Userscript+-- : Show Site All UserJS num 显示适用的UserJS脚本数及跳转

在脚本菜单显示适用于当前网站的油猴脚本数及跳转 Show the num of all Tampermonkey scripts for the current site.

  1. // ==UserScript==
  2. // @name Userscript+-- : Show Site All UserJS num 显示适用的UserJS脚本数及跳转
  3. // @name:zh UserScript+--: 显示适用的UserJS脚本数及跳转
  4. // @name:zh-CN UserScript+--: 显示适用的UserJS脚本数及跳转
  5. // @name:zh-TW UserScript+--: 显示適用的UserJS脚本数及跳转
  6. // @namespace https://github.com/ultranity/Userscript-Plus--
  7. // @version 1.0.0
  8. // @description 在脚本菜单显示适用于当前网站的油猴脚本数及跳转 Show the num of all Tampermonkey scripts for the current site.
  9. // @description:zh 在脚本菜单显示适用于当前网站的油猴脚本数及跳转
  10. // @description:zh-CN 在脚本菜单显示适用于当前网站的油猴脚本数及跳转
  11. // @description:zh-TW 在脚本菜单顯示適用於當前網站的油猴腳本数及跳转
  12. // @author momoos
  13. // @include *
  14. // @resource siteData https://gf.qytechs.cn/scripts/by-site.json
  15. // @run-at document-idle
  16. // @noframes
  17. // @grant GM_xmlHttpRequest
  18. // @grant GM_getResourceText
  19. // @grant GM_registerMenuCommand
  20. // @grant GM_openInTab
  21. // @grant unsafeWindow
  22. // @connect gf.qytechs.cn
  23. // ==/UserScript==
  24.  
  25. /* #eslint-disable no-undef */
  26. (function() {
  27. 'use strict';
  28.  
  29. // ==============================参数配置
  30. let thisDomain = document.domain.split('.').slice(-2).join('.').toLowerCase();
  31.  
  32. // 检查域名对应的脚本数量
  33. let getDomainCount = function(domain) {
  34. let siteData = GM_getResourceText('siteData');
  35. siteData = JSON.parse(siteData);
  36. let count = 0;
  37. if (siteData.hasOwnProperty(domain)) {
  38. count = siteData[domain];
  39. }
  40. return count;
  41. };
  42.  
  43. function goGreasyfork() {
  44. let url = `https://gf.qytechs.cn/zh-CN/scripts/by-site/${thisDomain}?filter_locale=0`;
  45. GM_openInTab(url, {
  46. active: true
  47. });
  48. }
  49.  
  50. function goOpenuserJS() {
  51. let url = `https://openuserjs.org/?q=${thisDomain}`;
  52. GM_openInTab(url, {
  53. active: true
  54. });
  55. }
  56. // END
  57.  
  58. // ############### 开始
  59.  
  60. // 检查当前域名是否有对应油猴脚本
  61. let domainCount = getDomainCount(thisDomain);
  62. // if (domainCount === 0) return;
  63.  
  64. GM_registerMenuCommand('Greasyfork:'+domainCount, goGreasyfork); // 设置油猴插件的菜单
  65. GM_registerMenuCommand('OpenuserJS', goOpenuserJS) // 设置油猴插件的菜单
  66. // ########
  67. })();

QingJ © 2025

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