Subversion Repositories SmartDukaan

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2629 vikas 1
 
2
(function() {
3
 
4
var showingNav = true;
5
 
6
$(document).ready( function () {
7
	var jqNav = $('div.fw_nav');
8
	jqNav.css('right', ($(window).width() - $('div.fw_container').width()) /2);
9
 
10
	var n = $('div.nav_blocker')[0];
11
	n.style.height = $(jqNav).outerHeight()+"px";
12
	n.style.width = $(jqNav).outerWidth()+"px";
13
 
14
	SyntaxHighlighter.highlight();
15
 
16
	$('#private_toggle').click( function () {
17
		if ( $('input[name=show_private]').val() == 0 ) {
18
			$('input[name=show_private]').val( 1 );
19
			$('#private_label').html('Showing');
20
			$('.private').css('display', 'block');
21
		} else {
22
			$('input[name=show_private]').val( 0 );
23
			$('#private_label').html('Hiding');
24
			$('.private').css('display', 'none');
25
		}
26
		fnWriteCookie();
27
		return false;
28
	} );
29
 
30
	$('#extended_toggle').click( function () {
31
		if ( $('input[name=show_extended]').val() == 0 ) {
32
			$('input[name=show_extended]').val( 1 );
33
			$('#extended_label').html('Showing');
34
			$('.augmented').css('display', 'block');
35
		} else {
36
			$('input[name=show_extended]').val( 0 );
37
			$('#extended_label').html('Hiding');
38
			$('.augmented').css('display', 'none');
39
		}
40
		fnWriteCookie();
41
		return false;
42
	} );
43
 
44
	var savedHeight = $(jqNav).height();
45
	$('div.fw_nav h2').click( function () {
46
		if ( showingNav ) {
47
			$('div.fw_nav').animate( {
48
				"height": 10,
49
				"opacity": 0.3
50
			} );
51
			showingNav = false;
52
		} else {
53
			$('div.fw_nav').animate( {
54
				"height": savedHeight,
55
				"opacity": 1
56
			} );
57
			showingNav = true;
58
		}
59
		fnWriteCookie();
60
	} );
61
 
62
	var cookie = fnReadCookie( 'SpryMedia_JSDoc' );
63
	if ( cookie != null ) {
64
		var a = cookie.split('-');
65
		if ( a[0] == 1 ) {
66
			$('#private_toggle').click();
67
		}
68
		if ( a[1] == 0 ) {
69
			$('#extended_toggle').click();
70
		}
71
		if ( a[2] == 'false' ) {
72
			$('div.fw_nav').css('height', 10).css('opacity', 0.3);
73
			showingNav = false;
74
		}
75
	}
76
} );
77
 
78
 
79
function fnWriteCookie()
80
{
81
	var sVal = 
82
		$('input[name=show_private]').val()+'-'+
83
		$('input[name=show_extended]').val()+'-'+
84
		showingNav;
85
 
86
	fnCreateCookie( 'SpryMedia_JSDoc', sVal );
87
}
88
 
89
 
90
function fnCreateCookie( sName, sValue )
91
{
92
	var iDays = 365;
93
	var date = new Date();
94
	date.setTime( date.getTime()+(iDays*24*60*60*1000) );
95
	var sExpires = "; expires="+date.toGMTString();
96
 
97
	document.cookie = sName+"="+sValue+sExpires+"; path=/";
98
}
99
 
100
 
101
function fnReadCookie( sName )
102
{
103
	var sNameEQ = sName + "=";
104
	var sCookieContents = document.cookie.split(';');
105
 
106
	for( var i=0 ; i<sCookieContents.length ; i++ ) {
107
		var c = sCookieContents[i];
108
 
109
		while (c.charAt(0)==' ') {
110
			c = c.substring(1,c.length);
111
		}
112
 
113
		if (c.indexOf(sNameEQ) == 0) {
114
			return c.substring(sNameEQ.length,c.length);
115
		}
116
	}
117
 
118
	return null;
119
}
120
 
121
})();