GM.addStyle Polyfill

Polyfill for GM.addStyle, for some reason their script doesn't work?

此腳本不應該直接安裝,它是一個供其他腳本使用的函式庫。欲使用本函式庫,請在腳本 metadata 寫上: // @require https://update.gf.qytechs.cn/scripts/35383/231590/GMaddStyle%20Polyfill.js

// ==UserScript==
// @name         GM.addStyle Polyfill
// @namespace    https://orbitalzero.ovh/scripts
// @version      0.01
// @description  Polyfill for GM.addStyle, for some reason their script doesn't work?
// @author       NeutronNoir
// 
// ==/UserScript==
GM.addStyle = function (aCss) {
  'use strict';
  let head = document.getElementsByTagName('head')[0];
  if (head) {
    let style = document.createElement('style');
    style.setAttribute('type', 'text/css');
    style.textContent = aCss;
    head.appendChild(style);
    return style;
  }
  return null;
};

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址