From 68c5c8619f2abbbb1c2524e706bbe2e5dc47a2de Mon Sep 17 00:00:00 2001 From: xiu2 <54703944+XIU2@users.noreply.github.com> Date: Sat, 8 May 2021 13:29:48 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=20=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E7=BB=86=E8=8A=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 52pojie-Enhanced.user.js | 28 ++--------- GithubEnhanced-High-Speed-Download.user.js | 57 ++++++++++------------ 2 files changed, 31 insertions(+), 54 deletions(-) diff --git a/52pojie-Enhanced.user.js b/52pojie-Enhanced.user.js index aaffa09..d12b4c4 100644 --- a/52pojie-Enhanced.user.js +++ b/52pojie-Enhanced.user.js @@ -131,30 +131,24 @@ // URL 匹配正则表达式 let patt_thread = /\/thread-\d+-\d+\-\d+.html/, - patt_thread_2 = /mod\=viewthread/, patt_forum = /\/forum-\d+-\d+\.html/, - patt_forum_2 = /mod\=forumdisplay/, - patt_guide = /mod\=guide\&view\=(hot|digest|new|newthread|my|tech|help)/, - patt_guide_newthread = /mod\=guide\&view\=newthread/, - patt_collection = /mod\=collection/ + patt_guide = /mod\=guide\&view\=(hot|digest|new|newthread|my|tech|help)/ // URL 判断 - if (patt_thread.test(location.pathname) || patt_thread_2.test(location.search)) { + if (patt_thread.test(location.pathname) || location.search.indexOf('mod=viewthread') > -1) { if (menu_value('menu_thread_pageLoading')) { curSite = DBSite.thread; // 帖子内 hidePgbtn(); // 隐藏帖子内的 [下一页] 按钮 } - } else if (patt_forum.test(location.pathname) || patt_forum_2.test(location.search)) { + } else if (patt_forum.test(location.pathname) || location.search.indexOf('mod=forumdisplay') > -1) { curSite = DBSite.forum; // 各板块帖子列表 } else if (patt_guide.test(location.search)) { curSite = DBSite.guide; // 导读帖子列表 delateReward(); // 屏蔽导读悬赏贴(最新发表) - } else if (patt_collection.test(location.search)) { + } else if (location.search.indexOf('mod=collection') > -1) { curSite = DBSite.collection; // 淘贴列表 } else if (location.pathname === '/search.php') { curSite = DBSite.search; // 搜索结果列表 - /*}else if(location.href === "https://www.52pojie.cn/home.php?mod=task&do=draw&id=2"){ - window.opener=null;window.open('','_self');window.close(); // 签到完成页面,关闭该标签页*/ } curSite.pageUrl = ""; // 下一页URL @@ -186,18 +180,6 @@ } - // 自动签到 - /*function qianDao() { - if (!menu_value('menu_autoClockIn')) return - let qiandao = document.querySelector('#um p:last-child a:first-child'); - if (qiandao && qiandao.href === "https://www.52pojie.cn/home.php?mod=task&do=apply&id=2"){ - window.GM_openInTab(qiandao.href, {active: false,insert: true,setParent: true}) // 后台打开签到地址 - qiandao.querySelector('.qq_bind').setAttribute('src','https://www.52pojie.cn/static/image/common/wbs.png') // 修改 [打卡签到] 图标为 [签到完毕] - qiandao.href = "#" // 修改 URL 为 # - } - }*/ - - // 自动签到(后台) function qianDao() { if (!menu_value('menu_autoClockIn')) return @@ -225,7 +207,7 @@ //屏蔽悬赏贴(导读-最新发表) function delateReward() { if (!menu_value('menu_delateReward')) return - if (patt_guide_newthread.test(location.search)) { + if (location.search.indexOf('mod=guide&view=newthread') > -1) { let tbody = document.querySelectorAll('#threadlist tbody[id^="normalthread"]'); Array.from(tbody).forEach(function (_this) { if (_this.querySelector('img[alt="悬赏"]')) { diff --git a/GithubEnhanced-High-Speed-Download.user.js b/GithubEnhanced-High-Speed-Download.user.js index 298e575..aeb779f 100644 --- a/GithubEnhanced-High-Speed-Download.user.js +++ b/GithubEnhanced-High-Speed-Download.user.js @@ -20,11 +20,11 @@ (function() { var backColor = '#ffffff'; var fontColor = '#888888'; - if(document.getElementsByTagName('html')[0].getAttribute('data-color-mode') == 'dark'){ // 黑暗模式判断 - if(document.getElementsByTagName('html')[0].getAttribute('data-dark-theme') == 'dark_dimmed'){ + if (document.getElementsByTagName('html')[0].getAttribute('data-color-mode') == 'dark') { // 黑暗模式判断 + if (document.getElementsByTagName('html')[0].getAttribute('data-dark-theme') == 'dark_dimmed') { backColor = '#272e37'; fontColor = '#768390'; - }else{ + } else { backColor = '#161a21'; fontColor = '#b2b8bf'; } @@ -62,12 +62,12 @@ registerMenuCommand(); // 注册脚本菜单 function registerMenuCommand() { - if (menu_feedBack_ID){ // 如果反馈菜单ID不是 null,则删除所有脚本菜单 + if (menu_feedBack_ID) { // 如果反馈菜单ID不是 null,则删除所有脚本菜单 GM_unregisterMenuCommand(menu_menu_raw_fast_ID); GM_unregisterMenuCommand(menu_feedBack_ID); menu_raw_fast = GM_getValue('xiu2_menu_raw_fast'); } - if(menu_raw_fast > raw_url.length - 1){ // 避免在减少 raw 数组后,用户储存的数据大于数组而报错 + if (menu_raw_fast > raw_url.length - 1) { // 避免在减少 raw 数组后,用户储存的数据大于数组而报错 menu_raw_fast = 0 } menu_menu_raw_fast_ID = GM_registerMenuCommand(`🔄 [ ${raw_url[menu_raw_fast][1]} ] 加速源 (☁) - 点击切换`, menu_toggle_raw_fast); @@ -76,9 +76,9 @@ // 切换加速源 function menu_toggle_raw_fast() { - if (menu_raw_fast >= raw_url.length - 1){ // 如果当前加速源位置大于等于加速源总数,则改为第一个加速源,反之递增下一个加速源 + if (menu_raw_fast >= raw_url.length - 1) { // 如果当前加速源位置大于等于加速源总数,则改为第一个加速源,反之递增下一个加速源 menu_raw_fast = 0; - }else{ + } else { menu_raw_fast += 1; } GM_setValue('xiu2_menu_raw_fast', menu_raw_fast); @@ -113,7 +113,7 @@ // Release - function addRelease(){ + function addRelease() { let html = document.getElementsByClassName('Box Box--condensed');if (!html) return Array.from(html).forEach(function (current) { current.querySelectorAll('.d-flex.Box-body > a').forEach(function (_this) { @@ -127,8 +127,7 @@ download_url[5][0] + '/' + _this.href ], _html = `