You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
8 lines
1.1 MiB
JavaScript
8 lines
1.1 MiB
JavaScript
7 years ago
|
/*
|
||
7 years ago
|
* Copyright (c) Ascensio System SIA 2018. All rights reserved
|
||
7 years ago
|
*
|
||
|
* http://www.onlyoffice.com
|
||
|
*
|
||
|
* Version: 0.0.0 (build:0)
|
||
|
*/
|
||
|
function onDropDownKeyDown(e){var t=$(this),n=t.parent(),r=jQuery.Event("keydown.before.bs.dropdown"),i=jQuery.Event("keydown.after.bs.dropdown");n.trigger(r),n.hasClass("no-stop-propagate")?(arguments.length>1&&arguments[1]instanceof KeyboardEvent&&(e=arguments[1]),/^(38|40|27|13|9|37|39)$/.test(e.keyCode)&&!e.ctrlKey&&!e.altKey&&(patchDropDownKeyDownAdditional.call(this,e),/(37|39)/.test(e.keyCode)||(e.preventDefault(),e.stopPropagation()))):(patchDropDownKeyDown.call(this,e),e.preventDefault(),e.stopPropagation()),n.trigger(i)}function patchDropDownKeyDown(e){if(!/(38|40|27|37|39)/.test(e.keyCode))return;var t=$(this);e.preventDefault(),e.stopPropagation();if(t.is(".disabled, :disabled"))return;var n=getParent(t),r=n.hasClass("open")||n.hasClass("over");if(!r||r&&e.keyCode==27){if(e.which==27){i=$("[role=menu] li.dropdown-submenu.over:visible",n);if(i.size())return i.eq(i.size()-1).removeClass("over"),!1;n.hasClass("dropdown-submenu")&&n.hasClass("over")?(n.removeClass("over"),n.find("> a").focus()):n.find("[data-toggle=dropdown]").focus()}return r?t.click():undefined}var i=$("> [role=menu] > li:not(.divider):not(.disabled):visible",n).find("> a");if(!i.length)return;var s=i.index(i.filter(":focus"));if(e.keyCode==39){if(s<0)return;var o=i.eq(s).parent();o.hasClass("dropdown-submenu")&&!o.hasClass("over")&&(o.mouseenter(),o.addClass("focused-submenu"),_.delay(function(){var e=$("> [role=menu]",o),t=e.find("> li:not(.divider):not(.disabled):visible > a"),n=0;if(e.find("> .menu-scroll").length>0){var r=e.scrollTop();for(var i=0;i<t.length;i++)if(t[i].offsetTop>r){n=i;break}}t.length>0&&t.eq(n).focus()},250))}else e.keyCode==37?n.hasClass("dropdown-submenu")&&n.hasClass("over")&&(n.removeClass("over"),n.find("> a").focus()):(e.keyCode==38?s>0?s--:t.hasClass("no-cyclic")?s=0:s=i.length-1:e.keyCode==40&&(s<i.length-1?s++:t.hasClass("no-cyclic")?s=i.length-1:s=0),~s||(s=0),n.hasClass("dropdown-submenu")&&n.hasClass("over")&&n.addClass("focused-submenu"),i.eq(s).focus())}function patchDropDownKeyDownAdditional(e){if(!/(38|40|27|37|39)/.test(e.keyCode))return;var t=$(this);/(37|39)/.test(e.keyCode)||(e.preventDefault(),e.stopPropagation());if(t.is(".disabled, :disabled"))return;var n=getParent(t),r=n.hasClass("open")||n.hasClass("over");if(!r||r&&(e.keyCode==27||e.keyCode==37||e.keyCode==39))return r?t.click():undefined;var i=$("> [role=menu] > li:not(.divider):not(.disabled):visible",n).find("> a");if(!i.length)return;var s=i.index(i.filter(".focus"));e.keyCode==38?s>0?s--:t.hasClass("no-cyclic")?s=0:s=i.length-1:e.keyCode==40&&(s<i.length-1?s++:t.hasClass("no-cyclic")?s=i.length-1:s=0),~s||(s=0),i.removeClass("focus"),i.eq(s).addClass("focus")}function getParent(e){var t=e.attr("data-target");t||(t=e.attr("href"),t=t&&/#/.test(t)&&t.replace(/.*(?=#[^\s]*$)/,""));var n=t&&$(t);return n&&n.length?n:e.parent()}function clearMenus(e){$(".dropdown-toggle").each(function(t){var n=$(this).parent();if(!n.hasClass("open"))return;n.trigger(t=$.Event("hide.bs.dropdown"));if(t.isDefaultPrevented())return;n.removeClass("open").trigger("hidden.bs.dropdown",e)})}(function(){var e=this,t=e._,n={},r=Array.prototype,i=Object.prototype,s=Function.prototype,o=r.push,u=r.slice,a=r.concat,f=i.toString,l=i.hasOwnProperty,c=r.forEach,h=r.map,p=r.reduce,d=r.reduceRight,v=r.filter,m=r.every,g=r.some,y=r.indexOf,b=r.lastIndexOf,w=Array.isArray,E=Object.keys,S=s.bind,x=function(e){if(e instanceof x)return e;if(!(this instanceof x))return new x(e);this._wrapped=e};typeof exports!="undefined"?(typeof module!="undefined"&&module.exports&&(exports=module.exports=x),exports._=x):e._=x,x.VERSION="1.5.2";var T=x.each=x.forEach=function(e,t,r){if(e==null)return;if(c&&e.forEach===c)e.forEach(t,r);else if(e.length===+e.length){for(var i=0,s=e.length;i<s;i++)if(t.call(r,e[i],i,e)===n)return}else{var o=x.keys(e);for(var i=0,s=o.length;i<s;i++)if(t.call(r,e[o[i]],o[i],e)===n)return}};x.map=x.collect=function(e,t,n){var r=[];return e==null?r:h&&e.map===h?e.map(t,n):(T(e,function(e,i,s){r.push(t.call(n,e,i,s))}),r)};var N="Reduce of empty array with no initial valu
|