PageSourceSearch

https://www.artfestival.com/sites/all/modules/mobile_navigation/js/mobile_menu.js?tlxpbz

js artfestival.com collected 2026-09-25 20:38:06 UTC 28,371 bytes, 811 lines download raw bytes

1/**
2 * @file
3 * Mobile_navigation 2.x Library functionality.
4 *
5 * Author - Christian Galicia
6 * Licenses: GPLv2
7 */
8
9/*! matchMedia() polyfill - Test a CSS media type/query in JS. Authors & copyright (c) 2012: Scott Jehl, Paul Irish, Nicholas Zakas, David Knight. Dual MIT/BSD license */
10window.matchMedia || (window.matchMedia = function() {
11  "use strict";
12  // For browsers that support matchMedium api such as IE 9 and webkit
13  var styleMedia = (window.styleMedia || window.media);
14  // For those that don't support matchMedium
15  if (!styleMedia) {
16    var style       = document.createElement('style'),
17        script      = document.getElementsByTagName('script')[0],
18        info        = null;
19    style.type  = 'text/css';
20    style.id    = 'matchmediajs-test';
21    script.parentNode.insertBefore(style, script);
22    // 'style.currentStyle' is used by IE <= 8 and 'window.getComputedStyle' for all other browsers
23    info = ('getComputedStyle' in window) && window.getComputedStyle(style) || style.currentStyle;
24    styleMedia = {
25      matchMedium: function(media) {
26        var text = '@media ' + media + '{ #matchmediajs-test { width: 1px; } }';
27        // 'style.styleSheet' is used by IE <= 8 and 'style.textContent' for all other browsers
28        if (style.styleSheet) {
29          style.styleSheet.cssText = text;
30        } else {
31          style.textContent = text;
32        }
33        // Test if media query is true or false
34        return info.width === '1px';
35      }
36    };
37  }
38  return function(media) {
39    return {
40      matches: styleMedia.matchMedium(media || 'all'),
41      media: media || 'all'
42    };
43  };
44}());
45
46(function($, document, window) {
47  /**
48   * MOBILE NAVIGATION PLUGINS
49   */ 
50  /**
51   * Basic Plugin
52   */
53  window.none = function(element) {
54    $ = jQuery;
55    
56    this.element = element;
57    this.build = function() {};
58    this.reset = function() {};     
59  } // End of Basic plugin
60  
61  /**
62   * Accordion Plugin
63   */
64  window.accordion = function(element) {
65    $ = jQuery;  
66    this.e = element;
67    this.build = function() {
68      var e = this.e;
69        if (e.data.conf.expand_only_active_trail!=0) {
70            e.data.me.find(".item-with-ul:not(.active-trail) ul").hide();
71            e.data.me.find(".item-with-ul.active-trail").addClass("active");
72        } else {
73            e.data.me.find(".item-with-ul ul").hide();
74        }
75        e.data.me.find(".item-with-ul").unbind('click').click(function(ev) {
76            if (e.data.conf.expand_only_active_trail!=0) {
77              e.data.me.find(".item-with-ul ul").not($(this).find("ul")).not($(this).parents()).slideUp("fast");
78            }
79            $(this).find("ul").first().slideToggle(function() {
80              e.data.me.find(".item-with-ul").removeClass("active");
81              e.data.me.find(".item-with-ul ul").each(function() {
82                if ($(this).css("display") != "none") {
83                  $(this).parent("li").addClass("active");
84                }
85              });
86            });
87            ev.stopPropagation();
88        });
89        e.data.me.find(".item-with-ul a").unbind('click').click(function(e) {
90          e.stopPropagation();
91        });
92    };
93    this.reset = function() {
94    	this.e.data.me.find(".item-with-ul ul").hide();
95    };
96  } // End of accordion plugin
97  
98  /**
99   * slide navigation Plugin
100   */
101  window.slide_navigation = function(element) {
102    this.e = element;
103    this.build = function() {
104          var e = this.e;
105          e.data.me.find(".item-with-ul ul").hide();
106          e.data.me.find("ul.mobile-menu-body").addClass("mobile-menu-slide mobile-menu-slide-first")
107            .wrap("<div class='mobile-menu-display'></div>")
108            .wrap("<div class='slide-menu-clip'></div>");
109          e.data.me.find(".mobile-menu-display").css({
110            overflow : "hidden"
111          });
112          function buildNewSub(sub) {
113            var no = e.data.me.find("ul.mobile-menu-slide").length, 
114              id = "mobile-menu-" + no, 
115              mm_w = e.data.me.find(".mobile-menu-inner-wrapper").width();
116            var sub = $(sub).clone().removeClass("item-with-ul"),
117              ul = $($('<div></div>').html(sub)).html();
118            e.data.me.find(".slide-menu-clip").append("<ul class='" + id + " mobile-menu mobile-menu-slide'>" + ul + "</ul>");
119            e.data.me.find("." + id + " > li > ul").show();
120            e.data.me.find("." + id + " > li > *").first().addClass("return-link");
121            e.data.me.find("." + id + " > li > ul").css({
122              padding : 0
123            });
124            
125            e.data.me.find(".slide-menu-clip").css({
126              width : (100 * (no + 1)) + "%", //(mm_w * (no + 1)),
127              float : "left"
128            });
129            e.data.me.find(".mobile-menu-slide").css({
130              width : (100 / (no + 1)) + "%", //mm_w,
131              float : "left"
132            });
133            e.data.me.find(".slide-menu-clip").animate({
134              "marginLeft" : -(mm_w * no)
135            }, 'normal');
136            bindClick(e.data.me.find("." + id));
137            e.data.me.find("." + id + " .return-link").unbind('click').click(function(ev) {
138              e.data.me.find('.slide-menu-clip').animate({
139                "marginLeft" : -(e.data.me.find(".mobile-menu-inner-wrapper").width() * (e.data.me.find(".mobile-menu-slide").length - 2))
140              }, 'normal', function() {
141                e.data.me.find(".mobile-menu-slide:last").remove();
142                var no = e.data.me.find("ul.mobile-menu-slide").length;
143                e.data.me.find('.slide-menu-clip').css({
144                  width : (100 * no) + "%", // (e.data.me.find(".mobile-menu-inner-wrapper").width() * (e.data.me.find(".mobile-menu-slide").length)),
145                  float : "left"
146                });
147                e.data.me.find(".mobile-menu-slide").css({
148                  width : (100 / (no)) + "%", //mm_w,
149                });
150              });
151              
152              ev.preventDefault();
153              ev.stopPropagation();
154            });
155          }
156          function bindClick(item) {
157            $(item).find(".item-with-ul").unbind('click').click(function(ev) {
158              buildNewSub(this);
159              ev.preventDefault();
160              ev.stopPropagation();
161            });
162            $(item).find("li a").unbind('click').click(function(ev) {
163              ev.stopPropagation();
164            });
165          }
166          bindClick("#"+e.data.name);
167    };
168    this.reset = function() {
169    	var e = this.e;
170    	e.data.me.find('.slide-menu-clip').animate({
171           "marginLeft" : 0
172        }, 'normal', function() {
173           e.data.me.find(".mobile-menu-slide").not(".mobile-menu-slide-first").remove();
174           e.data.me.find('.slide-menu-clip').css({
175             width : "100%", //(e.data.me.find(".mobile-menu-inner-wrapper").width() * (e.data.me.find(".mobile-menu-slide").length)),
176             float : "left"
177           });
178           var no = e.data.me.find("ul.mobile-menu-slide").length;
179           e.data.me.find(".mobile-menu-slide").css({
180             width : (100 / (no)) + "%", //mm_w,
181           });
182        });
183    };
184  } // End of slide nav plugin
185  // End of mobile navigation plugins
186
187  /**
188   * MOBILE NAVIGATION SHOW AND HIDE EFFECTS
189   */
190  /**
191   * MOBILE NAVIGATION EXPAND DOWN
192   */
193  window.expand_down = function(element) {
194    $ = jQuery;
195    this.e = element;
196    this.build = function() {
197      if (this.e.data.conf.use_button) {
198        $("#"+this.e.data.name).appendTo(this.e.data.conf.button_container);  
199      }
200      this.e.data.me.find(".menu-tab-handler").addClass('bottom'); 
201    };
202    this.hide = function() {
203      this.e.data.me.find('.mobile-menu-inner-wrapper').hide();
204      this.e.data.collapsed = true;
205    };
206    this.show = function() {
207      this.e.data.me.find('.mobile-menu-inner-wrapper').show('slow');
208      this.e.data.collapsed = false;
209    };
210    this.collapse = function() {
211      this.e.data.me.find('.mobile-menu-inner-wrapper').slideUp('slow');
212      this.e.data.collapsed = true;
213    };
214    this.expand = function() {
215      this.e.data.me.find('.mobile-menu-inner-wrapper').slideDown('slow');
216      this.e.data.collapsed = false;
217    };
218  } // end of expand_down effect
219  
220  /**
221   * MOBILE NAVIGATION MODAL TOP EFFECT
222   */
223  window.modal_top = function(element) {
224    $ = jQuery;
225    this.e = element;
226    this.build = function() {
227      this.e.data.me.find(".menu-tab-handler").addClass('bottom'); 
228    };
229    this.hide = function() {
230      this.e.data.me.find('.mobile-menu-inner-wrapper').hide();
231      this.e.data.collapsed = true;
232    };
233    this.show = function() {};
234    this.collapse = function() {
235        this.e.data.me.find('.mobile-menu-inner-wrapper').slideUp('slow');
236      this.e.data.collapsed = true;
237    };
238    this.expand = function() {
239      this.e.data.me.find('.mobile-menu-inner-wrapper').slideDown('slow');
240      this.e.data.collapsed = false;
241    };
242  } // end of modal top effect
243  
244  /**
245   * MOBILE NAVIGATION MODAL LEFT EFFECT
246   */
247  window.modal_left = function(element) {
248    $ = jQuery;
249    this.e = element;
250    this.build = function() {
251      this.e.data.me.find(".menu-tab-handler").addClass('right'); 
252      this.ww = this.e.data.me.find(".mobile-menu-inner-wrapper").width();
253    };
254    this.hide = function() {
255      this.e.data.me.find(".mobile-menu-outer-wrapper").css({
256        left : "-" + this.e.data.conf.menu_width + "%"
257      });
258      this.e.data.collapsed = true;
259    };
260    this.show = function() {};
261    this.collapse = function() {
262        this.e.data.me.find(".mobile-menu-outer-wrapper").animate({
263          left : "-" + this.e.data.conf.menu_width + "%"
264        }, "fast", function() {});
265      this.e.data.collapsed = true;
266    };
267    this.expand = function() {
268      this.e.data.me.find(".mobile-menu-outer-wrapper").animate({
269          left : 0
270        }, "fast", function() {});
271      this.e.data.collapsed = false;
272    };
273  } // end of modal left effect
274  
275  /**
276   * MOBILE NAVIGATION MODAL RIGHT EFFECT
277   */
278  window.modal_right = function(element) {
279    $ = jQuery;
280    this.e = element;
281    this.build = function() {
282      this.e.data.me.find(".menu-tab-handler").addClass('left'); 
283      this.ww = this.e.data.me.find(".mobile-menu-inner-wrapper").width();
284    };
285    this.hide = function() {
286      this.e.data.me.find(".mobile-menu-outer-wrapper").css({
287        right : "-" + this.e.data.conf.menu_width + "%"
288      });
289      this.e.data.collapsed = true;
290    };
291    this.show = function() {};
292    this.collapse = function() {
293        this.e.data.me.find(".mobile-menu-outer-wrapper").animate({
294          right : "-" + this.e.data.conf.menu_width + "%"
295        }, "fast", function() {
296          // Animation complete.
297        });
298        
299      this.e.data.collapsed = true;
300    };
301    this.expand = function() {
302      this.e.data.me.find(".mobile-menu-outer-wrapper").animate({
303          right : 0
304        }, "fast", function() {});
305      this.e.data.collapsed = false;
306    };
307  } // end of modal right effect
308  
309  /**
310   * MOBILE NAVIGATION MODAL BOTTOM EFFECT
311   */
312  window.modal_bottom = function(element) {
313    $ = jQuery;
314    this.e = element;
315    var hh;
316    this.build = function() {
317      this.e.data.me.find(".menu-tab-handler").addClass('top');
318      hh = this.e.data.me.find(".mobile-menu-inner-wrapper").height(); 
319    };
320    this.hide = function() {
321      this.e.data.me.find(".mobile-menu-outer-wrapper").css({
322        bottom : "-" + hh + "px"
323      });
324      this.e.data.collapsed = true;
325    };
326    this.show = function() {};
327    this.collapse = function() {
328      this.e.data.me.find(".mobile-menu-outer-wrapper").animate({
329        bottom : "-" + hh + "px"
330      }, "fast", function() {});
331      this.e.data.collapsed = true;
332    };
333    this.expand = function() {
334      this.e.data.me.find(".mobile-menu-outer-wrapper").animate({
335          bottom : 0
336        }, "fast", function() {});
337      this.e.data.collapsed = false;
338    };
339  } // end of modal bottom effect
340  
341  /**
342   * MOBILE NAVIGATION DRAWER TOP EFFECT
343   */
344  window.drawer_top = function(element) {
345    $ = jQuery;
346    this.e = element;
347    this.build = function() {
348      this.e.data.me.find(".menu-tab-handler").addClass('bottom'); 
349    };
350    this.hide = function() {
351      this.e.data.me.find('.mobile-menu-inner-wrapper').hide();
352      this.e.data.collapsed = true;
353    };
354    this.show = function() {};
355    this.collapse = function() {
356      this.e.data.me.find(".mobile-menu-inner-wrapper").slideUp();
357      this.e.data.collapsed = true;
358    };
359    this.expand = function() {
360       this.e.data.me.find(".mobile-menu-inner-wrapper").slideDown();
361       this.e.data.collapsed = false;
362    };
363  } // end of drawer top effect
364  
365  /**
366   * MOBILE NAVIGATION DRAWER LEFT EFFECT
367   */
368  window.drawer_left = function(element) {
369    $ = jQuery;
370    this.e = element;
371    this.build = function() {
372      this.e.useContentWrapper();
373      this.e.data.me.find(".menu-tab-handler").addClass('right'); 
374      this.e.data.me.find(".mobile-menu-inner-wrapper").css({
375              minHeight : $(window).height() + "px"
376        });
377        this.ww = this.e.data.me.find(".mobile-menu-inner-wrapper").width();
378    };
379    this.hide = function() {
380      this.e.data.me.find(".mobile-menu-outer-wrapper").css({
381        left : "-" + this.e.data.conf.menu_width + "%"
382      });
383      $("#mobile_navigation_main_content_wrapper").css({
384        left : "0",
385        overflow : "",
386        height : "",
387        position : "",
388        width : ""
389      });
390      this.e.data.collapsed = true;
391    };
392    this.show = function() {
393      $("#mobile_navigation_main_content_wrapper").css({
394          overflow : "hidden",
395          height : $(window).height() + "px",
396          position : "fixed",
397          width: "100%",
398          left: this.e.data.conf.menu_width + "%"
399      });
400    },
401    this.collapse = function() {
402        this.e.data.me.find(".mobile-menu-outer-wrapper").animate({
403          left : "-" + this.e.data.conf.menu_width + "%"
404        }, "slow", function() {});
405        $("#mobile_navigation_main_content_wrapper").animate({
406          left : "0"
407        }, "slow", function() {
408          $(this).css({
409            overflow : "",
410            height : "",
411            position : "",
412            width : ""
413          })
414        });
415      this.e.data.collapsed = true;
416    };
417    this.expand = function() {
418       $("#mobile_navigation_main_content_wrapper").css({
419          overflow : "hidden",
420          height : $(window).height() + "px",
421          position : "fixed",
422          width: "100%"
423       }).animate({
424          left : this.e.data.conf.menu_width + "%"
425       }, "slow", function() {});
426       this.e.data.me.find(".mobile-menu-outer-wrapper").animate({
427          left : 0
428       }, "slow", function() {});
429       this.e.data.collapsed = false;
430    };
431  } // end of drawer left effect
432  
433  /**
434   * MOBILE NAVIGATION DRAWER RIGHT EFFECT
435   */
436  window.drawer_right = function(element) {
437    $ = jQuery;
438    this.e = element;
439    this.build = function() {
440      this.e.useContentWrapper();
441      this.e.data.me.find(".menu-tab-handler").addClass('left'); 
442      this.e.data.me.find(".mobile-menu-inner-wrapper").css({
443              minHeight : $(window).height() + "px"
444        });
445        this.ww = this.e.data.me.find(".mobile-menu-inner-wrapper").width();
446    };
447    this.hide = function() {
448      this.e.data.me.find(".mobile-menu-outer-wrapper").css({
449          left : "100%",
450          width: 0
451        });
452        this.e.data.me.find(".mobile-menu-inner-wrapper").css({
453          display: "none"
454        });
455        
456        $("#mobile_navigation_main_content_wrapper").css({
457          left : "0",
458          overflow : "",
459          height : "",
460          position : ""
461        });
462        
463      this.e.data.collapsed = true;
464    };
465    this.show = function() {
466       /*this.e.data.me.find(".mobile-menu-inner-wrapper").show();
467       that.e.data.me.find(".mobile-menu-outer-wrapper").show();
468       $("#mobile_navigation_main_content_wrapper").css({
469          overflow : "hidden",
470          height : $(window).height() + "px",
471          position : "fixed",
472          width: "100%",
473          left: (-this.e.data.conf.menu_width) + "%"
474       });
475       this.e.data.me.find(".mobile-menu-outer-wrapper").css({
476         display : "block",
477         width : this.e.data.conf.menu_width + "%",
478         left: (100-this.e.data.conf.menu_width) + "%",
479       });*/
480       
481       
482       this.e.data.me.find(".mobile-menu-inner-wrapper").show();
483       $("#mobile_navigation_main_content_wrapper").css({
484          overflow : "hidden",
485          height : $(window).height() + "px",
486          position : "fixed",
487          width: "100%",
488          left : -this.e.data.conf.menu_width + "%"
489       });
490       this.e.data.me.find(".mobile-menu-outer-wrapper").show().css({
491         display : "block",
492         width : this.e.data.conf.menu_width + "%",
493         left : (100 - this.e.data.conf.menu_width) + "%"
494       });
495       this.e.data.collapsed = false;
496       
497    };
498    var e = this.e;
499    this.collapse = function() {
500        var that = this;
501        e.data.me.find(".mobile-menu-outer-wrapper").animate({
502          left : "100%"
503        }, "slow", function() {
504           that.e.data.me.find(".mobile-menu-inner-wrapper").hide();
505           that.e.data.me.find(".mobile-menu-outer-wrapper").css({
506              width: 0
507           });
508        });
509        $("#mobile_navigation_main_content_wrapper").animate({
510          left : "0"
511        }, "slow", function() {
512          $(this).css({
513            overflow : "",
514            height : "",
515            position : ""
516          });
517        });
518        this.e.data.collapsed = true;
519    };
520    this.expand = function() {
521       this.e.data.me.find(".mobile-menu-inner-wrapper").show();
522       $("#mobile_navigation_main_content_wrapper").css({
523          overflow : "hidden",
524          height : $(window).height() + "px",
525          position : "fixed",
526          width: "100%"
527       }).animate({
528          left : -this.e.data.conf.menu_width + "%"
529       }, "slow", function() {});
530       this.e.data.me.find(".mobile-menu-outer-wrapper").show().css({
531         display : "block",
532         width : this.e.data.conf.menu_width + "%"
533       }).animate({
534         left : (100 - this.e.data.conf.menu_width) + "%"
535       }, "slow");
536       this.e.data.collapsed = false;
537    };
538    
539  } // end of drawer right effect
540  // End of mobile navigation show and hide effects
541  
542  
543  var mobile_navigation_instances = {};
544
545  // Main Class
546  var mobile_menu = function(elem, options) {
547      
548    this.methods = {
549
550      /* destroy */
551      destroy : function() {
552
553      }, // End of destroy
554        
555      build : function() {
556        $("#mobile-navigation-menus").prependTo("body");
557        var show_hide_effect = _this.data.conf.show_hide_effect;
558        var classes = _this.data.name + " mobile-menu-outer-wrapper mobile-menu plugin-" + _this.data.conf.plugin + " display-" + _this.data.conf.display + " effect-" + show_hide_effect;
559        _this.data.me.wrapInner("<div class='" + classes + "'><div class='mobile-menu-inner-wrapper mobile-menu-inner'></div></div>");
560        _this.data.me.find("ul:first").addClass("mobile-menu-body");
561        _this.data.me.find("ul").addClass("mobile-menu");
562        // Setting configured menu width
563        _this.data.me.find(".mobile-menu-outer-wrapper").css("width", (_this.data.conf.menu_width+"%"));
564        _this.data.me.find("li").each(function() {
565          if ($(this).find("ul").length) {
566            $(this).addClass("item-with-ul");
567          }
568        });
569        _this.data.me.find("li.item-with-ul > *:first-child").each(function() {
570          if ($(this).get(0).tagName == "A") {
571            $(this).wrap("<div></div>");
572          }
573          $(this).parent().addClass("submenu-title");
574        });
575        // Add special classes to menu.
576        if (_this.data.conf.use_classes) {
577          function addClassesToUl(ul, parentClass) {
578            var ii = 1;
579            $(ul).find("> li").each(function() {
580              if (parentClass == "") {
581                var cls = "menuitem-" + ii;
582              } else {
583                var cls = "menuitem-" + parentClass + "-" + ii;
584              }
585              $(this).addClass(cls);
586              if ($(this).hasClass("item-with-ul")) {
587                if (parentClass == "") {
588                  addClassesToUl($(this).find("> ul"), ii);
589                } else {
590                  addClassesToUl($(this).find("> ul"), parentClass + "-" + ii);
591                }
592              }
593              ii++;
594            });
595          }
596          addClassesToUl(_this.data.me.find("ul"), "");
597        }
598        if (_this.data.conf.use_handler!="0") {
599          _this.data.me.find( ".mobile-menu-outer-wrapper" )
600            .prepend("<a id='" + _this.data.name + "-menu-handler' class='menu-tab-handler " + _this.data.name + "-trigger'>" + _this.data.conf.handler_title + "</a>");
601        }
602        if (_this.data.conf.use_mask!="0") {
603          $("body #mobile-navigation-menus").css({
604            position : "relative"
605          }).append("<div id='mobile-navigation-" + _this.data.name + "-mask' class='mobile-navigation-mask'></div>");
606        }
607        if ('ontouchstart' in document.documentElement) {
608          $("." + _this.data.name + "-trigger").on('touchstart', function(e) {
609            _this.toggle();
610            e.stopPropagation();
611            e.preventDefault();
612          });
613        } else {
614            $("." + _this.data.name + "-trigger").unbind('click').click(function(e) {
615              _this.toggle();
616              e.stopPropagation();
617              e.preventDefault();
618            });
619        }
620      }, // End of build()
621    
622      toggle : function() {
623        if (_this.data.conf.use_mask) {
624          if (_this.data.collapsed) {
625            if (_this.data.conf.use_mask!="0") {
626              $("#mobile-navigation-" + _this.data.name + "-mask").unbind("click").click(function() {
627                _this.toggle();
628                }).fadeIn();
629            }
630          } else {
631            if (_this.data.conf.use_mask!="0") {
632              $("#mobile-navigation-" + _this.data.name + "-mask").unbind("click").fadeOut();
633            }
634          }
635        }
636        if (_this.data.collapsed) {
637          _this.data.effect.expand();
638        } else {
639          _this.data.plugin.reset();
640          _this.data.effect.collapse();    
641        }
642      }, // End of toggle()
643    
644      applyNavigationPlugin : function() {
645        var plugin = _this.data.conf.plugin;
646        _this.data.plugin = new window[plugin](_this);
647        _this.data.plugin.build();
648      }, // End of applyNavigationPlugin()
649    
650      applyShowAndHideEffect : function() {
651        var effect = _this.data.conf.show_hide_effect;
652        _this.data.effect = new window[effect](_this);
653        _this.data.effect.build();
654        if (_this.data.conf.collapse_by_default!="0") {
655          _this.data.effect.hide();  
656        } else {
657          if (_this.data.conf.use_mask!="0") {
658            $("#mobile-navigation-" + _this.data.name + "-mask").unbind("click").click(function() {
659              _this.toggle();
660            }).fadeIn();
661          }
662          _this.data.effect.show();
663        }
664      }, // End of applyShowAndHideEffect()
665    
666      useContentWrapper : function() {
667        if (!$("#mobile_navigation_main_content_wrapper").length) {
668          $("body").wrapInner("<div id='mobile_navigation_main_content_wrapper'></div>");
669          $("#mobile-navigation-menus").prependTo("body");
670        }
671      }, // end of useContentWrapper()
672      
673      // Verify if a query is valid for current browser width.
674      checkQuery : function(query) {
675        return window.matchMedia(query).matches;
676      }, // End of checkQuery
677      
678      isCurrentDisplay : function() {
679        
680        var mediaQuery = _this.data.display_definitions[_this.data.conf.display]
681        
682        if (_this.checkQuery(mediaQuery)) {
683        	return true;
684        }
685        return false;
686        /*
687        var displays = _this.data.display_definitions,
688            display;
689        for (display in displays) {
690          var mediaQuery = displays[display];
691          if (_this.checkQuery(mediaQuery)) {
692            break;
693          }
694        }
695        
696        return display;*/
697      }, // End of currentDisplay
698      getCurrentDisplays : function() {
699        
700        var display_list = _this.data.display_definitions,
701            current_displays = [];
702        for (display in display_list) {
703          var mediaQuery = display_list[display];
704          if (_this.checkQuery(mediaQuery)) {
705            current_displays.push(display);
706          }
707        }
708        
709        return current_displays;
710      }, // End of currentDisplay
711      
712        
713      enable : function() {
714        _this.data.me.show();
715        
716        $("#" + _this.data.name + "-button").show()
717        $(_this.data.conf.menu_selector).hide();
718      }, // End of hide()
719        
720      disable : function() {
721      	if (_this.data.effect!=null) {
722	      	_this.data.effect.hide();
723	      	_this.data.plugin.reset();
724	      	
725	      	if (_this.data.conf.use_mask!="0") {
726	          $("#mobile-navigation-" + _this.data.name + "-mask").unbind("click").hide();
727	        }
728	            
729	        _this.data.me.hide();
730	        $("#" + _this.data.name + "-button").hide();
731	        $(_this.data.conf.menu_selector).show();
732	    }
733      }, // End of disable()
734        
735      /* Display is detected using the checkQuery function wich uses matchMedia. 
736      * Display list is iterated and tested on the resize method to find the current 
737      * and apply corresponding configuration if there is any for that display.*/
738      onResize : function() {
739        var conf = _this.data.conf;
740        
741        /* Get Current displays */
742        currentDisplays = _this.getCurrentDisplays();
743        
744        /** DEBUG INFO *****************************/
745        
746        var displays_string = "";
747        for(disp in currentDisplays) {
748        	if (displays_string!="") {
749        		displays_string = displays_string + ",";
750        	}
751        	displays_string = displays_string + currentDisplays[disp]; 
752        }
753        
754        $("#debugInfo").html($(window).width() + " - " + displays_string);
755        /*******************************/
756        
757        if (currentDisplays.indexOf(_this.data.prevDisplay)) { //  !=currentDisplay) {
758          if (_this.isCurrentDisplay()) {
759            if (!_this.data.done) {
760              _this.build(); 
761              _this.applyNavigationPlugin();
762              _this.applyShowAndHideEffect();        
763              _this.data.done = true;
764            }
765            _this.enable();        
766          } else {
767            _this.disable();
768          }
769          _this.data.prevDisplay = currentDisplay;
770        }
771      }, // End of onResize
772      // INIT
773      init : function(elem, opts) {
774        _this.data = {};
775        _this.data.target = elem;
776        _this.data.name = opts['name'];
777        _this.data.files_path = opts['files_path']; 
778        _this.data.configuration = _this.data.conf = opts['configuration'];
779        _this.data.display_definitions = opts['display_definitions'];
780        _this.data.me = $("#"+_this.data.name);
781        _this.data.done = false;
782        _this.data.prevDisplay = "";
783        _this.data.effect = null;
784        // bind to the window resize method.
785        $(window).resize(_this.onResize);
786        // call resize method
787        _this.onResize();
788      } // end of init
789    };
790      // end of methods
791      var _this = this.methods;
792  };
793    // end of mobile_menu class
794
795    // $.FN
796    $.fn.mobile_menu = function(name, opts) {
797      if (!(!$.support.leadingWhitespace)) {
798        //Not IE7 nor IE8.
799        if (mobile_navigation_instances[name] === undefined) {
800          mobile_navigation_instances[name] = new mobile_menu(this, opts);
801          return mobile_navigation_instances[name].methods.init(this, opts);
802        } else if (mobile_navigation_instances[name]) {
803          return mobile_navigation_instances[name].methods;
804        } else {
805          return $(this);
806        }
807      }
808    };
809    // end of $.fn.mobile_menu
810
811}
811)(jQuery, document, window);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.