source: extensions/greydragon/js/theme.menu.js @ 31175

Last change on this file since 31175 was 31175, checked in by SergeD, 9 years ago

version 1.2.25 - see changelog for details

  • Property svn:eol-style set to native
File size: 2.7 KB
Line 
1(function() {
2
3  var menubar=jQuery("#menubar"),
4      menuswitcher = null,
5      content=jQuery("#the_page > .content"),
6      pcontent=jQuery("#content");
7
8  // static, opened, closed, disabled, force_hide
9
10  function hideMenu(delay) {
11    if ((p_animated_menu == "on")  && (delay != 0)) {
12      jQuery("#menubar").fadeOut("fast");
13    } else {
14      jQuery("#menubar").hide();
15    }
16
17    menuswitcher.addClass("menuhidden").removeClass("menushown");
18    content.addClass("menuhidden").removeClass("menushown");
19    pcontent.addClass("menuhidden").removeClass("menushown");
20
21    jQuery.cookie('side-menu', 'hidden', {path: "/"});
22  }
23
24  function showMenu(delay) {
25    if ((p_animated_menu == "on") && (delay != 0)) {
26      jQuery("#menubar").fadeIn("fast");
27    } else {
28      jQuery("#menubar").show();
29    }
30
31    menuswitcher.addClass("menushown").removeClass("menuhidden");
32    content.addClass("menushown").removeClass("menuhidden");
33    pcontent.addClass("menushown").removeClass("menuhidden");
34
35    jQuery.cookie('side-menu', 'visible', {path: "/"});
36  }
37
38  jQuery(function(){
39
40    if (p_hideabout) { jQuery('a[href$="about.php"]').parent().remove(); }
41
42    if (p_main_menu == "force_hide") {
43      $("#menubar").on('mouseleave', function(e) {
44        $(this).hide();
45      });
46    }
47
48    if (p_main_menu == 'static') { 
49      var mh = jQuery('#menubar').height();
50      jQuery('.contentWithMenu').css("min-height", mh + 30);
51      jQuery('#menubar').css("display", "block"); 
52      return; 
53    } else if (p_main_menu == 'header-bottom' || p_main_menu == 'header-right') {
54    } else if (p_main_menu !== 'disabled') {
55      jQuery('<span id="menuSwitcher">&nbsp;</span>').insertBefore('div.titrePage h2 a:first');
56      menuswitcher = jQuery("#menuSwitcher");
57    }
58
59    if (menubar.length == 1 && p_main_menu != "disabled" && p_main_menu != 'header-bottom' && p_main_menu != 'header-right') {
60      if (p_main_menu == "force_hide") {
61        jQuery.cookie('side-menu', 'hidden', {path: "/"});
62      }else{
63        if (jQuery.cookie('side-menu') == undefined) {
64          if (p_main_menu == 'opened') {
65            jQuery.cookie('side-menu', 'visible', {path: "/"});
66          }else{
67            jQuery.cookie('side-menu', 'hidden', {path: "/"});
68          }
69        }
70      }
71
72      if (jQuery.cookie('side-menu') == 'visible') {
73        showMenu(0);
74      } else {
75        hideMenu(0);
76      }
77
78      menuswitcher.click(function(e){
79        if (menubar.is(":hidden")) {
80          showMenu(1);
81        } else {
82          hideMenu(1);
83        }
84        e.preventDefault();
85      });
86    }
87    else if (menubar.length == 1 && p_main_menu=="disabled") {
88      hideMenu(0);
89      menuswitcher.hide();
90    }
91
92  });
93}());
Note: See TracBrowser for help on using the repository browser.