Basic Functions (For userscripts)

Useful functions for myself

Verzia zo dňa 30.01.2023. Pozri najnovšiu verziu.

Tento skript by nemal byť nainštalovaný priamo. Je to knižnica pre ďalšie skripty, ktorú by mali používať cez meta príkaz // @require https://update.greasyforks.org/scripts/456034/1143733/Basic%20Functions%20%28For%20userscripts%29.js

// Append a style text to document(<head>) with a <style> element
	// arguments: css | parentElement, css | parentElement, css, attributes
    function addStyle() {
    	// Get arguments
    	const [parentElement, css, attributes] = parseArgs([...arguments], [
    		[2],
    		[1,2],
    		[1,2,3]
    	], [document.head, '', {}]);

    	// Make <style>
		const style = $CrE("style");
		style.textContent = css;
		for (const [name, val] of Object.entries(attributes)) {
			style.setAttribute(name, val);
		}

		// Append to parentElement
        parentElement.appendChild(style);
    }
长期地址
遇到问题?请前往 GitHub 提 Issues。