Your IP : 192.168.165.1


Current Path : C:/xampp/htdocs/moodle/admin/tool/lp/amd/build/
Upload File :
Current File : C:/xampp/htdocs/moodle/admin/tool/lp/amd/build/menubar.min.js

define ("tool_lp/menubar",["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()};e.prototype.openSubMenu=function(a){this.setOpenDirection();d();a.attr("aria-hidden","false");c=!0};e.prototype.addEventListeners=function(){var f=this;if(!1===b){a(document).click(function(){if(c){d()}});b=!0}this.subMenuItems.mouseenter(function(){a(this).addClass("menu-hover");return!0});this.subMenuItems.mouseout(function(){a(this).removeClass("menu-hover");return!0});this.allItems.click(function(b){return f.handleClick(a(this),b)});this.allItems.keydown(function(b){return f.handleKeyDown(a(this),b)});this.allItems.focus(function(){return f.handleFocus(a(this))});this.allItems.blur(function(){return f.handleBlur(a(this))})};e.prototype.handleClick=function(b,c){c.stopPropagation();var d=b.parent();if(d.is(".tool-lp-menu")){if("true"==b.children("ul").first().attr("aria-hidden")){this.openSubMenu(b.children("ul").first())}else{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;if(this.handlers){a.each(this.handlers,function(c,d){if(g){return}if(0<b.find(c).length){var h=a.proxy(d,e);g=!1===h(f)||f.isDefaultPrevented()}})}if(!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");this.allItems.removeClass("menu-focus");this.activeItem.addClass("menu-focus");b.addClass("menu-focus");if(!0===this.isChildOpen){var c=a.parent();if(c.is(".tool-lp-menu")&&"true"==a.attr("aria-haspopup")){this.openSubMenu(a.children("ul").first())}}return!0};e.prototype.handleBlur=function(a){a.removeClass("menu-focus");return!0};e.prototype.setOpenDirection=function(){var b=this.menuRoot.offset(),c=a(document.body).hasClass("dir-rtl"),d=this.rootMenus.outerHeight(),e=this.rootMenus.outerWidth(),f=this.rootMenus.find("ul.tool-lp-sub-menu");f.css("margin-right","");f.css("margin-left","");f.css("margin-top","");f.attr("aria-hidden",!1);var g=f.outerWidth(),h=f.outerHeight(),i=null,j=null,k=null,l=b.top-a(window).scrollTop();if(l+h>a(window).height()){i=h+d;f.css("margin-top","-"+i+"px")}if(c){if(0>b.left-g){j=g-e;f.css("margin-right","-"+j+"px")}}else{if(b.left+g>a(window).width()){k=g-e;f.css("margin-left","-"+k+"px")}}if(!0){this.menuRoot.addClass("tool-lp-menu-open-left")}else{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();if(c.is(".tool-lp-menu")){a.children("ul").first().attr("aria-hidden","true")}else{this.activeItem=c.parent();this.isChildOpen=!1;this.activeItem.focus();c.attr("aria-hidden","true")}b.stopPropagation();return!1}case this.keys.enter:case this.keys.space:{return this.handleClick(a,b)}case this.keys.left:{this.activeItem=this.moveToPrevious(a);this.activeItem.focus();b.stopPropagation();return!1}case this.keys.right:{this.activeItem=this.moveToNext(a);this.activeItem.focus();b.stopPropagation();return!1}case this.keys.up:{this.activeItem=this.moveUp(a);this.activeItem.focus();b.stopPropagation();return!1}case this.keys.down:{this.activeItem=this.moveDown(a);this.activeItem.focus();b.stopPropagation();return!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")){if(e<d-1){f=a.next()}else{f=c.first()}if("true"==a.attr("aria-haspopup")){g=a.children("ul").first();if("false"==g.attr("aria-hidden")){g.attr("aria-hidden","true");this.isChildOpen=!0}}a.removeClass("menu-focus");if("true"===f.attr("aria-haspopup")&&!0===this.isChildOpen){g=f.children("ul").first();this.openSubMenu(g)}}else{if("true"==a.attr("aria-haspopup")){g=a.children("ul").first();f=g.children("li").first();this.openSubMenu(g)}else{var h=null,i=null;h=a.parentsUntil("ul.tool-lp-menu").filter("ul").not(".tool-lp-menu");h.attr("aria-hidden","true");h.find("li").removeClass("menu-focus");h.last().parent().removeClass("menu-focus");i=h.last().parent();e=this.rootMenus.index(i);if(e<this.rootMenus.length-1){f=i.next()}else{f=this.rootMenus.first()}f.addClass("menu-focus");if("true"==f.attr("aria-haspopup")){g=f.children("ul").first();f=g.children("li").first();this.openSubMenu(g);this.isChildOpen=!0}}}return f};e.prototype.moveToPrevious=function(a){var b=a.parent(),c=b.children("li"),d=c.index(a),e=null,f=null;if(b.is(".tool-lp-menu")){if(0<d){e=a.prev()}else{e=c.last()}if("true"==a.attr("aria-haspopup")){f=a.children("ul").first();if("false"==f.attr("aria-hidden")){f.attr("aria-hidden","true");this.isChildOpen=!0}}a.removeClass("menu-focus");if("true"===e.attr("aria-haspopup")&&!0===this.isChildOpen){f=e.children("ul").first();this.openSubMenu(f)}}else{var g=b.parent(),h=g.parent();if(!h.is(".tool-lp-menu")){e=b.parent();b.attr("aria-hidden","true");a.removeClass("menu-focus")}else{b.attr("aria-hidden","true");a.removeClass("menu-focus");g.removeClass("menu-focus");d=this.rootMenus.index(g);if(0<d){e=g.prev()}else{e=this.rootMenus.last()}e.addClass("menu-focus");if("true"==e.attr("aria-haspopup")){f=e.children("ul").first();this.openSubMenu(f);this.isChildOpen=!0;e=f.children("li").first()}}}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")){if("true"!=a.attr("aria-haspopup")){return a}h=a.children("ul").first();g=h.children("li").first();this.openSubMenu(h);return g}if(b){var i=!1,j=f+1;if(j==e){j=0}while(j!=f){var k=d.eq(j).html().charAt(0);if(k.toLowerCase()==b){i=!0;break}j=j+1;if(j==e){j=0}}if(!0==i){g=d.eq(j);a.removeClass("menu-focus");return g}else{return a}}else{if(f<e-1){g=d.eq(f+1)}else{g=d.first()}}a.removeClass("menu-focus");return g};e.prototype.moveUp=function(a){var b=a.parent(),c=b.children("li").not(".separator"),d=c.index(a),e=null;if(b.is(".tool-lp-menu")){return a}if(0<d){e=c.eq(d-1)}else{e=c.last()}a.removeClass("menu-focus");return 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")};return{enhance:function enhance(b,c){a(b).each(function(b,d){var f=a(d);if(!0!==f.data("menubarEnhanced")){new e(f,c);f.data("menubarEnhanced",!0)}})},closeAll:d}});
//# sourceMappingURL=menubar.min.js.map