OwlCyberSecurity - MANAGER
Edit File: jquery.mmenu.keyboardnavigation.min.js
/* * jQuery mmenu keyboardNavigation add-on * mmenu.frebsite.nl * * Copyright (c) Fred Heusschen */ !function(n){function t(t,e){t=t||this.$pnls.children("."+s.opened);var a=n(),i=this.$menu.children("."+s.mm("navbars-top")+", ."+s.mm("navbars-bottom")).children("."+s.navbar);i.find(l).filter(":focus").length||("default"==e&&(a=t.children("."+s.listview).find("a[href]").not("."+s.hidden),a.length||(a=t.find(l).not("."+s.hidden)),a.length||(a=i.find(l).not("."+s.hidden))),a.length||(a=this.$menu.children("."+s.tabstart)),a.first().focus())}function e(n){n||(n=this.$pnls.children("."+s.opened));var t=this.$pnls.children("."+s.panel),e=t.not(n);e.find(l).attr("tabindex",-1),n.find(l).attr("tabindex",0),n.find("."+s.mm("toggle")+", ."+s.mm("check")).attr("tabindex",-1),n.children("."+s.navbar).children("."+s.title).attr("tabindex",-1)}var a="mmenu",i="keyboardNavigation";n[a].addons[i]={setup:function(){var o=this.opts[i];this.conf[i];if(c=n[a].glbl,"boolean"!=typeof o&&"string"!=typeof o||(o={enable:o}),"object"!=typeof o&&(o={}),o=this.opts[i]=n.extend(!0,{},n[a].defaults[i],o),o.enable){var d=n('<button class="'+s.tabstart+'" tabindex="0" type="button" />'),l=n('<button class="'+s.tabend+'" tabindex="0" type="button" />');this.bind("initMenu:after",function(){o.enhance&&this.$menu.addClass(s.keyboardfocus),this["_initWindow_"+i](o.enhance)}),this.bind("initOpened:before",function(){this.$menu.prepend(d).append(l).children("."+s.mm("navbars-top")+", ."+s.mm("navbars-bottom")).children("."+s.navbar).children("a."+s.title).attr("tabindex",-1)}),this.bind("open:start",function(){e.call(this)}),this.bind("open:finish",function(){t.call(this,null,o.enable)}),this.bind("openPanel:start",function(n){e.call(this,n)}),this.bind("openPanel:finish",function(n){t.call(this,n,o.enable)}),this.bind("initOpened:after",function(){this.__sr_aria(this.$menu.children("."+s.mm("tabstart")+", ."+s.mm("tabend")),"hidden",!0)})}},add:function(){s=n[a]._c,o=n[a]._d,d=n[a]._e,s.add("tabstart tabend keyboardfocus"),d.add("focusin keydown")},clickAnchor:function(n,t){}},n[a].defaults[i]={enable:!1,enhance:!1},n[a].configuration[i]={},n[a].prototype["_initWindow_"+i]=function(t){c.$wndw.off(d.keydown+"-offCanvas"),c.$wndw.off(d.focusin+"-"+i).on(d.focusin+"-"+i,function(t){if(c.$html.hasClass(s.opened)){var e=n(t.target);e.is("."+s.tabend)&&e.parent().find("."+s.tabstart).focus()}}),c.$wndw.off(d.keydown+"-"+i).on(d.keydown+"-"+i,function(t){var e=n(t.target),a=e.closest("."+s.menu);if(a.length){a.data("mmenu");if(e.is("input, textarea"));else switch(t.keyCode){case 13:(e.is(".mm-toggle")||e.is(".mm-check"))&&e.trigger(d.click);break;case 32:case 37:case 38:case 39:case 40:t.preventDefault()}}}),t&&c.$wndw.off(d.keydown+"-"+i).on(d.keydown+"-"+i,function(t){var e=n(t.target),a=e.closest("."+s.menu);if(a.length){var i=a.data("mmenu");if(e.is("input, textarea"))switch(t.keyCode){case 27:e.val("")}else switch(t.keyCode){case 8:var d=e.closest("."+s.panel).data(o.parent);d&&d.length&&i.openPanel(d.closest("."+s.panel));break;case 27:a.hasClass(s.offcanvas)&&i.close()}}})};var s,o,d,c,l="input, select, textarea, button, label, a[href]"}(jQuery);