אין להתקין סקריפט זה ישירות. זוהי ספריה עבור סקריפטים אחרים // @require https://update.greasyfork.org/scripts/487608/1657143/SyntaxLite_min.js
// ==UserScript==
// @name SyntaxLite
// @version 2025.09.08
// @author Canaan HS
// @description Library for simplifying code logic and syntax (Lite)
// @namespace https://greasyfork.org/users/989635
// @match *://*/*
// @license MPL-2.0
// ==/UserScript==
const Lib=(()=>{function t(a=document,b,c){if(1!==a?.nodeType&&9!==a?.nodeType)return c?[]:void 0;const e=b[0],d=b.slice(1);if(/[ .#:[\]>+~*,()^$=]/.test(d))return c?a.querySelectorAll(b):a.querySelector(b);if(!c&&"#"===e)return 9===a.nodeType?a.getElementById(d):a.querySelector(b);if("."===b[0])return a=a.getElementsByClassName(d),c?[...a]:a[0];a=a.getElementsByTagName(b);return c?[...a]:a[0]}function Q(...a){if(0!==a.length){var b={},c=a,e={dev:!0,group:null,collapsed:!0};if(1<a.length){const h=
a[0],k=a[a.length-1],m=h.constructor===Object,p=k.constructor===Object;if(p&&!m)b=k,c=a.slice(0,-1);else if(m&&!p)b=h,c=a.slice(1);else if(m&&p){const u=new Set(Object.keys(e));b=Object.keys(h).filter(r=>u.has(r)).length;Object.keys(k).filter(r=>u.has(r)).length>b?(b=k,c=a.slice(0,-1)):(b=h,c=a.slice(1))}}var {dev:d,group:f,collapsed:g}={...e,...b};if(d&&0!==c.length)return new Proxy({},{get(h,k){"count"===k?F.count(c[0]):(h=F[k]||F.log,f?(g?console.groupCollapsed(f):console.group(f),h(...c),console.groupEnd()):
h(...c))}})}}async function R(a,b,c=crypto.randomUUID(),e=!0){if(e||!G.has(c)){var d=document.getElementById(c);d||(d=document.createElement(a),d.id=c,(a=H.head)?a.appendChild(d):S("head").then(f=>{H.head=f;f.appendChild(d)}));d.textContent+=b;G.add(c)}}async function S(a,b=null,c={}){const e=Array.isArray(a)?T.queryMap:T.queryElement,{raf:d=!1,all:f=!1,timeout:g=8,throttle:h=0,debounce:k=50,visibility:m=!0,subtree:p=!0,childList:u=!0,attributes:r=!0,characterData:v=!1,timeoutResult:C=!1,root:I=document}=
c||{};return new Promise((l,w)=>{const n=async function(){let x,q;if(d){let z;const D=()=>{(q=e(a,f))?(cancelAnimationFrame(z),clearTimeout(x),b?.(q),l(q)):z=requestAnimationFrame(D)};z=requestAnimationFrame(D);x=setTimeout(()=>{cancelAnimationFrame(z);C&&(b?.(q),l(q))},1E3*g)}else{const [z,D]=0<h?[J,h]:[K,k],L=new MutationObserver(z(()=>{if(q=e(a,f))L.disconnect(),clearTimeout(x),b?.(q),l(q)},D));L.observe(I,{subtree:p,childList:u,attributes:r,characterData:v});x=setTimeout(()=>{L.disconnect();C&&
(b?.(q),l(q))},1E3*g)}};m&&"hidden"===document.visibilityState?document.addEventListener("visibilitychange",()=>n(),{once:!0}):n()})}function U(a,b,c,e){let d;return null!=c?V[M(c)](b,a,c):(d=b.getItem(a),void 0!=d?V[M(JSON.parse(d))](b,d):e)}function J(a,b){let c=0;return(...e)=>{const d=Date.now();d-c>=b&&(c=d,a(...e))}}function K(a,b){let c=null;return(...e)=>{clearTimeout(c);c=setTimeout(function(){a(...e)},b)}}const M=a=>Object.prototype.toString.call(a).slice(8,-1);[Document.prototype,Element.prototype].forEach(a=>
{a.$q=function(b){return t(this,b,!1)};a.$qa=function(b){return t(this,b,!0)}});const N={$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,N);const W=Object.keys(N)[0];Object.defineProperty(Object.prototype,W,{value:function(a=null){return N[W].call(this,a)},writable:!0,configurable:!0});const H={$q:document.$q.bind(document),
$Q:(a,b)=>t(a,b,!1),$qa:document.$qa.bind(document),$Qa:(a,b)=>t(a,b,!0),html:document.documentElement,head:document.head??t(document,"head",!1),body:document.body??t(document,"body",!1),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},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,{type:b,listener:c,add:e})=>"string"===typeof b&&"function"===typeof c?(a.addEventListener(b,c,e),{[b]:()=>a.removeEventListener(b,c,e)}):{},
createElement(a,b,c){const [e,d,f={}]="string"===typeof a?[null,a,b]:[a,b,c];if(d){var {id:g,title:h,class:k,text:m="",rows:p,cols:u,on:r={},style:v={},attr:C={},...I}=f,l=Object.assign(document.createElement(d),{textContent:m});g&&(l.id=g);h&&(l.title=h);k&&(l.className=k);void 0!==p&&(l.rowSpan=p);void 0!==u&&(l.colSpan=u);Object.assign(l,I);Object.assign(l.style,"string"===typeof v?{cssText:v}:v);Object.entries(C).forEach(([n,x])=>l.setAttribute(n,x));var w={};Array.isArray(r)?r.forEach(n=>Object.assign(w,
this._on(l,n))):"object"===typeof r&&Object.assign(w,this._on(l,r));Object.assign(l,{on(n,x,q){this.addEventListener(n,x,q);Object.assign(w,{[n]:()=>this.removeEventListener(n,x,q)})},off(n){w[n]?.();delete w[n]},offAll(){Object.keys(w).forEach(n=>{w[n]();delete w[n]})}});return 1===e?.nodeType?e.appendChild(l):l}}},A=new Map,F={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)},G=new Set,E=new Map,T={queryMap:(a,b)=>{a=a.map(c=>t(document,c,b));return b?a.every(c=>0<c.length)&&a:a.every(Boolean)&&a},queryElement:(a,b)=>{a=t(document,a,b);return(b?0<a.length:a)&&a}},V={String:(a,b,c)=>null!=c?(a.setItem(b,JSON.stringify(c)),!0):JSON.parse(b),Number:(a,b,c)=>null!=c?(a.setItem(b,JSON.stringify(c)),!0):Number(b),Array:(a,b,c)=>null!=c?(a.setItem(b,JSON.stringify(c)),!0):(b=JSON.parse(b),Array.isArray(b[0])?new Map(b):b),Object:(a,
b,c)=>null!=c?(a.setItem(b,JSON.stringify(c)),!0):JSON.parse(b),Boolean:(a,b,c)=>null!=c?(a.setItem(b,JSON.stringify(c)),!0):JSON.parse(b),Date:(a,b,c)=>null!=c?(a.setItem(b,JSON.stringify(c)),!0):new Date(b),Map:(a,b,c)=>(a.setItem(b,JSON.stringify([...c])),!0)},O={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"},y=new Set,P=a=>void 0===a||null===a?null:a,B=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},_cache:void 0,get platform(){this._cache||
(void 0!==navigator.userAgentData?.mobile?this._cache=navigator.userAgentData.mobile?"Mobile":"Desktop":window.matchMedia?.("(max-width: 767px), (pointer: coarse)")?.matches?this._cache="Mobile":/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)?this._cache="Mobile":this._cache="Desktop");return this._cache}},H,{addStyle:(a,b,c)=>R("style",a,b,c),addScript:(a,b,c)=>R("script",a,b,c),session:(a,{value:b=null,error:c}={})=>U(a,sessionStorage,b,c),local:(a,{value:b=
null,error:c}={})=>U(a,localStorage,b,c),delV:a=>GM_deleteValue(a),allV:()=>P(GM_listValues()),setV:(a,b)=>GM_setValue(a,b),getV:(a,b)=>P(GM_getValue(a,b)),setJV:(a,b,c=0)=>GM_setValue(a,JSON.stringify(b,null,c)),getJV(a,b){try{return JSON.parse(P(GM_getValue(a,b)))}catch{return b}},eventRecord:A,addRecord:G,observerRecord:E,$type:M,onE:async function(a,b,c,e={},d=null){try{"string"===typeof a&&(a=t(document,a));let f=b.split(/\s*[,|/]\s*/).filter(Boolean);if(0===f.length)throw Error("No event types provided");
if(1===f.length)a.addEventListener(b,c,e);else{let g=null;const h=k=>{clearTimeout(g);g=setTimeout(()=>c(k),15)};f.forEach(k=>a.addEventListener(k,h,e))}d?.(!0)}catch{d?.(!1)}},onEvent:async function(a,b,c,e={}){const {mark:d,...f}=e;"string"===typeof a&&(a=t(document,a));e=d??a;const g=A.get(e);g?.has(b)||(a.addEventListener(b,c,f),g||A.set(e,new Map),A.get(e).set(b,c))},offEvent:async function(a,b,c){"string"===typeof a&&(a=t(document,a));c=c??a;const e=A.get(c)?.get(b);e&&(a.removeEventListener(b,
e),A.get(c).delete(b))},onUrlChange:function(a,b=15){function c(p){clearTimeout(d);g||"urlchange"!==p||(g=!0);d=setTimeout(()=>{g&&e(!1,!0);a({type:p,url:location.href,domain:location.hostname})},Math.max(15,b))}function e(p=!0,u=!1){u&&f||(clearTimeout(d),history.pushState=h,history.replaceState=k,p&&window.removeEventListener("urlchange",m.urlchange),window.removeEventListener("popstate",m.popstate),window.removeEventListener("hashchange",m.hashchange),f=!0)}let d=null,f=!1,g=!1;const h=history.pushState,
k=history.replaceState,m={urlchange:()=>c("urlchange"),popstate:()=>c("popstate"),hashchange:()=>c("hashchange")};window.addEventListener("urlchange",m.urlchange);window.addEventListener("popstate",m.popstate);window.addEventListener("hashchange",m.hashchange);history.pushState=function(){h.apply(this,arguments);c("pushState")};history.replaceState=function(){k.apply(this,arguments);c("replacestate")};return{off:e}},log:Q,createLog:function(a={}){return(...b)=>Q(...b,a)},$observer:async function(a,
b,c={},e=null){const {mark:d="",debounce:f=0,throttle:g=100,subtree:h=!0,childList:k=!0,attributes:m=!0,characterData:p=!1}=c||{};if(d&&(c=E.get(d))){if(c.target===a)return;c.ob.disconnect();E.delete(d)}const [u,r]=0<f?[K,f]:[J,g];c={subtree:h,childList:k,attributes:m,characterData:p};const v=new MutationObserver(u(()=>{b()},r));v.observe(a,c);d&&E.set(d,{target:a,ob:v});e?.({ob:v,op:c})},waitEl:S,$throttle:J,$debounce:K,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 e=new Blob([a],{type:"application/json"}),d=document.createElement("a");d.href=URL.createObjectURL(e);d.download=b;d.click();URL.revokeObjectURL(d.href);d.remove();c?.({State:!0})}catch(e){c?.({State:!1,Info:e})}},runTime:function(a=null,{lable:b="Elapsed Time:",log:c=!0,format:e=!0,style:d="\u001b[1m\u001b[36m%s\u001b[0m"}={}){if(!a)return performance.now();a=e?`${((performance.now()-
a)/1E3).toPrecision(3)}s`:performance.now()-a;return c?console.log(d,`${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(e=>e.replace(/{([^}]+)}/g,(d,f)=>c[f]??"Error"))("string"===typeof a?a:"{year}-{month}-{date} {hour}:{minute}:{second}")},translMatcher:function(a,
b=navigator.language,c="en-US"){return a[O[b]]??a[O[c]]??a[O["en-US"]]},regMenu:function(a,b={}){let {name:c="regMenu",index:e=1,reset:d=!1}=b||{};d&&([...y].map(f=>GM_unregisterMenuCommand(f)),y.clear());for(let [f,g]of Object.entries(a))a=`${c}-${e++}`,"function"===typeof g&&(g={func:g}),GM_registerMenuCommand(f,()=>{g.func()},{id:a,title:g.desc,autoClose:g.close,accessKey:g.hotkey}),y.add(a)},unMenu:async function(a){null==a?([...y].map(b=>GM_unregisterMenuCommand(b)),y.clear()):Array.isArray(a)?
a.forEach(b=>{y.delete(b)&&GM_unregisterMenuCommand(b)}):y.delete(a)&&GM_unregisterMenuCommand(a)},storeListen:function(a,b){a.forEach(c=>{if(!B.has(c)){const e=GM_addValueChangeListener(c,function(d,f,g,h){b({key:d,ov:f,nv:g,far:h})});B.set(c,e)}});return{off(c){const e=B.get(c);e&&(GM_removeValueChangeListener(e),B.delete(c))},offAll(){for(const c of B.values())GM_removeValueChangeListener(c);B.clear()}}}})})();