Files
old-saburly-wagtail-web/static/wagtailadmin/js/core.js

2 lines
97 KiB
JavaScript
Raw Normal View History

2024-08-27 20:33:44 +02:00
/*! For license information please see core.js.LICENSE.txt */
(()=>{var e,t={6411:(e,t,n)=>{var i;!function(o,a,r){if(o){for(var s,l={8:"backspace",9:"tab",13:"enter",16:"shift",17:"ctrl",18:"alt",20:"capslock",27:"esc",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"ins",46:"del",91:"meta",93:"meta",224:"meta"},c={106:"*",107:"+",109:"-",110:".",111:"/",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},d={"~":"`","!":"1","@":"2","#":"3",$:"4","%":"5","^":"6","&":"7","*":"8","(":"9",")":"0",_:"-","+":"=",":":";",'"':"'","<":",",">":".","?":"/","|":"\\"},h={option:"alt",command:"meta",return:"enter",escape:"esc",plus:"+",mod:/Mac|iPod|iPhone|iPad/.test(navigator.platform)?"meta":"ctrl"},u=1;u<20;++u)l[111+u]="f"+u;for(u=0;u<=9;++u)l[u+96]=u.toString();y.prototype.bind=function(e,t,n){var i=this;return e=e instanceof Array?e:[e],i._bindMultiple.call(i,e,t,n),i},y.prototype.unbind=function(e,t){return this.bind.call(this,e,(function(){}),t)},y.prototype.trigger=function(e,t){var n=this;return n._directMap[e+":"+t]&&n._directMap[e+":"+t]({},e),n},y.prototype.reset=function(){var e=this;return e._callbacks={},e._directMap={},e},y.prototype.stopCallback=function(e,t){if((" "+t.className+" ").indexOf(" mousetrap ")>-1)return!1;if(b(t,this.target))return!1;if("composedPath"in e&&"function"==typeof e.composedPath){var n=e.composedPath()[0];n!==e.target&&(t=n)}return"INPUT"==t.tagName||"SELECT"==t.tagName||"TEXTAREA"==t.tagName||t.isContentEditable},y.prototype.handleKey=function(){return this._handleKey.apply(this,arguments)},y.addKeycodes=function(e){for(var t in e)e.hasOwnProperty(t)&&(l[t]=e[t]);s=null},y.init=function(){var e=y(a);for(var t in e)"_"!==t.charAt(0)&&(y[t]=function(t){return function(){return e[t].apply(e,arguments)}}(t))},y.init(),o.Mousetrap=y,e.exports&&(e.exports=y),void 0===(i=function(){return y}.call(t,n,t,e))||(e.exports=i)}function p(e,t,n){e.addEventListener?e.addEventListener(t,n,!1):e.attachEvent("on"+t,n)}function f(e){if("keypress"==e.type){var t=String.fromCharCode(e.which);return e.shiftKey||(t=t.toLowerCase()),t}return l[e.which]?l[e.which]:c[e.which]?c[e.which]:String.fromCharCode(e.which).toLowerCase()}function m(e){return"shift"==e||"ctrl"==e||"alt"==e||"meta"==e}function g(e,t,n){return n||(n=function(){if(!s)for(var e in s={},l)e>95&&e<112||l.hasOwnProperty(e)&&(s[l[e]]=e);return s}()[e]?"keydown":"keypress"),"keypress"==n&&t.length&&(n="keydown"),n}function v(e,t){var n,i,o,a=[];for(n=function(e){return"+"===e?["+"]:(e=e.replace(/\+{2}/g,"+plus")).split("+")}(e),o=0;o<n.length;++o)i=n[o],h[i]&&(i=h[i]),t&&"keypress"!=t&&d[i]&&(i=d[i],a.push("shift")),m(i)&&a.push(i);return{key:i,modifiers:a,action:t=g(i,a,t)}}function b(e,t){return null!==e&&e!==a&&(e===t||b(e.parentNode,t))}function y(e){var t=this;if(e=e||a,!(t instanceof y))return new y(e);t.target=e,t._callbacks={},t._directMap={};var n,i={},o=!1,r=!1,s=!1;function l(e){e=e||{};var t,n=!1;for(t in i)e[t]?n=!0:i[t]=0;n||(s=!1)}function c(e,n,o,a,r,s){var l,c,d,h,u=[],p=o.type;if(!t._callbacks[e])return[];for("keyup"==p&&m(e)&&(n=[e]),l=0;l<t._callbacks[e].length;++l)if(c=t._callbacks[e][l],(a||!c.seq||i[c.seq]==c.level)&&p==c.action&&("keypress"==p&&!o.metaKey&&!o.ctrlKey||(d=n,h=c.modifiers,d.sort().join(",")===h.sort().join(",")))){var f=!a&&c.combo==r,g=a&&c.seq==a&&c.level==s;(f||g)&&t._callbacks[e].splice(l,1),u.push(c)}return u}function d(e,n,i,o){t.stopCallback(n,n.target||n.srcElement,i,o)||!1===e(n,i)&&(function(e){e.preventDefault?e.preventDefault():e.returnValue=!1}(n),function(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}(n))}function h(e){"number"!=typeof e.which&&(e.which=e.keyCode);var n=f(e);n&&("keyup"!=e.type||o!==n?t.handleKey(n,function(e){var t=[];return e.shiftKey&&t.push("shift"),e.altKey&&t.push("alt"),e.ctrlKey&&t.push("ctrl"),e.metaKey&&t.push("meta"),t}(e),e):o=!1)}function u(e,a,r,h,p){t._directMap[e+":"+r]=a;var m,g=(e=e.replace(/\s+/g," ")).split(" ");g.length>1?function(e,t,a,r){function c(t){return function(){s=t,++i[e],clearTimeout(n),n=setTimeout(l,1e3)}}funct