tampermonkey_utils

For Tampermonkey info

此脚本不应直接安装。它是供其他脚本使用的外部库,要使用该库请加入元指令 // @require https://update.gf.qytechs.cn/scripts/399614/788382/tampermonkey_utils.js

  1. /*
  2. Tampermonkey utils
  3. */
  4.  
  5. class TmUtils {
  6. static getClassName4Run() {
  7. const matches = GM_info.script.matches.map(s => s.replace(/\*$/, ''));
  8. const cfgFuncs = this.getUserScriptHeaders('classname');
  9.  
  10. let funcName;
  11. const thisUrl = window.location.href;
  12. for (let len = matches.length, i = 0; i < len; i++) {
  13. if (thisUrl.includes(matches[i])) {
  14. funcName = cfgFuncs[i];
  15. break;
  16. }
  17. }
  18. console.log(`class name: ${funcName}`);
  19. return funcName;
  20. }
  21.  
  22. static getUserScriptHeaders(name) {
  23. const reg = new RegExp(`(?<=\/\/ @${name})\\s+.*`, 'g');
  24. return (
  25. GM_info.script.header.match(reg).map(s => s.trim())
  26. );
  27. }
  28. }

QingJ © 2025

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