diff --git a/GithubEnhanced-High-Speed-Download.user.js b/GithubEnhanced-High-Speed-Download.user.js index 270b719a..fe7a75e3 100644 --- a/GithubEnhanced-High-Speed-Download.user.js +++ b/GithubEnhanced-High-Speed-Download.user.js @@ -5,6 +5,7 @@ * @name Github 增强 - 高速下载(Github油猴脚本) * @name:en Github Enhancement - High Speed Download(Github Greasemonkey Script) * @version 2.5.20 + * @since 2024-04-24 14:49 * @author X.I.U * @description 高速下载 Git Clone/SSH、Release、Raw、Code(ZIP) 等文件 (公益加速)、项目列表单文件快捷下载 (☁)、添加 git clone 命令 * @description:en High-speed download of Git Clone/SSH, Release, Raw, Code(ZIP) and other files (Based on public welfare), project list file quick download (☁) @@ -150,9 +151,9 @@ document.addEventListener("DOMContentLoaded", () => { if (menu_feedBack_ID) {GM_unregisterMenuCommand(menu_rawFast_ID); GM_unregisterMenuCommand(menu_rawDownLink_ID); GM_unregisterMenuCommand(menu_gitClone_ID); GM_unregisterMenuCommand(menu_feedBack_ID); menu_rawFast = GM_getValue('xiu2_menu_raw_fast');} // 避免在减少 raw 数组后,用户储存的数据大于数组而报错 if (menu_rawFast > raw_url.length - 1) menu_rawFast = 0 - menu_rawDownLink_ID = GM_registerMenuCommand(`${GM_getValue('menu_rawDownLink')?'✅':'❌'} 项目列表单文件快捷下载 (☁)`, function(){if (GM_getValue('menu_rawDownLink') === true) {GM_setValue('menu_rawDownLink', false); GM_notification({text: `已关闭 [项目列表单文件快捷下载 (☁)] 功能\n(刷新网页后生效)`, timeout: 3500, onclick: function(){location.reload();}});} else {GM_setValue('menu_rawDownLink', true); GM_notification({text: `已开启 [项目列表单文件快捷下载 (☁)] 功能\n(刷新网页后生效)`, timeout: 3500, onclick: function(){location.reload();}});}registerMenuCommand();}, {title: "点击开关「项目列表单文件快捷下载 (☁)」功能"}); + menu_rawDownLink_ID = GM_registerMenuCommand(`${GM_getValue('menu_rawDownLink')?'✅':'❌'} 项目列表单文件快捷下载 (☁)`, function(){if (GM_getValue('menu_rawDownLink') === true) {GM_setValue('menu_rawDownLink', false); GM_notification({text: `已关闭 [项目列表单文件快捷下载 (☁)] 功能\n(点击刷新网页后生效)`, timeout: 3500, onclick: function(){location.reload();}});} else {GM_setValue('menu_rawDownLink', true); GM_notification({text: `已开启 [项目列表单文件快捷下载 (☁)] 功能\n(点击刷新网页后生效)`, timeout: 3500, onclick: function(){location.reload();}});}registerMenuCommand();}, {title: "点击开关「项目列表单文件快捷下载 (☁)」功能"}); if (GM_getValue('menu_rawDownLink')) menu_rawFast_ID = GM_registerMenuCommand(`      ${['0️⃣','1️⃣','2️⃣','3️⃣','4️⃣','5️⃣','6️⃣','7️⃣','8️⃣','9️⃣','🔟'][menu_rawFast]} [ ${raw_url[menu_rawFast][1]} ] 加速源 (☁) - 点击切换`, menu_toggle_raw_fast, {title: "点击切换「项目列表单文件快捷下载 (☁)」功能的加速源"}); - menu_gitClone_ID = GM_registerMenuCommand(`${GM_getValue('menu_gitClone')?'✅':'❌'} 添加 git clone 命令`, function(){if (GM_getValue('menu_gitClone') === true) {GM_setValue('menu_gitClone', false); GM_notification({text: `已关闭 [添加 git clone 命令] 功能`, timeout: 3500, onclick: function(){location.reload();}});} else {GM_setValue('menu_gitClone', true); GM_notification({text: `已开启 [添加 git clone 命令] 功能`, timeout: 3500, onclick: function(){location.reload();}});}registerMenuCommand();}, {title: "点击开关「添加 git clone 命令」功能"}); + menu_gitClone_ID = GM_registerMenuCommand(`${GM_getValue('menu_gitClone')?'✅':'❌'} 添加 git clone 命令`, function(){if (GM_getValue('menu_gitClone') === true) {GM_setValue('menu_gitClone', false); GM_notification({text: `已关闭 [添加 git clone 命令] 功能`, timeout: 3500});} else {GM_setValue('menu_gitClone', true); GM_notification({text: `已开启 [添加 git clone 命令] 功能`, timeout: 3500});}registerMenuCommand();}, {title: "点击开关「添加 git clone 命令」功能"}); menu_feedBack_ID = GM_registerMenuCommand('💬 反馈 & 建议 [Github]', function () {GM_openInTab('https://github.com/XIU2/UserScript', {active: true,insert: true,setParent: true});GM_openInTab('https://greasyfork.org/zh-CN/scripts/412245/feedback', {active: true,insert: true,setParent: true});}, {title: "点击前往反馈问题或提出建议"}); } diff --git a/tampermonkey.js b/tampermonkey.js index 5bdaabc2..36938363 100644 --- a/tampermonkey.js +++ b/tampermonkey.js @@ -2,7 +2,7 @@ * 篡改猴(Tampermonkey)| 油猴(Greasemonkey)浏览器脚本扩展 * * @version 0.1.2 - * @since 2024-04-24 14:43 + * @since 2024-04-24 14:49 * @author 王良 * @authorHomePage https://wangliang1024.cn * @remark 当前脚本为仿照的版本,并非篡改猴插件的源码,仅供学习参考。 @@ -216,8 +216,9 @@ switchMenuElement.title = `点击${enabled ? "关闭" : "开启"}此脚本功能`; api.GM_setValue("ds_enabled", enabled) api.GM_notification({ - text: `已${enabled ? "开启" : "关闭"} 「${options.name}」 功能\n(刷新网页后生效)`, - timeout: 3500 + text: `已${enabled ? "开启" : "关闭"} 「${options.name}」 功能\n(点击刷新网页后生效)`, + timeout: 3500, + onclick: () => location.reload() }); }; // 将开关菜单添加到菜单列表div中