1;(function($) { 2 3 'use strict'; 4 5 var defaults = { 6 panel: '#mobile-menu', 7 close: '', 8 side: 'right', 9 speed: 250 10 }; 11 12 function SideMenu ( element, options ) { 13 this.element = element; 14 this.settings = $.extend( {}, defaults, options ); 15 this._defaults = defaults; 16 this.panelVisible = false; 17 this.panelCleanName = this.settings.panel.replace( /#|\.|\s/g, function(match) { 18 var replacements = { '#':'', '\.':'', ' ':'-' }; 19 return replacements[match]; } ); 20 this.init(); 21 } 22 23 SideMenu.prototype = { 24 init: function () { 25 var self = this; 26 $(this.element).on('click', function(e) { 27 e.preventDefault(); 28 if ( self.panelVisible ) { 29 self.hidePanel(); 30 } else { 31 self.showPanel(); 32 } 33 }); 34 if ( '' !== self.settings.close ) { 35 $(self.settings.close).on('click', function(e) { 36 e.preventDefault(); 37 self.hidePanel(); 38 }); 39 } 40 $('body').addClass('sidemenu-active').on( 'scrollhighlightstart.themify', function() { 41 if ( self.panelVisible ) { 42 self.hidePanel(); 43 } 44 }).on( 'sidemenushow.themify', function(e, emitterPanel, side) { 45 if ( emitterPanel !== self.settings.panel ) { 46 self.hidePanel( side ); 47 } 48 }); 49 }, 50 showPanel: function () { 51 var thisPanel = this.settings.panel; 52 $(thisPanel).removeClass('sidemenu-off').addClass('sidemenu-on').one('webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend', function(){ 53 $(this).trigger( 'sidemenuaftershow.themify', [thisPanel] ); 54 }); 55 $('body').addClass(this.panelCleanName + '-visible sidemenu-' + this.settings.side).trigger('sidemenushow.themify', [thisPanel, this.settings.side]); 56 this.panelVisible = true; 57 }, 58 hidePanel: function ( side ) { 59 var thisPanel = this.settings.panel, cssClass = this.panelCleanName + '-visible'; 60 $(thisPanel).removeClass('sidemenu-on').addClass('sidemenu-off'); 61 if ( side !== this.settings.side ) { 62 cssClass += ' sidemenu-' + this.settings.side; 63 } 64 $('body').removeClass(cssClass).trigger('sidemenuhide.themify', [thisPanel]); 65 this.panelVisible = false; 66 } 67 }; 68 69 $.fn.themifySideMenu = function ( options ) { 70 if ( 'string' === typeof options ) { 71 var self = $( this ).data( 'SideMenu' ); 72 if ( self ) { 73 if ( 'show' == options ) { 74 self.showPanel(); 75 } 76 if ( 'hide' == options ) { 77 self.hidePanel(); 78 } 79 } 80 } else { 81 return this.each(function() { 82 if ( !$.data( this, 'SideMenu' ) ) { 83 $.data( this, 'SideMenu', new SideMenu( this, options ) ); 84 } 85 }); 86 } 87 }; 88 89})(jQuery);
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.