GrammarSimplified

Simple syntax simplification function

Verze ze dne 19. 02. 2024. 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/487608/1330066/GrammarSimplified.js

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

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

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         GrammarSimplified
// @version      2024/02/20
// @author       HentaiSaru
// @description  Simple syntax simplification function
// @namespace    https://greasyfork.org/users/989635
// @match        *://*/*
// ==/UserScript==
class API{constructor(){this.ListenerRecord=new Map;this.Parser=new DOMParser;this.GM={__verify:a=>void 0!==a?a:null,set:function(a,c){GM_setValue(a,c)},get:function(a,c){return this.__verify(GM_getValue(a,c))},setjs:function(a,c){GM_setValue(a,JSON.stringify(c,null,4))},getjs:function(a,c){return JSON.parse(this.__verify(GM_getValue(a,c)))}};this.Template={log:a=>console.log(a),warn:a=>console.warn(a),error:a=>console.error(a),count:a=>console.count(a)}}$$(a,c=!1,b=document){const d=a.slice(1);switch([" ",".","#","="].some(e=>d.includes(e))?" ":a[0]){case "#":return b.getElementById(d);case " ":return c?b.querySelectorAll(a):b.querySelector(a);case ".":a=b.getElementsByClassName(d);break;default:a=b.getElementsByTagName(a)}return c?Array.from(a):a[0]}DomParse(a){return this.Parser.parseFromString(a,"text/html")}IllegalCharacters(a){return a.replace(/[\/\?<>\\:\*\|":]/g,"")}ExtensionName(a){try{return a.match(/\.([^.]+)$/)[1].toLowerCase()||"png"}catch{return"png"}}WorkerCreation(a){a=new Blob([a],{type:"application/javascript"});return new Worker(URL.createObjectURL(a))}async AddStyle(a,c="New-Style"){let b=document.getElementById(c);b||(b=document.createElement("style"),b.id=c,document.head.appendChild(b));b.appendChild(document.createTextNode(a))}async AddScript(a,c="New-Script"){let b=document.getElementById(c);b||(b=document.createElement("script"),b.id=c,document.head.appendChild(b));b.appendChild(document.createTextNode(a))}async AddListener(a,c,b,d={}){this.ListenerRecord.has(a)&&this.ListenerRecord.get(a).has(c)||(a.addEventListener(c,b,d),this.ListenerRecord.has(a)||this.ListenerRecord.set(a,new Map),this.ListenerRecord.get(a).set(c,b))}async RemovListener(a,c){if(this.ListenerRecord.has(a)&&this.ListenerRecord.get(a).has(c)){const b=this.ListenerRecord.get(a).get(c);a.removeEventListener(c,b);this.ListenerRecord.get(a).delete(c)}}async Listen(a,c,b,d={},e){try{a.addEventListener(c,b,d),e(!0)}catch{e(!1)}}async WaitElem(a,c,b,d){let e,f,g;const h=new MutationObserver(()=>{f=c?document.querySelectorAll(a):document.querySelector(a);if(g=c?0<f.length:f)h.disconnect(),clearTimeout(e),d(f)});h.observe(document.body,{childList:!0,subtree:!0});e=setTimeout(()=>{h.disconnect()},1E3*b)}async WaitMap(a,c,b){let d,e;const f=new MutationObserver(()=>{e=a.map(g=>document.querySelector(g));e.every(g=>g)&&(f.disconnect(),clearTimeout(d),b(e))});f.observe(document.body,{childList:!0,subtree:!0});d=setTimeout(()=>{f.disconnect()},1E3*c)}async log(a=null,c="print",b="log"){b="string"===typeof b&&this.Template[b]?b:b="log";if(null==a)this.Template[b](c);else console.groupCollapsed(a),this.Template[b](c),console.groupEnd()}store(a,c,b=null){switch(a[0]){case "g":return this.GM[a](c,b);case "s":return null!==b?this.GM[a](c,b):null;default:return Error("wrong type of operation")}}async Menu(a){for(const [c,b]of Object.entries(a))GM_registerMenuCommand(c,()=>{b()})}};