1 | jQuery.noConflict(); |
---|
2 | |
---|
3 | jQuery(document).ready(function($){ |
---|
4 | $("#theComments h3").click(function () { |
---|
5 | $("#theComments div").toggle("slow"); |
---|
6 | }); |
---|
7 | |
---|
8 | $("#menuswitcher").click(function(){ |
---|
9 | if ($("#menubar").is(":hidden")) { |
---|
10 | $("#menubar").show("slow"); |
---|
11 | $.cookie('side-menu', 'showing', {path: "/"}); |
---|
12 | return false; |
---|
13 | } else { |
---|
14 | $("#menubar").hide("slow"); |
---|
15 | $.cookie('side-menu', 'hiding', {path: "/"}); |
---|
16 | return false; |
---|
17 | } |
---|
18 | }); |
---|
19 | |
---|
20 | // creates a variable with the contents of the cookie side-menu |
---|
21 | var sidemenu = $.cookie('side-menu'); |
---|
22 | // if cookie says the menu is hiding, keep it hidden! |
---|
23 | if (sidemenu == 'hiding') { |
---|
24 | $("#menubar").hide(); |
---|
25 | } |
---|
26 | if (sidemenu == 'showing') { |
---|
27 | $("#menubar").show(); |
---|
28 | }; |
---|
29 | }); |
---|
30 | |
---|
31 | /** |
---|
32 | * Cookie plugin |
---|
33 | * Copyright (c) 2006 Klaus Hartl (stilbuero.de) |
---|
34 | * Dual licensed under the MIT and GPL licenses: |
---|
35 | */ |
---|
36 | jQuery.cookie=function(name,value,options){if(typeof value!='undefined'){options=options||{};if(value===null){value='';options=$.extend({},options);options.expires=-1;} |
---|
37 | var expires='';if(options.expires&&(typeof options.expires=='number'||options.expires.toUTCString)){var date;if(typeof options.expires=='number'){date=new Date();date.setTime(date.getTime()+(options.expires*24*60*60*1000));}else{date=options.expires;} |
---|
38 | expires='; expires='+date.toUTCString();} |
---|
39 | var path=options.path?'; path='+(options.path):'';var domain=options.domain?'; domain='+(options.domain):'';var secure=options.secure?'; secure':'';document.cookie=[name,'=',encodeURIComponent(value),expires,path,domain,secure].join('');}else{var cookieValue=null;if(document.cookie&&document.cookie!=''){var cookies=document.cookie.split(';');for(var i=0;i<cookies.length;i++){var cookie=jQuery.trim(cookies[i]);if(cookie.substring(0,name.length+1)==(name+'=')){cookieValue=decodeURIComponent(cookie.substring(name.length+1));break;}}} |
---|
40 | return cookieValue;}}; |
---|