source: trunk/themes/elegant/scripts.js @ 13464

Last change on this file since 13464 was 13464, checked in by Zaphod, 12 years ago

feature 2587: new theme elegant, first beta version

File size: 2.8 KB
Line 
1jQuery("document").ready(function(jQuery){
2
3        var menubar=jQuery("#menubar");
4        var content=jQuery("#content");
5       
6        if ( (menubar.length == 1) && (content.length ==1)) {
7                menubar.after("<div id=\"menuswitcher\">«</div>");
8/*              if (!content.hasClass('content')) content.addClass('content');*/
9        }
10        /*»*/
11       
12        jQuery("#menuswitcher").click(function(){
13                if (jQuery("#menubar").is(":hidden")) {
14                        showMenu(0);
15                        return false;
16                } else {
17                        hideMenu(0);
18                        return false;
19                }
20        });
21
22        // creates a variable with the contents of the cookie side-menu
23        var sidemenu = jQuery.cookie('side-menu');
24       
25        // if cookie says the menu is hiding, keep it hidden!
26        if (sidemenu == 'hiding') {
27                hideMenu(0);
28        } else {
29                showMenu(0);
30        }
31
32       
33});
34
35function hideMenu(delay) {
36
37        var menubar=jQuery("#menubar");
38        var menuswitcher=jQuery("#menuswitcher");
39        var content=jQuery("#the_page > .content");
40        var pcontent=jQuery("#content");
41       
42        menubar.hide(delay);
43        menuswitcher.addClass("menuhidden").removeClass("menushown");
44        menuswitcher.text("»");
45        content.addClass("menuhidden").removeClass("menushown");
46        pcontent.addClass("menuhidden").removeClass("menushown");
47        jQuery.cookie('side-menu', 'hiding', {path: "/"});
48       
49}
50
51function showMenu(delay) {
52
53        var menubar=jQuery("#menubar");
54        var menuswitcher=jQuery("#menuswitcher");
55        var content=jQuery("#the_page > .content");
56        var pcontent=jQuery("#content");
57
58        menubar.show(delay);
59        menuswitcher.addClass("menushown").removeClass("menuhidden");
60        menuswitcher.text("«");
61        content.addClass("menushown").removeClass("menuhidden");
62        pcontent.addClass("menushown").removeClass("menuhidden");
63        jQuery.cookie('side-menu', 'showing', {path: "/"});
64       
65}
66
67/**
68 * Cookie plugin
69 * Copyright (c) 2006 Klaus Hartl (stilbuero.de)
70 * Dual licensed under the MIT and GPL licenses:
71 */
72jQuery.cookie=function(name,value,options){if(typeof value!='undefined'){options=options||{};if(value===null){value='';options=jQuery.extend({},options);options.expires=-1;}
73var 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;}
74expires='; expires='+date.toUTCString();}
75var 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;}}}
76return cookieValue;}};
77
Note: See TracBrowser for help on using the repository browser.