ZG-AddScriptToDocHeader

Add user script to the document header

此脚本不应直接安装,它是一个供其他脚本使用的外部库。如果您需要使用该库,请在脚本元属性加入:// @require https://update.gf.qytechs.cn/scripts/525825/1531591/ZG-AddScriptToDocHeader.js

// ==UserLibrary==
// @name        ZG-AddScriptToDocHeader
// @namespace   https://gf.qytechs.cn/users/1340965-zecageo
// @version     1.0.0
// @description Add user script to the document header
// @author      ZecaGeo
// @license     MIT
// ==/UserLibrary==

function addScriptToDocHeader(func) {
  let script = document.createElement("script");
  script.type = "text/javascript";
  script.text = "(async () => { try { await (" + func.toString() + ")(); } catch (error) { console.error(error); }})();";
  document.head.appendChild(script);
}

window.addScriptToDocHeader = addScriptToDocHeader;

QingJ © 2025

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