🏠 Home 

Greasy Fork is available in English.

style-shims

Shims for GM_addStyle and GM.addStyle.

此脚本不应直接安装,它是一个供其他脚本使用的外部库。如果您需要使用该库,请在脚本元属性加入:// @require https://update.greasyfork.org/scripts/483122/1304475/style-shims.js

// ==UserScript==
// @name               style-shims
// @description        Shims for GM_addStyle and GM.addStyle.
// @author             Jason Kwok
// @namespace          https://jasonhk.dev/
// @version            1.0.3
// @license            MIT
// ==/UserScript==
let GM_addStyle = function GM_addStyle(css)
{
const style = document.createElement("style");
style.setAttribute("type", "text/css");
style.textContent = css;
const target = document.head ?? document.documentElement;
return target.appendChild(style);
}
GM.addStyle = GM_addStyle;