From 5a8389f5c273bef27fdb01b1e7b7ea39ac76e8dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E8=89=AF?= <841369634@qq.com> Date: Thu, 18 Apr 2024 13:19:35 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9EGM=5FgetValue=E5=92=8CGM=5Fse?= =?UTF-8?q?tValue=E7=9A=84=E5=AE=9E=E7=8E=B0=EF=BC=8C=E8=A7=A3=E9=94=81git?= =?UTF-8?q?hub=E6=B2=B9=E7=8C=B4=E8=84=9A=E6=9C=AC=E7=9A=84=E9=83=A8?= =?UTF-8?q?=E5=88=86=E5=8A=9F=E8=83=BD=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- github/monkey.js | 34 +++++++++++++++++++++++++++------- 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/github/monkey.js b/github/monkey.js index 4e2ac476..8b89ff23 100644 --- a/github/monkey.js +++ b/github/monkey.js @@ -12,12 +12,32 @@ * @sourceURL https://github.com/XIU2/UserScript/blob/master/GithubEnhanced-High-Speed-Download.user.js */ window.addEventListener("load", () => { - const GM_registerMenuCommand = () => {} - const GM_unregisterMenuCommand = () => {} - const GM_openInTab = () => {} - const GM_getValue = () => {} - const GM_setValue = () => {} - const GM_notification = () => {}; + // 配置信息 + const config = { + "xiu2_menu_raw_fast": null, + "menu_rawDownLink": null, + "menu_gitClone": null + }; + + // 获取配置 + const GM_getValue = (key) => { + return config[key] + }; + // 设置配置 + const GM_setValue = (key, newValue) => { + const oldValue = config[key]; + config[key] = newValue; + return oldValue; + }; + // 注册菜单命令,并返回menuCommandId + const GM_registerMenuCommand = (name, callback, accessKey) => {}; + // 注销菜单命令 + const GM_unregisterMenuCommand = (menuCommandId) => {}; + // 在tab中打开url + const GM_openInTab = (url, options) => {}; + // 消息通知 + const GM_notification = (options) => {}; + (function() { 'use strict'; var backColor = '#ffffff', fontColor = '#888888', menu_rawFast = GM_getValue('xiu2_menu_raw_fast'), menu_rawFast_ID, menu_rawDownLink_ID, menu_gitClone_ID, menu_feedBack_ID; @@ -463,4 +483,4 @@ window.addEventListener("load", () => { })(); console.log("ds_github_monkey_2.5.20 completed") }) -console.log("ds_github_monkey_2.5.20 loaded") +console.log("ds_github_monkey_2.5.20 loaded") \ No newline at end of file