1/*! ========================================================= 2 * Sliding Menu v0.3.0 3 * http://github.danielcardoso.net/sliding-menu/ 4 * ========================================================== 5 * Copyright (c) 2014-2019 DanielCardoso.net. 6 * Licensed under MIT. 7 * ======================================================== */ 8if(typeof jQuery==='undefined'){throw new Error('Sliding Menu requires jQuery')}(function(factory){'use strict';if(typeof define==='function'&&define.amd){define(['jquery'],factory)}else{factory(jQuery)}}(function($){'use strict';var slidingMenuUsedIds,SlidingMenu;slidingMenuUsedIds=[];SlidingMenu=function(element,options){this.options=undefined;this.$el=undefined;this.currentPanel=undefined;this.init(element,options)};SlidingMenu.NAME='Sliding Menu';SlidingMenu.VERSION='0.3.0';SlidingMenu.MAIN_CLASS='sliding-menu';SlidingMenu.PANEL_CLASS=SlidingMenu.MAIN_CLASS+'__panel';SlidingMenu.ICON_CLASS=SlidingMenu.MAIN_CLASS+'__icon';SlidingMenu.NAVIGATION_CLASS=SlidingMenu.MAIN_CLASS+'__nav';SlidingMenu.BACK_CLASS=SlidingMenu.MAIN_CLASS+'__back';SlidingMenu.SEPARATOR_CLASS=SlidingMenu.MAIN_CLASS+'__separator';SlidingMenu.SET_ICON_CLASS='sm-set-icon';SlidingMenu.DEFAULTS={className:'',transitionDuration:250,dataJSON:!1,initHref:!1,backLabel:'Back'};SlidingMenu.prototype.init=function(element,options){this.$el=$(element);if(this.$el.hasClass(SlidingMenu.MAIN_CLASS)){return} 9this.options=this.getOptions(options);this.events();this.process()};SlidingMenu.prototype.$=function(selector){return this.$el.find(selector)};SlidingMenu.prototype.events=function(){this.$el.on('click','a, .'+SlidingMenu.NAVIGATION_CLASS,$.proxy(this._onClickItem,this))};SlidingMenu.prototype._onClickItem=function(event){var linker,targetPanel,movePanelTo;linker=$(event.currentTarget);if(linker.attr('data-id')!==undefined){movePanelTo=linker.hasClass(SlidingMenu.BACK_CLASS);targetPanel=this.$('.'+SlidingMenu.PANEL_CLASS+'[data-id="'+linker.attr('data-id')+'"]');if(this.currentPanel.attr('data-id')!==targetPanel.attr('data-id')){this.currentPanel.stop(!0,!0).animate({left:movePanelTo?'100%':'-100%'},this.options.transitionDuration);targetPanel.stop(!0,!0).css('left',movePanelTo?'-100%':'100%').animate({left:0},this.options.transitionDuration);this.$el.stop(!0,!0).animate({height:targetPanel.height()},this.options.transitionDuration)}else{targetPanel.css({'left':0});this.$el.height(targetPanel.height())} 10this.currentPanel=targetPanel} 11if(!linker.hasClass(SlidingMenu.NAVIGATION_CLASS)){this.$('li.active').removeClass('active');linker.closest('li').addClass('active')}};SlidingMenu.prototype.process=function(){var data;if(this.options.dataJSON===!0){data=this.processJSON(this.options.dataJSON)}else{data=this.processHTML()} 12this.setMenuContent(data)};SlidingMenu.prototype.processJSON=function(data,parent,backLabel){var root,panels;root={id:SlidingMenu.PANEL_CLASS+'-'+this.getNewId(),root:parent?!1:!0,children:[]};panels=[];if(parent){root.children.push({panelId:parent.id,href:!1,label:this.options.backLabel===!0?backLabel:this.options.backLabel,_styleClass:SlidingMenu.BACK_CLASS+' '+SlidingMenu.NAVIGATION_CLASS})} 13$(data).each($.proxy(function(index,item){var panel;root.children.push(item);if(item.children){panel=this.processJSON(item.children,root,item.label);item.panelId=panel[0].id;item._styleClass=SlidingMenu.NAVIGATION_CLASS;panels=panels.concat(panel);delete item.children}},this));return[root].concat(panels)};SlidingMenu.prototype.processHTML=function(parentElem,parentObj,backLabel){var root,panels;root={id:SlidingMenu.PANEL_CLASS+'-'+this.getNewId(),root:parentElem?!1:!0,children:[]};panels=[];if(parentElem!==undefined){root.children.push({panelId:parentObj.id,href:!1,label:this.options.backLabel===!0?backLabel:this.options.backLabel,_styleClass:SlidingMenu.BACK_CLASS+' '+SlidingMenu.NAVIGATION_CLASS})}else{parentElem=this.$el.children('ul')} 14parentElem.children('li').each($.proxy(function(key,item){var itemObj,itemLink,panel,subPanel;item=$(item);if(!item.hasClass('separator')){itemLink=item.children('a');itemObj={icon:itemLink.find('.'+SlidingMenu.SET_ICON_CLASS).attr('class')||undefined,href:itemLink.attr('href'),label:itemLink.html(),classNames:{parent:this.trimWhiteSpaces(item.attr('class')||''),element:this.trimWhiteSpaces(itemLink.attr('class')||'')}};if(itemObj.icon!==undefined){itemObj.icon=(itemObj.icon).replace(SlidingMenu.SET_ICON_CLASS,'')} 15subPanel=item.children('ul');if(subPanel.length!==0){panel=this.processHTML(subPanel,root,itemObj.label);itemObj.panelId=panel[0].id;itemObj._styleClass=SlidingMenu.NAVIGATION_CLASS;panels=panels.concat(panel)}}else{itemObj={separator:!0}} 16root.children.push(itemObj)},this));return[root].concat(panels)};SlidingMenu.prototype.setMenuContent=function(json){var rootPanel;this.$el.empty().addClass(SlidingMenu.MAIN_CLASS+' '+this.options.className);$(json).each($.proxy(function(index,item){var panel;panel=$('<ul/>');if(item.root){rootPanel='.'+SlidingMenu.PANEL_CLASS+'[data-id="'+item.id+'"]'} 17panel.attr('data-id',item.id);panel.addClass(SlidingMenu.PANEL_CLASS);$(item.children).each(function(index,item){var li,link,icon;li=$('<li/>');if(item.separator!==!0){link=item.panelId?$('<button/>'):$('<a/>');if(item.classNames!==undefined){li.addClass(item.classNames.parent);link.addClass(item.classNames.element)} 18link.addClass(item._styleClass);if(item.panelId){link.attr({'type':'button','data-id':item.panelId})}else{link.attr({'href':item.href})} 19link.html(item.label);if(item.icon){icon=$('<i/>');icon.addClass(SlidingMenu.ICON_CLASS+' '+item.icon);link.prepend(icon)} 20li.append(link)}else{li.addClass(SlidingMenu.SEPARATOR_CLASS)} 21panel.append(li)});this.$el.append(panel)},this));rootPanel=this.$(rootPanel);rootPanel.addClass(SlidingMenu.PANEL_CLASS+'-root');this.currentPanel=rootPanel;if(this.options.initHref!==!1){this.changeVisiblePanel()}else{this.currentPanel.css('left',0)} 22this.$el.height(this.currentPanel.height())};SlidingMenu.prototype.changeVisiblePanel=function(){var selectedLink,selectedPanel;selectedLink=this.getHyperlinkByHref(this.options.initHref) 23if(selectedLink.length!==0){selectedLink.closest('li').addClass('active');selectedPanel=this.getPanelByHref(this.options.initHref);this.currentPanel=selectedPanel}else{console.warn(SlidingMenu.NAME+': the link "'+this.options.initHref+'" does not exists. Please '+'check the '+(this.options.dataJSON!==!1?'JSON object':'HTML
23structure')+'.')} 24this.options.initHref=!1;this.currentPanel.css('left',0)};SlidingMenu.prototype.trimWhiteSpaces=function(text){return text.trim()};SlidingMenu.prototype.getDefaults=function(){return SlidingMenu.DEFAULTS};SlidingMenu.prototype.getOptions=function(options){return $.extend({},this.getDefaults(),this.$el.data(),options)};SlidingMenu.prototype.getHyperlinkByHref=function(href){return this.$('a[href="'+href+'"]')||undefined};SlidingMenu.prototype.getPanelByHref=function(href){var linkElement=this.getHyperlinkByHref(href);return linkElement!==undefined?linkElement.closest('ul'):undefined};SlidingMenu.prototype.getNewId=function(){var id;do{id=Math.random().toString(36).substring(2,9)}while(slidingMenuUsedIds.indexOf(id)>=0);slidingMenuUsedIds.push(id);return id};function Plugin(option){return this.each(function(){var $this,data,options;$this=$(this);data=$this.data('dc.slidingMenu');options=typeof option==='object'&&option;if(!data&&/destroy|hide/.test(option)){return} 25if(!data){$this.data('dc.slidingMenu',(data=new SlidingMenu(this,options)))} 26if(typeof option==='string'){data[option]()}})} 27var old=$.fn.slidingMenu;$.fn.slidingMenu=Plugin;$.fn.slidingMenu.Constructor=SlidingMenu;$.fn.slidingMenu.noConflict=function(){$.fn.slidingMenu=old;return this}})) 28;
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.