Syntax

Library for simplifying code logic and syntax

Verze ze dne 30. 09. 2025. Zobrazit nejnovější verzi.

Tento skript by neměl být instalován přímo. Jedná se o knihovnu, kterou by měly jiné skripty využívat pomocí meta příkazu // @require https://update.greasyfork.org/scripts/495339/1669598/Syntax.js

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name         Syntax
// @version      2025.10.01
// @author       Canaan HS
// @description  Library for simplifying code logic and syntax
// @namespace    https://greasyfork.org/users/989635
// @match        *://*/*
// @license      MPL-2.0
// ==/UserScript==
const Lib=(()=>{function x(a=document,b,c){if(1!==a?.nodeType&&9!==a?.nodeType)return c?[]:void 0;const d=b[0],e=b.slice(1);if(/[ .#:[\]>+~*,()^$=]/.test(e))return c?a.querySelectorAll(b):a.querySelector(b);if(!c&&"#"===d)return 9===a.nodeType?a.getElementById(e):a.querySelector(b);if("."===b[0])return a=a.getElementsByClassName(e),c?[...a]:a[0];a=a.getElementsByTagName(b);return c?[...a]:a[0]}function R(...a){if(0!==a.length){var b={},c=a,d={dev:!0,group:null,collapsed:!0};if(1<a.length){const f=
a[0],m=a.at(-1),n=f?.constructor===Object,t=m?.constructor===Object;if(t&&!n)b=m,c=a.slice(0,-1);else if(n&&!t)b=f,c=a.slice(1);else if(n&&t){const r=new Set(Object.keys(d));b=Object.keys(f).filter(v=>r.has(v)).length;Object.keys(m).filter(v=>r.has(v)).length>b?(b=m,c=a.slice(0,-1)):(b=f,c=a.slice(1))}}var {dev:e,group:g,collapsed:k}={...d,...b};if(!e||0===c.length)return new Proxy({},{get(){}});var l=f=>{"count"===f?I.count(c[0]):(f=I[f]||I.log,g?(k?console.groupCollapsed(g):console.group(g),f(...c),
console.groupEnd()):f(...c))},h=setTimeout(()=>l("log",c));return new Proxy({},{get(f,m){clearTimeout(h);l(m,c)}})}}async function S(a,b,c=crypto.randomUUID(),d=!0){if(d||!J.has(c)){var e=document.getElementById(c);e||(e=document.createElement(a),e.id=c,(a=F.head)?a.appendChild(e):T("head").then(g=>{g.appendChild(e)}));e.textContent+=b;J.add(c)}}async function T(a,b=null,c={}){const d=Array.isArray(a)?U.queryMap:U.queryElement,{raf:e=!1,all:g=!1,timeout:k=8,throttle:l=0,debounce:h=50,visibility:f=
!0,subtree:m=!0,childList:n=!0,attributes:t=!0,characterData:r=!1,timeoutResult:v=!1,root:z=document}=c||{};return new Promise((p,q)=>{const u=async function(){let y,w;if(e){let A;const G=()=>{(w=d(a,g))?(cancelAnimationFrame(A),clearTimeout(y),b?.(w),p(w)):A=requestAnimationFrame(G)};A=requestAnimationFrame(G);y=setTimeout(()=>{cancelAnimationFrame(A);v&&(b?.(w),p(w))},1E3*k)}else{const [A,G]=0<l?[K,l]:[L,h],M=new MutationObserver(A(()=>{if(w=d(a,g))M.disconnect(),clearTimeout(y),b?.(w),p(w)},G));
M.observe(z,{subtree:m,childList:n,attributes:t,characterData:r});y=setTimeout(()=>{M.disconnect();v&&(b?.(w),p(w))},1E3*k)}};f&&"hidden"===document.visibilityState?document.addEventListener("visibilitychange",()=>u(),{once:!0}):u()})}function aa(a){if(!a||!a.trim())return 0;if(/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$/.test(a)){var b=(new Date(a)).getTime();if(!isNaN(b))return Math.floor(b/1E3)}b=new Date;var c=[...a.matchAll(/(\d+)\s*([YyMDdhms])/g)];if(0===c.length)return 0;var d=a=0,e=0,g=0,k=0,
l=0;for(const h of c){c=parseInt(h[1],10);const f=h[2];switch(f.toLowerCase()){case "y":a+=c;break;case "d":e+=c;break;case "h":g+=c;break;case "s":l+=c;break;default:"M"===f?d+=c:"m"===f&&(k+=c)}}b.setFullYear(b.getFullYear()+a);b.setMonth(b.getMonth()+d);b.setDate(b.getDate()+e);b.setHours(b.getHours()+g);b.setMinutes(b.getMinutes()+k);b.setSeconds(b.getSeconds()+l);return Math.floor(b.getTime()/1E3)}function N(a,b,c,{space:d=0,expireStr:e}={}){const g=B(c);c={type:g,value:ba[g]?.(c)??c};(e=aa(e))&&
(c.expire=e);a(b,JSON.stringify(c,null,d))}function O(a,b,c,{autoRemove:d=!1,removeer:e}={}){a=a(b);if(null==a)return c;try{a=JSON.parse(a);const g=a instanceof Object;if(g&&a.expire&&Date.now()>1E3*a.expire)return e(b),c;let k,l;g?(k=a.type??"Object",l=a.value??a):(k=B(a),l=a);const h=ca[k]?.(l)??l;d&&e(b);return h}catch{return"object"===typeof a&&F.isEmpty(a)||"string"===typeof a&&a.startsWith("[object")?c:a}}function K(a,b){let c=0;return(...d)=>{const e=Date.now();e-c>=b&&(c=e,a(...d))}}function L(a,
b){let c=null;return(...d)=>{clearTimeout(c);c=setTimeout(function(){a(...d)},b)}}function V(a){a=new Blob([a],{type:"application/javascript"});const b=URL.createObjectURL(a),c=new Worker(b),d=c.terminate;c.terminate=function(){d.call(c);URL.revokeObjectURL(b)};return c}const da=new DOMParser,B=a=>Object.prototype.toString.call(a).slice(8,-1);[Document.prototype,Element.prototype].forEach(a=>{a.$q=function(b){return x(this,b,!1)};a.$qa=function(b){return x(this,b,!0)}});const P={$text(a=null){return null===
a?this?.textContent?.trim():this.textContent=a?.trim()??""},$copy(a=!0){return this.cloneNode(a)},$iHtml(a=null){return null===a?this.innerHTML:this.innerHTML=a},$oHtml(a=null){return null===a?this.outerHTML:this.outerHTML=a},$iAdjacent(a,b="beforeend"){null!=a&&(1===a.nodeType?this.insertAdjacentElement(b,a):this.insertAdjacentHTML(b,a))},$sAttr(a,b){this.setAttribute(a,b)},$dAttr(a){this.removeAttribute(a)},$gAttr(a){return this.getAttribute(a)},$hAttr(a){return this.hasAttribute(a)},$addClass(...a){this.classList.add(...a)},
$delClass(...a){this.classList.remove(...a)},$toggleClass(a,b){this.classList.toggle(a,b)},$replaceClass(a,b){this.classList.replace(a,b)},$hasClass(a){return this.classList.contains(a)}};Object.assign(Node.prototype,P);const W=Object.keys(P)[0];Object.defineProperty(Object.prototype,W,{value:function(a=null){return P[W].call(this,a)},writable:!0,configurable:!0});const F={$q:document.$q.bind(document),$Q:(a,b)=>x(a,b,!1),$qa:document.$qa.bind(document),$Qa:(a,b)=>x(a,b,!0),html:document.documentElement,
get head(){const a=document.head;a&&Object.defineProperty(this,"head",{value:a,writable:!1});return a},get body(){const a=document.body;a&&Object.defineProperty(this,"body",{value:a,writable:!1});return a},img:document.images,link:document.links,script:document.scripts,style:document.styleSheets,$url:location.href,get url(){return location.href},$origin:location.origin,get origin(){return location.origin},$domain:location.hostname,get domain(){return location.hostname},$lang:navigator.language,get lang(){return navigator.language},
$agen:navigator.userAgent,get agen(){return navigator.userAgent},isEmpty(a){for(const b in a)return!1;return!0},createDomFragment:a=>document.createRange().createContextualFragment(a),get createFragment(){return document.createDocumentFragment()},title:(a=null)=>null===a?document.title:document.title=a,cookie:(a=null)=>null===a?document.cookie:document.cookie=a,createUrl:a=>URL.createObjectURL(a),_on:(a,b)=>{const c={};for(const d of Object.keys(b)){let e=b[d];e&&("function"===typeof e&&(e={listen:e}),
e.listen&&(a.addEventListener(d,e.listen,e.add),c[d]=()=>a.removeEventListener(d,e.listen,e.add)))}return c},createElement(a,b,c,d){const [e,g,k={},l="beforeend"]="string"===typeof a?[void 0,a,b,c]:[a,b,c,d];if(g){var {class:h,text:f="",rows:m,cols:n,on:t={},style:r={},attr:v={},...z}=k;a=document.createElement(g);a.textContent=f;h&&(a.className=h);void 0!==m&&(a.rowSpan=m);void 0!==n&&(a.colSpan=n);Object.assign(a,z);"string"===typeof r?a.style.cssText=r:Object.assign(a.style,r);for(const q in v)a.setAttribute(q,
v[q]);var p="object"!==typeof t||this.isEmpty(t)?{}:this._on(a,t);Object.assign(a,{on(q,u,y){this.addEventListener(q,u,y);Object.assign(p,{[q]:()=>this.removeEventListener(q,u,y)})},off(q){p[q]?.();delete p[q]},offAll(){Object.keys(p).forEach(q=>{p[q]();delete p[q]})}});return 1===e?.nodeType?e.insertAdjacentElement(l,a):a}}},D=new Map,I={log:(...a)=>console.log(...a),warn:(...a)=>console.warn(...a),table:(...a)=>console.table(...a),trace:(...a)=>console.trace(...a),debug:(...a)=>console.debug(...a),
error:(...a)=>console.error(...a),count:a=>console.count(a)},J=new Set,H=new Map,U={queryMap:(a,b)=>{a=a.map(c=>x(document,c,b));return b?a.every(c=>0<c.length)&&a:a.every(Boolean)&&a},queryElement:(a,b)=>{a=x(document,a,b);return(b?0<a.length:a)&&a}},ca={Set:a=>new Set(a),Map:a=>new Map(a),Date:a=>new Date(a)},ba={Set:a=>a instanceof Set?[...a]:a,Map:a=>a instanceof Map?[...a]:a,Date:a=>a instanceof Date?a.toISOString():a},X=localStorage.removeItem.bind(localStorage),ea=localStorage.setItem.bind(localStorage),
fa=localStorage.getItem.bind(localStorage),Y=sessionStorage.removeItem.bind(sessionStorage),ha=sessionStorage.setItem.bind(sessionStorage),ia=sessionStorage.getItem.bind(sessionStorage),Z={Process:(a,b,c=null)=>{a=a[b.toLowerCase()];return"Function"===B(a)?a(c):a?a:"None"}},Q={ko:"Korea","ko-KR":"Korea",ja:"Japan","ja-JP":"Japan",ru:"Russia","ru-RU":"Russia",en:"English","en-US":"English","en-GB":"English","en-AU":"English","en-CA":"English","en-NZ":"English","en-IE":"English","en-ZA":"English","en-IN":"English",
zh:"Simplified","zh-CN":"Simplified","zh-SG":"Simplified","zh-MY":"Simplified","zh-TW":"Traditional","zh-HK":"Traditional","zh-MO":"Traditional"},C=new Set,E=new Map;return function(...a){const b={};for(const c of a)c&&Object.defineProperties(b,Object.getOwnPropertyDescriptors(c));return b}({get sX(){return window.scrollX},get sY(){return window.scrollY},get iW(){return window.innerWidth},get iH(){return window.innerHeight},get platform(){let a;a=void 0!==navigator.userAgentData?.mobile?navigator.userAgentData.mobile?
"Mobile":"Desktop":window.matchMedia?.("(max-width: 767px), (pointer: coarse)")?.matches?"Mobile":/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)?"Mobile":"Desktop";Object.defineProperty(this,"platform",{value:a,writable:!1});return a}},F,{addStyle:(a,b,c)=>S("style",a,b,c),addScript:(a,b,c)=>S("script",a,b,c),delLocal:a=>X(a),setLocal:(a,b,c)=>N(ea,a,b,{expireStr:c}),getLocal:(a,b,c)=>O(fa,a,b,{autoRemove:c,removeer:X}),delSession:a=>Y(a),setSession:(a,
b,c)=>N(ha,a,b,{expireStr:c}),getSession:(a,b,c)=>O(ia,a,b,{autoRemove:c,removeer:Y}),delV:a=>GM_deleteValue(a),allV:()=>{var a=GM_listValues();return null==a?null:a},setV:(a,b)=>GM_setValue(a,b),getV:(a,b)=>{a=GM_getValue(a,b);return null==a?null:a},setJV:(a,b,c=0,d)=>N(GM_setValue,a,b,{space:c,expireStr:d}),getJV:(a,b,c)=>O(GM_getValue,a,b,{autoRemove:c,removeer:GM_deleteValue}),eventRecord:D,addRecord:J,observerRecord:H,$type:B,onE:async function(a,b,c,d={},e=null){try{"string"===typeof a&&(a=
x(document,a));let g=b.split(/\s*[,|/]\s*/).filter(Boolean);if(0===g.length)throw Error("No event types provided");if(1===g.length)a.addEventListener(b,c,d);else{let k=null;const l=h=>{clearTimeout(k);k=setTimeout(()=>c(h),15)};g.forEach(h=>a.addEventListener(h,l,d))}e?.(!0)}catch{e?.(!1)}},onEvent:async function(a,b,c,d={}){const {mark:e,...g}=d;"string"===typeof a&&(a=x(document,a));d=e??a;const k=D.get(d);k?.has(b)||(a.addEventListener(b,c,g),k||D.set(d,new Map),D.get(d).set(b,c))},offEvent:async function(a,
b,c){"string"===typeof a&&(a=x(document,a));c=c??a;const d=D.get(c)?.get(b);d&&(a.removeEventListener(b,d),D.get(c).delete(b))},onUrlChange:function(a,b=15){function c(m){clearTimeout(e);k||"urlchange"!==m||(k=!0);e=setTimeout(()=>{k&&d(!1,!0);a({type:m,url:location.href,domain:location.hostname})},Math.max(15,b))}function d(m=!0,n=!1){n&&g||(clearTimeout(e),history.pushState=l,history.replaceState=h,m&&window.removeEventListener("urlchange",f.urlchange),window.removeEventListener("popstate",f.popstate),
window.removeEventListener("hashchange",f.hashchange),g=!0)}let e=null,g=!1,k=!1;const l=history.pushState,h=history.replaceState,f={urlchange:()=>c("urlchange"),popstate:()=>c("popstate"),hashchange:()=>c("hashchange")};window.addEventListener("urlchange",f.urlchange);window.addEventListener("popstate",f.popstate);window.addEventListener("hashchange",f.hashchange);history.pushState=function(){l.apply(this,arguments);c("pushState")};history.replaceState=function(){h.apply(this,arguments);c("replacestate")};
return{off:d}},log:R,createLog:function(a={}){return(...b)=>R(...b,a)},$observer:async function(a,b,c={},d=null){const {mark:e="",debounce:g=0,throttle:k=100,subtree:l=!0,childList:h=!0,attributes:f=!0,characterData:m=!1}=c||{};if(e&&(c=H.get(e))){if(c.target===a)return;c.ob.disconnect();H.delete(e)}const [n,t]=0<g?[L,g]:[K,k];c={subtree:l,childList:h,attributes:f,characterData:m};const r=new MutationObserver(n(()=>{b()},t));r.observe(a,c);e&&H.set(e,{target:a,ob:r});d?.({ob:r,op:c})},waitEl:T,$throttle:K,
$debounce:L,scopeParse:function(a,b){if("string"!==typeof a||""===a.trim())return b;const c=b.length;let d=!1;const e=new Set,g=new Set,k=(h,f,m)=>{const n=h<=f;for(;n?h<=f:h>=f;n?h++:h--)m.add(h)};let l;for(l of a.split(/\s*[\.,|/]\s*/))if(/^(!|-)?\d+(~\d+|-\d+)?$/.test(l)){a=l.slice(1);const h=/^[!-]/.test(l),f=/[~-]/.test(a),[m,n]=h?[g,a]:(d=!0,[e,l]),[t,r]=f?n.split(/-|~/):[n,n];t===r?m.add(+t-1):k(+t-1,+r-1,m)}return(d?[...e]:[...b.keys()]).filter(h=>!g.has(h)&&h<c&&0<=h).sort((h,f)=>h-f).map(h=>
b[h])},createWorker:V,formatTemplate:function(a,b){if("Object"!==B(a))return"Template must be an object";a=Object.fromEntries(Object.entries(a).map(([c,d])=>[c.toLowerCase(),d]));return"String"===B(b)?b.replace(/\{\s*([^}\s]+)\s*\}/g,(c,d)=>Z.Process(a,d)):"Object"===B(b)?Object.entries(b).map(([c,d])=>Z.Process(a,c,d)):{"Unsupported format":b}},createCompressor:function(){let a=V('importScripts("https://cdn.jsdelivr.net/npm/[email protected]/umd/index.min.js");onmessage = function(e) {const { filesWithOptions } = e.data;const fileNames = Object.keys(filesWithOptions);let totalSize = 0;let processedSize = 0;fileNames.forEach(name => {totalSize += filesWithOptions[name].data.length;});const chunks = [];const zip = new fflate.Zip((err, data, final) => {if (err) {postMessage({ type: "error", error: err.message });return;}chunks.push(data);if (final) {let size = 0;let offset = 0;chunks.forEach(c => size += c.length);const zipped = new Uint8Array(size);chunks.forEach(c => {zipped.set(c, offset);offset += c.length;});postMessage({ type: "done", data: zipped }, [zipped.buffer]);}});(async () => {for (const name of fileNames) {const { data, level } = filesWithOptions[name];const fileStream = new fflate.ZipPassThrough(name, { level });zip.add(fileStream);fileStream.push(data, true);processedSize += data.length;postMessage({ type: "progress", loaded: processedSize, total: totalSize });} zip.end();})().catch(err => {postMessage({ type: "error", error: err.message });});}');
const b=new Set("mp4 mov avi mkv flv wmv webm mpg mpeg m4v ogv 3gp asf ts vob rm rmvb m2ts f4v mts zip rar 7z gz bz2 .pg jpeg png gif webp bmp tiff tif svg .eic heif raw ico psd mp3 aac flac wav ogg pdf".split(" "));let c={},d=[];return{async destroyWorker(){a&&(a.terminate(),a=null)},async file(e,g){const k=new Promise(async l=>{const h=await g.arrayBuffer();c[e]=new Uint8Array(h);l()});d.push(k);return k},async generateZip(e={},g){await Promise.all(d);return new Promise((k,l)=>{if(F.isEmpty(c))return l("Empty Data Error");
const h={};Object.entries(c).forEach(([f,m])=>{var n=f.split(".").pop().toLowerCase();n=b.has(n)?0:e.level||5;h[f]={data:m,level:n}});a.postMessage({filesWithOptions:h},Object.values(h).map(f=>f.data.buffer));a.onmessage=f=>{f=f.data;"progress"===f.type?g?.(f.loaded/f.total*100):"done"===f.type?(g?.(100),c={},d=[],k(new Blob([f.data],{type:"application/zip"}))):"error"===f.type&&(c={},d=[],l(f.error))}})}}},createNnetworkObserver:function(a={}){function b(){var p=Date.now();if(p-v<f)return z;v=p;
if(navigator.connection){const {effectiveType:q,saveData:u}=navigator.connection;z="4g"!==q||u?"3g"===q||"4g"===q&&u?"normal":"poor":"good"}else 5<=r.length&&(p=r.reduce((q,u)=>q+u,0)/r.length,z=p<g?"good":p>k?"poor":"normal");return z}let {MAX_Delay:c=2E3,MIN_CONCURRENCY:d=1,MAX_CONCURRENCY:e=16,Good_Network_THRESHOLD:g=500,Poor_Network_THRESHOLD:k=1500,adaptiveFactors:l={good:{delayFactor:.8,threadFactor:1.2},normal:{delayFactor:1,threadFactor:1},poor:{delayFactor:1.5,threadFactor:.7}},TIME_THRESHOLD:h=
1E3,Network_Check_Interval:f=1E4,EMA_ALPHA:m=.3,ADJUSTMENT_FACTOR:n=.25,History_Size:t=10}=a||{},{responseHistory:r=[],lastNetworkCheck:v=0,networkCondition:z="normal"}={};return function(p,q,u=null,y=0){p=Date.now()-p;r.push(p);r.length>t&&r.shift();h=!h||1>=r.length?p:m*p+(1-m)*h;h=Math.max(20,Math.min(2E3,h));const {delayFactor:w,threadFactor:A}=l[b()];p/=h;q=Math.max(y,Math.min(q*(1+(p-1)*n*w),c));return null!==u?[Math.round(q),Math.round(Math.max(d,Math.min(u*(1-(p-1)*n*A),e)))]:Math.round(q)}},
outputTXT:async function(a,b,c=null){try{b="string"===typeof b?b.endsWith(".txt")?b:`${b}.txt`:`Untitled-${crypto.randomUUID().slice(9,23)}.txt`;const d=new Blob([a],{type:"text/plain"}),e=document.createElement("a");e.href=URL.createObjectURL(d);e.download=b;e.click();URL.revokeObjectURL(e.href);e.remove();c?.({State:!0})}catch(d){c?.({State:!1,Info:d})}},outputJson:async function(a,b,c=null){try{a="string"===typeof a?a:JSON.stringify(a,null,4);b="string"===typeof b?b.endsWith(".json")?b:`${b}.json`:
`Untitled-${crypto.randomUUID().slice(9,23)}.json`;const d=new Blob([a],{type:"application/json"}),e=document.createElement("a");e.href=URL.createObjectURL(d);e.download=b;e.click();URL.revokeObjectURL(e.href);e.remove();c?.({State:!0})}catch(d){c?.({State:!1,Info:d})}},runTime:function(a=null,{lable:b="Elapsed Time:",log:c=!0,format:d=!0,style:e="\u001b[1m\u001b[36m%s\u001b[0m"}={}){if(!a)return performance.now();a=d?`${((performance.now()-a)/1E3).toPrecision(3)}s`:performance.now()-a;return c?console.log(e,
`${b} ${a}`):a},getDate:function(a=null){const b=new Date,c={year:b.getFullYear(),month:`${b.getMonth()+1}`.padStart(2,"0"),date:`${b.getDate()}`.padStart(2,"0"),hour:`${b.getHours()}`.padStart(2,"0"),minute:`${b.getMinutes()}`.padStart(2,"0"),second:`${b.getSeconds()}`.padStart(2,"0")};return(d=>d.replace(/{([^}]+)}/g,(e,g)=>c[g]??"Error"))("string"===typeof a?a:"{year}-{month}-{date} {hour}:{minute}:{second}")},translMatcher:function(a,b=navigator.language,c="en-US"){return a[Q[b]]??a[Q[c]]??a[Q["en-US"]]},
regMenu:function(a,b={}){let {name:c="regMenu",index:d=1,reset:e=!1}=b||{};e&&([...C].map(g=>GM_unregisterMenuCommand(g)),C.clear());for(let [g,k]of Object.entries(a))a=`${c}-${d++}`,"function"===typeof k&&(k={func:k}),GM_registerMenuCommand(g,()=>{k.func()},{id:a,title:k.desc,autoClose:k.close,accessKey:k.hotkey}),C.add(a)},unMenu:async function(a){null==a?([...C].map(b=>GM_unregisterMenuCommand(b)),C.clear()):Array.isArray(a)?a.forEach(b=>{C.delete(b)&&GM_unregisterMenuCommand(b)}):C.delete(a)&&
GM_unregisterMenuCommand(a)},storageListen:function(a,b){a.forEach(c=>{if(!E.has(c)){const d=GM_addValueChangeListener(c,function(e,g,k,l){b({key:e,ov:g,nv:k,far:l})});E.set(c,d)}});return{off(c){const d=E.get(c);d&&(GM_removeValueChangeListener(d),E.delete(c))},offAll(){for(const c of E.values())GM_removeValueChangeListener(c);E.clear()}}},sleep:a=>new Promise(b=>setTimeout(b,a)),domParse:a=>da.parseFromString(a,"text/html"),nameFilter:a=>a.replace(/[\/\?<>\\:\*\|":]/g,"").trim(),getFill:a=>Math.max(2,
`${a}`.length),suffixName(a,b="webp"){try{if(!a)return b;const c=new URL(a,location.href);a=/\.([^.]+)$/;return(c.pathname.match(a)?.[1]||c.search.match(a)?.[1])?.toLowerCase().trim()||b}catch{return b}},mantissa(a,b,c="0",d=null){return d?`${++a}`.padStart(b,c)+`.${this.suffixName(d)}`:`${++a}`.padStart(b,c)}})})();