ZG-AddScriptToDocHeader

Add user script to the document header

目前為 2025-02-04 提交的版本,檢視 最新版本

此腳本不應該直接安裝,它是一個供其他腳本使用的函式庫。欲使用本函式庫,請在腳本 metadata 寫上: // @require https://update.gf.qytechs.cn/scripts/525825/1531591/ZG-AddScriptToDocHeader.js

  1. // ==UserLibrary==
  2. // @name ZG-AddScriptToDocHeader
  3. // @namespace https://gf.qytechs.cn/users/1340965-zecageo
  4. // @version 1.0.0
  5. // @description Add user script to the document header
  6. // @author ZecaGeo
  7. // @license MIT
  8. // ==/UserLibrary==
  9.  
  10. function addScriptToDocHeader(func) {
  11. let script = document.createElement("script");
  12. script.type = "text/javascript";
  13. script.text = "(async () => { try { await (" + func.toString() + ")(); } catch (error) { console.error(error); }})();";
  14. document.head.appendChild(script);
  15. }
  16.  
  17. window.addScriptToDocHeader = addScriptToDocHeader;

QingJ © 2025

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