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.

1 line
14 KiB
JavaScript

1 year ago
(()=>{"use strict";function t(t,e){var n=t.split(".");"isekai"in window||(window.isekai={});for(var o=window.isekai,i=0;i<n.length-1;i++){var r=n[i];r in o||(o[r]={}),o=o[r]}o[n[i]]=e}function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},e(t)}function n(t,n){for(var o=0;o<n.length;o++){var i=n[o];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,(void 0,r=function(t,n){if("object"!==e(t)||null===t)return t;var o=t[Symbol.toPrimitive];if(void 0!==o){var i=o.call(t,"string");if("object"!==e(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(i.key),"symbol"===e(r)?r:String(r)),i)}var r}function o(){o=function(t,e){return new r(t,void 0,e)};var t=RegExp.prototype,n=new WeakMap;function r(t,e,o){var a=new RegExp(t,e);return n.set(a,o||n.get(t)),i(a,r.prototype)}function a(t,e){var o=n.get(e);return Object.keys(o).reduce((function(e,n){var i=o[n];if("number"==typeof i)e[n]=t[i];else{for(var r=0;void 0===t[i[r]]&&r+1<i.length;)r++;e[n]=t[i[r]]}return e}),Object.create(null))}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&i(t,e)}(r,RegExp),r.prototype.exec=function(e){var n=t.exec.call(this,e);if(n){n.groups=a(n,this);var o=n.indices;o&&(o.groups=a(o,this))}return n},r.prototype[Symbol.replace]=function(o,i){if("string"==typeof i){var r=n.get(this);return t[Symbol.replace].call(this,o,i.replace(/\$<([^>]+)>/g,(function(t,e){var n=r[e];return"$"+(Array.isArray(n)?n.join("$"):n)})))}if("function"==typeof i){var l=this;return t[Symbol.replace].call(this,o,(function(){var t=arguments;return"object"!=e(t[t.length-1])&&(t=[].slice.call(t)).push(a(t,l)),i.apply(this,t)}))}return t[Symbol.replace].call(this,o,i)},o.apply(this,arguments)}function i(t,e){return i=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},i(t,e)}var r,a=!(!(r=navigator.userAgent.match(o(/Version\/(\S+) Mobile\/\S+/,{version:1})))||!r.groups.version),l=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.menuItems=[],this.menuItemsUpdated=!0,this.initDom()}var e,o;return e=t,o=[{key:"initDom",value:function(){var t=this,e=document.createElement("div");e.id="iseai-contextmenu",e.className="oo-ui-toolGroup-tools oo-ui-popupToolGroup-tools oo-ui-listToolGroup-tools oo-ui-toolGroup-enabled-tools oo-ui-popupToolGroup-active-tools",e.style.minWidth="unset",e.style.display="none",this.menuContainer=e;var n=document.createElement("div");n.className="isekai-contextmenu-cover",n.style.display="none",n.addEventListener("click",(function(){t.hide()})),this.menuCover=n,document.body.appendChild(e),document.body.appendChild(n)}},{key:"setMenuItem",value:function(t){this.menuItems=t,this.menuItemsUpdated=!0}},{key:"updateMenuItemDom",value:function(){var t=this;this.menuItemsUpdated&&(this.menuContainer.innerHTML="",this.menuItems.sort((function(t,e){var n,o;return(null!==(n=e.priority)&&void 0!==n?n:0)-(null!==(o=t.priority)&&void 0!==o?o:0)})).forEach((function(e){var n=document.createElement("span");n.className="oo-ui-widget oo-ui-widget-enabled oo-ui-tool";var o=document.createElement("a");o.className="oo-ui-tool-link",o.tabIndex=0,o.role="button",o.addEventListener("click",(function(n){var o;n.preventDefault(),null===(o=e.onClick)||void 0===o||o.call(e),t.hide()}));var i=document.createElement("span");i.className="oo-ui-tool-title",i.innerText=e.label,o.appendChild(i),n.appendChild(o),t.menuContainer.appendChild(n)})),this.menuItemsUpdated=!1)}},{key:"show",value:function(){for(var t=0,e=0,n=arguments.length,o=new Array(n),i=0;i<n;i++)o[i]=arguments[i];if(o[0]instanceof