芝麻web文件管理V1.00
编辑当前文件:/home2/sdektunc/.trash/cepali/admin/tool/lp/amd/build/menubar.min.js
define(["jquery"],function(a){var b=!1,c=!1,d=function(){a(".tool-lp-menu .tool-lp-sub-menu").attr("aria-hidden","true"),c=!1},e=function(a,b){this.menuRoot=a,this.handlers=b,this.rootMenus=this.menuRoot.children("li"),this.subMenus=this.rootMenus.children("ul"),this.subMenuItems=this.subMenus.children("li"),this.allItems=this.rootMenus.add(this.subMenuItems),this.activeItem=null,this.isChildOpen=!1,this.keys={tab:9,enter:13,esc:27,space:32,left:37,up:38,right:39,down:40},this.addAriaAttributes(),this.addEventListeners()};return e.prototype.openSubMenu=function(a){this.setOpenDirection(),d(),a.attr("aria-hidden","false"),c=!0},e.prototype.addEventListeners=function(){var e=this;b===!1&&(a(document).click(function(){c&&d()}),b=!0),this.subMenuItems.mouseenter(function(){return a(this).addClass("menu-hover"),!0}),this.subMenuItems.mouseout(function(){return a(this).removeClass("menu-hover"),!0}),this.allItems.click(function(b){return e.handleClick(a(this),b)}),this.allItems.keydown(function(b){return e.handleKeyDown(a(this),b)}),this.allItems.focus(function(){return e.handleFocus(a(this))}),this.allItems.blur(function(){return e.handleBlur(a(this))})},e.prototype.handleClick=function(b,c){c.stopPropagation();var d=b.parent();if(d.is(".tool-lp-menu"))"true"==b.children("ul").first().attr("aria-hidden")?this.openSubMenu(b.children("ul").first()):b.children("ul").first().attr("aria-hidden","true");else{this.allItems.removeClass("menu-hover menu-focus"),this.activeItem=null,this.menuRoot.find("ul").not(".root-level").attr("aria-hidden","true");var e=b.find("a").first(),f=new a.Event("click");f.target=e;var g=!1;this.handlers&&a.each(this.handlers,function(c,d){if(!g&&b.find(c).length>0){var h=a.proxy(d,e);g=h(f)===!1||f.isDefaultPrevented()}}),g||"#"===e.attr("href")||(window.location.href=e.attr("href"))}return!1},e.prototype.handleFocus=function(a){if(null===this.activeItem)this.activeItem=a;else if(a[0]!=this.activeItem[0])return!0;var b=this.activeItem.parentsUntil("ul.tool-lp-menu").filter("li");if(this.allItems.removeClass("menu-focus"),this.activeItem.addClass("menu-focus"),b.addClass("menu-focus"),this.isChildOpen===!0){var c=a.parent();c.is(".tool-lp-menu")&&"true"==a.attr("aria-haspopup")&&this.openSubMenu(a.children("ul").first())}return!0},e.prototype.handleBlur=function(a){return a.removeClass("menu-focus"),!0},e.prototype.setOpenDirection=function(){var b=this.menuRoot.offset(),c=a(document.body).hasClass("dir-rtl"),d=!0,e=this.rootMenus.outerHeight(),f=this.rootMenus.outerWidth(),g=this.rootMenus.find("ul.tool-lp-sub-menu");g.css("margin-right",""),g.css("margin-left",""),g.css("margin-top",""),g.attr("aria-hidden",!1);var h=g.outerWidth(),i=g.outerHeight(),j=null,k=null,l=null,m=b.top-a(window).scrollTop();m+i>a(window).height()&&(j=i+e,g.css("margin-top","-"+j+"px")),c?b.left-h<0&&(k=h-f,g.css("margin-right","-"+k+"px")):b.left+h>a(window).width()&&(l=h-f,g.css("margin-left","-"+l+"px")),d?this.menuRoot.addClass("tool-lp-menu-open-left"):this.menuRoot.removeClass("tool-lp-menu-open-left")},e.prototype.handleKeyDown=function(a,b){if(b.altKey||b.ctrlKey)return!0;switch(b.keyCode){case this.keys.tab:this.menuRoot.find("ul").attr("aria-hidden","true"),this.allItems.removeClass("menu-focus"),this.activeItem=null,this.isChildOpen=!1;break;case this.keys.esc:var c=a.parent();return c.is(".tool-lp-menu")?a.children("ul").first().attr("aria-hidden","true"):(this.activeItem=c.parent(),this.isChildOpen=!1,this.activeItem.focus(),c.attr("aria-hidden","true")),b.stopPropagation(),!1;case this.keys.enter:case this.keys.space:return this.handleClick(a,b);case this.keys.left:return this.activeItem=this.moveToPrevious(a),this.activeItem.focus(),b.stopPropagation(),!1;case this.keys.right:return this.activeItem=this.moveToNext(a),this.activeItem.focus(),b.stopPropagation(),!1;case this.keys.up:return this.activeItem=this.moveUp(a),this.activeItem.focus(),b.stopPropagation(),!1;case this.keys.down:return this.activeItem=this.moveDown(a),this.activeItem.focus(),b.stopPropagation(),!1}return!0},e.prototype.moveToNext=function(a){var b=a.parent(),c=b.children("li"),d=c.length,e=c.index(a),f=null,g=null;if(b.is(".tool-lp-menu"))f=e
0?a.prev():c.last(),"true"==a.attr("aria-haspopup")&&(f=a.children("ul").first(),"false"==f.attr("aria-hidden")&&(f.attr("aria-hidden","true"),this.isChildOpen=!0)),a.removeClass("menu-focus"),"true"===e.attr("aria-haspopup")&&this.isChildOpen===!0&&(f=e.children("ul").first(),this.openSubMenu(f));else{var g=b.parent(),h=g.parent();h.is(".tool-lp-menu")?(b.attr("aria-hidden","true"),a.removeClass("menu-focus"),g.removeClass("menu-focus"),d=this.rootMenus.index(g),e=d>0?g.prev():this.rootMenus.last(),e.addClass("menu-focus"),"true"==e.attr("aria-haspopup")&&(f=e.children("ul").first(),this.openSubMenu(f),this.isChildOpen=!0,e=f.children("li").first())):(e=b.parent(),b.attr("aria-hidden","true"),a.removeClass("menu-focus"))}return e},e.prototype.moveDown=function(a,b){var c=a.parent(),d=c.children("li").not(".separator"),e=d.length,f=d.index(a),g=null,h=null;if(c.is(".tool-lp-menu"))return"true"!=a.attr("aria-haspopup")?a:(h=a.children("ul").first(),g=h.children("li").first(),this.openSubMenu(h),g);if(b){var i=!1,j=f+1;for(j==e&&(j=0);j!=f;){var k=d.eq(j).html().charAt(0);if(k.toLowerCase()==b){i=!0;break}j+=1,j==e&&(j=0)}return i===!0?(g=d.eq(j),a.removeClass("menu-focus"),g):a}return g=f
0?c.eq(d-1):c.last(),a.removeClass("menu-focus"),e)},e.prototype.addAriaAttributes=function(){this.menuRoot.attr("role","menubar"),this.rootMenus.attr("role","menuitem"),this.rootMenus.attr("tabindex","0"),this.rootMenus.attr("aria-haspopup","true"),this.subMenus.attr("role","menu"),this.subMenus.attr("aria-hidden","true"),this.subMenuItems.attr("role","menuitem"),this.subMenuItems.attr("tabindex","-1"),this.menuRoot.addClass("tool-lp-menu"),this.allItems.addClass("tool-lp-menu-item"),this.rootMenus.addClass("tool-lp-root-menu"),this.subMenus.addClass("tool-lp-sub-menu"),this.subMenuItems.addClass("dropdown-item")},{enhance:function(b,c){a(b).each(function(b,d){var f=a(d);f.data("menubarEnhanced")!==!0&&(new e(f,c),f.data("menubarEnhanced",!0))})},closeAll:d}});