File "sliding-menu.min.js"
Full Path: /home/jlklyejr/public_html/wp-content/test/wp-content/themes/goya/assets/js/vendor/sliding-menu.min.js
File size: 5.45 KB
MIME-type: text/plain
Charset: utf-8
if("undefined"==typeof jQuery)throw new Error("Sliding Menu requires jQuery");!function(t){"use strict";"function"==typeof define&&define.amd?define(["jquery"],t):t(jQuery)}(function(o){"use strict";var e,l;e=[],(l=function(t,e){this.options=void 0,this.$el=void 0,this.currentPanel=void 0,this.init(t,e)}).NAME="Sliding Menu",l.VERSION="0.2.0",l.PANEL_CLASS=(l.MAIN_CLASS="sliding-menu")+"-panel",l.ICON_CLASS=l.MAIN_CLASS+"-icon",l.NAVIGATION_CLASS=l.MAIN_CLASS+"-nav",l.SET_ICON_CLASS="sm-set-icon",l.DEFAULTS={className:"",transitionDuration:250,dataJSON:!1,initHref:!1,backLabel:"Back"},l.prototype.init=function(t,e){this.$el=o(t),this.$el.hasClass(l.MAIN_CLASS)||(this.options=this.getOptions(e),this.events(),this.process())},l.prototype.$=function(t){return this.$el.find(t)},l.prototype.events=function(){this.$el.on("click","a",o.proxy(this._onClickItem,this))},l.prototype._onClickItem=function(t){var e,i=o(t.currentTarget);void 0!==i.attr("data-id")&&(t.preventDefault(),e=i.hasClass(l.MAIN_CLASS+"-back"),t=this.$("."+l.PANEL_CLASS+'[data-id="'+i.attr("data-id")+'"]'),this.currentPanel.attr("data-id")!==t.attr("data-id")?(this.currentPanel.stop(!0,!0).animate({left:e?"100%":"-100%"},this.options.transitionDuration),t.stop(!0,!0).css("left",e?"-100%":"100%").animate({left:0},this.options.transitionDuration),this.$el.stop(!0,!0).animate({height:t.height()},this.options.transitionDuration)):(t.css({left:0}),this.$el.height(t.height())),this.currentPanel=t),i.hasClass(l.NAVIGATION_CLASS)||(this.$("li.active").removeClass("active"),i.closest("li").addClass("active"))},l.prototype.process=function(){var t=this.options.dataJSON?this.processJSON(this.options.dataJSON):this.processHTML();this.setMenuContent(t)},l.prototype.setMenuContent=function(t){var i;this.$el.empty().addClass(l.MAIN_CLASS+" "+this.options.className),o(t).each(o.proxy(function(t,e){var a=o("<ul/>");e.root&&(i="."+l.PANEL_CLASS+'[data-id="'+e.id+'"]'),a.attr("data-id",e.id),a.addClass(l.PANEL_CLASS),o(e.children).each(function(t,e){var i,n,s=o("<li/>");s.attr({class:e.class}),!0!==e.separator?((i=o("<a/>")).attr({class:e.styleClass,href:e.href}),e.panelId&&i.attr("data-id",e.panelId),i.text(e.label),e.tag&&i.append(e.tag),e.icon&&((n=o("<i/>")).addClass(l.ICON_CLASS+" "+e.icon),i.prepend(n)),s.append(i)):s.addClass(l.MAIN_CLASS+"-separator"),a.append(s)}),this.$el.append(a)},this)),(i=this.$(i)).addClass(l.PANEL_CLASS+"-root"),this.currentPanel=i,!1!==this.options.initHref?this.changeVisiblePanel():this.currentPanel.css("left",0),this.$el.height(this.currentPanel.height())},l.prototype.changeVisiblePanel=function(){var t=this.getHyperlinkByHref(this.options.initHref);0!==t.length?(t.closest("li").addClass("active"),t=this.getPanelByHref(this.options.initHref),this.currentPanel=t):console.warn(l.NAME+': the link "'+this.options.initHref+'" does not exists. Please check the '+(!1!==this.options.dataJSON?"JSON object":"HTML structure")+"."),this.options.initHref=!1,this.currentPanel.css("left",0)},l.prototype.processHTML=function(t,e,i){var n,a={id:l.PANEL_CLASS+"-"+this.getNewId(),root:!t,children:[]},r=[];return void 0!==t?(a.children.push({panelId:e.id,href:"#",label:!0===this.options.backLabel?i:this.options.backLabel,styleClass:l.MAIN_CLASS+"-back "+l.NAVIGATION_CLASS}),n=t.parent(),void 0!==(i=(e=t.parent().children("a")).find(".menu-label")||void 0)&&e.find(".menu-label").remove(),e.find("noscript").remove(),a.children.push({href:e.attr("href"),class:n.attr("class")+" menu-item-top",label:this.trimWhiteSpaces(e.text()),tag:i,styleClass:l.MAIN_CLASS+"-top "})):t=this.$el.children("ul"),t.children("li").each(o.proxy(function(t,e){var i,n,s;(e=o(e)).hasClass("separator")?i={separator:!0}:(void 0!==(s=(n=e.children("a")).find(".menu-label")||void 0)&&n.find(".menu-label").remove(),n.find("noscript").remove(),void 0!==(i={icon:n.find("."+l.SET_ICON_CLASS).attr("class")||void 0,class:e.attr("class"),href:n.attr("href"),tag:s,label:this.trimWhiteSpaces(n.text())}).icon&&(i.icon=i.icon.replace(l.SET_ICON_CLASS,"")),0!==(e=e.children("ul")).length&&(e=this.processHTML(e,a,i.label),i.panelId=e[0].id,i.styleClass=l.NAVIGATION_CLASS,r=r.concat(e))),a.children.push(i)},this)),[a].concat(r)},l.prototype.processJSON=function(t,e,i){var n={id:l.PANEL_CLASS+"-"+this.getNewId(),root:!e,children:[]},s=[];return e&&n.children.push({panelId:e.id,href:"#",label:!0===this.options.backLabel?i:this.options.backLabel,styleClass:l.MAIN_CLASS+"-back "+l.NAVIGATION_CLASS}),o(t).each(o.proxy(function(t,e){var i;n.children.push(e),e.children&&(i=this.processJSON(e.children,n,e.label),e.panelId=i[0].id,e.styleClass=l.NAVIGATION_CLASS,s=s.concat(i),delete e.children)},this)),[n].concat(s)},l.prototype.trimWhiteSpaces=function(t){return t.trim()},l.prototype.getDefaults=function(){return l.DEFAULTS},l.prototype.getOptions=function(t){return o.extend({},this.getDefaults(),this.$el.data(),t)},l.prototype.getHyperlinkByHref=function(t){return this.$('a[href="'+t+'"]')||void 0},l.prototype.getPanelByHref=function(t){t=this.getHyperlinkByHref(t);return void 0!==t?t.closest("ul"):void 0},l.prototype.getNewId=function(){for(var t;t=Math.random().toString(36).substring(2,9),0<=e.indexOf(t););return e.push(t),t};var t=o.fn.slidingMenu;o.fn.slidingMenu=function(n){return this.each(function(){var t=o(this),e=t.data("dc.slidingMenu"),i="object"==typeof n&&n;!e&&/destroy|hide/.test(n)||(e||t.data("dc.slidingMenu",e=new l(this,i)),"string"==typeof n&&e[n]())})},o.fn.slidingMenu.Constructor=l,o.fn.slidingMenu.noConflict=function(){return o.fn.slidingMenu=t,this}});