1 line
2.0 KiB
JavaScript
1 line
2.0 KiB
JavaScript
|
(()=>{"use strict";function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e(t)}function t(e,t){for(var o=0;o<t.length;o++){var r=t[o];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,n(r.key),r)}}function n(t){var n=function(t,n){if("object"!=e(t)||!t)return t;var o=t[Symbol.toPrimitive];if(void 0!==o){var r=o.call(t,n||"default");if("object"!=e(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===n?String:Number)(t)}(t,"string");return"symbol"==e(n)?n:n+""}var o,r=function(e){var t=e.key,n=e.handler,o=e.preventDefault,r=void 0!==o&&o,i=t.toLowerCase().split("+").map((function(e){return e.trim()})),u=/Mac|iPod|iPhone|iPad/.test(navigator.platform),a=function(e){i.every((function(t){return"control"===t?u?e.metaKey:e.ctrlKey:e.key.toLowerCase()===t}))&&(r&&e.preventDefault(),n(e))};return document.addEventListener("keydown",a),function(){return document.removeEventListener("keydown",a)}},i=function(){return e=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)},n=[{key:"emit",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:document,o=new CustomEvent(e,{detail:t,bubbles:!0,composed:!0});n.dispatchEvent(o)}},{key:"on",value:function(e,t){(arguments.length>2&&void 0!==arguments[2]?arguments[2]:document).addEventListener(e,t)}},{key:"off",value:function(e,t){(arguments.length>2&&void 0!==arguments[2]?arguments[2]:document).removeEventListener(e,t)}}],n&&t(e.prototype,n),o&&t(e,o),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,n,o}();new i;o=()=>{r({key:"control+h",preventDefault:!0,handler:()=>location.href="/"}),r({key:"control+p",preventDefault:!0,handler:()=>location.href="/cosy-preference"})},"loading"===document.readyState?document.addEventListener("DOMContentLoaded",o):o()})();
|