From 3dc9461f99b73e204b435cbbe3350f3d3870e797 Mon Sep 17 00:00:00 2001 From: xiu2 <54703944+XIU2@users.noreply.github.com> Date: Sun, 8 Aug 2021 13:54:32 +0800 Subject: [PATCH 0001/1990] =?UTF-8?q?=E4=BC=98=E5=8C=96=20=E8=84=9A?= =?UTF-8?q?=E6=9C=AC=E8=8F=9C=E5=8D=95=20[X]=20=E5=9B=BE=E6=A0=87=EF=BC=88?= =?UTF-8?q?=E6=9B=B4=E5=AE=B9=E6=98=93=E5=8C=BA=E5=88=86=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 3dm-Enhanced.user.js | 2 +- 52pojie-Beautification.user.js | 2 +- 52pojie-Enhanced.user.js | 2 +- Autopage.user.js | 4 ++-- DarkMode.user.js | 6 +++--- Hostloc-Enhanced.user.js | 2 +- Lanzou-Enhanced.user.js | 4 ++-- V2ex-Enhanced.user.js | 2 +- Zhihu-Beautification.user.js | 2 +- Zhihu-Enhanced.user.js | 2 +- Zhiyoo-Enhanced.user.js | 2 +- 11 files changed, 15 insertions(+), 15 deletions(-) diff --git a/3dm-Enhanced.user.js b/3dm-Enhanced.user.js index 8a8ede5d3..fcbb3b458 100644 --- a/3dm-Enhanced.user.js +++ b/3dm-Enhanced.user.js @@ -41,7 +41,7 @@ } for (let i=0;i -1) { @@ -49,7 +49,7 @@ } GM_registerMenuCommand('✅ 已启用 (点击对当前网站禁用)', function(){menu_disable('add')}); if (webType === 2) { - GM_registerMenuCommand(`${GM_getValue('menu_discuz_thread_page')?'✅':'❎'} 帖子内自动翻页 (仅 Discuz! 论坛)`, function(){menu_switch(GM_getValue('menu_discuz_thread_page'), 'menu_discuz_thread_page', 'Discuz! 论坛帖子内翻页')}); + GM_registerMenuCommand(`${GM_getValue('menu_discuz_thread_page')?'✅':'❌'} 帖子内自动翻页 (仅 Discuz! 论坛)`, function(){menu_switch(GM_getValue('menu_discuz_thread_page'), 'menu_discuz_thread_page', 'Discuz! 论坛帖子内翻页')}); } } GM_registerMenuCommand('💬 反馈 & 欢迎申请支持', function () {window.GM_openInTab('https://github.com/XIU2/UserScript#xiu2userscript', {active: true,insert: true,setParent: true});window.GM_openInTab('https://greasyfork.org/zh-CN/scripts/419215/feedback', {active: true,insert: true,setParent: true});}); diff --git a/DarkMode.user.js b/DarkMode.user.js index 5cb30f1db..ede740a3d 100644 --- a/DarkMode.user.js +++ b/DarkMode.user.js @@ -27,10 +27,10 @@ (function() { 'use strict'; var menu_ALL = [ - ['menu_disable', '✅ 已启用 (点击对当前网站禁用)', '❎ 已禁用 (点击对当前网站启用)', []], + ['menu_disable', '✅ 已启用 (点击对当前网站禁用)', '❌ 已禁用 (点击对当前网站启用)', []], ['menu_runDuringTheDay', '白天保持开启 (比晚上亮一点点)', '白天保持开启', true], ['menu_autoRecognition', '智能排除自带暗黑模式的网页 (beta)', '智能排除自带暗黑模式的网页 (beta)', true], - ['menu_forcedToEnable', '✅ 已强制当前网站启用护眼模式 (👆)', '❎ 未强制当前网站启用护眼模式 (👆)', []], + ['menu_forcedToEnable', '✅ 已强制当前网站启用护眼模式 (👆)', '❌ 未强制当前网站启用护眼模式 (👆)', []], ['menu_darkModeType', '点击切换模式', '点击切换模式', 1], ['menu_customMode', '自定义当前模式', '自定义当前模式', true], ['menu_customMode1',,,'80|70'], ['menu_customMode2',,,'80|20|70|30'], ['menu_customMode3',,,'80'] ], menu_ID = []; @@ -88,7 +88,7 @@ } else { - menu_ID[i] = GM_registerMenuCommand(`${menu_ALL[i][3]?'✅':'❎'} ${menu_ALL[i][1]}`, function(){menu_switch(`${menu_ALL[i][3]}`,`${menu_ALL[i][0]}`,`${menu_ALL[i][2]}`)}); + menu_ID[i] = GM_registerMenuCommand(`${menu_ALL[i][3]?'✅':'❌'} ${menu_ALL[i][1]}`, function(){menu_switch(`${menu_ALL[i][3]}`,`${menu_ALL[i][0]}`,`${menu_ALL[i][2]}`)}); } } menu_ID[menu_ID.length] = GM_registerMenuCommand('💬 反馈 & 建议', function () {window.GM_openInTab('https://github.com/XIU2/UserScript#xiu2userscript', {active: true,insert: true,setParent: true});window.GM_openInTab('https://greasyfork.org/zh-CN/scripts/412212/feedback', {active: true,insert: true,setParent: true});}); diff --git a/Hostloc-Enhanced.user.js b/Hostloc-Enhanced.user.js index 3de1a221b..9d59b5cc8 100644 --- a/Hostloc-Enhanced.user.js +++ b/Hostloc-Enhanced.user.js @@ -62,7 +62,7 @@ if (menu_value(menu_ALL[i][0]).length === 0) {GM_setValue(menu_ALL[i][0], '')} // 修改旧版类型 menu_ID[i] = GM_registerMenuCommand(`#️⃣ ${menu_ALL[i][1]}`, function(){customLittleTail()}); } else { - menu_ID[i] = GM_registerMenuCommand(`${menu_ALL[i][3]?'✅':'❎'} ${menu_ALL[i][1]}`, function(){menu_switch(`${menu_ALL[i][3]}`,`${menu_ALL[i][0]}`,`${menu_ALL[i][2]}`)}); + menu_ID[i] = GM_registerMenuCommand(`${menu_ALL[i][3]?'✅':'❌'} ${menu_ALL[i][1]}`, function(){menu_switch(`${menu_ALL[i][3]}`,`${menu_ALL[i][0]}`,`${menu_ALL[i][2]}`)}); } } menu_ID[menu_ID.length] = GM_registerMenuCommand('💬 反馈 & 建议', function () {window.GM_openInTab('https://github.com/XIU2/UserScript#xiu2userscript', {active: true,insert: true,setParent: true});window.GM_openInTab('https://greasyfork.org/zh-CN/scripts/414005/feedback', {active: true,insert: true,setParent: true});}); diff --git a/Lanzou-Enhanced.user.js b/Lanzou-Enhanced.user.js index 1e4db9c11..744cf2279 100644 --- a/Lanzou-Enhanced.user.js +++ b/Lanzou-Enhanced.user.js @@ -55,9 +55,9 @@ for (let i=0;i Date: Mon, 9 Aug 2021 10:03:00 +0800 Subject: [PATCH 0002/1990] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20[=E6=94=B6?= =?UTF-8?q?=E8=B5=B7=E5=BD=93=E5=89=8D=E5=9B=9E=E7=AD=94/=E8=AF=84?= =?UTF-8?q?=E8=AE=BA=EF=BC=88=E7=82=B9=E5=87=BB=E4=B8=A4=E4=BE=A7=E7=A9=BA?= =?UTF-8?q?=E7=99=BD=E5=A4=84=EF=BC=89]=20=E5=9C=A8=E9=83=A8=E5=88=86?= =?UTF-8?q?=E5=9B=9E=E7=AD=94=E4=B8=8B=E4=B8=8D=E8=B5=B7=E4=BD=9C=E7=94=A8?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- Zhihu-Enhanced.user.js | 50 +++++++++++++++++++++++++++++------------- 2 files changed, 36 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index a4968be54..11dc1b3fe 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ | [](https://github.com/XIU2) | **护眼模式** | 简单有效的全网通用护眼模式、夜间模式、暗黑模式~ | **[安装](https://greasyfork.org/zh-CN/scripts/426377)** \| **[备用](https://cdn.jsdelivr.net/gh/XIU2/UserScript@master/DarkMode.user.js)** | | [](https://www.zhihu.com/people/xiu2) | **知乎 美化** | 宽屏显示、**暗黑模式**、隐藏文章开头大图、调整图片最大高... | **[安装](https://greasyfork.org/zh-CN/scripts/412212)** \| **[备用](https://cdn.jsdelivr.net/gh/XIU2/UserScript@master/Zhihu-Beautification.user.js)** | | [](https://www.zhihu.com/people/xiu2) | **知乎 增强** | **移除登录弹窗**、一键收起回答、屏蔽用户、屏蔽关键词、快... | **[安装](https://greasyfork.org/zh-CN/scripts/419081)** \| **[备用](https://cdn.jsdelivr.net/gh/XIU2/UserScript@master/Zhihu-Enhanced.user.js)** | -| [](https://www.v2ex.com/) | **V2ex 增强** | **自动签到**、链接转图片、自动无缝翻页、新标签页打开链接... | **[安装](https://greasyfork.org/zh-CN/scripts/424246)** \| **[备用](https://cdn.jsdelivr.net/gh/XIU2/UserScript@master/V2ex-Enhanced.user.js)** | +| [](https://www.v2ex.com/) | **V2EX 增强** | **自动签到**、链接转图片、自动无缝翻页、新标签页打开链接... | **[安装](https://greasyfork.org/zh-CN/scripts/424246)** \| **[备用](https://cdn.jsdelivr.net/gh/XIU2/UserScript@master/V2ex-Enhanced.user.js)** | | [](https://github.com/XIU2) | **Github 增强** | **高速下载** Git Clone/SSH、Release、Raw、Code(ZIP) 文件... | **[安装](https://greasyfork.org/zh-CN/scripts/412245)** \| **[备用](https://cdn.jsdelivr.net/gh/XIU2/UserScript@master/GithubEnhanced-High-Speed-Download.user.js)** | | [](https://github.com/XIU2) | **自动无缝翻页 \*** | **所有 Discuz! / Flarum 论坛**、百度、豆瓣、微博、千图网... | **[安装](https://greasyfork.org/zh-CN/scripts/419215)** \| **[备用](https://cdn.jsdelivr.net/gh/XIU2/UserScript@master/Autopage.user.js)** | | [](https://bbs.3dmgame.com) | **3DM论坛 美化** | 精简多余内容、样式优化 | **[安装](https://greasyfork.org/zh-CN/scripts/413593)** \| **[备用](https://cdn.jsdelivr.net/gh/XIU2/UserScript@master/3dm-Beautification.user.js)** | diff --git a/Zhihu-Enhanced.user.js b/Zhihu-Enhanced.user.js index 4cecee962..0f8d51150 100644 --- a/Zhihu-Enhanced.user.js +++ b/Zhihu-Enhanced.user.js @@ -1,6 +1,6 @@ // ==UserScript== // @name 知乎增强 -// @version 1.5.2 +// @version 1.5.3 // @author X.I.U // @description 移除登录弹窗、一键收起回答、收起当前回答/评论(点击两侧空白处)、快捷回到顶部(右键两侧空白处)、屏蔽用户 (发布的内容)、屏蔽关键词(标题/评论)、屏蔽盐选内容、展开问题描述、置顶显示时间、显示问题时间、区分问题文章、默认高清原图、默认站外直链 // @match *://www.zhihu.com/* @@ -111,24 +111,38 @@ function collapsedNowAnswer(selectors) { if (event.target==this) { // 下面这段主要是 [收起回答],顺便 [收起评论](如果展开了的话) let rightButton = document.querySelector('.ContentItem-actions.Sticky.RichContent-actions.is-fixed.is-bottom') - // 悬浮在底部的 [收起回答](此时正在浏览回答内容 [头部区域 + 中间区域]) + // 悬浮在底部的 [收起回答](此时正在浏览回答内容 [中间区域]) if (rightButton) { // 固定的 [收起评论](先看看是否展开评论) let commentCollapseButton = rightButton.querySelector('button.Button.ContentItem-action.Button--plain.Button--withIcon.Button--withLabel:first-of-type') if (commentCollapseButton && commentCollapseButton.textContent.indexOf('收起评论') > -1) commentCollapseButton.click(); // 再去收起回答 - rightButton = rightButton.querySelector('.ContentItem-rightButton') - if (rightButton && rightButton.hasAttribute('data-zop-retract-question')) rightButton.click(); - // 固定在回答底部的 [收起回答](此时正在浏览回答内容 [尾部区域]) + rightButton = rightButton.querySelector('.ContentItem-rightButton[data-zop-retract-question]') + if (rightButton) rightButton.click(); + // 固定在回答底部的 [收起回答](此时正在浏览回答内容 [尾部区域]) } else { - for (let el of document.querySelectorAll('.ContentItem-rightButton')) { // 遍历所有回答底部的 [收起] 按钮 - if (el.hasAttribute('data-zop-retract-question')) { - if (isElementInViewport(el)) { // 判断该 [收起] 按钮是否在可视区域内 + let answerCollapseButton_ = false; + for (let el of document.querySelectorAll('.ContentItem-rightButton[data-zop-retract-question]')) { // 遍历所有回答底部的 [收起] 按钮 + if (isElementInViewport(el)) { // 判断该 [收起] 按钮是否在可视区域内 + // 固定的 [收起评论](先看看是否展开评论,即存在 [收起评论] 按钮) + let commentCollapseButton = el.parentNode.querySelector('button.Button.ContentItem-action.Button--plain.Button--withIcon.Button--withLabel:first-of-type') + // 如果展开了评论,就收起评论 + if (commentCollapseButton && commentCollapseButton.textContent.indexOf('收起评论') > -1) commentCollapseButton.click(); + el.click() // 再去收起回答 + answerCollapseButton_ = true; // 如果找到并点击收起了,就没必要执行下面的代码了(可视区域中没有 [收起回答] 时) + break + } + } + // 针对完全看不到 [收起回答] 按钮时(如 [头部区域],以及部分明明很长却不显示悬浮横条的回答) + if (!answerCollapseButton_) { + for (let el of document.querySelectorAll('.List-item')) { // 遍历所有回答主体元素 + if (isElementInViewport_(el)) { // 判断该回答是否在可视区域内 // 固定的 [收起评论](先看看是否展开评论,即存在 [收起评论] 按钮) let commentCollapseButton = el.parentNode.querySelector('button.Button.ContentItem-action.Button--plain.Button--withIcon.Button--withLabel:first-of-type') // 如果展开了评论,就收起评论 if (commentCollapseButton && commentCollapseButton.textContent.indexOf('收起评论') > -1) commentCollapseButton.click(); - el.click() // 再去收起回答 + let answerCollapseButton__ = document.querySelector('.ContentItem-rightButton[data-zop-retract-question]'); + if (answerCollapseButton__) answerCollapseButton__.click() // 再去收起回答 break } } @@ -136,7 +150,7 @@ function collapsedNowAnswer(selectors) { } // 下面这段只针对 [收起评论](如果展开了的话) - var commentCollapseButton_ = false, commentCollapseButton__ = false; + let commentCollapseButton_ = false, commentCollapseButton__ = false; // 悬浮的 [收起评论](此时正在浏览评论内容 [中间区域]) let commentCollapseButton = document.querySelector('.CommentCollapseButton') if (commentCollapseButton) { @@ -202,16 +216,22 @@ function backToTop(selectors) { } -//获取元素是否在可视区域 +//获取元素是否在可视区域(完全可见) function isElementInViewport(el) { let rect = el.getBoundingClientRect(); return ( rect.top >= 0 && rect.left >= 0 && - rect.bottom <= - (window.innerHeight || document.documentElement.clientHeight) && - rect.right <= - (window.innerWidth || document.documentElement.clientWidth) + rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) && + rect.right <= (window.innerWidth || document.documentElement.clientWidth) + ); +} +//获取元素是否在可视区域(部分可见) +function isElementInViewport_(el) { + let rect = el.getBoundingClientRect(); + return ( + rect.top <= (window.innerHeight || document.documentElement.clientHeight) && + rect.left <= (window.innerWidth || document.documentElement.clientWidth) ); } From bab3f9340146e13e8ddb51de20b9e9d7e89786ba Mon Sep 17 00:00:00 2001 From: xiu2 <54703944+XIU2@users.noreply.github.com> Date: Mon, 9 Aug 2021 10:07:22 +0800 Subject: [PATCH 0003/1990] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20[=E6=94=B6?= =?UTF-8?q?=E8=B5=B7=E5=BD=93=E5=89=8D=E5=9B=9E=E7=AD=94/=E8=AF=84?= =?UTF-8?q?=E8=AE=BA=EF=BC=88=E7=82=B9=E5=87=BB=E4=B8=A4=E4=BE=A7=E7=A9=BA?= =?UTF-8?q?=E7=99=BD=E5=A4=84=EF=BC=89]=20=E5=9C=A8=E9=83=A8=E5=88=86?= =?UTF-8?q?=E5=9B=9E=E7=AD=94=E4=B8=8B=E4=B8=8D=E8=B5=B7=E4=BD=9C=E7=94=A8?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Zhihu-Enhanced.user.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Zhihu-Enhanced.user.js b/Zhihu-Enhanced.user.js index 0f8d51150..0a19eef11 100644 --- a/Zhihu-Enhanced.user.js +++ b/Zhihu-Enhanced.user.js @@ -135,7 +135,7 @@ function collapsedNowAnswer(selectors) { } // 针对完全看不到 [收起回答] 按钮时(如 [头部区域],以及部分明明很长却不显示悬浮横条的回答) if (!answerCollapseButton_) { - for (let el of document.querySelectorAll('.List-item')) { // 遍历所有回答主体元素 + for (let el of document.querySelectorAll('.List-item, .Card.AnswerCard')) { // 遍历所有回答主体元素 if (isElementInViewport_(el)) { // 判断该回答是否在可视区域内 // 固定的 [收起评论](先看看是否展开评论,即存在 [收起评论] 按钮) let commentCollapseButton = el.parentNode.querySelector('button.Button.ContentItem-action.Button--plain.Button--withIcon.Button--withLabel:first-of-type') From 050b571209372761cc4829035cbff2f9d12182eb Mon Sep 17 00:00:00 2001 From: xiu2 <54703944+XIU2@users.noreply.github.com> Date: Mon, 9 Aug 2021 14:28:47 +0800 Subject: [PATCH 0004/1990] =?UTF-8?q?=E4=BC=98=E5=8C=96=20=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 3dm-Beautification.user.js | 4 ++-- 3dm-Enhanced.user.js | 16 +++++++--------- 52pojie-Beautification.user.js | 2 +- 52pojie-Enhanced.user.js | 16 +++++++--------- Hostloc-Enhanced.user.js | 28 +++++++++++++--------------- V2ex-Enhanced.user.js | 12 ++++++------ Zhiyoo-Enhanced.user.js | 2 +- 7 files changed, 37 insertions(+), 43 deletions(-) diff --git a/3dm-Beautification.user.js b/3dm-Beautification.user.js index 0a0f450c4..63e0cbab0 100644 --- a/3dm-Beautification.user.js +++ b/3dm-Beautification.user.js @@ -12,8 +12,8 @@ // @homepageURL https://github.com/XIU2/UserScript // ==/UserScript== -'use strict'; (function() { + 'use strict'; let style_Add = document.createElement('style'); style_Add.innerHTML = ` [url=home.php?mod=space&uid=945662]@media[/url] (min-width:1366px) { @@ -98,6 +98,6 @@ textarea#fastpostmessage { document.head.appendChild(style_Add); clearInterval(timer); } - }, 1); + }); } })(); \ No newline at end of file diff --git a/3dm-Enhanced.user.js b/3dm-Enhanced.user.js index fcbb3b458..09285cd0f 100644 --- a/3dm-Enhanced.user.js +++ b/3dm-Enhanced.user.js @@ -19,8 +19,8 @@ // @homepageURL https://github.com/XIU2/UserScript // ==/UserScript== -'use strict'; (function() { + 'use strict'; var menu_ALL = [ ['menu_autoReply', '自动回复', '自动回复', true], ['menu_cleanTopPost', '清理置顶帖子', '清理置顶帖子', true], @@ -186,7 +186,7 @@ let checklogin = document.querySelectorAll('.wp.h_menu p a'); if (checklogin){ for (let value of checklogin) { - if (value.innerHTML == "退出"){ + if (value.textContent == '退出'){ loginStatus = true; } } @@ -220,10 +220,10 @@ // 写入自动回复内容 function writeReply(){ - let textarea = document.getElementById("fastpostmessage"); + let textarea = document.getElementById('fastpostmessage'); if (textarea){ textarea.value = textarea.value + replyList[Math.floor((Math.random()*replyList.length))] + replyList[Math.floor((Math.random()*replyList.length))]; - let fastpostsubmit = document.getElementById("fastpostsubmit"); + let fastpostsubmit = document.getElementById('fastpostsubmit'); if (fastpostsubmit){ fastpostsubmit.click(); } @@ -233,7 +233,7 @@ // 清理置顶帖子 function cleanTopPost(){ - let showhide = document.querySelectorAll("a.showhide.y"); + let showhide = document.querySelectorAll('a.showhide.y'); if (showhide.length > 0){ showhide.forEach(el=>el.click()); } @@ -242,9 +242,7 @@ // 隐藏帖子内的 [下一页] 按钮 function hidePgbtn() { - let style_hidePgbtn = document.createElement('style'); - style_hidePgbtn.innerHTML = `.pgbtn {display: none;}`; - document.head.appendChild(style_hidePgbtn); + document.lastChild.appendChild(document.createElement('style')).textContent = '.pgbtn {display: none;}'; } @@ -258,7 +256,7 @@ if (document.documentElement.scrollHeight <= document.documentElement.clientHeight + scrollTop + scrollDelta) { if (curSite.SiteTypeID === SiteType.FORUM) { // 如果是各版块帖子列表则直接点下一页就行了 let autopbn = document.querySelector('#autopbn'); - if (autopbn && autopbn.innerText == "下一页 »"){ // 如果已经在加载中了,就忽略 + if (autopbn && autopbn.textContent == '下一页 »'){ // 如果已经在加载中了,就忽略 autopbn.click(); } }else{ diff --git a/52pojie-Beautification.user.js b/52pojie-Beautification.user.js index 872305405..fb0ce2c5b 100644 --- a/52pojie-Beautification.user.js +++ b/52pojie-Beautification.user.js @@ -18,8 +18,8 @@ // @homepageURL https://github.com/XIU2/UserScript // ==/UserScript== -'use strict'; (function() { + 'use strict'; var menu_ALL = [ ['menu_rule', '隐藏版规', '隐藏版规', false] ], menu_ID = []; diff --git a/52pojie-Enhanced.user.js b/52pojie-Enhanced.user.js index 87667d582..9b3815b07 100644 --- a/52pojie-Enhanced.user.js +++ b/52pojie-Enhanced.user.js @@ -19,8 +19,8 @@ // @homepageURL https://github.com/XIU2/UserScript // ==/UserScript== -'use strict'; (function() { + 'use strict'; var menu_ALL = [ ['menu_autoClockIn', '自动签到', '自动签到', true], ['menu_pageLoading', '自动无缝翻页', '自动无缝翻页', true], @@ -191,14 +191,14 @@ if (qiandao) { GM_xmlhttpRequest({ url: qiandao.href, - method: "GET", + method: 'GET', timeout: 5000, onload: function (response) { let html = ShowPager.createDocumentByString(response.responseText); html = html.querySelector('#messagetext p') - if (html && html.innerText.indexOf('任务已完成') > -1 || html && html.innerText.indexOf('已申请过此任务') > -1) { - qiandao.querySelector('.qq_bind').setAttribute('src','https://www.52pojie.cn/static/image/common/wbs.png') // 修改 [打卡签到] 图标为 [签到完毕] - qiandao.href = "#" // 修改 URL 为 # + if (html && html.textContent.indexOf('任务已完成') > -1 || html && html.textContent.indexOf('已申请过此任务') > -1) { + qiandao.querySelector('.qq_bind').src = 'https://www.52pojie.cn/static/image/common/wbs.png'; // 修改 [打卡签到] 图标为 [签到完毕] 图标 + qiandao.href = 'javascript:void(0);' } else { GM_notification({text: '自动签到失败!请联系作者解决!', title: '吾爱破解论坛增强', timeout: 3000}); } @@ -229,9 +229,7 @@ // 隐藏帖子内的 [下一页] 按钮 function hidePgbtn() { - let style_hidePgbtn = document.createElement('style'); - style_hidePgbtn.innerHTML = `.pgbtn {display: none;}`; - document.head.appendChild(style_hidePgbtn); + document.lastChild.appendChild(document.createElement('style')).textContent = '.pgbtn {display: none;}'; } @@ -248,7 +246,7 @@ ShowPager.loadMorePage(); } else { let autopbn = document.querySelector(curSite.pager.nextLink); - if (autopbn && autopbn.innerText == curSite.pager.nextText) { // 如果正在加载,就不再点击 + if (autopbn && autopbn.textContent == curSite.pager.nextText) { // 如果正在加载,就不再点击 autopbn.click(); } } diff --git a/Hostloc-Enhanced.user.js b/Hostloc-Enhanced.user.js index 9d59b5cc8..626026636 100644 --- a/Hostloc-Enhanced.user.js +++ b/Hostloc-Enhanced.user.js @@ -278,7 +278,7 @@ listItem.forEach(function(item){ // 遍历所有帖子 menu_value('menu_customBlockUsers').forEach(function(item1){ // 遍历用户黑名单 let itemName = item.querySelector(list2); // 寻找用户名 - if (itemName && itemName.innerText === item1) { + if (itemName && itemName.textContent === item1) { console.log(`屏蔽用户:${item1}`); item.remove(); // 删除帖子 } @@ -294,7 +294,7 @@ listItem.forEach(function(item){ // 遍历所有回复 menu_value('menu_customBlockUsers').forEach(function(item1){ // 遍历用户黑名单 let itemName = item.querySelector('a.xi2'); // 寻找用户名 - if (itemName && itemName.innerText === item1) { + if (itemName && itemName.textContent === item1) { console.log(`屏蔽用户:${item1}`); item.remove(); // 删除回复 } @@ -331,8 +331,8 @@ listItem.forEach(function(item){ // 遍历所有帖子标题 menu_value('menu_customBlockKeywords').forEach(function(item1){ // 遍历关键词 let itemName = item.querySelector('a.s.xst'); // 寻找帖子标题 - if (itemName && itemName.innerText.indexOf(item1) > -1) { - console.log(`屏蔽关键词:[${item1}]`, `,帖子标题:[${itemName.innerText}]`); + if (itemName && itemName.textContent.indexOf(item1) > -1) { + console.log(`屏蔽关键词:[${item1}]`, `,帖子标题:[${itemName.textContent}]`); item.remove(); // 删除帖子 } }) @@ -343,7 +343,7 @@ // 监听插入事件(有新的回复主题,点击查看) function blockDOMNodeInserted() { let block = e => { - if (e.target.innerText && e.target.innerText.indexOf('newthread') > -1) { + if (e.target.textContent && e.target.textContent.indexOf('newthread') > -1) { setTimeout(function () { blockUsers('forum'); // 屏蔽用户(黑名单) blockKeywords(); // 屏蔽关键词(帖子标题) @@ -426,7 +426,7 @@ function replyCustom_3() { let postsubmit = document.getElementById('postsubmit'); - if (postsubmit && postsubmit.innerText === '\n参与/回复主题\n' || postsubmit && postsubmit.innerText === '\n发表帖子\n') { + if (postsubmit && postsubmit.textContent === '\n参与/回复主题\n' || postsubmit && postsubmit.textContent === '\n发表帖子\n') { postsubmit.onclick = function(){ if (GM_getValue('menu_customLittleTail')) document.getElementById('e_textarea').value += GM_getValue('menu_customLittleTail').replaceAll('\\n', '\n'); } @@ -438,7 +438,7 @@ // 监听插入事件(回帖间隔) /*function replyIntervalDOMNodeInserted() { let replyInterval = e => { - if (e.target.innerHTML && e.target.innerText.indexOf('发表回复 金钱+1') > -1) { + if (e.target.innerHTML && e.target.textContent.indexOf('发表回复 金钱+1') > -1) { setTimeout(function () {GM_notification({text: '过去 60 秒了,可以回帖了~', timeout: 3500});}, 60000) } } @@ -459,9 +459,7 @@ // 隐藏帖子内的 [下一页] 按钮 function hidePgbtn() { - let style_hidePgbtn = document.createElement('style'); - style_hidePgbtn.innerHTML = `.pgbtn {display: none;}`; - document.head.appendChild(style_hidePgbtn); + document.lastChild.appendChild(document.createElement('style')).textContent = '.pgbtn {display: none;}'; } @@ -496,10 +494,10 @@ // 显示在线状态 function onlineStatus() { document.querySelectorAll('[id^="favatar"]').forEach(function(item){ // 遍历所有帖子 - let icon = (item.querySelector('[id^="userinfo"] > .i.y em').innerText === '当前在线') ? '🌝' : '🌚'; + let icon = (item.querySelector('[id^="userinfo"] > .i.y em').textContent === '当前在线') ? '🌝' : '🌚'; let divStatus = document.createElement('div'); divStatus.style = 'position: absolute;margin: -8px 0 0 8px;padding: 0 1px 1.2px;background-color: #ffffff;border-radius: 50%;'; - divStatus.innerText = icon; + divStatus.textContent = icon; let mochu = item.querySelector('.avatar'); mochu.parentNode.insertBefore(divStatus,mochu); }) @@ -511,7 +509,7 @@ if (patt_forum.test(location.pathname) || location.search.indexOf('mod=forumdisplay') > -1){ let tbody = document.querySelectorAll('tbody[id^="normalthread_"] .xw1'); Array.from(tbody).forEach(function (_this) { - if (_this.innerText === '255') { + if (_this.textContent === '255') { _this.parentNode.parentNode.parentNode.remove(); } }) @@ -529,10 +527,10 @@ if (document.documentElement.scrollHeight <= document.documentElement.clientHeight + scrollTop + 999) { if (curSite.SiteTypeID === SiteType.FORUM) { // 如果是各版块帖子列表则直接点下一页就行了 let autopbn = document.querySelector('#autopbn'); - if (autopbn && autopbn.innerText === "下一页 »"){ // 如果已经在加载中了,就忽略 + if (autopbn && autopbn.textContent === "下一页 »"){ // 如果已经在加载中了,就忽略 autopbn.click(); let timer = setInterval(function(){ // 在下一页加载完成后 - if (document.querySelector('#autopbn').innerText === "下一页 »") { + if (document.querySelector('#autopbn').textContent === "下一页 »") { if (menu_value('menu_delate255')) delate255(); // 隐藏 255 权限帖子 if (menu_value('menu_blockUsers')) blockUsers('forum'); // 屏蔽用户(黑名单) if (menu_value('menu_blockKeywords')) blockKeywords(); // 屏蔽关键词(帖子标题) diff --git a/V2ex-Enhanced.user.js b/V2ex-Enhanced.user.js index 8975afaf9..1c19c3e5e 100644 --- a/V2ex-Enhanced.user.js +++ b/V2ex-Enhanced.user.js @@ -20,8 +20,8 @@ // @homepageURL https://github.com/XIU2/UserScript // ==/UserScript== -'use strict'; (function() { + 'use strict'; var menu_ALL = [ ['menu_autoClockIn', '自动签到', '自动签到', true], ['menu_linksToImgs', '链接转图片', '链接转图片', true], @@ -245,22 +245,22 @@ let url = (location.origin + "/mission/daily/redeem?" + RegExp("once\\=(\\d+)").exec(document.querySelector('div#Top .tools').innerHTML)[0]); GM_xmlhttpRequest({ url: url, - method: "GET", + method: 'GET', timeout: 5000, onload: function (response) { let html = ShowPager.createDocumentByString(response.responseText); if (html.querySelector('li.fa.fa-ok-sign')) { - html = html.getElementById('Main').innerText.match(/已连续登录 (\d+?) 天/)[0]; + html = html.getElementById('Main').textContent.match(/已连续登录 (\d+?) 天/)[0]; GM_setValue('menu_clockInTime', timeNow); // 写入签到时间以供后续比较 console.info('[V2EX 增强] 自动签到完成!') if (qiandao) { - qiandao.innerText = `自动签到完成!${html}`; - qiandao.href = '#'; + qiandao.textContent = `自动签到完成!${html}`; + qiandao.href = 'javascript:void(0);'; } } else { GM_notification({text: '自动签到失败!请联系作者解决!', timeout: 4000, onclick() {window.GM_openInTab('https://github.com/XIU2/UserScript#xiu2userscript', {active: true,insert: true,setParent: true});window.GM_openInTab('https://greasyfork.org/zh-CN/scripts/424246/feedback', {active: true,insert: true,setParent: true});}}); console.warn('[V2EX 增强] 自动签到失败!请联系作者解决!') - if (qiandao) qiandao.innerText = '自动签到失败!请尝试手动签到!'; + if (qiandao) qiandao.textContent = '自动签到失败!请尝试手动签到!'; } } }); diff --git a/Zhiyoo-Enhanced.user.js b/Zhiyoo-Enhanced.user.js index 20a390941..7ec25bc2e 100644 --- a/Zhiyoo-Enhanced.user.js +++ b/Zhiyoo-Enhanced.user.js @@ -20,8 +20,8 @@ // @homepageURL https://github.com/XIU2/UserScript // ==/UserScript== -'use strict'; (function() { + 'use strict'; var menu_ALL = [ ['menu_autoReply', '自动回复', '自动回复', true], ['menu_pageLoading', '自动无缝翻页', '自动无缝翻页', true], From 0d01f6805792e65264ab8902a87a0124c6477ad1 Mon Sep 17 00:00:00 2001 From: xiu2 <54703944+XIU2@users.noreply.github.com> Date: Mon, 9 Aug 2021 14:30:11 +0800 Subject: [PATCH 0005/1990] =?UTF-8?q?=E4=BC=98=E5=8C=96=20[=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E6=89=93=E5=BC=80/=E5=A4=8D=E5=88=B6=E5=88=86?= =?UTF-8?q?=E4=BA=AB=E9=93=BE=E6=8E=A5]=20=E5=8A=9F=E8=83=BD=EF=BC=88?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8F=B3=E9=94=AE=E8=8F=9C=E5=8D=95=20[?= =?UTF-8?q?=E5=A4=96=E9=93=BE=E5=88=86=E4=BA=AB=E5=9C=B0=E5=9D=80]=20?= =?UTF-8?q?=E4=B8=BA=20[=E5=A4=8D=E5=88=B6=E5=B9=B6=E6=89=93=E5=BC=80?= =?UTF-8?q?=E5=88=86=E4=BA=AB=E9=93=BE=E6=8E=A5]=20/=20[=E5=A4=8D=E5=88=B6?= =?UTF-8?q?=E5=88=86=E4=BA=AB=E9=93=BE=E6=8E=A5]=20/=20[=E6=89=93=E5=BC=80?= =?UTF-8?q?=E5=88=86=E4=BA=AB=E9=93=BE=E6=8E=A5]=20=E4=B9=8B=E4=B8=80?= =?UTF-8?q?=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Lanzou-Enhanced.user.js | 156 +++++++++++++++++++++++----------------- 1 file changed, 90 insertions(+), 66 deletions(-) diff --git a/Lanzou-Enhanced.user.js b/Lanzou-Enhanced.user.js index 744cf2279..5fb6994c1 100644 --- a/Lanzou-Enhanced.user.js +++ b/Lanzou-Enhanced.user.js @@ -1,6 +1,6 @@ // ==UserScript== // @name 蓝奏云网盘增强 -// @version 1.2.8 +// @version 1.2.9 // @author X.I.U // @description 刷新不回根目录、后退返回上一级、右键文件显示菜单、自动显示更多文件、自动打开分享链接、自动复制分享链接、带密码的分享链接自动输密码、拖入文件自动显示上传框、输入密码后回车确认、调整描述(话说)编辑框初始大小 // @match *://*.lanzous.com/* @@ -56,7 +56,7 @@ menu_ALL[i][3] = GM_getValue(menu_ALL[i][0]); if (menu_ALL[i][0] == 'menu_refreshCorrection') { menu_ID[i] = GM_registerMenuCommand(`${menu_ALL[i][3]?'✅':'❌'} ${menu_ALL[i][1]}`, function(){if(menu_value('menu_refreshCorrection')){UNrefreshCorrection();}else{refreshCorrection();};menu_switch(`${menu_ALL[i][3]}`,`${menu_ALL[i][0]}`,`${menu_ALL[i][2]}`)}); - }else{ + } else { menu_ID[i] = GM_registerMenuCommand(`${menu_ALL[i][3]?'✅':'❌'} ${menu_ALL[i][1]}`, function(){menu_switch(`${menu_ALL[i][3]}`,`${menu_ALL[i][0]}`,`${menu_ALL[i][2]}`)}); } } @@ -67,10 +67,10 @@ function menu_switch(menu_status, Name, Tips) { let RefreshTips = '\n(刷新网页后生效)'; if (Name == 'menu_refreshCorrection')RefreshTips = '' - if (menu_status == 'true'){ + if (menu_status == 'true') { GM_setValue(`${Name}`, false); GM_notification({text: `已关闭 [${Tips}] 功能${RefreshTips}`, timeout: 3500}); - }else{ + } else { GM_setValue(`${Name}`, true); GM_notification({text: `已开启 [${Tips}] 功能${RefreshTips}`, timeout: 3500}); } @@ -88,17 +88,17 @@ if (window.top.location.pathname === '/u' || window.top.location.pathname.indexOf('account.php') > -1 || window.top.location.pathname.indexOf('mydisk.php') > -1) { // 后台页 - if (window.top.location.href != "https://pc.woozooo.com/mydisk.php") { + if (window.top.location.href != 'https://pc.woozooo.com/mydisk.php') { window.top.location.href = "https://pc.woozooo.com/mydisk.php" } var mainframe; iframe(); - } else if (window.top.location.pathname.indexOf('%') > -1) { // 带密码的分享链接页面 + } else if (window.top.location.pathname.indexOf('%') > -1) { // > 带密码的分享链接页面 shareLinkWithPassword(); // 带密码的分享链接自动输密码 } else { setTimeout(function() { // 延迟 300 毫秒(避免网页还没加载完) - if (document.getElementById('infos')) { // 分享链接文件列表页 - if (document.getElementById('pwdload')) { // 分享链接输入密码页 + if (document.getElementById('infos')) { // > 分享链接文件列表页 + if (document.getElementById('pwdload')) { // > 分享链接输入密码页 enterPassword(); // 自动输入密码(仅支持访问 带密码的分享链接 时) enterToPass(); // 输入密码后回车确认 } @@ -110,8 +110,8 @@ // 获取 iframe 框架 function iframe() { - mainframe = document.getElementById("mainframe"); - if(mainframe){ // 只有找到 iframe 框架时才会继续运行脚本 + mainframe = document.getElementById('mainframe'); + if (mainframe) { // 只有找到 iframe 框架时才会继续运行脚本 mainframe = mainframe.contentWindow; if(menu_value('menu_refreshCorrection')){ refreshCorrection(); // 刷新不返回根目录(F5) @@ -122,6 +122,7 @@ EventXMLHttpRequest(); // 监听 XMLHttpRequest 事件并执行 [自动显示更多文件] dragEnter(); // 拖入文件自动显示上传框 + setTimeout(viewTop,1000); // 监听并修改右键菜单 [外链分享地址] 为 [复制并打开分享链接] / [复制分享链接] / [打开分享链接] 之一 } } @@ -158,7 +159,7 @@ document.onkeydown = mainframe.onkeydown = function (e) { e = window.event || e; if (e.key === 'F5') { - let folderID = /-?\d+/.exec(mainframe.document.getElementById("filemore").children[0].getAttribute("onclick")) + let folderID = /-?\d+/.exec(mainframe.document.getElementById('filemore').children[0].onclick) if(folderID.length > 0){ mainframe.folder(folderID[0]); e.returnValue = false; @@ -183,9 +184,9 @@ // 右键文件显示菜单 function rightClickMenu() { - if(menu_value('menu_rightClickMenu')){ // 脚本菜单开启时才继续 - rightClickMenu_("sub_folder_list", "fols", "folse") // 文件夹 - rightClickMenu_("filelist", "fs", "fse") // 文件 + if (menu_value('menu_rightClickMenu')) { // 脚本菜单开启时才继续 + rightClickMenu_('sub_folder_list', 'fols', 'folse') // 文件夹 + rightClickMenu_('filelist', 'fs', 'fse') // 文件 } } @@ -193,19 +194,19 @@ // 右键文件显示菜单,参数:文件/文件夹列表 ID、菜单 ID 前缀 function rightClickMenu_(list_id_name, menu_id_name_prefix, list_id_name_prefix) { let list_ = mainframe.document.getElementById(list_id_name); - if(list_){ // 文件/文件夹列表 + if (list_) { // 文件/文件夹列表 list_.oncontextmenu = function(e){ e.preventDefault(); // 屏蔽浏览器自身右键菜单 let left = e.pageX - 30; // 右键菜单弹出位置 let list_ID = e.target.id; - if(e.target.nodeName == "FONT"){ + if (e.target.nodeName === 'FONT') { list_ID = e.target.parentNode.parentNode.id - }else if(e.target.id == ""){ + } else if(e.target.id === '') { list_ID = e.target.parentNode.id } list_ID = /\d+/.exec(list_ID) if(list_ID.length > 0){ - mainframe.document.getElementById(menu_id_name_prefix + list_ID[0]).style.cssText="position: absolute !important; left: " + left + "px;" // 修改右键菜单弹出位置(X) + mainframe.document.getElementById(menu_id_name_prefix + list_ID[0]).style.cssText='position: absolute !important; left: ' + left + 'px;' // 修改右键菜单弹出位置(X) mainframe.document.getElementById(list_id_name_prefix + list_ID[0]).focus(); mainframe.document.getElementById(list_id_name_prefix + list_ID[0]).click(); } @@ -216,9 +217,9 @@ // 自动显示更多文件(后台页) function fileMore() { - let filemore = mainframe.document.getElementById("filemore"); // 寻找 [显示更多文件] 按钮 - if(filemore && filemore.style.display == "block"){ // 判断按钮是否存在且可见 - if(filemore.children[0]){ // 判断按钮元素下第一个元素是否存在 + let filemore = mainframe.document.getElementById('filemore'); // 寻找 [显示更多文件] 按钮 + if (filemore && filemore.style.display === 'block') { // 判断按钮是否存在且可见 + if (filemore.children[0]) { // 判断按钮元素下第一个元素是否存在 filemore.children[0].click(); // 点击 [显示更多文件] 按钮 } } @@ -228,13 +229,13 @@ // 自动显示更多文件(分享链接列表页) function fileMoreS() { windowScroll(function (direction, e) { - if (direction === "down") { // 下滑才准备加载更多 + if (direction === 'down') { // 下滑才准备加载更多 let scrollTop = document.documentElement.scrollTop || window.pageYOffset || document.body.scrollTop; let scrollDelta = 500; if (document.documentElement.scrollHeight <= document.documentElement.clientHeight + scrollTop + scrollDelta) { - let filemore = document.getElementById("filemore"); // 寻找 [显示更多文件] 按钮 - if (filemore && filemore.style.display != "none") { // 如果正在加载,就不再点击 - if (filemore.innerText.indexOf('更多') > -1){ // 避免已经在加载了,重复点击 + let filemore = document.getElementById('filemore'); // 寻找 [显示更多文件] 按钮 + if (filemore && filemore.style.display != 'none') { // 如果正在加载,就不再点击 + if (filemore.textContent.indexOf('更多') > -1){ // 避免已经在加载了,重复点击 filemore.click(); // 点击 [显示更多文件] 按钮 } } @@ -249,11 +250,11 @@ var beforeScrollTop = document.documentElement.scrollTop, fn = fn1 || function () {}; setTimeout(function () { // 延时执行,避免刚载入到页面就触发翻页事件 - window.addEventListener("scroll", function (e) { + window.addEventListener('scroll', function (e) { var afterScrollTop = document.documentElement.scrollTop, delta = afterScrollTop - beforeScrollTop; if (delta == 0) return false; - fn(delta > 0 ? "down" : "up", e); + fn(delta > 0 ? 'down' : 'up', e); beforeScrollTop = afterScrollTop; }, false); }, 1000) @@ -262,18 +263,18 @@ // 调整话说编辑框初始大小 function folderDescdes() { - if(menu_value('menu_folderDescdesMenu')) { - let folderdescdes = mainframe.document.getElementById("folder_descdes"); // 寻找话说(描述)编辑框 - if(folderdescdes){ // 判断话说(描述)元素是否存在 - folderdescdes.style.cssText="margin: 15px 0px; width: 550px; height: 125px;" + if (menu_value('menu_folderDescdesMenu')) { + let folderdescdes = mainframe.document.getElementById('folder_descdes'); // 寻找话说(描述)编辑框 + if (folderdescdes) { // 判断话说(描述)元素是否存在 + folderdescdes.style.cssText='margin: 15px 0px; width: 550px; height: 125px;' } - let folderdescdes2 = mainframe.document.getElementById("fol_credes"); // 寻找话说(描述)编辑框 - if(folderdescdes2){ // 判断话说(描述)元素是否存在 - folderdescdes2.style.cssText="margin: 15px 0px; width: 550px; height: 125px;" + let folderdescdes2 = mainframe.document.getElementById('fol_credes'); // 寻找话说(描述)编辑框 + if (folderdescdes2) { // 判断话说(描述)元素是否存在 + folderdescdes2.style.cssText='margin: 15px 0px; width: 550px; height: 125px;' } - let folderdescdes3 = mainframe.document.getElementById("file_desc"); // 寻找话说(描述)编辑框 - if(folderdescdes3){ // 判断话说(描述)元素是否存在 - folderdescdes3.style.cssText="margin: 15px 0px; width: 550px; height: 125px;" + let folderdescdes3 = mainframe.document.getElementById('file_desc'); // 寻找话说(描述)编辑框 + if (folderdescdes3) { // 判断话说(描述)元素是否存在 + folderdescdes3.style.cssText='margin: 15px 0px; width: 550px; height: 125px;' } } } @@ -281,19 +282,19 @@ // 拖入文件自动显示上传框 function dragEnter() { - mainframe.addEventListener("dragenter", function (e) { + mainframe.addEventListener('dragenter', function (e) { e.preventDefault(); e.stopPropagation(); - let f_upb = mainframe.document.querySelector(".f_upb") - if(f_upb.style.top != "-36px") { - f_upb.style.top = "-36px"; + let f_upb = mainframe.document.querySelector('.f_upb') + if(f_upb.style.top != '-36px') { + f_upb.style.top = '-36px'; mainframe.f_upc(); } }, false); - mainframe.addEventListener("drop", function (e) { + mainframe.addEventListener('drop', function (e) { e.preventDefault(); //e.stopPropagation(); - console.log('111111') + //console.log('111111') //console.log(e.dataTransfer.files) }); } @@ -301,12 +302,12 @@ // 分享链接相关(点击文件时) function fileSha() { - var f_sha = mainframe.document.getElementById("f_sha"); // 寻找分享链接(下载链接)信息框 - if(f_sha && f_sha.style.display == "block"){ // 判断信息框是否存在且可见 - fileSha_Open(); // 自动打开分享链接(点击文件时) - fileSha_Copy(); // 自动复制分享链接(点击文件时) - if(menu_value('menu_open_fileSha') || menu_value('menu_copy_fileSha')){ - f_sha.style.display = "none"; // 隐藏分享链接(下载链接)信息框 + var f_sha = mainframe.document.getElementById('f_sha'); // 寻找分享链接(下载链接)信息框 + if (f_sha && f_sha.style.display === 'block') { // 判断信息框是否存在且可见 + fileSha_Open(); // 自动打开分享链接(点击文件时) + fileSha_Copy(); // 自动复制分享链接(点击文件时) + if (menu_value('menu_open_fileSha') || menu_value('menu_copy_fileSha')) { + f_sha.style.display = 'none'; // 隐藏分享链接(下载链接)信息框 } } } @@ -314,9 +315,9 @@ // 自动打开分享链接(点击文件时) function fileSha_Open() { - if(menu_value('menu_open_fileSha')){ // 脚本菜单开启时才继续 - let code = mainframe.document.getElementById("code").getAttribute("title"); // 获取分享链接(下载链接) - if(code != ""){ // 确保分享链接(下载链接)不是空 + if (menu_value('menu_open_fileSha')) { // 脚本菜单开启时才继续 + let code = mainframe.document.getElementById('code').title; // 获取分享链接(下载链接) + if (code != '') { // 确保分享链接(下载链接)不是空 window.GM_openInTab(code, {active: true,insert: true,setParent: true}) // 打开分享链接(下载链接) } } @@ -325,10 +326,10 @@ // 自动复制分享链接(点击文件时) function fileSha_Copy() { - if(menu_value('menu_copy_fileSha')){ // 脚本菜单开启时才继续 - let f_sha1 = mainframe.document.getElementById("f_sha1").innerText; // 获取分享链接(下载链接) - if(f_sha1 != ""){ // 确保分享链接(下载链接)不是空 - copyToClipboard(f_sha1); // 复制到剪切板 + if (menu_value('menu_copy_fileSha')) { // 脚本菜单开启时才继续 + let f_sha1 = mainframe.document.getElementById('f_sha1').textContent; // 获取分享链接(下载链接) + if (f_sha1 != '') { // 确保分享链接(下载链接)不是空 + copyToClipboard(f_sha1); // 复制到剪切板 } } } @@ -336,9 +337,9 @@ // 复制到剪切板 function copyToClipboard(s){ - if(window.clipboardData){ + if (window.clipboardData) { window.clipboardData.setData('text',s); - }else{ + } else { (function(s){ document.oncopy=function(e){ e.clipboardData.setData('text',s); @@ -353,11 +354,8 @@ // 隐藏分享链接窗口(这样自动打开/复制分享链接时,不会一闪而过) function hideSha(){ - if(menu_value('menu_open_fileSha') || menu_value('menu_copy_fileSha')){ // [自动复制分享链接] 或 [自动打开分享链接] 任意一个功能开启时才继续 - let style_Add = mainframe.document.createElement('style'); - style_Add.type = 'text/css'; - style_Add.innerHTML = `#f_sha {display: none !important;}`; - mainframe.document.head.appendChild(style_Add); + if (menu_value('menu_open_fileSha') || menu_value('menu_copy_fileSha')) { // [自动复制分享链接] 或 [自动打开分享链接] 任意一个功能开启时才继续 + mainframe.document.head.appendChild(document.createElement('style')).textContent = '#f_sha {display: none !important;}'; } } @@ -378,7 +376,7 @@ // 浏览器后退事件函数 function backEvent() { - if(lastFolderID) { + if (lastFolderID) { mainframe.folder(lastFolderID); } history.pushState(null, null, document.URL); @@ -389,7 +387,7 @@ function getLastFolderID() { lastFolderID = null let f_tpspan = mainframe.document.querySelectorAll("span.f_tpspan"); - if(f_tpspan.length > 1) { + if (f_tpspan.length > 1) { lastFolderID = /-?\d+/.exec(f_tpspan[f_tpspan.length - 2].getAttribute("onclick"))[0]; } } @@ -398,7 +396,7 @@ // 输入密码后回车确认 function enterToPass() { document.getElementById('pwd').onkeydown = function(e){ - if(e.key === 'Enter'){ + if (e.key === 'Enter') { document.getElementById('sub').click(); } }; @@ -419,6 +417,32 @@ } + // 监听并修改右键菜单 [外链分享地址] 为 [复制并打开分享链接] / [复制分享链接] / [打开分享链接] 之一 + function viewTop() { + const callback = (mutationsList, observer) => { + for (const mutation of mutationsList) { + for (const target of mutation.addedNodes) { + if (target.nodeType != 1) return + if (target.className === 'f_view') { + let f_viewtop = target.querySelector('.f_viewtop'); + if (f_viewtop) { + if (menu_value('menu_open_fileSha') && menu_value('menu_copy_fileSha')) { + f_viewtop.textContent = '复制并打开分享链接'; + } else if (menu_value('menu_open_fileSha')) { + f_viewtop.textContent = '打开分享链接'; + } else if (menu_value('menu_copy_fileSha')) { + f_viewtop.textContent = '复制分享链接'; + } + } + } + } + } + }; + const observer = new MutationObserver(callback); + observer.observe(mainframe.document, { childList: true, subtree: true }); + } + + /*(function (open) { mainframe.XMLHttpRequest.prototype.open = function () { this.addEventListener("readystatechange", function () { From 7410b0c7a53f0b02dd7c74871bbe6bb903fb0567 Mon Sep 17 00:00:00 2001 From: xiu2 <54703944+XIU2@users.noreply.github.com> Date: Tue, 10 Aug 2021 01:25:44 +0800 Subject: [PATCH 0006/1990] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20=E4=B8=8A?= =?UTF-8?q?=E4=B8=AA=E7=89=88=E6=9C=AC=E6=9B=B4=E6=96=B0=E7=9A=84=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=E5=AF=BC=E8=87=B4=E5=90=8E=E5=8F=B0=E5=85=B6=E4=BB=96?= =?UTF-8?q?=E8=8F=9C=E5=8D=95=EF=BC=88=E5=A6=82=E5=88=A0=E9=99=A4=EF=BC=89?= =?UTF-8?q?=E4=B9=9F=E8=A2=AB=E4=BF=AE=E6=94=B9=E6=96=87=E5=AD=97=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Lanzou-Enhanced.user.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Lanzou-Enhanced.user.js b/Lanzou-Enhanced.user.js index 5fb6994c1..8899f279e 100644 --- a/Lanzou-Enhanced.user.js +++ b/Lanzou-Enhanced.user.js @@ -1,6 +1,6 @@ // ==UserScript== // @name 蓝奏云网盘增强 -// @version 1.2.9 +// @version 1.3.0 // @author X.I.U // @description 刷新不回根目录、后退返回上一级、右键文件显示菜单、自动显示更多文件、自动打开分享链接、自动复制分享链接、带密码的分享链接自动输密码、拖入文件自动显示上传框、输入密码后回车确认、调整描述(话说)编辑框初始大小 // @match *://*.lanzous.com/* @@ -425,7 +425,7 @@ if (target.nodeType != 1) return if (target.className === 'f_view') { let f_viewtop = target.querySelector('.f_viewtop'); - if (f_viewtop) { + if (f_viewtop && f_viewtop.textContent === '外链分享地址') { if (menu_value('menu_open_fileSha') && menu_value('menu_copy_fileSha')) { f_viewtop.textContent = '复制并打开分享链接'; } else if (menu_value('menu_open_fileSha')) { From da009764f451059c353744b656dd7b98b4bc9071 Mon Sep 17 00:00:00 2001 From: xiu2 <54703944+XIU2@users.noreply.github.com> Date: Tue, 10 Aug 2021 01:37:14 +0800 Subject: [PATCH 0007/1990] =?UTF-8?q?=E4=BC=98=E5=8C=96=20=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 52pojie-Enhanced.user.js | 2 +- V2ex-Enhanced.user.js | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/52pojie-Enhanced.user.js b/52pojie-Enhanced.user.js index 9b3815b07..cec518621 100644 --- a/52pojie-Enhanced.user.js +++ b/52pojie-Enhanced.user.js @@ -178,7 +178,7 @@ } else if(location.search.indexOf('mod=space') > -1 && location.search.indexOf('&view=me') > -1) { // 别人的主题/回复 curSite = DBSite.youspace; } - curSite.pageUrl = ""; // 下一页URL + curSite.pageUrl = ''; // 下一页URL qianDao(); // 自动签到 pageLoading(); // 自动翻页 diff --git a/V2ex-Enhanced.user.js b/V2ex-Enhanced.user.js index 1c19c3e5e..9573b29c9 100644 --- a/V2ex-Enhanced.user.js +++ b/V2ex-Enhanced.user.js @@ -207,7 +207,7 @@ } } - curSite.pageUrl = ""; // 下一页URL + curSite.pageUrl = ''; // 下一页URL if(menu_value('menu_fish'))fish(); // 标签页伪装为 Github(摸鱼) if(menu_value('menu_autoClockIn'))setTimeout(qianDao, 1000); // 自动签到(后台),延迟 1 秒执行是为了兼容 [V2ex Plus] 扩展 if(menu_value('menu_pageLoading'))pageLoading(); // 自动翻页(无缝) @@ -233,9 +233,9 @@ let timeOld = GM_getValue('menu_clockInTime') if (!timeOld || timeOld != timeNow) { qianDaoStatus_(timeNow) // 后台获取签到状态(并判断是否需要签到) - } else { // 新旧签到时间一致 + }/* else { // 新旧签到时间一致 console.info('[V2EX 增强] 已经签过到了。') - } + }*/ } } @@ -271,7 +271,7 @@ function qianDaoStatus_(timeNow) { GM_xmlhttpRequest({ url: 'https://www.v2ex.com/mission/daily', - method: "GET", + method: 'GET', timeout: 5000, onload: function (response) { let html = ShowPager.createDocumentByString(response.responseText); @@ -288,7 +288,7 @@ // 回到顶部(右键左右两侧空白处) function backToTop() { - document.getElementById("Wrapper").oncontextmenu = document.querySelector("#Wrapper > .content").oncontextmenu = function(event){ + document.getElementById('Wrapper').oncontextmenu = document.querySelector("#Wrapper > .content").oncontextmenu = function(event){ if (event.target==this) { event.preventDefault(); window.scrollTo(0,0) @@ -321,7 +321,7 @@ // 快速回复(双击左右两侧空白处) function quickReply() { - document.getElementById("Wrapper").ondblclick = document.querySelector("#Wrapper > .content").ondblclick = function(event){ + document.getElementById('Wrapper').ondblclick = document.querySelector('#Wrapper > .content').ondblclick = function(event){ if (event.target==this) { if (document.querySelector('.box.reply-box-sticky')) { document.getElementById('undock-button').click(); From e41275617e3b0863ff7bd5f10d173e5b94d454f9 Mon Sep 17 00:00:00 2001 From: xiu2 <54703944+XIU2@users.noreply.github.com> Date: Tue, 10 Aug 2021 01:54:13 +0800 Subject: [PATCH 0008/1990] =?UTF-8?q?=E6=96=B0=E5=A2=9E=20[Crackhub213]=20?= =?UTF-8?q?=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Autopage.user.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/Autopage.user.js b/Autopage.user.js index 49fc53f7f..009328edb 100644 --- a/Autopage.user.js +++ b/Autopage.user.js @@ -1,8 +1,8 @@ // ==UserScript== // @name 自动无缝翻页 -// @version 1.4.8 +// @version 1.4.9 // @author X.I.U -// @description 自动无缝翻页,目前支持:所有「Discuz!、Flarum」论坛、百度、豆瓣、微博、千图网、3DM、游侠网、游民星空、Steam 创意工坊、423Down、APPHOT、不死鸟、亿破姐、小众软件、微当下载、落尘之木、异次元软件、老殁殁漂遥、异星软件空间、古风漫画网、RARBG、PubMed、AfreecaTV、GreasyFork、AlphaCoders、FitGirl Repacks... +// @description 自动无缝翻页,目前支持:所有「Discuz!、Flarum」论坛、百度、豆瓣、微博、千图网、3DM、游侠网、游民星空、Steam 创意工坊、423Down、APPHOT、不死鸟、亿破姐、小众软件、微当下载、落尘之木、异次元软件、老殁殁漂遥、异星软件空间、古风漫画网、RARBG、PubMed、AfreecaTV、GreasyFork、AlphaCoders、Crackhub213、FitGirl Repacks... // @match *://*/* // @connect www.gamersky.com // @icon https://i.loli.net/2021/03/07/rdijeYm83pznxWq.png @@ -28,7 +28,7 @@ 'www.gufengmh8.com', 'rarbgprx.org', 'pubmed.ncbi.nlm.nih.gov', 'www.afreecatv.com', 'greasyfork.org', 'art.alphacoders.com', 'wall.alphacoders.com', 'avatars.alphacoders.com', 'mobile.alphacoders.com', - 'fitgirl-repacks.site']; + 'crackhub.site', 'fitgirl-repacks.site']; if (GM_getValue('menu_disable') == null){GM_setValue('menu_disable', [])}; if (GM_getValue('menu_discuz_thread_page') == null){GM_setValue('menu_discuz_thread_page', true)}; @@ -547,8 +547,8 @@ type: 1, nextLink: '//a[@class="next page-numbers"][@href]', pageElement: 'css;article[id^="post-"]', - HT_insert: ['css;nav.navigation.paging-navigation', 1], - replaceE: 'css;nav.navigation.paging-navigation', + HT_insert: ['css;nav.paging-navigation', 1], + replaceE: 'css;nav.paging-navigation', scrollDelta: 2000 } } @@ -603,7 +603,7 @@ break; case 'gl.ali213.net': // < 游侠网 - 攻略页 > curSite = DBSite.ali213_gl; - document.lastElementChild.appendChild(document.createElement('style')).textContent = `.n_show_b {display: none !important;}` // 隐藏部分碍事元素 + document.lastElementChild.appendChild(document.createElement('style')).textContent = '.n_show_b {display: none !important;}' // 隐藏部分碍事元素 break; case 'www.gamersky.com': // < 游民星空 > if (location.pathname.indexOf('/ent/') > -1) { @@ -680,6 +680,10 @@ case 'mobile.alphacoders.com': curSite = DBSite.alphacoders_wall; break; + case 'crackhub.site': // < 游戏下载网站 > + curSite = DBSite.fitgirl; + document.lastElementChild.appendChild(document.createElement('style')).textContent = 'html.wp-dark-mode-active .inside-article {background-color: var(--wp-dark-mode-bg);}' + break; case 'fitgirl-repacks.site': // < 游戏下载网站 > curSite = DBSite.fitgirl; break; From 36b83cbf1cf3ac9e062a2996ec0fcc831d9ea7d8 Mon Sep 17 00:00:00 2001 From: xiu2 <54703944+XIU2@users.noreply.github.com> Date: Wed, 11 Aug 2021 08:27:22 +0800 Subject: [PATCH 0009/1990] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20=E5=9C=A8=20Viol?= =?UTF-8?q?entmonkey=20=E4=B8=8B=E9=83=A8=E5=88=86=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E6=97=A0=E6=B3=95=E4=BD=BF=E7=94=A8=E7=9A=84=E9=97=AE=E9=A2=98?= =?UTF-8?q?;=20=E4=BF=AE=E5=A4=8D=20=E9=83=A8=E5=88=86=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E5=9C=A8=E5=8D=95=E7=8B=AC=E5=9B=9E=E7=AD=94=E9=A1=B5=E7=82=B9?= =?UTF-8?q?=E5=87=BB=20[=E5=85=A8=E9=83=A8=E5=9B=9E=E7=AD=94]=20=E8=B7=B3?= =?UTF-8?q?=E8=BD=AC=E5=88=B0=E5=85=A8=E9=83=A8=E5=9B=9E=E7=AD=94=E9=A1=B5?= =?UTF-8?q?=E6=97=B6=E6=B2=A1=E6=9C=89=E8=BF=90=E8=A1=8C=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98;=20=E4=BC=98=E5=8C=96=20=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Zhihu-Enhanced.user.js | 163 +++++++++++++++++++++++------------------ 1 file changed, 90 insertions(+), 73 deletions(-) diff --git a/Zhihu-Enhanced.user.js b/Zhihu-Enhanced.user.js index 0a19eef11..f89ae026d 100644 --- a/Zhihu-Enhanced.user.js +++ b/Zhihu-Enhanced.user.js @@ -1,6 +1,6 @@ // ==UserScript== // @name 知乎增强 -// @version 1.5.3 +// @version 1.5.4 // @author X.I.U // @description 移除登录弹窗、一键收起回答、收起当前回答/评论(点击两侧空白处)、快捷回到顶部(右键两侧空白处)、屏蔽用户 (发布的内容)、屏蔽关键词(标题/评论)、屏蔽盐选内容、展开问题描述、置顶显示时间、显示问题时间、区分问题文章、默认高清原图、默认站外直链 // @match *://www.zhihu.com/* @@ -13,6 +13,7 @@ // @grant GM_getValue // @grant GM_setValue // @grant GM_notification +// @grant GM_info // @license GPL-3.0 License // @run-at document-end // @namespace https://greasyfork.org/scripts/4122051 @@ -25,9 +26,9 @@ var menu_ALL = [ ['menu_collapsedAnswer', '一键收起回答', '一键收起回答', true], ['menu_collapsedNowAnswer', '收起当前回答/评论(点击两侧空白处)', '收起当前回答/评论', true], ['menu_backToTop', '快捷回到顶部(右键两侧空白处)', '快捷回到顶部', true], - ['menu_blockUsers', '屏蔽指定用户', '屏蔽指定用户', false], + ['menu_blockUsers', '屏蔽指定用户', '屏蔽指定用户', true], ['menu_customBlockUsers', '自定义屏蔽用户', '自定义屏蔽用户', ['故事档案局', '盐选推荐', '盐选科普', '盐选成长计划', '知乎盐选会员', '知乎盐选创作者', '盐选心理', '盐选健康必修课', '盐选奇妙物语', '盐选生活馆', '盐选职场', '盐选文学甄选', '盐选作者小管家', '盐选博物馆', '盐选点金', '盐选测评室', '盐选科技前沿', '盐选会员精品']], - ['menu_blockKeywords', '屏蔽指定关键词', '屏蔽指定关键词', false], + ['menu_blockKeywords', '屏蔽指定关键词', '屏蔽指定关键词', true], ['menu_customBlockKeywords', '自定义屏蔽关键词', '自定义屏蔽关键词', []], ['menu_blockYanXuan', '屏蔽盐选内容', '屏蔽盐选内容', false], ['menu_questionRichTextMore', '展开问题描述', '展开问题描述', false], @@ -88,17 +89,16 @@ function menu_value(menuName) { // 一键收起回答 function collapsedAnswer() { if (!menu_value('menu_collapsedAnswer')) return - let button_Add = `` - let style_Add = document.createElement('style'); - style_Add.innerHTML = '.CornerButton{margin-bottom:8px !important;}.CornerButtons{bottom:45px !important;}'; - document.head.appendChild(style_Add); - document.querySelector('.CornerAnimayedFlex').insertAdjacentHTML('afterBegin', button_Add); - document.getElementById('collapsed-button').onclick = function () { - document.querySelectorAll('.ContentItem-rightButton').forEach(function (el) { - if (el.hasAttribute('data-zop-retract-question')) { - el.click() - } - }); + if (document.querySelector('.CornerAnimayedFlex')) { + document.head.appendChild(document.createElement('style')).textContent = '.CornerButton{margin-bottom:8px !important;}.CornerButtons{bottom:45px !important;}'; + document.querySelector('.CornerAnimayedFlex').insertAdjacentHTML('afterBegin', ''); + document.getElementById('collapsed-button').onclick = function () { + document.querySelectorAll('.ContentItem-rightButton').forEach(function (el) { + if (el.hasAttribute('data-zop-retract-question')) { + el.click() + } + }); + } } } @@ -108,7 +108,7 @@ function collapsedNowAnswer(selectors) { backToTop(selectors) // 快捷回到顶部 if (!menu_value('menu_collapsedNowAnswer')) return document.querySelector(selectors).onclick = function(event){ - if (event.target==this) { + if (event.target == this) { // 下面这段主要是 [收起回答],顺便 [收起评论](如果展开了的话) let rightButton = document.querySelector('.ContentItem-actions.Sticky.RichContent-actions.is-fixed.is-bottom') // 悬浮在底部的 [收起回答](此时正在浏览回答内容 [中间区域]) @@ -208,7 +208,7 @@ function collapsedNowAnswer(selectors) { function backToTop(selectors) { if (!menu_value('menu_backToTop')) return document.querySelector(selectors).oncontextmenu = function(event){ - if (event.target==this) { + if (event.target == this) { event.preventDefault(); window.scrollTo(0,0) } @@ -486,8 +486,10 @@ function blockUsers(type) { item1 = target.querySelector('a.UserLink-link'), name = item1.textContent, userid = item1.href.split('/')[4]; - item.insertAdjacentHTML('beforeend', ``); - item.lastElementChild.onclick = function(){blockUsers_button_add(this.dataset.name, this.dataset.userid, false)} + if (item && !target.querySelector('button[data-name][data-userid]')) { + item.insertAdjacentHTML('beforeend', ``); + item.lastElementChild.onclick = function(){blockUsers_button_add(this.dataset.name, this.dataset.userid, false)} + } } } } @@ -1149,64 +1151,79 @@ function addLocationchange() { (function() { removeLogin(); // 移除登录弹窗 - closeFloatingComments(); // 快捷关闭悬浮评论(监听点击事件,点击网页两侧空白处) - questionInvitation(); // 默认折叠邀请 setInterval(originalPic,100); // 默认高清原图 if (menu_value('menu_directLink')) setInterval(directLink, 100); // 默认站外直链 - blockKeywords('comment'); // 屏蔽指定关键词(评论) - - if (window.location.href.indexOf("question") > -1) { // 回答页 // - if (window.location.href.indexOf("waiting") == -1) { - collapsedAnswer(); // 一键收起回答 - collapsedNowAnswer(".QuestionPage"); // 收起当前回答 + 快捷返回顶部 - collapsedNowAnswer(".Question-main"); // 收起当前回答 + 快捷返回顶部 - questionRichTextMore(); // 展开问题描述 - blockUsers('question'); // 屏蔽指定用户 - blockYanXuan(); // 屏蔽盐选内容 + addLocationchange(); + window.addEventListener('locationchange', function(){ // 针对的是从单个回答页跳转到完整回答页时 + if (window.location.pathname.indexOf('question') > -1 && window.location.pathname.indexOf('waiting') == -1 && window.location.pathname.indexOf('answer') == -1) { // 回答页 // + setTimeout(function(){ + collapsedNowAnswer('.QuestionPage'); // 收起当前回答 + 快捷返回顶部 + collapsedNowAnswer('.Question-main'); // 收起当前回答 + 快捷返回顶部 + questionRichTextMore(); // 展开问题描述 + blockUsers('question'); // 屏蔽指定用户 + blockYanXuan(); // 屏蔽盐选内容 + }, 300); } - setInterval(topTime_question, 300); // 置顶显示时间 - } else if (window.location.href.indexOf("search") > -1) { // 搜索结果页 // - collapsedAnswer(); // 一键收起回答 - collapsedNowAnswer("main div"); // 收起当前回答 + 快捷返回顶部 - collapsedNowAnswer(".Search-container"); // 收起当前回答 + 快捷返回顶部 - setInterval(topTime_search, 300); // 置顶显示时间 - EventXMLHttpRequest(); // 区分问题文章 - blockUsers('search'); // 屏蔽指定用户 - blockKeywords('search'); // 屏蔽指定关键词 - } else if (window.location.href.indexOf("topic") > -1) { // 话题页 // - if (window.location.href.indexOf("hot") > -1 || window.location.href.indexOf("top-answers") > -1) { // 仅限 [讨论] [精华] - collapsedAnswer(); // 一键收起回答 - collapsedNowAnswer("main.App-main"); // 收起当前回答 + 快捷返回顶部 - collapsedNowAnswer(".ContentLayout"); // 收起当前回答 + 快捷返回顶部 - setInterval(topTime_people, 300); // 置顶显示时间 - EventXMLHttpRequest(); // 区分问题文章 - blockUsers('topic'); // 屏蔽指定用户 - blockKeywords('topic'); // 屏蔽指定关键词 + }) + + if (GM_info.scriptHandler === 'Violentmonkey') { + setTimeout(start, 300); + } else { + start(); + } + + function start(){ + collapsedAnswer(); // 一键收起回答 + closeFloatingComments(); // 快捷关闭悬浮评论(监听点击事件,点击网页两侧空白处) + questionInvitation(); // 默认折叠邀请 + blockKeywords('comment'); // 屏蔽指定关键词(评论) + if (window.location.href.indexOf('question') > -1) { // 回答页 // + if (window.location.href.indexOf('waiting') == -1) { + collapsedNowAnswer('.QuestionPage'); // 收起当前回答 + 快捷返回顶部 + collapsedNowAnswer('.Question-main'); // 收起当前回答 + 快捷返回顶部 + questionRichTextMore(); // 展开问题描述 + blockUsers('question'); // 屏蔽指定用户 + blockYanXuan(); // 屏蔽盐选内容 + } + setInterval(topTime_question, 300); // 置顶显示时间 + } else if (window.location.href.indexOf('search') > -1) { // 搜索结果页 // + collapsedNowAnswer('main div'); // 收起当前回答 + 快捷返回顶部 + collapsedNowAnswer('.Search-container'); // 收起当前回答 + 快捷返回顶部 + setInterval(topTime_search, 300); // 置顶显示时间 + EventXMLHttpRequest(); // 区分问题文章 + blockUsers('search'); // 屏蔽指定用户 + blockKeywords('search'); // 屏蔽指定关键词 + } else if (window.location.href.indexOf('topic') > -1) { // 话题页 // + if (window.location.href.indexOf('hot') > -1 || window.location.href.indexOf('top-answers') > -1) { // 仅限 [讨论] [精华] + collapsedNowAnswer('main.App-main'); // 收起当前回答 + 快捷返回顶部 + collapsedNowAnswer('.ContentLayout'); // 收起当前回答 + 快捷返回顶部 + setInterval(topTime_people, 300); // 置顶显示时间 + EventXMLHttpRequest(); // 区分问题文章 + blockUsers('topic'); // 屏蔽指定用户 + blockKeywords('topic'); // 屏蔽指定关键词 + } + } else if (window.location.href.indexOf('zhuanlan') > -1){ // 文章 // + backToTop('article.Post-Main.Post-NormalMain'); // 快捷返回顶部 + backToTop('div.Post-Sub.Post-NormalSub'); // 快捷返回顶部 + setInterval(topTime_zhuanlan, 300); // 置顶显示时间 + blockUsers(); // 屏蔽指定用户 + } else if (window.location.href.indexOf('column') > -1) { // 专栏 // + collapsedNowAnswer('main div'); // 收起当前回答 + 快捷返回顶部 + setInterval(topTime_zhuanlan, 300); // 置顶显示时间 + blockUsers(); // 屏蔽指定用户 + } else if (window.location.href.indexOf('people') > -1 || window.location.href.indexOf('org') > -1) { // 用户主页 // + collapsedNowAnswer('main div'); // 收起当前回答 + 快捷返回顶部 + collapsedNowAnswer('.Profile-main'); // 收起当前回答 + 快捷返回顶部 + setInterval(topTime_people, 300); // 置顶显示时间 + blockUsers('people'); // 屏蔽指定用户 + blockKeywords('people'); // 屏蔽指定关键词 + } else { // 首页 // + collapsedNowAnswer('main div'); // 收起当前回答 + 快捷返回顶部 + collapsedNowAnswer('.Topstory-container'); // 收起当前回答 + 快捷返回顶部 + setInterval(topTime_index, 300); // 置顶显示时间 + EventXMLHttpRequest(); // 区分问题文章 + blockUsers('index'); // 屏蔽指定用户 + blockKeywords('index'); // 屏蔽指定关键词 } - } else if (window.location.href.indexOf("zhuanlan") > -1){ // 文章 // - backToTop("article.Post-Main.Post-NormalMain"); // 快捷返回顶部 - backToTop("div.Post-Sub.Post-NormalSub"); // 快捷返回顶部 - setInterval(topTime_zhuanlan, 300); // 置顶显示时间 - blockUsers(); // 屏蔽指定用户 - } else if (window.location.href.indexOf("column") > -1) { // 专栏 // - collapsedAnswer(); // 一键收起回答 - collapsedNowAnswer("main div"); // 收起当前回答 + 快捷返回顶部 - setInterval(topTime_zhuanlan, 300); // 置顶显示时间 - blockUsers(); // 屏蔽指定用户 - } else if (window.location.href.indexOf("people") > -1 || window.location.href.indexOf("org") > -1) { // 用户主页 // - collapsedAnswer(); // 一键收起回答 - collapsedNowAnswer("main div"); // 收起当前回答 + 快捷返回顶部 - collapsedNowAnswer(".Profile-main"); // 收起当前回答 + 快捷返回顶部 - setInterval(topTime_people, 300); // 置顶显示时间 - blockUsers('people'); // 屏蔽指定用户 - blockKeywords('people'); // 屏蔽指定关键词 - } else { // 首页 // - collapsedAnswer(); // 一键收起回答 - collapsedNowAnswer("main div"); // 收起当前回答 + 快捷返回顶部 - collapsedNowAnswer(".Topstory-container"); // 收起当前回答 + 快捷返回顶部 - setInterval(topTime_index, 300); // 置顶显示时间 - EventXMLHttpRequest(); // 区分问题文章 - blockUsers('index'); // 屏蔽指定用户 - blockKeywords('index'); // 屏蔽指定关键词 } })(); \ No newline at end of file From 94d312ebdda1dd65691cf470b9b86434375b127d Mon Sep 17 00:00:00 2001 From: xiu2 <54703944+XIU2@users.noreply.github.com> Date: Wed, 11 Aug 2021 11:42:39 +0800 Subject: [PATCH 0010/1990] =?UTF-8?q?=E6=96=B0=E5=A2=9E=20[=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=E6=94=B6=E8=B5=B7=E5=9B=9E=E7=AD=94]=20=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Zhihu-Enhanced.user.js | 95 +++++++++++++++++++++++++++++------------- 1 file changed, 67 insertions(+), 28 deletions(-) diff --git a/Zhihu-Enhanced.user.js b/Zhihu-Enhanced.user.js index f89ae026d..b771477a3 100644 --- a/Zhihu-Enhanced.user.js +++ b/Zhihu-Enhanced.user.js @@ -1,8 +1,8 @@ // ==UserScript== // @name 知乎增强 -// @version 1.5.4 +// @version 1.5.5 // @author X.I.U -// @description 移除登录弹窗、一键收起回答、收起当前回答/评论(点击两侧空白处)、快捷回到顶部(右键两侧空白处)、屏蔽用户 (发布的内容)、屏蔽关键词(标题/评论)、屏蔽盐选内容、展开问题描述、置顶显示时间、显示问题时间、区分问题文章、默认高清原图、默认站外直链 +// @description 移除登录弹窗、默认收起回答、一键收起回答、收起当前回答/评论(点击两侧空白处)、快捷回到顶部(右键两侧空白处)、屏蔽用户 (发布的内容)、屏蔽关键词(标题/评论)、屏蔽盐选内容、展开问题描述、置顶显示时间、显示问题时间、区分问题文章、默认高清原图、默认站外直链 // @match *://www.zhihu.com/* // @match *://zhuanlan.zhihu.com/* // @icon https://static.zhihu.com/heifetz/favicon.ico @@ -23,6 +23,7 @@ 'use strict'; var menu_ALL = [ + ['menu_defaultCollapsedAnswer', '默认收起回答', '默认收起回答', true], ['menu_collapsedAnswer', '一键收起回答', '一键收起回答', true], ['menu_collapsedNowAnswer', '收起当前回答/评论(点击两侧空白处)', '收起当前回答/评论', true], ['menu_backToTop', '快捷回到顶部(右键两侧空白处)', '快捷回到顶部', true], @@ -86,6 +87,45 @@ function menu_value(menuName) { } +// 默认收起回答 +function defaultCollapsedAnswer() { + if (!menu_value('menu_defaultCollapsedAnswer')) return + const callback = (mutationsList, observer) => { + for (const mutation of mutationsList) { + for (const target of mutation.addedNodes) { + if (target.nodeType != 1) return + if (target.className === 'List-item' || target.className === 'Card AnswerCard') { + if (target.querySelector('.RichContent-inner').offsetHeight > 300) { + let button = target.querySelector('.ContentItem-rightButton[data-zop-retract-question]'); + if (button) { + button.click(); + } + } + } + } + } + }; + const observer = new MutationObserver(callback); + observer.observe(document, { childList: true, subtree: true }); + defaultCollapsedAnswer_(); + window.addEventListener('locationchange', function(){ + setTimeout(defaultCollapsedAnswer_, 500); // 网页 URL 变化后再次执行 + }) + + // 针对的是打开网页后直接加载的前面几个回答(上面哪些是针对动态加载的回答) + function defaultCollapsedAnswer_() { + document.querySelectorAll('.List-item, .Card.AnswerCard').forEach(function(item){ + if (item.querySelector('.RichContent-inner').offsetHeight > 300) { + let button = item.querySelector('.ContentItem-rightButton[data-zop-retract-question]'); + if (button) { + button.click(); + } + } + }) + } +} + + // 一键收起回答 function collapsedAnswer() { if (!menu_value('menu_collapsedAnswer')) return @@ -293,7 +333,6 @@ function blockUsers(type) { } blockKeywords_now(); - addLocationchange(); window.addEventListener('locationchange', function(){ setTimeout(blockKeywords_now, 500); // 网页 URL 变化后再次执行 }) @@ -402,7 +441,6 @@ function blockUsers(type) { } setTimeout(blockUsers_now, 500); - addLocationchange(); window.addEventListener('locationchange', function(){ setTimeout(blockUsers_now, 500); // 网页 URL 变化后再次执行 }) @@ -619,7 +657,6 @@ function blockKeywords(type) { } blockKeywords_now(); - addLocationchange(); window.addEventListener('locationchange', function(){ setTimeout(blockKeywords_now, 500); // 网页 URL 变化后再次执行 }) @@ -667,7 +704,6 @@ function blockKeywords(type) { } setTimeout(blockKeywords_now, 500); - addLocationchange(); window.addEventListener('locationchange', function(){ setTimeout(blockKeywords_now, 500); // 网页 URL 变化后再次执行 }) @@ -890,6 +926,28 @@ function EventXMLHttpRequest() { } +// 自定义 locationchange 事件(用来监听 URL 变化) +function addLocationchange() { + history.pushState = ( f => function pushState(){ + var ret = f.apply(this, arguments); + window.dispatchEvent(new Event('pushstate')); + window.dispatchEvent(new Event('locationchange')); + return ret; + })(history.pushState); + + history.replaceState = ( f => function replaceState(){ + var ret = f.apply(this, arguments); + window.dispatchEvent(new Event('replacestate')); + window.dispatchEvent(new Event('locationchange')); + return ret; + })(history.replaceState); + + window.addEventListener('popstate',()=>{ + window.dispatchEvent(new Event('locationchange')) + }); +} + + // [完整显示时间 + 置顶显示时间] 功能修改自:https://greasyfork.org/scripts/402808(从 JQuery 改为原生 JavaScript,且优化了代码) // 完整显示时间 + 置顶显示时间 - 首页 function topTime_index() { @@ -1128,32 +1186,12 @@ function questionInvitation(){ }); } -// 自定义 locationchange 事件(用来监听 URL 变化) -function addLocationchange() { - history.pushState = ( f => function pushState(){ - var ret = f.apply(this, arguments); - window.dispatchEvent(new Event('pushstate')); - window.dispatchEvent(new Event('locationchange')); - return ret; - })(history.pushState); - - history.replaceState = ( f => function replaceState(){ - var ret = f.apply(this, arguments); - window.dispatchEvent(new Event('replacestate')); - window.dispatchEvent(new Event('locationchange')); - return ret; - })(history.replaceState); - - window.addEventListener('popstate',()=>{ - window.dispatchEvent(new Event('locationchange')) - }); -} (function() { + addLocationchange(); removeLogin(); // 移除登录弹窗 setInterval(originalPic,100); // 默认高清原图 if (menu_value('menu_directLink')) setInterval(directLink, 100); // 默认站外直链 - addLocationchange(); window.addEventListener('locationchange', function(){ // 针对的是从单个回答页跳转到完整回答页时 if (window.location.pathname.indexOf('question') > -1 && window.location.pathname.indexOf('waiting') == -1 && window.location.pathname.indexOf('answer') == -1) { // 回答页 // setTimeout(function(){ @@ -1166,7 +1204,7 @@ function addLocationchange() { } }) - if (GM_info.scriptHandler === 'Violentmonkey') { + if (GM_info.scriptHandler === 'Violentmonkey') { // Violentmonkey 比 Tampermonkey 加载更早,会导致一些元素还没加载,因此需要延迟一会儿 setTimeout(start, 300); } else { start(); @@ -1184,6 +1222,7 @@ function addLocationchange() { questionRichTextMore(); // 展开问题描述 blockUsers('question'); // 屏蔽指定用户 blockYanXuan(); // 屏蔽盐选内容 + defaultCollapsedAnswer(); // 默认收起回答 } setInterval(topTime_question, 300); // 置顶显示时间 } else if (window.location.href.indexOf('search') > -1) { // 搜索结果页 // From 9bd9f342ea4824c0b74773a672ee489dc6f08875 Mon Sep 17 00:00:00 2001 From: xiu2 <54703944+XIU2@users.noreply.github.com> Date: Thu, 12 Aug 2021 00:04:13 +0800 Subject: [PATCH 0011/1990] =?UTF-8?q?=E6=96=B0=E5=A2=9E=20[=E7=A0=82?= =?UTF-8?q?=E4=B9=8B=E8=88=B9=E5=8A=A8=E6=BC=AB=E5=AE=B6]=20=E6=94=AF?= =?UTF-8?q?=E6=8C=81;=20=E4=BC=98=E5=8C=96=20[=E5=8F=A4=E9=A3=8E=E6=BC=AB?= =?UTF-8?q?=E7=94=BB=E7=BD=91]=EF=BC=88=E8=87=AA=E5=8A=A8=E7=BF=BB?= =?UTF-8?q?=E9=A1=B5=E7=9A=84=20URL=20=E4=BC=9A=E5=86=99=E5=85=A5=E5=8E=86?= =?UTF-8?q?=E5=8F=B2=E8=AE=B0=E5=BD=95=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Autopage.user.js | 56 +++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 51 insertions(+), 5 deletions(-) diff --git a/Autopage.user.js b/Autopage.user.js index 009328edb..d12edd82a 100644 --- a/Autopage.user.js +++ b/Autopage.user.js @@ -1,8 +1,8 @@ // ==UserScript== // @name 自动无缝翻页 -// @version 1.4.9 +// @version 1.5.0 // @author X.I.U -// @description 自动无缝翻页,目前支持:所有「Discuz!、Flarum」论坛、百度、豆瓣、微博、千图网、3DM、游侠网、游民星空、Steam 创意工坊、423Down、APPHOT、不死鸟、亿破姐、小众软件、微当下载、落尘之木、异次元软件、老殁殁漂遥、异星软件空间、古风漫画网、RARBG、PubMed、AfreecaTV、GreasyFork、AlphaCoders、Crackhub213、FitGirl Repacks... +// @description 自动无缝翻页,目前支持:所有「Discuz!、Flarum」论坛、百度、豆瓣、微博、千图网、3DM、游侠网、游民星空、Steam 创意工坊、423Down、APPHOT、不死鸟、亿破姐、小众软件、微当下载、落尘之木、异次元软件、老殁殁漂遥、异星软件空间、古风漫画网、砂之船动漫家、RARBG、PubMed、AfreecaTV、GreasyFork、AlphaCoders、Crackhub213、FitGirl Repacks... // @match *://*/* // @connect www.gamersky.com // @icon https://i.loli.net/2021/03/07/rdijeYm83pznxWq.png @@ -25,7 +25,7 @@ const websiteList = ['www.baidu.com', 'movie.douban.com', 'weibo.com', 'www.58pic.com', 'www.3dmgame.com', 'www.ali213.net', 'gl.ali213.net', 'www.gamersky.com', 'steamcommunity.com', 'www.423down.com', 'apphot.cc', 'iao.su', 'www.ypojie.com', 'www.appinn.com', 'www.weidown.com', 'www.luochenzhimu.com', 'www.iplaysoft.com', 'www.mpyit.com', 'www.yxssp.com', - 'www.gufengmh8.com', + 'www.gufengmh8.com', 'www.szcdmj.com', 'rarbgprx.org', 'pubmed.ncbi.nlm.nih.gov', 'www.afreecatv.com', 'greasyfork.org', 'art.alphacoders.com', 'wall.alphacoders.com', 'avatars.alphacoders.com', 'mobile.alphacoders.com', 'crackhub.site', 'fitgirl-repacks.site']; @@ -454,6 +454,20 @@ scrollDelta: 2333 } }, + szcdmj: { + SiteTypeID: 0, + pager: { + type: 1, + nextLink: '//div[@class="fanye"][1]/a[@href][text()="下一页" or text()="下一话"]', + pageElement: 'css;.comicpage > div,title', + HT_insert: ['css;.comicpage', 3], + replaceE: 'css;.fanye,h1.title', + scrollDelta: 2000 + }, + function: { + before: szcdmj_beforeFunction + } + }, rarbgprx: { SiteTypeID: 0, pager: { @@ -651,7 +665,16 @@ curSite = DBSite.yxssp; break; case 'www.gufengmh8.com': // < 古风漫画网 > - curSite = DBSite.gufengmh8; + if (location.pathname.indexOf('.html') > -1) { + let chapterScroll = document.getElementById('chapter-scroll') // 强制为 [下拉阅读] 模式 + if (chapterScroll && chapterScroll.className === '') { + chapterScroll.click(); + } + curSite = DBSite.gufengmh8; + } + break; + case 'www.szcdmj.com': // < 砂之船动漫家 > + if (location.pathname.indexOf('/szcchapter/') > -1) curSite = DBSite.szcdmj; break; case 'rarbgprx.org': // < RARBG > curSite = DBSite.rarbgprx; @@ -855,6 +878,7 @@ // gufengmh8 function gufengmh8_functionAdd(pageElems) { if (pageElems) { + let url = curSite.pageUrl; curSite.pageUrl = ''; // 留空后,下一页 URL 依然交给 gufengmh8_function 函数获取(方便点) pageElems = pageElems[0]; //console.log(pageElems) @@ -868,7 +892,9 @@ } else if (one.indexOf('chapterPath') > -1) { // 图片文件路径 chapterPath = one.split('"')[1]; } else if (one.indexOf('pageTitle') > -1) { // 网页标题 - window.document.title = one.split('"')[1]; // 修改当前网页标题为下一页的标题 + let title = one.split('"')[1]; + window.history.pushState(`{title: ${document.title}, url: ${location.href}}`, title, url); // 添加历史记录 + window.document.title = title; // 修改当前网页标题为下一页的标题 } }) if (chapterImages && chapterPath) { @@ -884,6 +910,26 @@ } + // szcdmj 的插入前函数(加载图片) + function szcdmj_beforeFunction(pageElems) { + pageElems.forEach(function (one) { + if (one.tagName === 'TITLE') { + let title = one.textContent; + window.history.pushState(`{title: ${document.title}, url: ${location.href}}`, title, curSite.pageUrl); // 添加历史记录 + window.document.title = title; // 修改当前网页标题为下一页的标题 + one.style.display = 'none'; + } else { + let now = one.querySelector('img[data-original]') + if (now) { + now.setAttribute('src', now.dataset.original) + now.style.display = 'inline'; + } + } + }); + return pageElems + } + + // 自动无缝翻页 function pageLoading() { if (curSite.SiteTypeID > 0) { From 955e2e0e7297e13b5cf6c60cda8a8bcddb6e0ab6 Mon Sep 17 00:00:00 2001 From: liangjiancang <42267675+liangjiancang@users.noreply.github.com> Date: Thu, 12 Aug 2021 21:03:03 +0800 Subject: [PATCH 0012/1990] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20[=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=E6=94=B6=E8=B5=B7=E5=9B=9E=E7=AD=94]=20=E5=AF=BC?= =?UTF-8?q?=E8=87=B4=E5=9B=9E=E7=AD=94=E7=9A=84=E5=BA=95=E9=83=A8=E6=A8=AA?= =?UTF-8?q?=E6=9D=A1=E5=A4=B1=E5=8E=BB=E6=82=AC=E6=B5=AE=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98=20(#67)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Zhihu-Enhanced.user.js | 42 ++++++++++++------------------------------ 1 file changed, 12 insertions(+), 30 deletions(-) diff --git a/Zhihu-Enhanced.user.js b/Zhihu-Enhanced.user.js index b771477a3..cab0ae441 100644 --- a/Zhihu-Enhanced.user.js +++ b/Zhihu-Enhanced.user.js @@ -90,39 +90,21 @@ function menu_value(menuName) { // 默认收起回答 function defaultCollapsedAnswer() { if (!menu_value('menu_defaultCollapsedAnswer')) return - const callback = (mutationsList, observer) => { - for (const mutation of mutationsList) { - for (const target of mutation.addedNodes) { - if (target.nodeType != 1) return - if (target.className === 'List-item' || target.className === 'Card AnswerCard') { - if (target.querySelector('.RichContent-inner').offsetHeight > 300) { - let button = target.querySelector('.ContentItem-rightButton[data-zop-retract-question]'); - if (button) { - button.click(); - } - } - } - } - } - }; - const observer = new MutationObserver(callback); - observer.observe(document, { childList: true, subtree: true }); - defaultCollapsedAnswer_(); - window.addEventListener('locationchange', function(){ - setTimeout(defaultCollapsedAnswer_, 500); // 网页 URL 变化后再次执行 - }) - - // 针对的是打开网页后直接加载的前面几个回答(上面哪些是针对动态加载的回答) - function defaultCollapsedAnswer_() { - document.querySelectorAll('.List-item, .Card.AnswerCard').forEach(function(item){ - if (item.querySelector('.RichContent-inner').offsetHeight > 300) { - let button = item.querySelector('.ContentItem-rightButton[data-zop-retract-question]'); + (new MutationObserver(mutations => { + for (const mutation of mutations) { + if (!mutation.target.classList.contains('RichContent')) continue + for (const addedNode of mutation.addedNodes) { + if (mutation.target._defaultCollapsed) return + if (addedNode.nodeType != Node.ELEMENT_NODE) continue + const button = addedNode.querySelector('.ContentItem-actions.Sticky [data-zop-retract-question]') if (button) { - button.click(); + mutation.target._defaultCollapsed = true + button.click() + return } } - }) - } + } + })).observe(document, { childList: true, subtree: true }) } From 3719e04c9a7f710ce40081ae41c38fe4732b942b Mon Sep 17 00:00:00 2001 From: xiu2 <54703944+XIU2@users.noreply.github.com> Date: Thu, 12 Aug 2021 21:08:40 +0800 Subject: [PATCH 0013/1990] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20[=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=E6=94=B6=E8=B5=B7=E5=9B=9E=E7=AD=94]=20=E5=AF=BC?= =?UTF-8?q?=E8=87=B4=E5=9B=9E=E7=AD=94=E7=9A=84=E5=BA=95=E9=83=A8=E6=A8=AA?= =?UTF-8?q?=E6=9D=A1=E5=A4=B1=E5=8E=BB=E6=82=AC=E6=B5=AE=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98=20(#67)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Zhihu-Enhanced.user.js | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/Zhihu-Enhanced.user.js b/Zhihu-Enhanced.user.js index cab0ae441..a1ff645f2 100644 --- a/Zhihu-Enhanced.user.js +++ b/Zhihu-Enhanced.user.js @@ -1,6 +1,6 @@ // ==UserScript== // @name 知乎增强 -// @version 1.5.5 +// @version 1.5.6 // @author X.I.U // @description 移除登录弹窗、默认收起回答、一键收起回答、收起当前回答/评论(点击两侧空白处)、快捷回到顶部(右键两侧空白处)、屏蔽用户 (发布的内容)、屏蔽关键词(标题/评论)、屏蔽盐选内容、展开问题描述、置顶显示时间、显示问题时间、区分问题文章、默认高清原图、默认站外直链 // @match *://www.zhihu.com/* @@ -115,11 +115,7 @@ function collapsedAnswer() { document.head.appendChild(document.createElement('style')).textContent = '.CornerButton{margin-bottom:8px !important;}.CornerButtons{bottom:45px !important;}'; document.querySelector('.CornerAnimayedFlex').insertAdjacentHTML('afterBegin', ''); document.getElementById('collapsed-button').onclick = function () { - document.querySelectorAll('.ContentItem-rightButton').forEach(function (el) { - if (el.hasAttribute('data-zop-retract-question')) { - el.click() - } - }); + document.querySelectorAll('.ContentItem-rightButton[data-zop-retract-question]').forEach(function (el) {el.click()}); } } } From c5bcfaeed414d449a04a4091ef0bec69a345630e Mon Sep 17 00:00:00 2001 From: xiu2 <54703944+XIU2@users.noreply.github.com> Date: Thu, 12 Aug 2021 21:42:22 +0800 Subject: [PATCH 0014/1990] =?UTF-8?q?=E8=B0=83=E6=95=B4=20[=E4=B8=80?= =?UTF-8?q?=E9=94=AE=E6=94=B6=E8=B5=B7=E5=9B=9E=E7=AD=94]=20=E4=B8=BA?= =?UTF-8?q?=E9=BB=98=E8=AE=A4=E5=85=B3=E9=97=AD=EF=BC=88=E5=AD=98=E5=9C=A8?= =?UTF-8?q?=E7=BC=BA=E9=99=B7=E4=B8=94=E5=8F=AF=E8=A2=AB=20[=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=E6=94=B6=E8=B5=B7=E5=9B=9E=E7=AD=94]=20=E6=9B=BF?= =?UTF-8?q?=E4=BB=A3=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Zhihu-Enhanced.user.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/Zhihu-Enhanced.user.js b/Zhihu-Enhanced.user.js index a1ff645f2..56668bd93 100644 --- a/Zhihu-Enhanced.user.js +++ b/Zhihu-Enhanced.user.js @@ -24,7 +24,7 @@ 'use strict'; var menu_ALL = [ ['menu_defaultCollapsedAnswer', '默认收起回答', '默认收起回答', true], - ['menu_collapsedAnswer', '一键收起回答', '一键收起回答', true], + ['menu_collapsedAnswer', '一键收起回答', '一键收起回答', false], ['menu_collapsedNowAnswer', '收起当前回答/评论(点击两侧空白处)', '收起当前回答/评论', true], ['menu_backToTop', '快捷回到顶部(右键两侧空白处)', '快捷回到顶部', true], ['menu_blockUsers', '屏蔽指定用户', '屏蔽指定用户', true], @@ -108,14 +108,22 @@ function defaultCollapsedAnswer() { } -// 一键收起回答 +// 一键收起回答(全部) function collapsedAnswer() { if (!menu_value('menu_collapsedAnswer')) return if (document.querySelector('.CornerAnimayedFlex')) { document.head.appendChild(document.createElement('style')).textContent = '.CornerButton{margin-bottom:8px !important;}.CornerButtons{bottom:45px !important;}'; - document.querySelector('.CornerAnimayedFlex').insertAdjacentHTML('afterBegin', ''); + document.querySelector('.CornerAnimayedFlex').insertAdjacentHTML('afterBegin', ''); document.getElementById('collapsed-button').onclick = function () { - document.querySelectorAll('.ContentItem-rightButton[data-zop-retract-question]').forEach(function (el) {el.click()}); + document.querySelectorAll('.RichContent').forEach(function (el) { + if (el.querySelector('.RichContent-inner').offsetHeight > 400) { + const button = el.querySelector('.ContentItem-rightButton[data-zop-retract-question]') + if (button) { + el._defaultCollapsed = true + button.click() + } + } + }); } } } From 829fb25b23e77eb3725999193cf216b82a6b7c45 Mon Sep 17 00:00:00 2001 From: xiu2 <54703944+XIU2@users.noreply.github.com> Date: Thu, 12 Aug 2021 21:43:28 +0800 Subject: [PATCH 0015/1990] README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 11dc1b3fe..5f8b6fb50 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ | :----: | :---- | :---- | :----: | | [](https://github.com/XIU2) | **护眼模式** | 简单有效的全网通用护眼模式、夜间模式、暗黑模式~ | **[安装](https://greasyfork.org/zh-CN/scripts/426377)** \| **[备用](https://cdn.jsdelivr.net/gh/XIU2/UserScript@master/DarkMode.user.js)** | | [](https://www.zhihu.com/people/xiu2) | **知乎 美化** | 宽屏显示、**暗黑模式**、隐藏文章开头大图、调整图片最大高... | **[安装](https://greasyfork.org/zh-CN/scripts/412212)** \| **[备用](https://cdn.jsdelivr.net/gh/XIU2/UserScript@master/Zhihu-Beautification.user.js)** | -| [](https://www.zhihu.com/people/xiu2) | **知乎 增强** | **移除登录弹窗**、一键收起回答、屏蔽用户、屏蔽关键词、快... | **[安装](https://greasyfork.org/zh-CN/scripts/419081)** \| **[备用](https://cdn.jsdelivr.net/gh/XIU2/UserScript@master/Zhihu-Enhanced.user.js)** | +| [](https://www.zhihu.com/people/xiu2) | **知乎 增强** | **移除登录弹窗**、默认收起回答、屏蔽用户、屏蔽关键词、快... | **[安装](https://greasyfork.org/zh-CN/scripts/419081)** \| **[备用](https://cdn.jsdelivr.net/gh/XIU2/UserScript@master/Zhihu-Enhanced.user.js)** | | [](https://www.v2ex.com/) | **V2EX 增强** | **自动签到**、链接转图片、自动无缝翻页、新标签页打开链接... | **[安装](https://greasyfork.org/zh-CN/scripts/424246)** \| **[备用](https://cdn.jsdelivr.net/gh/XIU2/UserScript@master/V2ex-Enhanced.user.js)** | | [](https://github.com/XIU2) | **Github 增强** | **高速下载** Git Clone/SSH、Release、Raw、Code(ZIP) 文件... | **[安装](https://greasyfork.org/zh-CN/scripts/412245)** \| **[备用](https://cdn.jsdelivr.net/gh/XIU2/UserScript@master/GithubEnhanced-High-Speed-Download.user.js)** | | [](https://github.com/XIU2) | **自动无缝翻页 \*** | **所有 Discuz! / Flarum 论坛**、百度、豆瓣、微博、千图网... | **[安装](https://greasyfork.org/zh-CN/scripts/419215)** \| **[备用](https://cdn.jsdelivr.net/gh/XIU2/UserScript@master/Autopage.user.js)** | From 173b8d1995fa52fbd076b5e9fa4e5564409a0dbe Mon Sep 17 00:00:00 2001 From: xiu2 <54703944+XIU2@users.noreply.github.com> Date: Fri, 13 Aug 2021 12:38:56 +0800 Subject: [PATCH 0016/1990] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20=E9=83=A8?= =?UTF-8?q?=E5=88=86=20Discuz!=20=E8=AE=BA=E5=9D=9B=E7=BD=91=E9=A1=B5?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B=E8=AF=86=E5=88=AB=E9=94=99=E8=AF=AF=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Autopage.user.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Autopage.user.js b/Autopage.user.js index d12edd82a..723a3283f 100644 --- a/Autopage.user.js +++ b/Autopage.user.js @@ -1,6 +1,6 @@ // ==UserScript== // @name 自动无缝翻页 -// @version 1.5.0 +// @version 1.5.1 // @author X.I.U // @description 自动无缝翻页,目前支持:所有「Discuz!、Flarum」论坛、百度、豆瓣、微博、千图网、3DM、游侠网、游民星空、Steam 创意工坊、423Down、APPHOT、不死鸟、亿破姐、小众软件、微当下载、落尘之木、异次元软件、老殁殁漂遥、异星软件空间、古风漫画网、砂之船动漫家、RARBG、PubMed、AfreecaTV、GreasyFork、AlphaCoders、Crackhub213、FitGirl Repacks... // @match *://*/* @@ -714,13 +714,13 @@ // < 所有 Discuz!论坛 > } else if (webType === 2) { if (location.pathname.indexOf('.html') > -1) { // 判断是不是静态网页(.html 结尾) - if (location.pathname.indexOf('forum') > -1) { // 各版块帖子列表 + if (location.pathname.indexOf('/forum-') > -1) { // 各版块帖子列表 if (document.getElementById('autopbn')) { // 判断是否有 [下一页] 按钮 curSite = DBSite.discuz_forum; } else { curSite = DBSite.discuz_guide; } - } else if (location.pathname.indexOf('thread') > -1) { // 帖子内 + } else if (location.pathname.indexOf('/thread-') > -1) { // 帖子内 if (GM_getValue('menu_discuz_thread_page')) { curSite = DBSite.discuz_thread; hidePgbtn(); // 隐藏帖子内的 [下一页] 按钮 @@ -757,6 +757,7 @@ curSite = DBSite.flarum; } curSite.pageUrl = ''; // 下一页URL + //console.log(curSite); pageLoading(); // 自动无缝翻页 From 354fc59b323b44b1f05d5b367860b95df4e99bf5 Mon Sep 17 00:00:00 2001 From: xiu2 <54703944+XIU2@users.noreply.github.com> Date: Fri, 13 Aug 2021 13:51:29 +0800 Subject: [PATCH 0017/1990] =?UTF-8?q?=E4=BC=98=E5=8C=96=20=E5=8A=A0?= =?UTF-8?q?=E9=80=9F=E6=BA=90=E6=A0=B7=E5=BC=8F=EF=BC=88=E5=90=8C=E6=AD=A5?= =?UTF-8?q?=20Github=20=E6=A0=B7=E5=BC=8F=E5=8F=98=E5=8A=A8=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- GithubEnhanced-High-Speed-Download.user.js | 32 ++++++---------------- 1 file changed, 8 insertions(+), 24 deletions(-) diff --git a/GithubEnhanced-High-Speed-Download.user.js b/GithubEnhanced-High-Speed-Download.user.js index 77e807e7c..8ad44892d 100644 --- a/GithubEnhanced-High-Speed-Download.user.js +++ b/GithubEnhanced-High-Speed-Download.user.js @@ -1,6 +1,6 @@ // ==UserScript== // @name Github 增强 - 高速下载 -// @version 1.5.6 +// @version 1.5.7 // @author X.I.U // @description 高速下载 Git Clone/SSH、Release、Raw、Code(ZIP) 等文件、项目列表单文件快捷下载 (☁) // @match *://github.com/* @@ -29,7 +29,7 @@ fontColor = '#768390'; } else { backColor = '#161a21'; - fontColor = '#b2b8bf'; + fontColor = '#97a0aa'; } } else if (document.getElementsByTagName('html')[0].getAttribute('data-color-mode') === 'auto') { console.log(window.getComputedStyle(document.body).backgroundColor) @@ -38,7 +38,7 @@ fontColor = '#768390'; } else if (window.getComputedStyle(document.body).backgroundColor === 'rgb(13, 17, 23)') { backColor = '#161a21'; - fontColor = '#b2b8bf'; + fontColor = '#97a0aa'; } } //['https://gh.66ccff.work', '美国'], @@ -71,8 +71,8 @@ ['https://ghproxy.com','韩国首尔', ''] ], svg = [ - '', - '', + '', + '', '' ], style = ['padding:0 6px;margin-right: -1px;border-radius: 2px;background-color: '+backColor+';border-color: rgba(27, 31, 35, 0.1);font-size: 11px;color: '+fontColor+';']; @@ -134,22 +134,6 @@ addRawDownLink_(); // 在浏览器返回/前进时重新添加 Raw 下载链接(☁)事件 }) - /*pushHistory(); - window.addEventListener('popstate', function(e) { - addRawDownLink_(); // 在浏览器返回/前进时重新添加 Raw 下载链接(☁)事件 - }, false); - function pushHistory() { - let state = {title: 'title',url: '#'}; - window.history.pushState(state, '', ''); - }*/ - - /*let oldUrl = location.href, - timer = setInterval(function(){ - if (oldUrl != location.href) { - oldUrl = location.href; - addRawDownLink_(); // 在浏览器返回/前进时重新添加 Raw 下载链接(☁)事件 - } - }, 1000);*/ // Release function addRelease() { @@ -229,7 +213,7 @@ } for (let i=0;i${svg[0]}Download ZIP ${download_url[i][1]}` + _html += `
  • ${svg[0]}Download ZIP ${download_url[i][1]}
  • ` } html.insertAdjacentHTML('afterend', _html); } @@ -251,7 +235,7 @@ } for (let i=0;i
    ${svg[1]}
    ` + _html += `
    ${svg[1]}
    ` } html.insertAdjacentHTML('afterend', _html); } @@ -271,7 +255,7 @@ } for (let i=0;i
    ${svg[1]}
    ` + _html += `
    ${svg[1]}
    ` } html.insertAdjacentHTML('afterend', _html); } From a0c56a107e0c06bcc6faf719de2c1a332a34c70a Mon Sep 17 00:00:00 2001 From: liangjiancang <42267675+liangjiancang@users.noreply.github.com> Date: Fri, 13 Aug 2021 19:36:23 +0800 Subject: [PATCH 0018/1990] =?UTF-8?q?=E4=BC=98=E5=8C=96=20[=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=E6=94=B6=E8=B5=B7=E5=9B=9E=E7=AD=94]=20=E5=92=8C=20[?= =?UTF-8?q?=E4=B8=80=E9=94=AE=E6=94=B6=E8=B5=B7=E5=9B=9E=E7=AD=94]=20?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=20(#70)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Zhihu-Enhanced.user.js | 90 +++++++++++++++++++++++++++++++----------- 1 file changed, 67 insertions(+), 23 deletions(-) diff --git a/Zhihu-Enhanced.user.js b/Zhihu-Enhanced.user.js index 56668bd93..03d8c4743 100644 --- a/Zhihu-Enhanced.user.js +++ b/Zhihu-Enhanced.user.js @@ -87,24 +87,53 @@ function menu_value(menuName) { } -// 默认收起回答 -function defaultCollapsedAnswer() { - if (!menu_value('menu_defaultCollapsedAnswer')) return - (new MutationObserver(mutations => { - for (const mutation of mutations) { - if (!mutation.target.classList.contains('RichContent')) continue - for (const addedNode of mutation.addedNodes) { - if (mutation.target._defaultCollapsed) return - if (addedNode.nodeType != Node.ELEMENT_NODE) continue - const button = addedNode.querySelector('.ContentItem-actions.Sticky [data-zop-retract-question]') - if (button) { - mutation.target._defaultCollapsed = true - button.click() - return +// 添加收器回答观察器 +function getCollapsedAnswerObserver() { + if (!window._collapsedAnswerObserver) { + const ob = new MutationObserver(mutations => { + for (const mutation of mutations) { + if (mutation.target.hasAttribute('script-collapsed')) return + if (!mutation.target.classList.contains('RichContent')) continue + for (const addedNode of mutation.addedNodes) { + if (addedNode.nodeType != Node.ELEMENT_NODE) continue + const button = addedNode.querySelector('.ContentItem-actions.Sticky [data-zop-retract-question]') + if (button) { + mutation.target.setAttribute('script-collapsed', '') + button.click() + return + } } } + }) + + ob.start = function() { + if (!this._active) { + this.observe(document, { childList: true, subtree: true }) + this._active = true + } + } + ob.end = function() { + if (this._active) { + this.disconnect() + } } - })).observe(document, { childList: true, subtree: true }) + + window.addEventListener('locationchange', function() { + ob[window.location.href.indexOf('answer') == -1 ? 'start' : 'end']() + }) + window._collapsedAnswerObserver = ob + } + return window._collapsedAnswerObserver +} + + +// 默认收起回答 +function defaultCollapsedAnswer() { + if (!menu_value('menu_defaultCollapsedAnswer')) return + const ob = getCollapsedAnswerObserver() + if (window.location.href.indexOf('answer') == -1) { + ob.start() + } } @@ -115,15 +144,30 @@ function collapsedAnswer() { document.head.appendChild(document.createElement('style')).textContent = '.CornerButton{margin-bottom:8px !important;}.CornerButtons{bottom:45px !important;}'; document.querySelector('.CornerAnimayedFlex').insertAdjacentHTML('afterBegin', ''); document.getElementById('collapsed-button').onclick = function () { - document.querySelectorAll('.RichContent').forEach(function (el) { - if (el.querySelector('.RichContent-inner').offsetHeight > 400) { - const button = el.querySelector('.ContentItem-rightButton[data-zop-retract-question]') - if (button) { - el._defaultCollapsed = true - button.click() - } + document.querySelectorAll('[script-collapsed]').forEach(function(scriptCollapsed) { + scriptCollapsed.querySelectorAll('.ContentItem-actions [data-zop-retract-question], .ContentItem-actions.Sticky [data-zop-retract-question]').forEach(function(button) { + button.click() + }) + }) + document.querySelectorAll(':not([script-collapsed]) .ContentItem-actions.Sticky [data-zop-retract-question]').forEach(function(button) { + let el = button.parentElement + while (!el?.classList.contains('RichContent')) { + el = el.parentElement } - }); + if (el) { + el.setAttribute('script-collapsed', '') + } + button.click() + }) + const ob = getCollapsedAnswerObserver() + ob.start() + if (!menu_value('menu_defaultCollapsedAnswer') && !ob._disconnectListener) { + window.addEventListener('locationchange', function() { + ob.end() + window._collapsedAnswerObserver = null + }) + ob._disconnectListener = true + } } } } From eda436ba8a33c7fbbd99e349e265c531ad861462 Mon Sep 17 00:00:00 2001 From: xiu2 <54703944+XIU2@users.noreply.github.com> Date: Fri, 13 Aug 2021 19:38:05 +0800 Subject: [PATCH 0019/1990] =?UTF-8?q?=E4=BC=98=E5=8C=96=20=E8=84=9A?= =?UTF-8?q?=E6=9C=AC=E8=8F=9C=E5=8D=95=E5=BC=80=E5=85=B3=E9=80=9A=E7=9F=A5?= =?UTF-8?q?=EF=BC=88=E7=82=B9=E5=87=BB=E9=80=9A=E7=9F=A5=E5=8D=B3=E5=8F=AF?= =?UTF-8?q?=E5=88=B7=E6=96=B0=E7=BD=91=E9=A1=B5=EF=BC=89;=20=E6=81=A2?= =?UTF-8?q?=E5=A4=8D=20[=E4=B8=80=E9=94=AE=E6=94=B6=E8=B5=B7=E5=9B=9E?= =?UTF-8?q?=E7=AD=94]=20=E4=B8=BA=E9=BB=98=E8=AE=A4=E5=BC=80=E5=90=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Zhihu-Enhanced.user.js | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/Zhihu-Enhanced.user.js b/Zhihu-Enhanced.user.js index 03d8c4743..35fe74f03 100644 --- a/Zhihu-Enhanced.user.js +++ b/Zhihu-Enhanced.user.js @@ -1,6 +1,6 @@ // ==UserScript== // @name 知乎增强 -// @version 1.5.6 +// @version 1.5.7 // @author X.I.U // @description 移除登录弹窗、默认收起回答、一键收起回答、收起当前回答/评论(点击两侧空白处)、快捷回到顶部(右键两侧空白处)、屏蔽用户 (发布的内容)、屏蔽关键词(标题/评论)、屏蔽盐选内容、展开问题描述、置顶显示时间、显示问题时间、区分问题文章、默认高清原图、默认站外直链 // @match *://www.zhihu.com/* @@ -24,7 +24,7 @@ 'use strict'; var menu_ALL = [ ['menu_defaultCollapsedAnswer', '默认收起回答', '默认收起回答', true], - ['menu_collapsedAnswer', '一键收起回答', '一键收起回答', false], + ['menu_collapsedAnswer', '一键收起回答', '一键收起回答', true], ['menu_collapsedNowAnswer', '收起当前回答/评论(点击两侧空白处)', '收起当前回答/评论', true], ['menu_backToTop', '快捷回到顶部(右键两侧空白处)', '快捷回到顶部', true], ['menu_blockUsers', '屏蔽指定用户', '屏蔽指定用户', true], @@ -68,10 +68,10 @@ function registerMenuCommand() { function menu_switch(menu_status, Name, Tips) { if (menu_status == 'true'){ GM_setValue(`${Name}`, false); - GM_notification({text: `已关闭 [${Tips}] 功能\n(刷新网页后生效)`, timeout: 3500}); + GM_notification({text: `已关闭 [${Tips}] 功能\n(点击刷新网页后生效)`, timeout: 3500, onclick: function(){location.reload();}}); }else{ GM_setValue(`${Name}`, true); - GM_notification({text: `已开启 [${Tips}] 功能\n(刷新网页后生效)`, timeout: 3500}); + GM_notification({text: `已开启 [${Tips}] 功能\n(点击刷新网页后生效)`, timeout: 3500, onclick: function(){location.reload();}}); } registerMenuCommand(); // 重新注册脚本菜单 }; @@ -87,10 +87,10 @@ function menu_value(menuName) { } -// 添加收器回答观察器 +// 添加收起回答观察器 function getCollapsedAnswerObserver() { if (!window._collapsedAnswerObserver) { - const ob = new MutationObserver(mutations => { + const observer = new MutationObserver(mutations => { for (const mutation of mutations) { if (mutation.target.hasAttribute('script-collapsed')) return if (!mutation.target.classList.contains('RichContent')) continue @@ -106,22 +106,22 @@ function getCollapsedAnswerObserver() { } }) - ob.start = function() { + observer.start = function() { if (!this._active) { this.observe(document, { childList: true, subtree: true }) this._active = true } } - ob.end = function() { + observer.end = function() { if (this._active) { this.disconnect() } } window.addEventListener('locationchange', function() { - ob[window.location.href.indexOf('answer') == -1 ? 'start' : 'end']() + observer[window.location.href.indexOf('/answer/') === -1 ? 'start' : 'end']() }) - window._collapsedAnswerObserver = ob + window._collapsedAnswerObserver = observer } return window._collapsedAnswerObserver } @@ -130,9 +130,9 @@ function getCollapsedAnswerObserver() { // 默认收起回答 function defaultCollapsedAnswer() { if (!menu_value('menu_defaultCollapsedAnswer')) return - const ob = getCollapsedAnswerObserver() - if (window.location.href.indexOf('answer') == -1) { - ob.start() + const observer = getCollapsedAnswerObserver() + if (window.location.href.indexOf('/answer/') === -1) { + observer.start() } } From 7ac2b0a16130dd23527b8291bf7a75431096c3f3 Mon Sep 17 00:00:00 2001 From: xiu2 <54703944+XIU2@users.noreply.github.com> Date: Fri, 13 Aug 2021 19:53:50 +0800 Subject: [PATCH 0020/1990] =?UTF-8?q?=E4=BC=98=E5=8C=96=20=E8=84=9A?= =?UTF-8?q?=E6=9C=AC=E8=8F=9C=E5=8D=95=E5=BC=80=E5=85=B3=E9=80=9A=E7=9F=A5?= =?UTF-8?q?=EF=BC=88=E7=82=B9=E5=87=BB=E9=80=9A=E7=9F=A5=E5=8D=B3=E5=8F=AF?= =?UTF-8?q?=E5=88=B7=E6=96=B0=E7=BD=91=E9=A1=B5=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 3dm-Enhanced.user.js | 6 ++-- 52pojie-Beautification.user.js | 66 +++------------------------------- 52pojie-Enhanced.user.js | 6 ++-- DarkMode.user.js | 6 ++-- Hostloc-Enhanced.user.js | 6 ++-- Lanzou-Enhanced.user.js | 16 ++++++--- V2ex-Enhanced.user.js | 6 ++-- Zhihu-Beautification.user.js | 6 ++-- Zhiyoo-Enhanced.user.js | 4 +-- 9 files changed, 35 insertions(+), 87 deletions(-) diff --git a/3dm-Enhanced.user.js b/3dm-Enhanced.user.js index 09285cd0f..99838c3fe 100644 --- a/3dm-Enhanced.user.js +++ b/3dm-Enhanced.user.js @@ -1,6 +1,6 @@ // ==UserScript== // @name 3DM论坛增强 -// @version 1.1.0 +// @version 1.1.1 // @author X.I.U // @description 自动回复、自动无缝翻页、清理置顶帖子、自动滚动至隐藏内容 // @match *://bbs.3dmgame.com/* @@ -50,10 +50,10 @@ function menu_switch(menu_status, Name, Tips) { if (menu_status == 'true'){ GM_setValue(`${Name}`, false); - GM_notification({text: `已关闭 [${Tips}] 功能\n(刷新网页后生效)`, timeout: 3500}); + GM_notification({text: `已关闭 [${Tips}] 功能\n(点击刷新网页后生效)`, timeout: 3500, onclick: function(){location.reload();}}); }else{ GM_setValue(`${Name}`, true); - GM_notification({text: `已开启 [${Tips}] 功能\n(刷新网页后生效)`, timeout: 3500}); + GM_notification({text: `已开启 [${Tips}] 功能\n(点击刷新网页后生效)`, timeout: 3500, onclick: function(){location.reload();}}); } registerMenuCommand(); // 重新注册脚本菜单 }; diff --git a/52pojie-Beautification.user.js b/52pojie-Beautification.user.js index fb0ce2c5b..7ffa1494c 100644 --- a/52pojie-Beautification.user.js +++ b/52pojie-Beautification.user.js @@ -1,6 +1,6 @@ // ==UserScript== // @name 吾爱破解论坛美化 -// @version 1.0.8 +// @version 1.0.9 // @author X.I.U // @description 精简多余内容、样式优化 // @match *://www.52pojie.cn/* @@ -20,54 +20,10 @@ (function() { 'use strict'; - var menu_ALL = [ - ['menu_rule', '隐藏版规', '隐藏版规', false] - ], menu_ID = []; - for (let i=0;i menu_ALL.length){ // 如果菜单ID数组多于菜单数组,说明不是首次添加菜单,需要卸载所有脚本菜单 - for (let i=0;i Date: Fri, 13 Aug 2021 21:26:39 +0800 Subject: [PATCH 0021/1990] =?UTF-8?q?=E4=BC=98=E5=8C=96=20[=E5=8C=BA?= =?UTF-8?q?=E5=88=86=E9=97=AE=E9=A2=98=E6=96=87=E7=AB=A0]=20=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Zhihu-Enhanced.user.js | 96 ++++++++++++++++++++++++------------------ 1 file changed, 54 insertions(+), 42 deletions(-) diff --git a/Zhihu-Enhanced.user.js b/Zhihu-Enhanced.user.js index 35fe74f03..303d9bf9a 100644 --- a/Zhihu-Enhanced.user.js +++ b/Zhihu-Enhanced.user.js @@ -1,6 +1,6 @@ // ==UserScript== // @name 知乎增强 -// @version 1.5.7 +// @version 1.5.8 // @author X.I.U // @description 移除登录弹窗、默认收起回答、一键收起回答、收起当前回答/评论(点击两侧空白处)、快捷回到顶部(右键两侧空白处)、屏蔽用户 (发布的内容)、屏蔽关键词(标题/评论)、屏蔽盐选内容、展开问题描述、置顶显示时间、显示问题时间、区分问题文章、默认高清原图、默认站外直链 // @match *://www.zhihu.com/* @@ -119,7 +119,7 @@ function getCollapsedAnswerObserver() { } window.addEventListener('locationchange', function() { - observer[window.location.href.indexOf('/answer/') === -1 ? 'start' : 'end']() + observer[location.href.indexOf('/answer/') === -1 ? 'start' : 'end']() }) window._collapsedAnswerObserver = observer } @@ -131,7 +131,7 @@ function getCollapsedAnswerObserver() { function defaultCollapsedAnswer() { if (!menu_value('menu_defaultCollapsedAnswer')) return const observer = getCollapsedAnswerObserver() - if (window.location.href.indexOf('/answer/') === -1) { + if (location.href.indexOf('/answer/') === -1) { observer.start() } } @@ -848,36 +848,47 @@ function blockYanXuan() { } -var postNum; // 区分问题文章 function addTypeTips() { if (!menu_value('menu_typeTips')) return - // URL 匹配正则表达式 let patt_zhuanlan = /zhuanlan.zhihu.com/, patt_question = /question\/\d+/, patt_question_answer = /answer\/\d+/, patt_video = /\/zvideo\//, - patt_tip = /zhihu_e_tips/ - let postList = document.querySelectorAll('h2.ContentItem-title a'); - postNum = document.querySelectorAll('small.zhihu_e_tips'); - //console.log(`${postList.length} ${postNum.length}`) - if (postList.length > postNum.length) { - for (let num = postNum.length;num文章 ` + postList[num].innerHTML - } else if (patt_question.test(postList[num].href)) { // 如果是问题 - if (!postList[num].getAttribute('data-tooltip')) { // 排除用户名后面的蓝标、黄标等链接 - if (patt_question_answer.test(postList[num].href)) { // 如果是指向回答的问题(而非指向纯问题的链接) - postList[num].innerHTML = `问题 ` + postList[num].innerHTML - } else { - postList[num].innerHTML = `问题 ` + postList[num].innerHTML - } + patt_tip = /zhihu_e_tips/; + + const typeTips = (mutationsList, observer) => { + for (const mutation of mutationsList) { + for (const target of mutation.addedNodes) { + if (target.nodeType != 1) return + addTypeTips_(target.querySelector('h2.ContentItem-title a')); + } + } + }; + // 后续加载的信息流 + const observer = new MutationObserver(typeTips); + observer.observe(document, { childList: true, subtree: true }); + // 一开始加载的信息流 + document.querySelectorAll('h2.ContentItem-title a').forEach(function(item){ + addTypeTips_(item); + }) + + function addTypeTips_(titleA) { + if (titleA) { + if (!patt_tip.test(titleA.innerHTML)) { + if (patt_zhuanlan.test(titleA.href)) { // 如果是文章 + titleA.innerHTML = `文章 ` + titleA.innerHTML + } else if (patt_question.test(titleA.href)) { // 如果是问题 + if (!titleA.dataset.tooltip) { // 排除用户名后面的蓝标、黄标等链接 + if (patt_question_answer.test(titleA.href)) { // 如果是指向回答的问题(而非指向纯问题的链接) + titleA.innerHTML = `问题 ` + titleA.innerHTML + } else { + titleA.innerHTML = `问题 ` + titleA.innerHTML + } } - } else if (patt_video.test(postList[num].href)) { // 如果是视频 - postList[num].innerHTML = `视频 ` + postList[num].innerHTML + } else if (patt_video.test(titleA.href)) { // 如果是视频 + titleA.innerHTML = `视频 ` + titleA.innerHTML } - //postNum += 1; } } } @@ -907,7 +918,7 @@ function removeLogin() { }; // 未登录时才会监听并移除登录弹窗 - if(window.location.href.indexOf('zhuanlan') > -1) { // 如果是文章页 + if(location.hostname === 'zhuanlan.zhihu.com') { // 如果是文章页 if (!document.querySelector('button.ColumnPageHeader-MenuToggler')) { // 如果不存在,则代表已登录 const observer = new MutationObserver(removeLoginModal); observer.observe(document, { childList: true, subtree: true }); @@ -946,14 +957,14 @@ function closeFloatingComments() { // 监听 XMLHttpRequest 事件 -function EventXMLHttpRequest() { +/*function EventXMLHttpRequest() { var _send = window.XMLHttpRequest.prototype.send function sendReplacement(data) { addTypeTips(); return _send.apply(this, arguments); } window.XMLHttpRequest.prototype.send = sendReplacement; -} +}*/ // 自定义 locationchange 事件(用来监听 URL 变化) @@ -1009,7 +1020,7 @@ function topTime_question() { }); // 问题创建时间 - if (!(document.querySelector('.QuestionPage .QuestionHeader-side p')) && window.location.href.indexOf("log") == -1) { // 没有执行过 且 非问题日志页 + if (!(document.querySelector('.QuestionPage .QuestionHeader-side p')) && location.href.indexOf("log") == -1) { // 没有执行过 且 非问题日志页 let createtime = document.querySelector('.QuestionPage>[itemprop~=dateCreated]').getAttribute('content'); let modifiedtime = document.querySelector('.QuestionPage>[itemprop~=dateModified]').getAttribute('content'); createtime = getUTC8(new Date(createtime)); @@ -1070,7 +1081,7 @@ function topTime_zhuanlan() { ContentItemTime.style.cssText = 'padding:0px 0px 0px 0px; margin-top: 14px' let temp_time = ContentItemTime.cloneNode(true); // ContentItemTime.style.display = 'none'; - if (window.location.href.indexOf("column") > -1){ + if (location.href.indexOf("column") > -1){ document.querySelector('.ContentItem-meta').insertAdjacentElement('beforeEnd', temp_time); } else { document.querySelector('.Post-Header').insertAdjacentElement('beforeEnd', temp_time); @@ -1129,7 +1140,7 @@ function directLink () { _this.setAttribute('href', newHref); } else if (_this.href.indexOf("link.zhihu.com/?target=") > -1) { externalHref = _this.href; - newHref = externalHref.substring(externalHref = _this.href.indexOf("link.zhihu.com/?target=") + "link.zhihu.com/?target=".length); + newHref = externalHref.substring(externalHref = _this.href.indexOf('link.zhihu.com/?target=') + 'link.zhihu.com/?target='.length); _this.setAttribute('href', decodeURIComponent(newHref)); } else { externalHref = _this.href; @@ -1223,7 +1234,7 @@ function questionInvitation(){ setInterval(originalPic,100); // 默认高清原图 if (menu_value('menu_directLink')) setInterval(directLink, 100); // 默认站外直链 window.addEventListener('locationchange', function(){ // 针对的是从单个回答页跳转到完整回答页时 - if (window.location.pathname.indexOf('question') > -1 && window.location.pathname.indexOf('waiting') == -1 && window.location.pathname.indexOf('answer') == -1) { // 回答页 // + if (location.pathname.indexOf('question') > -1 && location.pathname.indexOf('waiting') === -1 && location.pathname.indexOf('/answer/') === -1) { // 回答页 // setTimeout(function(){ collapsedNowAnswer('.QuestionPage'); // 收起当前回答 + 快捷返回顶部 collapsedNowAnswer('.Question-main'); // 收起当前回答 + 快捷返回顶部 @@ -1245,8 +1256,8 @@ function questionInvitation(){ closeFloatingComments(); // 快捷关闭悬浮评论(监听点击事件,点击网页两侧空白处) questionInvitation(); // 默认折叠邀请 blockKeywords('comment'); // 屏蔽指定关键词(评论) - if (window.location.href.indexOf('question') > -1) { // 回答页 // - if (window.location.href.indexOf('waiting') == -1) { + if (location.pathname.indexOf('question') > -1) { // 回答页 // + if (location.pathname.indexOf('waiting') == -1) { collapsedNowAnswer('.QuestionPage'); // 收起当前回答 + 快捷返回顶部 collapsedNowAnswer('.Question-main'); // 收起当前回答 + 快捷返回顶部 questionRichTextMore(); // 展开问题描述 @@ -1255,32 +1266,33 @@ function questionInvitation(){ defaultCollapsedAnswer(); // 默认收起回答 } setInterval(topTime_question, 300); // 置顶显示时间 - } else if (window.location.href.indexOf('search') > -1) { // 搜索结果页 // + } else if (location.pathname === '/search') { // 搜索结果页 // collapsedNowAnswer('main div'); // 收起当前回答 + 快捷返回顶部 collapsedNowAnswer('.Search-container'); // 收起当前回答 + 快捷返回顶部 setInterval(topTime_search, 300); // 置顶显示时间 - EventXMLHttpRequest(); // 区分问题文章 + addTypeTips(); // 区分问题文章 blockUsers('search'); // 屏蔽指定用户 blockKeywords('search'); // 屏蔽指定关键词 - } else if (window.location.href.indexOf('topic') > -1) { // 话题页 // - if (window.location.href.indexOf('hot') > -1 || window.location.href.indexOf('top-answers') > -1) { // 仅限 [讨论] [精华] + } else if (location.pathname.indexOf('/topic/') > -1) { // 话题页 // + if (location.pathname.indexOf('/hot') > -1 || location.href.indexOf('/top-answers') > -1) { // 仅限 [讨论] [精华] collapsedNowAnswer('main.App-main'); // 收起当前回答 + 快捷返回顶部 collapsedNowAnswer('.ContentLayout'); // 收起当前回答 + 快捷返回顶部 setInterval(topTime_people, 300); // 置顶显示时间 - EventXMLHttpRequest(); // 区分问题文章 + addTypeTips(); // 区分问题文章 blockUsers('topic'); // 屏蔽指定用户 blockKeywords('topic'); // 屏蔽指定关键词 } - } else if (window.location.href.indexOf('zhuanlan') > -1){ // 文章 // + } else if (location.hostname === 'zhuanlan.zhihu.com'){ // 文章 // backToTop('article.Post-Main.Post-NormalMain'); // 快捷返回顶部 backToTop('div.Post-Sub.Post-NormalSub'); // 快捷返回顶部 setInterval(topTime_zhuanlan, 300); // 置顶显示时间 blockUsers(); // 屏蔽指定用户 - } else if (window.location.href.indexOf('column') > -1) { // 专栏 // + } else if (location.pathname.indexOf('/column/') > -1) { // 专栏 // collapsedNowAnswer('main div'); // 收起当前回答 + 快捷返回顶部 setInterval(topTime_zhuanlan, 300); // 置顶显示时间 blockUsers(); // 屏蔽指定用户 - } else if (window.location.href.indexOf('people') > -1 || window.location.href.indexOf('org') > -1) { // 用户主页 // + } else if (location.pathname.indexOf('/people/') > -1 || location.href.indexOf('org') > -1) { // 用户主页 // + if (location.pathname.split('/').length === 3) addTypeTips(); // 区分问题文章 collapsedNowAnswer('main div'); // 收起当前回答 + 快捷返回顶部 collapsedNowAnswer('.Profile-main'); // 收起当前回答 + 快捷返回顶部 setInterval(topTime_people, 300); // 置顶显示时间 @@ -1290,7 +1302,7 @@ function questionInvitation(){ collapsedNowAnswer('main div'); // 收起当前回答 + 快捷返回顶部 collapsedNowAnswer('.Topstory-container'); // 收起当前回答 + 快捷返回顶部 setInterval(topTime_index, 300); // 置顶显示时间 - EventXMLHttpRequest(); // 区分问题文章 + addTypeTips(); // 区分问题文章 blockUsers('index'); // 屏蔽指定用户 blockKeywords('index'); // 屏蔽指定关键词 } From c7959cf9f404c5719f7d915d756088a4c6f221ec Mon Sep 17 00:00:00 2001 From: xiu2 <54703944+XIU2@users.noreply.github.com> Date: Fri, 13 Aug 2021 21:48:16 +0800 Subject: [PATCH 0022/1990] =?UTF-8?q?=E4=BC=98=E5=8C=96=20[=E5=8C=BA?= =?UTF-8?q?=E5=88=86=E9=97=AE=E9=A2=98=E6=96=87=E7=AB=A0]=20=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Zhihu-Enhanced.user.js | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/Zhihu-Enhanced.user.js b/Zhihu-Enhanced.user.js index 303d9bf9a..17fce54ea 100644 --- a/Zhihu-Enhanced.user.js +++ b/Zhihu-Enhanced.user.js @@ -1,6 +1,6 @@ // ==UserScript== // @name 知乎增强 -// @version 1.5.8 +// @version 1.5.9 // @author X.I.U // @description 移除登录弹窗、默认收起回答、一键收起回答、收起当前回答/评论(点击两侧空白处)、快捷回到顶部(右键两侧空白处)、屏蔽用户 (发布的内容)、屏蔽关键词(标题/评论)、屏蔽盐选内容、展开问题描述、置顶显示时间、显示问题时间、区分问题文章、默认高清原图、默认站外直链 // @match *://www.zhihu.com/* @@ -865,16 +865,20 @@ function addTypeTips() { } } }; + + // 一开始加载的信息流 + if (location.pathname === '/search') { + setTimeout(function(){document.querySelectorAll('h2.ContentItem-title a').forEach(function(item){addTypeTips_(item);})}, 2000); + } else { + document.querySelectorAll('h2.ContentItem-title a').forEach(function(item){addTypeTips_(item);}) + } + // 后续加载的信息流 const observer = new MutationObserver(typeTips); observer.observe(document, { childList: true, subtree: true }); - // 一开始加载的信息流 - document.querySelectorAll('h2.ContentItem-title a').forEach(function(item){ - addTypeTips_(item); - }) function addTypeTips_(titleA) { - if (titleA) { + if (!titleA) return if (!patt_tip.test(titleA.innerHTML)) { if (patt_zhuanlan.test(titleA.href)) { // 如果是文章 titleA.innerHTML = `文章 ` + titleA.innerHTML @@ -890,7 +894,6 @@ function addTypeTips() { titleA.innerHTML = `视频 ` + titleA.innerHTML } } - } } } From 94137d587c4e1ec9a4615b82da3d6a46e526a412 Mon Sep 17 00:00:00 2001 From: xiu2 <54703944+XIU2@users.noreply.github.com> Date: Sat, 14 Aug 2021 10:36:34 +0800 Subject: [PATCH 0023/1990] =?UTF-8?q?=E6=96=B0=E5=A2=9E=20[=E6=89=80?= =?UTF-8?q?=E6=9C=89=E4=BD=BF=E7=94=A8=20DUX(WordPress)=20=E4=B8=BB?= =?UTF-8?q?=E9=A2=98=E7=9A=84=E7=BD=91=E7=AB=99]=20=E6=94=AF=E6=8C=81?= =?UTF-8?q?=EF=BC=88=E5=8E=9F=E5=85=88=E6=94=AF=E6=8C=81=E7=9A=84=20APPHOT?= =?UTF-8?q?=E3=80=81=E4=BA=BF=E7=A0=B4=E5=A7=90=E3=80=81=E7=A6=8F=E5=88=A9?= =?UTF-8?q?=E5=90=A7=E3=80=81=E8=90=BD=E5=B0=98=E4=B9=8B=E6=9C=A8=20?= =?UTF-8?q?=E9=83=BD=E5=90=88=E5=B9=B6=E4=BA=86=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Autopage.user.js | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/Autopage.user.js b/Autopage.user.js index 723a3283f..21c6e772b 100644 --- a/Autopage.user.js +++ b/Autopage.user.js @@ -1,8 +1,8 @@ // ==UserScript== // @name 自动无缝翻页 -// @version 1.5.1 +// @version 1.5.2 // @author X.I.U -// @description 自动无缝翻页,目前支持:所有「Discuz!、Flarum」论坛、百度、豆瓣、微博、千图网、3DM、游侠网、游民星空、Steam 创意工坊、423Down、APPHOT、不死鸟、亿破姐、小众软件、微当下载、落尘之木、异次元软件、老殁殁漂遥、异星软件空间、古风漫画网、砂之船动漫家、RARBG、PubMed、AfreecaTV、GreasyFork、AlphaCoders、Crackhub213、FitGirl Repacks... +// @description 自动无缝翻页,目前支持:所有「Discuz!、Flarum、DUX(WP)」论坛/主题网站、百度、豆瓣、微博、千图网、3DM、游侠网、游民星空、Steam 创意工坊、423Down、不死鸟、小众软件、微当下载、异次元软件、老殁殁漂遥、异星软件空间、古风漫画网、砂之船动漫家、RARBG、PubMed、AfreecaTV、GreasyFork、AlphaCoders、Crackhub213、FitGirl Repacks... // @match *://*/* // @connect www.gamersky.com // @icon https://i.loli.net/2021/03/07/rdijeYm83pznxWq.png @@ -11,6 +11,7 @@ // @grant GM_openInTab // @grant GM_getValue // @grant GM_setValue +// @noframes // @license GPL-3.0 License // @run-at document-end // @namespace https://github.com/XIU2/UserScript @@ -24,7 +25,7 @@ // 目前支持的网站 const websiteList = ['www.baidu.com', 'movie.douban.com', 'weibo.com', 'www.58pic.com', 'www.3dmgame.com', 'www.ali213.net', 'gl.ali213.net', 'www.gamersky.com', 'steamcommunity.com', - 'www.423down.com', 'apphot.cc', 'iao.su', 'www.ypojie.com', 'www.appinn.com', 'www.weidown.com', 'www.luochenzhimu.com', 'www.iplaysoft.com', 'www.mpyit.com', 'www.yxssp.com', + 'www.423down.com', 'iao.su', 'www.appinn.com', 'www.weidown.com', 'www.iplaysoft.com', 'www.mpyit.com', 'www.yxssp.com', 'www.gufengmh8.com', 'www.szcdmj.com', 'rarbgprx.org', 'pubmed.ncbi.nlm.nih.gov', 'www.afreecatv.com', 'greasyfork.org', 'art.alphacoders.com', 'wall.alphacoders.com', 'avatars.alphacoders.com', 'mobile.alphacoders.com', @@ -38,13 +39,16 @@ return } else { if (websiteList.indexOf(location.host) > -1) { - webType = 1 // 其他网站 + webType = 1;console.info('[自动无缝翻页] - 其他网站'); // 其他网站 } else if (document.querySelector('meta[name="author"][content*="Discuz!"], meta[name="generator"][content*="Discuz!"]') || document.getElementById('ft') && document.getElementById('ft').textContent.indexOf('Discuz!') > -1) { - webType = 2 // 所有 Discuz! 论坛 + webType = 2;console.info('[自动无缝翻页] - Discuz! 论坛'); // 所有 Discuz! 论坛 } else if (document.getElementById('flarum-loading')) { - webType = 3 // 所有 Flarum 论坛 + webType = 3;console.info('[自动无缝翻页] - Flarum 论坛'); // 所有 Flarum 论坛 + } else if (document.querySelector('link[href*="themes/dux" i], script[src*="themes/dux" i]')) { + webType = 4;console.info('[自动无缝翻页] - 使用 WordPress DUX 主题的网站'); // 所有使用 WordPress DUX 主题的网站 } else { GM_registerMenuCommand('❌ 当前网站暂不支持 [点击申请支持]', function () {window.GM_openInTab('https://github.com/XIU2/UserScript#xiu2userscript', {active: true,insert: true,setParent: true});window.GM_openInTab('https://greasyfork.org/zh-CN/scripts/419215/feedback', {active: true,insert: true,setParent: true});}); + console.info('[自动无缝翻页] - 不支持当前网站'); return } GM_registerMenuCommand('✅ 已启用 (点击对当前网站禁用)', function(){menu_disable('add')}); @@ -156,7 +160,7 @@ pageElement: 'css;.content > article', HT_insert: ['css;.content > .pagination', 1], replaceE: 'css;.content > .pagination', - scrollDelta: 1000 + scrollDelta: 1500 }, function: { before: dux_beforeFunction @@ -580,13 +584,6 @@ // < 其他网站 > if (webType === 1) { switch (location.host) { - case 'apphot.cc': // < APPHOT > - case 'www.ypojie.com': // < 亿破姐 > - case 'www.luochenzhimu.com': // < 落尘之木 > - if (location.pathname.indexOf('.html') === -1) curSite = DBSite.dux; - if (location.host === 'apphot.cc') curSite.pager.scrollDelta = 1600; // 对于速度慢的网站,需要增加翻页敏感度 - break; - // 以上几个都是 WordPress 的 DUX 主题 case 'www.baidu.com': // < 百度搜索 > if (location.pathname === '/s') curSite = DBSite.baidu; break; @@ -755,7 +752,12 @@ // < 所有 Flarum 论坛 > } else if (webType === 3) { curSite = DBSite.flarum; + // < 所有使用 WordPress DUX 主题的网站 > + } else if (webType === 4) { + if (location.pathname.indexOf('.html') === -1) curSite = DBSite.dux; + if (location.host === 'apphot.cc') curSite.pager.scrollDelta = 2500; // 对于速度慢的网站,需要增加翻页敏感度 } + curSite.pageUrl = ''; // 下一页URL //console.log(curSite); pageLoading(); // 自动无缝翻页 From b5c091fe8b31090d71084ba90136f75bc19a6e69 Mon Sep 17 00:00:00 2001 From: xiu2 <54703944+XIU2@users.noreply.github.com> Date: Sat, 14 Aug 2021 12:13:15 +0800 Subject: [PATCH 0024/1990] =?UTF-8?q?=E6=96=B0=E5=A2=9E=20[=E7=9B=B4?= =?UTF-8?q?=E8=BE=BE=E9=97=AE=E9=A2=98=E6=8C=89=E9=92=AE]=20=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Zhihu-Enhanced.user.js | 91 +++++++++++++++++++++++++++++------------- 1 file changed, 64 insertions(+), 27 deletions(-) diff --git a/Zhihu-Enhanced.user.js b/Zhihu-Enhanced.user.js index 17fce54ea..7050d565c 100644 --- a/Zhihu-Enhanced.user.js +++ b/Zhihu-Enhanced.user.js @@ -1,8 +1,8 @@ // ==UserScript== // @name 知乎增强 -// @version 1.5.9 +// @version 1.6.0 // @author X.I.U -// @description 移除登录弹窗、默认收起回答、一键收起回答、收起当前回答/评论(点击两侧空白处)、快捷回到顶部(右键两侧空白处)、屏蔽用户 (发布的内容)、屏蔽关键词(标题/评论)、屏蔽盐选内容、展开问题描述、置顶显示时间、显示问题时间、区分问题文章、默认高清原图、默认站外直链 +// @description 移除登录弹窗、默认收起回答、一键收起回答、收起当前回答/评论(点击两侧空白处)、快捷回到顶部(右键两侧空白处)、屏蔽用户 (发布的内容)、屏蔽关键词(标题/评论)、屏蔽盐选内容、展开问题描述、置顶显示时间、显示问题时间、区分问题文章、直达问题按钮、默认高清原图、默认站外直链 // @match *://www.zhihu.com/* // @match *://zhuanlan.zhihu.com/* // @icon https://static.zhihu.com/heifetz/favicon.ico @@ -36,6 +36,7 @@ var menu_ALL = [ ['menu_publishTop', '置顶显示时间', '置顶显示时间', true], ['menu_allTime', '完整显示时间', '完整显示时间', true], ['menu_typeTips', '区分问题文章', '区分问题文章', true], + ['menu_toQuestion', '直达问题按钮', '直达问题按钮', true], ['menu_directLink', '默认站外直链', '默认站外直链', true] ], menu_ID = []; for (let i=0;i { + // 一开始加载的信息流 + if (location.pathname === '/search') { + setTimeout(function(){document.querySelectorAll('h2.ContentItem-title a').forEach(function(item){addTypeTips_(item);})}, 2000); + } else { + document.querySelectorAll('h2.ContentItem-title a').forEach(function(item){addTypeTips_(item);}) + } + + // 后续加载的信息流 + const observer = new MutationObserver(mutationsList => { for (const mutation of mutationsList) { for (const target of mutation.addedNodes) { if (target.nodeType != 1) return addTypeTips_(target.querySelector('h2.ContentItem-title a')); } } - }; + }); + observer.observe(document, { childList: true, subtree: true }); + + function addTypeTips_(titleA) { + if (!titleA) return // 判断是否为真 + if (titleA.querySelector('small.zhihu_e_tips')) return // 判断是否已添加 + + let patt_zhuanlan = /zhuanlan.zhihu.com/, + patt_question = /question\/\d+/, + patt_question_answer = /answer\/\d+/, + patt_video = /\/zvideo\//; + if (patt_zhuanlan.test(titleA.href)) { // 如果是文章 + titleA.innerHTML = `文章 ` + titleA.innerHTML + } else if (patt_question.test(titleA.href)) { // 如果是问题 + if (!titleA.dataset.tooltip) { // 排除用户名后面的蓝标、黄标等链接 + if (patt_question_answer.test(titleA.href)) { // 如果是指向回答的问题(而非指向纯问题的链接) + titleA.innerHTML = `问题 ` + titleA.innerHTML + } else { + titleA.innerHTML = `问题 ` + titleA.innerHTML + } + } + } else if (patt_video.test(titleA.href)) { // 如果是视频 + titleA.innerHTML = `视频 ` + titleA.innerHTML + } + + } +} + + +// 直达问题按钮 +function addToQuestion() { + if (!menu_value('menu_toQuestion')) return + + // 添加按钮样式 + document.lastChild.appendChild(document.createElement('style')).textContent = `svg.zhihu_e_toQuestion {-webkit-transform: rotate(270deg);transform: rotate(270deg);} a.zhihu_e_toQuestion {font-size: 14px;font-weight: normal;padding: 3px 5px;margin-left: 3px;border-radius: 3px;}`; // 一开始加载的信息流 if (location.pathname === '/search') { @@ -874,26 +912,22 @@ function addTypeTips() { } // 后续加载的信息流 - const observer = new MutationObserver(typeTips); + const observer = new MutationObserver(mutationsList => { + for (const mutation of mutationsList) { + for (const target of mutation.addedNodes) { + if (target.nodeType != 1) return + addTypeTips_(target.querySelector('h2.ContentItem-title a')); + } + } + }); observer.observe(document, { childList: true, subtree: true }); function addTypeTips_(titleA) { - if (!titleA) return - if (!patt_tip.test(titleA.innerHTML)) { - if (patt_zhuanlan.test(titleA.href)) { // 如果是文章 - titleA.innerHTML = `文章 ` + titleA.innerHTML - } else if (patt_question.test(titleA.href)) { // 如果是问题 - if (!titleA.dataset.tooltip) { // 排除用户名后面的蓝标、黄标等链接 - if (patt_question_answer.test(titleA.href)) { // 如果是指向回答的问题(而非指向纯问题的链接) - titleA.innerHTML = `问题 ` + titleA.innerHTML - } else { - titleA.innerHTML = `问题 ` + titleA.innerHTML - } - } - } else if (patt_video.test(titleA.href)) { // 如果是视频 - titleA.innerHTML = `视频 ` + titleA.innerHTML - } - } + if (!titleA) return // 判断是否为真 + if (titleA.parentElement.querySelector('a.zhihu_e_toQuestion')) return // 判断是否已添加 + if (/answer\/\d+/.test(titleA.href)) { // 如果是指向回答的问题(而非指向纯问题的链接) + titleA.insertAdjacentHTML('afterend', `直达问题`); + } } } @@ -1274,6 +1308,7 @@ function questionInvitation(){ collapsedNowAnswer('.Search-container'); // 收起当前回答 + 快捷返回顶部 setInterval(topTime_search, 300); // 置顶显示时间 addTypeTips(); // 区分问题文章 + addToQuestion(); // 直达问题按钮 blockUsers('search'); // 屏蔽指定用户 blockKeywords('search'); // 屏蔽指定关键词 } else if (location.pathname.indexOf('/topic/') > -1) { // 话题页 // @@ -1282,6 +1317,7 @@ function questionInvitation(){ collapsedNowAnswer('.ContentLayout'); // 收起当前回答 + 快捷返回顶部 setInterval(topTime_people, 300); // 置顶显示时间 addTypeTips(); // 区分问题文章 + addToQuestion(); // 直达问题按钮 blockUsers('topic'); // 屏蔽指定用户 blockKeywords('topic'); // 屏蔽指定关键词 } @@ -1295,7 +1331,7 @@ function questionInvitation(){ setInterval(topTime_zhuanlan, 300); // 置顶显示时间 blockUsers(); // 屏蔽指定用户 } else if (location.pathname.indexOf('/people/') > -1 || location.href.indexOf('org') > -1) { // 用户主页 // - if (location.pathname.split('/').length === 3) addTypeTips(); // 区分问题文章 + if (location.pathname.split('/').length === 3) addTypeTips();addToQuestion(); // 区分问题文章、直达问题按钮 collapsedNowAnswer('main div'); // 收起当前回答 + 快捷返回顶部 collapsedNowAnswer('.Profile-main'); // 收起当前回答 + 快捷返回顶部 setInterval(topTime_people, 300); // 置顶显示时间 @@ -1306,6 +1342,7 @@ function questionInvitation(){ collapsedNowAnswer('.Topstory-container'); // 收起当前回答 + 快捷返回顶部 setInterval(topTime_index, 300); // 置顶显示时间 addTypeTips(); // 区分问题文章 + addToQuestion(); // 直达问题按钮 blockUsers('index'); // 屏蔽指定用户 blockKeywords('index'); // 屏蔽指定关键词 } From a5ae7ed3d9396da87106ea649c8ea43e9586bd6b Mon Sep 17 00:00:00 2001 From: xiu2 <54703944+XIU2@users.noreply.github.com> Date: Sat, 14 Aug 2021 12:14:03 +0800 Subject: [PATCH 0025/1990] =?UTF-8?q?=E4=BC=98=E5=8C=96=20[=E6=9A=97?= =?UTF-8?q?=E9=BB=91=E6=A8=A1=E5=BC=8F]=20=E6=A0=B7=E5=BC=8F=E4=B8=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Zhihu-Beautification.user.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Zhihu-Beautification.user.js b/Zhihu-Beautification.user.js index fc5d0c9c6..b33b3a12d 100644 --- a/Zhihu-Beautification.user.js +++ b/Zhihu-Beautification.user.js @@ -177,7 +177,7 @@ html[data-theme=dark] .Highlight em {color: #c33c39 !important;} /* 背景颜色 - 网页 */ html[data-theme=dark] body, html[data-theme=dark] .Select-option:focus {background: #22272E !important;} /* 背景颜色 - 问题 */ -html[data-theme=dark] .AppHeader, html[data-theme=dark] .QuestionHeader, html[data-theme=dark] .QuestionHeader-footer, html[data-theme=dark] .EmoticonsFooter-item--selected, html[data-theme=dark] .Card, html[data-theme=dark] .ContentItem-actions, html[data-theme=dark] .MoreAnswers .List-headerText, html[data-theme=dark] .CommentsV2-withPagination, html[data-theme=dark] .Topbar, html[data-theme=dark] .CommentsV2-footer, html[data-theme=dark] .CommentEditorV2-inputWrap--active, html[data-theme=dark] .InputLike, html[data-theme=dark] .Popover-content, html[data-theme=dark] .Notifications-footer, html[data-theme=dark] .Messages-footer, html[data-theme=dark] .Modal-inner, html[data-theme=dark] .Emoticons, html[data-theme=dark] .EmoticonsFooter, html[data-theme=dark] .SearchTabs, html[data-theme=dark] .Popover-arrow:after, html[data-theme=dark] .CommentEditorV2-inputWrap, html[data-theme=dark] .ProfileHeader-wrapper, html[data-theme=dark] .UserCover, html[data-theme=dark] .AnswerForm-footer, html[data-theme=dark] .Editable-toolbar, html[data-theme=dark] .AnswerForm-fullscreenContent .Editable-toolbar, html[data-theme=dark] .KfeCollection-PcCollegeCard-wrapper, html[data-theme=dark] .KfeCollection-PcCollegeCard-root, html[data-theme=dark] .HotItem, html[data-theme=dark] .HotList, html[data-theme=dark] .HotListNavEditPad, html[data-theme=dark] .QuestionWaiting-typesTopper, html[data-theme=dark] .QuestionWaiting-types, html[data-theme=dark] .PostItem, html[data-theme=dark] .ClubSideBar section, html[data-theme=dark] .SearchSubTabs, html[data-theme=dark] .Club-SearchPosts-Content, html[data-theme=dark] .Club-content, html[data-theme=dark] .ClubJoinOrCheckinButton, html[data-theme=dark] .ClubEdit, html[data-theme=dark] .CornerButton, html[data-theme=dark] .Notifications-Section-header, html[data-theme=dark] .NotificationList, .NotificationList-Item.NotificationList-Item:after, .NotificationList-DateSplit.NotificationList-DateSplit:after, html[data-theme=dark] .Chat, .ChatUserListItem:after, .ChatListGroup-SectionTitle--bottomBorder:after, html[data-theme=dark] .ActionMenu, .ChatSideBar-Search--active, html[data-theme=dark] .ChatSideBar-Search-ResultListWrap, html[data-theme=dark] .QuestionMainDivider-inner, html[data-theme=dark] .Topic-bar, html[data-theme=dark] .AnnotationTag, html[data-theme=dark] .HoverCard, html[data-theme=dark] .HoverCard-loading, html[data-theme=dark] .ExploreSpecialCard, html[data-theme=dark] .ExploreHomePage-ContentSection-moreButton a, html[data-theme=dark] .ExploreRoundtableCard, html[data-theme=dark] .ExploreCollectionCard, html[data-theme=dark] .ExploreColumnCard, html[data-theme=dark] .RichText .lazy[data-lazy-status], html[data-theme=dark] #TopstoryContent > div:first-child {background: #2D333B !important;} +html[data-theme=dark] .AppHeader, html[data-theme=dark] .QuestionHeader, html[data-theme=dark] .QuestionHeader-footer, html[data-theme=dark] .EmoticonsFooter-item--selected, html[data-theme=dark] .Card, html[data-theme=dark] .ContentItem-actions, html[data-theme=dark] .MoreAnswers .List-headerText, html[data-theme=dark] .CommentsV2-withPagination, html[data-theme=dark] .Topbar, html[data-theme=dark] .CommentsV2-footer, html[data-theme=dark] .CommentEditorV2-inputWrap--active, html[data-theme=dark] .InputLike, html[data-theme=dark] .Popover-content, html[data-theme=dark] .Notifications-footer, html[data-theme=dark] .Messages-footer, html[data-theme=dark] .Modal-inner, html[data-theme=dark] .Emoticons, html[data-theme=dark] .EmoticonsFooter, html[data-theme=dark] .SearchTabs, html[data-theme=dark] .Popover-arrow:after, html[data-theme=dark] .CommentEditorV2-inputWrap, html[data-theme=dark] .ProfileHeader-wrapper, html[data-theme=dark] .UserCover, html[data-theme=dark] .AnswerForm-footer, html[data-theme=dark] .Editable-toolbar, html[data-theme=dark] .AnswerForm-fullscreenContent .Editable-toolbar, html[data-theme=dark] .KfeCollection-PcCollegeCard-wrapper, html[data-theme=dark] .KfeCollection-PcCollegeCard-root, html[data-theme=dark] .HotItem, html[data-theme=dark] .HotList, html[data-theme=dark] .HotListNavEditPad, html[data-theme=dark] .QuestionWaiting-typesTopper, html[data-theme=dark] .QuestionWaiting-types, html[data-theme=dark] .PostItem, html[data-theme=dark] .ClubSideBar section, html[data-theme=dark] .SearchSubTabs, html[data-theme=dark] .Club-SearchPosts-Content, html[data-theme=dark] .Club-content, html[data-theme=dark] .ClubJoinOrCheckinButton, html[data-theme=dark] .ClubEdit, html[data-theme=dark] .CornerButton, html[data-theme=dark] .Notifications-Section-header, html[data-theme=dark] .NotificationList, .NotificationList-Item.NotificationList-Item:after, .NotificationList-DateSplit.NotificationList-DateSplit:after, html[data-theme=dark] .Chat, .ChatUserListItem:after, .ChatListGroup-SectionTitle--bottomBorder:after, html[data-theme=dark] .ActionMenu, .ChatSideBar-Search--active, html[data-theme=dark] .ChatSideBar-Search-ResultListWrap, html[data-theme=dark] .QuestionMainDivider-inner, html[data-theme=dark] .Topic-bar, html[data-theme=dark] .AnnotationTag, html[data-theme=dark] .HoverCard, html[data-theme=dark] .HoverCard-loading, html[data-theme=dark] .ExploreSpecialCard, html[data-theme=dark] .ExploreHomePage-ContentSection-moreButton a, html[data-theme=dark] .ExploreRoundtableCard, html[data-theme=dark] .ExploreCollectionCard, html[data-theme=dark] .ExploreColumnCard, html[data-theme=dark] .RichText .lazy[data-lazy-status], html[data-theme=dark] #TopstoryContent > div:first-child, html[data-theme=dark] .Topstory-newUserFollowCountPanel {background: #2D333B !important;} html[data-theme=dark] .CommentListV2-header-divider, html[data-theme=dark] .CommentsV2-openComment-divider, html[data-theme=dark] .AnswerForm-fullscreenScroller, html[data-theme=dark] .HotListNav-item, html[data-theme=dark] .AutoInviteItem-wrapper--desktop, html[data-theme=dark] .ExploreSpecialCard-contentTag, html[data-theme=dark] .ExploreCollectionCard-contentTypeTag, html[data-theme=dark] .Reward-TipjarDialog-tagLine {background-color: #222933 !important;} html[data-theme=dark] .CornerButton:hover {background: #3f4752 !important;} /* 右下角按钮 */ @@ -263,6 +263,9 @@ html[data-theme=dark] .CommentItemV2--highlighted {-webkit-animation: nano !impo /* 赞赏 */ html[data-theme=dark] .Reward-TipjarDialog-amountList .Button--red, html[data-theme=dark] .Reward-TipjarDialog-amountList .Button--red, html[data-theme=dark] .Reward-TipjarDialog-amountInput .SimpleInput {color: #d3d3d3 !important; background-color: #353b44 !important; border: none !important;} + +/* 点赞 */ +html[data-theme=dark] .VoteButton.is-active {color: #d6edff !important;} `, style_darkMode_1_x = `/* 问题日志页 */ html[data-theme=dark] .zu-top {background: #2D333B !important;border: none !important;} From c714ecf52bfa10beba21f4e71afc6d7dcee65e72 Mon Sep 17 00:00:00 2001 From: xiu2 <54703944+XIU2@users.noreply.github.com> Date: Sat, 14 Aug 2021 13:59:27 +0800 Subject: [PATCH 0026/1990] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20Description?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Autopage.user.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Autopage.user.js b/Autopage.user.js index 21c6e772b..b645f4277 100644 --- a/Autopage.user.js +++ b/Autopage.user.js @@ -2,7 +2,7 @@ // @name 自动无缝翻页 // @version 1.5.2 // @author X.I.U -// @description 自动无缝翻页,目前支持:所有「Discuz!、Flarum、DUX(WP)」论坛/主题网站、百度、豆瓣、微博、千图网、3DM、游侠网、游民星空、Steam 创意工坊、423Down、不死鸟、小众软件、微当下载、异次元软件、老殁殁漂遥、异星软件空间、古风漫画网、砂之船动漫家、RARBG、PubMed、AfreecaTV、GreasyFork、AlphaCoders、Crackhub213、FitGirl Repacks... +// @description 自动无缝翻页,目前支持:[所有使用「Discuz!、Flarum、DUX(WordPress)」的网站]、百度、豆瓣、微博、千图网、3DM、游侠网、游民星空、Steam 创意工坊、423Down、不死鸟、小众软件、微当下载、异次元软件、老殁殁漂遥、异星软件空间、古风漫画网、砂之船动漫家、RARBG、PubMed、AfreecaTV、GreasyFork、AlphaCoders、Crackhub213、FitGirl Repacks... // @match *://*/* // @connect www.gamersky.com // @icon https://i.loli.net/2021/03/07/rdijeYm83pznxWq.png From 33865ffaea4da2d322b83a7971030d217364afa2 Mon Sep 17 00:00:00 2001 From: xiu2 <54703944+XIU2@users.noreply.github.com> Date: Sat, 14 Aug 2021 20:47:04 +0800 Subject: [PATCH 0027/1990] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20[=E7=A7=BB?= =?UTF-8?q?=E9=99=A4=E7=99=BB=E5=BD=95=E5=BC=B9=E7=AA=97]=20=E5=9C=A8?= =?UTF-8?q?=E9=83=A8=E5=88=86=E6=83=85=E5=86=B5=E4=B8=8B=E5=A4=B1=E6=95=88?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98;=20=E4=BC=98=E5=8C=96=20[=E5=8C=BA?= =?UTF-8?q?=E5=88=86=E9=97=AE=E9=A2=98=E6=96=87=E7=AB=A0]=20=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Zhihu-Enhanced.user.js | 63 ++++++++++++++++++++++++------------------ 1 file changed, 36 insertions(+), 27 deletions(-) diff --git a/Zhihu-Enhanced.user.js b/Zhihu-Enhanced.user.js index 7050d565c..de8b9ebd6 100644 --- a/Zhihu-Enhanced.user.js +++ b/Zhihu-Enhanced.user.js @@ -1,6 +1,6 @@ // ==UserScript== // @name 知乎增强 -// @version 1.6.0 +// @version 1.6.1 // @author X.I.U // @description 移除登录弹窗、默认收起回答、一键收起回答、收起当前回答/评论(点击两侧空白处)、快捷回到顶部(右键两侧空白处)、屏蔽用户 (发布的内容)、屏蔽关键词(标题/评论)、屏蔽盐选内容、展开问题描述、置顶显示时间、显示问题时间、区分问题文章、直达问题按钮、默认高清原图、默认站外直链 // @match *://www.zhihu.com/* @@ -97,10 +97,10 @@ function getCollapsedAnswerObserver() { if (!mutation.target.classList.contains('RichContent')) continue for (const addedNode of mutation.addedNodes) { if (addedNode.nodeType != Node.ELEMENT_NODE) continue - const button = addedNode.querySelector('.ContentItem-actions.Sticky [data-zop-retract-question]') + const button = addedNode.querySelector('.ContentItem-actions.Sticky [data-zop-retract-question]'); if (button) { - mutation.target.setAttribute('script-collapsed', '') - button.click() + mutation.target.setAttribute('script-collapsed', ''); + button.click(); return } } @@ -109,20 +109,20 @@ function getCollapsedAnswerObserver() { observer.start = function() { if (!this._active) { - this.observe(document, { childList: true, subtree: true }) - this._active = true + this.observe(document, { childList: true, subtree: true }); + this._active = true; } } observer.end = function() { if (this._active) { - this.disconnect() + this.disconnect(); } } window.addEventListener('locationchange', function() { - observer[location.href.indexOf('/answer/') === -1 ? 'start' : 'end']() + observer[location.href.indexOf('/answer/') === -1 ? 'start' : 'end'](); }) - window._collapsedAnswerObserver = observer + window._collapsedAnswerObserver = observer; } return window._collapsedAnswerObserver } @@ -131,9 +131,9 @@ function getCollapsedAnswerObserver() { // 默认收起回答 function defaultCollapsedAnswer() { if (!menu_value('menu_defaultCollapsedAnswer')) return - const observer = getCollapsedAnswerObserver() + const observer = getCollapsedAnswerObserver(); if (location.href.indexOf('/answer/') === -1) { - observer.start() + observer.start(); } } @@ -147,27 +147,27 @@ function collapsedAnswer() { document.getElementById('collapsed-button').onclick = function () { document.querySelectorAll('[script-collapsed]').forEach(function(scriptCollapsed) { scriptCollapsed.querySelectorAll('.ContentItem-actions [data-zop-retract-question], .ContentItem-actions.Sticky [data-zop-retract-question]').forEach(function(button) { - button.click() + button.click(); }) }) document.querySelectorAll(':not([script-collapsed]) .ContentItem-actions.Sticky [data-zop-retract-question]').forEach(function(button) { - let el = button.parentElement - while (!el?.classList.contains('RichContent')) { - el = el.parentElement + let el = button.parentElement; + while (!el.classList.contains('RichContent')) { + el = el.parentElement; } if (el) { - el.setAttribute('script-collapsed', '') + el.setAttribute('script-collapsed', ''); } - button.click() + button.click(); }) - const ob = getCollapsedAnswerObserver() - ob.start() - if (!menu_value('menu_defaultCollapsedAnswer') && !ob._disconnectListener) { + const observer = getCollapsedAnswerObserver(); + observer.start(); + if (!menu_value('menu_defaultCollapsedAnswer') && !observer._disconnectListener) { window.addEventListener('locationchange', function() { - ob.end() - window._collapsedAnswerObserver = null + observer.end(); + window._collapsedAnswerObserver = null; }) - ob._disconnectListener = true + observer._disconnectListener = true; } } } @@ -871,6 +871,16 @@ function addTypeTips() { }); observer.observe(document, { childList: true, subtree: true }); + window.addEventListener('locationchange', function(){ + if (location.pathname.indexOf('/people/') > -1) { + if (location.pathname.split('/').length === 3) { + observer.observe(document, { childList: true, subtree: true }); + } else { + observer.disconnect(); + } + } + }) + function addTypeTips_(titleA) { if (!titleA) return // 判断是否为真 if (titleA.querySelector('small.zhihu_e_tips')) return // 判断是否已添加 @@ -947,7 +957,7 @@ function removeLogin() { for (const target of mutation.addedNodes) { if (target.nodeType != 1) return if (target.querySelector('.signFlowModal')) { - let button = target.getElementsByClassName('Button Modal-closeButton Button--plain')[0]; + let button = target.querySelector('.Button.Modal-closeButton.Button--plain'); if (button) button.click(); } } @@ -965,7 +975,6 @@ function removeLogin() { const observer = new MutationObserver(removeLoginModal); observer.observe(document, { childList: true, subtree: true }); document.querySelector('button.AppHeader-login').onclick=function(){location.href='https://www.zhihu.com/signin';} // [登录] 按钮跳转至登录页面 - document.querySelector('.AppHeader-profile button.Button--primary').onclick=function(){location.href='https://www.zhihu.com/signin';} // [加入知乎] 按钮跳转至注册页面(实际上是同一个页面) } } } @@ -980,7 +989,7 @@ function closeFloatingComments() { if (target.querySelector('.Modal-backdrop')) { document.querySelector('.Modal-backdrop').onclick = function(event){ if (event.target == this) { - let button = document.getElementsByClassName('Button Modal-closeButton Button--plain')[0]; + let button = document.querySelector('.Button.Modal-closeButton.Button--plain'); if (button) button.click(); } } @@ -1317,7 +1326,7 @@ function questionInvitation(){ collapsedNowAnswer('.ContentLayout'); // 收起当前回答 + 快捷返回顶部 setInterval(topTime_people, 300); // 置顶显示时间 addTypeTips(); // 区分问题文章 - addToQuestion(); // 直达问题按钮 + addToQuestion(); // 直达问题按钮 blockUsers('topic'); // 屏蔽指定用户 blockKeywords('topic'); // 屏蔽指定关键词 } From 5d26536ab9e45ab3ce3cc6fdf2bdcff1e9957895 Mon Sep 17 00:00:00 2001 From: xiu2 <54703944+XIU2@users.noreply.github.com> Date: Sun, 15 Aug 2021 01:16:42 +0800 Subject: [PATCH 0028/1990] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20[=E5=8C=BA?= =?UTF-8?q?=E5=88=86=E9=97=AE=E9=A2=98=E6=96=87=E7=AB=A0]=E3=80=81[?= =?UTF-8?q?=E7=9B=B4=E8=BE=BE=E9=97=AE=E9=A2=98=E6=8C=89=E9=92=AE]=20?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=E5=9C=A8=E7=82=B9=E5=87=BB=E5=88=87=E6=8D=A2?= =?UTF-8?q?=E9=80=89=E9=A1=B9=E5=8D=A1=E6=97=B6=E4=B8=8D=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98;=20=E4=BC=98=E5=8C=96=20[=E5=8C=BA?= =?UTF-8?q?=E5=88=86=E9=97=AE=E9=A2=98=E6=96=87=E7=AB=A0]=20=E6=A0=87?= =?UTF-8?q?=E7=AD=BE=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Zhihu-Enhanced.user.js | 53 ++++++++++++++++++++++++++++++++---------- 1 file changed, 41 insertions(+), 12 deletions(-) diff --git a/Zhihu-Enhanced.user.js b/Zhihu-Enhanced.user.js index de8b9ebd6..314a5b3da 100644 --- a/Zhihu-Enhanced.user.js +++ b/Zhihu-Enhanced.user.js @@ -1,6 +1,6 @@ // ==UserScript== // @name 知乎增强 -// @version 1.6.1 +// @version 1.6.2 // @author X.I.U // @description 移除登录弹窗、默认收起回答、一键收起回答、收起当前回答/评论(点击两侧空白处)、快捷回到顶部(右键两侧空白处)、屏蔽用户 (发布的内容)、屏蔽关键词(标题/评论)、屏蔽盐选内容、展开问题描述、置顶显示时间、显示问题时间、区分问题文章、直达问题按钮、默认高清原图、默认站外直链 // @match *://www.zhihu.com/* @@ -853,11 +853,14 @@ function blockYanXuan() { function addTypeTips() { if (!menu_value('menu_typeTips')) return + // 添加标签样式 + document.lastChild.appendChild(document.createElement('style')).textContent = `small.zhihu_e_tips {font-weight: bold;font-size: 13px;padding: 0 4px;border-radius: 2px;display: inline-block;height: 20px;}`; + // 一开始加载的信息流 if (location.pathname === '/search') { - setTimeout(function(){document.querySelectorAll('h2.ContentItem-title a').forEach(function(item){addTypeTips_(item);})}, 2000); - } else { - document.querySelectorAll('h2.ContentItem-title a').forEach(function(item){addTypeTips_(item);}) + addSetInterval_('h2.ContentItem-title a:not(.zhihu_e_toQuestion)'); + } else { + document.querySelectorAll('h2.ContentItem-title a:not(.zhihu_e_toQuestion)').forEach(function(item){addTypeTips_(item);}) } // 后续加载的信息流 @@ -865,7 +868,7 @@ function addTypeTips() { for (const mutation of mutationsList) { for (const target of mutation.addedNodes) { if (target.nodeType != 1) return - addTypeTips_(target.querySelector('h2.ContentItem-title a')); + addTypeTips_(target.querySelector('h2.ContentItem-title a:not(.zhihu_e_toQuestion)')); } } }); @@ -874,10 +877,13 @@ function addTypeTips() { window.addEventListener('locationchange', function(){ if (location.pathname.indexOf('/people/') > -1) { if (location.pathname.split('/').length === 3) { + addSetInterval_('h2.ContentItem-title a:not(.zhihu_e_toQuestion)'); observer.observe(document, { childList: true, subtree: true }); } else { observer.disconnect(); } + } else { + addSetInterval_('h2.ContentItem-title a:not(.zhihu_e_toQuestion)'); } }) @@ -890,19 +896,28 @@ function addTypeTips() { patt_question_answer = /answer\/\d+/, patt_video = /\/zvideo\//; if (patt_zhuanlan.test(titleA.href)) { // 如果是文章 - titleA.innerHTML = `文章 ` + titleA.innerHTML + titleA.innerHTML = `文章 ` + titleA.innerHTML } else if (patt_question.test(titleA.href)) { // 如果是问题 if (!titleA.dataset.tooltip) { // 排除用户名后面的蓝标、黄标等链接 if (patt_question_answer.test(titleA.href)) { // 如果是指向回答的问题(而非指向纯问题的链接) - titleA.innerHTML = `问题 ` + titleA.innerHTML + titleA.innerHTML = `问题 ` + titleA.innerHTML } else { - titleA.innerHTML = `问题 ` + titleA.innerHTML + titleA.innerHTML = `问题 ` + titleA.innerHTML } } } else if (patt_video.test(titleA.href)) { // 如果是视频 - titleA.innerHTML = `视频 ` + titleA.innerHTML + titleA.innerHTML = `视频 ` + titleA.innerHTML } + } + function addSetInterval_(A) { + let timer = setInterval(function(){ + let aTag = document.querySelectorAll(A); + if (aTag.length > 0) { + clearInterval(timer); + aTag.forEach(function(item){addTypeTips_(item);}) + } + }); } } @@ -916,9 +931,9 @@ function addToQuestion() { // 一开始加载的信息流 if (location.pathname === '/search') { - setTimeout(function(){document.querySelectorAll('h2.ContentItem-title a').forEach(function(item){addTypeTips_(item);})}, 2000); + addSetInterval_('h2.ContentItem-title a:not(.zhihu_e_tips)'); } else { - document.querySelectorAll('h2.ContentItem-title a').forEach(function(item){addTypeTips_(item);}) + document.querySelectorAll('h2.ContentItem-title a:not(.zhihu_e_tips)').forEach(function(item){addTypeTips_(item);}) } // 后续加载的信息流 @@ -926,12 +941,16 @@ function addToQuestion() { for (const mutation of mutationsList) { for (const target of mutation.addedNodes) { if (target.nodeType != 1) return - addTypeTips_(target.querySelector('h2.ContentItem-title a')); + addTypeTips_(target.querySelector('h2.ContentItem-title a:not(.zhihu_e_tips)')); } } }); observer.observe(document, { childList: true, subtree: true }); + window.addEventListener('locationchange', function(){ + addSetInterval_('h2.ContentItem-title a:not(.zhihu_e_tips)'); + }) + function addTypeTips_(titleA) { if (!titleA) return // 判断是否为真 if (titleA.parentElement.querySelector('a.zhihu_e_toQuestion')) return // 判断是否已添加 @@ -939,6 +958,16 @@ function addToQuestion() { titleA.insertAdjacentHTML('afterend', `直达问题`); } } + + function addSetInterval_(A) { + let timer = setInterval(function(){ + let aTag = document.querySelectorAll(A); + if (aTag.length > 0) { + clearInterval(timer); + aTag.forEach(function(item){addTypeTips_(item);}) + } + }); + } } From dd35160c3392da2df50e6304e2d9b69aa6e4ccab Mon Sep 17 00:00:00 2001 From: liangjiancang <42267675+liangjiancang@users.noreply.github.com> Date: Sun, 15 Aug 2021 12:26:47 +0800 Subject: [PATCH 0029/1990] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20[=E4=B8=80?= =?UTF-8?q?=E9=94=AE=E6=94=B6=E8=B5=B7=E5=9B=9E=E7=AD=94]=20=E4=B8=80?= =?UTF-8?q?=E5=A4=84=E9=94=99=E8=AF=AF=E7=9A=84=20CSS=20=E9=80=89=E6=8B=A9?= =?UTF-8?q?=E5=99=A8=20(#76)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Zhihu-Enhanced.user.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Zhihu-Enhanced.user.js b/Zhihu-Enhanced.user.js index 314a5b3da..bf1372a2e 100644 --- a/Zhihu-Enhanced.user.js +++ b/Zhihu-Enhanced.user.js @@ -150,7 +150,7 @@ function collapsedAnswer() { button.click(); }) }) - document.querySelectorAll(':not([script-collapsed]) .ContentItem-actions.Sticky [data-zop-retract-question]').forEach(function(button) { + document.querySelectorAll('.RichContent:not([script-collapsed]) .ContentItem-actions.Sticky [data-zop-retract-question]').forEach(function(button) { let el = button.parentElement; while (!el.classList.contains('RichContent')) { el = el.parentElement; From 78e4ab15f8ff50c2e83e75fb1a074cdc1d5ff9b8 Mon Sep 17 00:00:00 2001 From: xiu2 <54703944+XIU2@users.noreply.github.com> Date: Sun, 15 Aug 2021 12:28:42 +0800 Subject: [PATCH 0030/1990] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20[=E4=B8=80?= =?UTF-8?q?=E9=94=AE=E6=94=B6=E8=B5=B7=E5=9B=9E=E7=AD=94]=20=E4=B8=80?= =?UTF-8?q?=E5=A4=84=E9=94=99=E8=AF=AF=E7=9A=84=20CSS=20=E9=80=89=E6=8B=A9?= =?UTF-8?q?=E5=99=A8=20(#76)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Zhihu-Enhanced.user.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Zhihu-Enhanced.user.js b/Zhihu-Enhanced.user.js index bf1372a2e..21cede5d2 100644 --- a/Zhihu-Enhanced.user.js +++ b/Zhihu-Enhanced.user.js @@ -1,6 +1,6 @@ // ==UserScript== // @name 知乎增强 -// @version 1.6.2 +// @version 1.6.3 // @author X.I.U // @description 移除登录弹窗、默认收起回答、一键收起回答、收起当前回答/评论(点击两侧空白处)、快捷回到顶部(右键两侧空白处)、屏蔽用户 (发布的内容)、屏蔽关键词(标题/评论)、屏蔽盐选内容、展开问题描述、置顶显示时间、显示问题时间、区分问题文章、直达问题按钮、默认高清原图、默认站外直链 // @match *://www.zhihu.com/* From 54aead1ac17941bb3a2a870c8d513133238edd73 Mon Sep 17 00:00:00 2001 From: XIU2 <54703944+XIU2@users.noreply.github.com> Date: Sun, 15 Aug 2021 15:12:05 +0800 Subject: [PATCH 0031/1990] Update issue templates --- .github/ISSUE_TEMPLATE/------bug-.md | 10 ++++++++++ .github/ISSUE_TEMPLATE/------bug-report-.md | 10 ++++++++++ .github/ISSUE_TEMPLATE/------feature-request-.md | 10 ++++++++++ .github/ISSUE_TEMPLATE/------script-request-.md | 10 ++++++++++ .github/ISSUE_TEMPLATE/----.md | 10 ++++++++++ .github/ISSUE_TEMPLATE/bug---.md | 10 ++++++++++ 6 files changed, 60 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/------bug-.md create mode 100644 .github/ISSUE_TEMPLATE/------bug-report-.md create mode 100644 .github/ISSUE_TEMPLATE/------feature-request-.md create mode 100644 .github/ISSUE_TEMPLATE/------script-request-.md create mode 100644 .github/ISSUE_TEMPLATE/----.md create mode 100644 .github/ISSUE_TEMPLATE/bug---.md diff --git a/.github/ISSUE_TEMPLATE/------bug-.md b/.github/ISSUE_TEMPLATE/------bug-.md new file mode 100644 index 000000000..44d600aa6 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/------bug-.md @@ -0,0 +1,10 @@ +--- +name: 反馈问题 (BUG) +about: 某个功能失效,或在某个浏览器下无法使用,或有其他预期之外的问题~ +title: "[脚本名称] XX 功能失效(记得修改该示例标题)" +labels: 反馈问题 +assignees: '' + +--- + + diff --git a/.github/ISSUE_TEMPLATE/------bug-report-.md b/.github/ISSUE_TEMPLATE/------bug-report-.md new file mode 100644 index 000000000..3e61b6ae0 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/------bug-report-.md @@ -0,0 +1,10 @@ +--- +name: 反馈问题 (Bug report) +about: 某个功能失效,或在某个浏览器下无法使用,或有其他预期之外的问题~ +title: "[脚本名称] XX 功能失效(记得修改该示例标题)" +labels: 反馈问题 +assignees: '' + +--- + + diff --git a/.github/ISSUE_TEMPLATE/------feature-request-.md b/.github/ISSUE_TEMPLATE/------feature-request-.md new file mode 100644 index 000000000..68561fd0b --- /dev/null +++ b/.github/ISSUE_TEMPLATE/------feature-request-.md @@ -0,0 +1,10 @@ +--- +name: 功能建议 (Feature request) +about: 你有一个好想法、好需求,想要做成脚本但不会写,来告诉我吧~ +title: "[脚本名称] 希望添加 XX 功能(记得修改该示例标题)" +labels: 功能建议 +assignees: '' + +--- + + diff --git a/.github/ISSUE_TEMPLATE/------script-request-.md b/.github/ISSUE_TEMPLATE/------script-request-.md new file mode 100644 index 000000000..e81bcad3d --- /dev/null +++ b/.github/ISSUE_TEMPLATE/------script-request-.md @@ -0,0 +1,10 @@ +--- +name: 脚本请求 (Script request) +about: 你有一个好想法、好需求,想要做成脚本但不会写,来告诉我吧~ +title: 希望制作一个 XX 功能的脚本(记得修改该示例标题) +labels: 脚本请求 +assignees: '' + +--- + + diff --git a/.github/ISSUE_TEMPLATE/----.md b/.github/ISSUE_TEMPLATE/----.md new file mode 100644 index 000000000..2c4611284 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/----.md @@ -0,0 +1,10 @@ +--- +name: 脚本请求 +about: 你有一个好想法、好需求,想要做成脚本但不会写,来告诉我吧~ +title: 希望制作一个 XX 功能的脚本(记得修改该示例标题) +labels: 脚本请求 +assignees: '' + +--- + + diff --git a/.github/ISSUE_TEMPLATE/bug---.md b/.github/ISSUE_TEMPLATE/bug---.md new file mode 100644 index 000000000..efb022dd8 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug---.md @@ -0,0 +1,10 @@ +--- +name: BUG 反馈 +about: 某个功能失效,或在某个浏览器下无法使用,或有其他预期之外的问题 +title: "[脚本名称] XXX 功能失效(记得修改该示例)" +labels: 反馈问题 +assignees: '' + +--- + + From 86a7bc1114bf4f95271f5f9b236401bca8ab1274 Mon Sep 17 00:00:00 2001 From: XIU2 <54703944+XIU2@users.noreply.github.com> Date: Sun, 15 Aug 2021 15:13:08 +0800 Subject: [PATCH 0032/1990] Update issue templates --- .github/ISSUE_TEMPLATE/----.md | 10 ---------- .github/ISSUE_TEMPLATE/bug---.md | 10 ---------- 2 files changed, 20 deletions(-) delete mode 100644 .github/ISSUE_TEMPLATE/----.md delete mode 100644 .github/ISSUE_TEMPLATE/bug---.md diff --git a/.github/ISSUE_TEMPLATE/----.md b/.github/ISSUE_TEMPLATE/----.md deleted file mode 100644 index 2c4611284..000000000 --- a/.github/ISSUE_TEMPLATE/----.md +++ /dev/null @@ -1,10 +0,0 @@ ---- -name: 脚本请求 -about: 你有一个好想法、好需求,想要做成脚本但不会写,来告诉我吧~ -title: 希望制作一个 XX 功能的脚本(记得修改该示例标题) -labels: 脚本请求 -assignees: '' - ---- - - diff --git a/.github/ISSUE_TEMPLATE/bug---.md b/.github/ISSUE_TEMPLATE/bug---.md deleted file mode 100644 index efb022dd8..000000000 --- a/.github/ISSUE_TEMPLATE/bug---.md +++ /dev/null @@ -1,10 +0,0 @@ ---- -name: BUG 反馈 -about: 某个功能失效,或在某个浏览器下无法使用,或有其他预期之外的问题 -title: "[脚本名称] XXX 功能失效(记得修改该示例)" -labels: 反馈问题 -assignees: '' - ---- - - From 1a7e62421995589715659f63d29425596f92ab08 Mon Sep 17 00:00:00 2001 From: XIU2 <54703944+XIU2@users.noreply.github.com> Date: Sun, 15 Aug 2021 15:13:56 +0800 Subject: [PATCH 0033/1990] Update issue templates --- .github/ISSUE_TEMPLATE/------bug-.md | 10 ---------- 1 file changed, 10 deletions(-) delete mode 100644 .github/ISSUE_TEMPLATE/------bug-.md diff --git a/.github/ISSUE_TEMPLATE/------bug-.md b/.github/ISSUE_TEMPLATE/------bug-.md deleted file mode 100644 index 44d600aa6..000000000 --- a/.github/ISSUE_TEMPLATE/------bug-.md +++ /dev/null @@ -1,10 +0,0 @@ ---- -name: 反馈问题 (BUG) -about: 某个功能失效,或在某个浏览器下无法使用,或有其他预期之外的问题~ -title: "[脚本名称] XX 功能失效(记得修改该示例标题)" -labels: 反馈问题 -assignees: '' - ---- - - From 2088a5672b0d1b26d3e4bdd26de0509530e99589 Mon Sep 17 00:00:00 2001 From: xiu2 <54703944+XIU2@users.noreply.github.com> Date: Sun, 15 Aug 2021 18:38:08 +0800 Subject: [PATCH 0034/1990] =?UTF-8?q?=E6=96=B0=E5=A2=9E=20[=E6=9A=97?= =?UTF-8?q?=E9=BB=91=E6=A8=A1=E5=BC=8F=E8=B7=9F=E9=9A=8F=E6=B5=8F=E8=A7=88?= =?UTF-8?q?=E5=99=A8]=20=E5=8A=9F=E8=83=BD;=20=E4=BC=98=E5=8C=96=20?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Zhihu-Beautification.user.js | 131 ++++++++++++++++++++--------------- 1 file changed, 74 insertions(+), 57 deletions(-) diff --git a/Zhihu-Beautification.user.js b/Zhihu-Beautification.user.js index b33b3a12d..efbde2988 100644 --- a/Zhihu-Beautification.user.js +++ b/Zhihu-Beautification.user.js @@ -1,8 +1,8 @@ // ==UserScript== // @name 知乎美化 -// @version 1.2.9 +// @version 1.3.0 // @author X.I.U -// @description 宽屏显示、暗黑模式(4种)、隐藏文章开头大图、调整图片最大高度、向下翻时自动隐藏顶栏、文章编辑页面与实际文章宽度一致、屏蔽登录提示 +// @description 宽屏显示、暗黑模式(4种)、暗黑模式跟随浏览器、隐藏文章开头大图、调整图片最大高度、向下翻时自动隐藏顶栏、文章编辑页面与实际文章宽度一致、屏蔽登录提示 // @match *://www.zhihu.com/* // @match *://zhuanlan.zhihu.com/* // @icon https://static.zhihu.com/heifetz/favicon.ico @@ -25,6 +25,7 @@ ['menu_widescreenDisplay', '宽屏显示', '宽屏显示', true], ['menu_darkMode', '暗黑模式', '暗黑模式', true], ['menu_darkModeType', '暗黑模式切换(1~4)', '暗黑模式切换', 1], + ['menu_darkModeAuto', '暗黑模式跟随浏览器', '暗黑模式跟随浏览器', false], ['menu_picHeight', '调整图片最大高度', '调整图片最大高度', true], ['menu_postimg', '隐藏文章开头大图', '隐藏文章开头大图', true], ['menu_hideTitle', '向下翻时自动隐藏顶栏', '向下翻时自动隐藏顶栏', true] @@ -67,15 +68,13 @@ } GM_setValue(`${Name}`, menu_status); if (menu_status === 1) { // 设置 Cookie - if (getTheme() === 'light') document.cookie='theme=dark; expires=Thu, 18 Dec 2031 12:00:00 GMT; path=/'; + if (getTheme() === 'light') setTheme('dark'); } else { - if (getTheme() === 'dark') document.cookie='theme=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/'; - } - if (menu_value('menu_darkMode')) { - location.reload(); // 刷新网页 - } else { - GM_notification({text: `已切换暗黑模式为:方案 ${menu_status}\n`, timeout: 3500}); // 提示消息 - registerMenuCommand(); // 重新注册脚本菜单 + if (getTheme() === 'dark') { + setTheme('light'); + } else { + if (menu_value('menu_darkMode')) {location.reload();} else {registerMenuCommand();} + } } }; @@ -90,8 +89,7 @@ GM_setValue(`${Name}`, false); if (Name === 'menu_darkMode') { // 暗黑模式 - if (getTheme() === 'dark') document.cookie='theme=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/'; - location.reload(); // 刷新网页 + if (getTheme() === 'dark') {setTheme('light');} else {location.reload();} } else { GM_notification({text: `已关闭 [${Tips}] 功能\n(点击刷新网页后生效)`, timeout: 3500, onclick: function(){location.reload();}}); } @@ -100,11 +98,10 @@ if (Name === 'menu_darkMode') { if (menu_value('menu_darkModeType') === 1) { - if (getTheme() === 'light') document.cookie='theme=dark; expires=Thu, 18 Dec 2031 12:00:00 GMT; path=/'; + if (getTheme() === 'light') setTheme('dark'); } else { - if (getTheme() === 'dark') document.cookie='theme=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/'; + if (getTheme() === 'dark') {setTheme('light');} else {location.reload();} } - location.reload(); // 刷新网页 } else { GM_notification({text: `已开启 [${Tips}] 功能\n(点击刷新网页后生效)`, timeout: 3500, onclick: function(){location.reload();}}); } @@ -264,7 +261,7 @@ html[data-theme=dark] .CommentItemV2--highlighted {-webkit-animation: nano !impo /* 赞赏 */ html[data-theme=dark] .Reward-TipjarDialog-amountList .Button--red, html[data-theme=dark] .Reward-TipjarDialog-amountList .Button--red, html[data-theme=dark] .Reward-TipjarDialog-amountInput .SimpleInput {color: #d3d3d3 !important; background-color: #353b44 !important; border: none !important;} -/* 点赞 */ +/* 赞同 */ html[data-theme=dark] .VoteButton.is-active {color: #d6edff !important;} `, style_darkMode_1_x = `/* 问题日志页 */ @@ -303,52 +300,56 @@ html {filter: brightness(75%) sepia(30%) !important; background-image: url();} ` let style_Add = document.createElement('style'); - // 如果开启了暗黑模式 + + + // 如果开启了 [暗黑模式] if (menu_value('menu_darkMode')) { - // 如果暗黑模式为 1 - if (menu_value('menu_darkModeType') === 1) { - // 如果当前知乎主题为白天模式,那就是改为暗黑模式 - if (getTheme() === 'light') { - document.cookie='theme=dark; expires=Thu, 18 Dec 2031 12:00:00 GMT; path=/'; - document.lastChild.setAttribute('data-theme', 'dark'); - location.reload(); // 刷新网页 - } - // 如果是问题日志页,则改为暗黑模式 - if (location.pathname.indexOf('/log') > -1) { - document.documentElement.setAttribute('data-theme', 'dark'); - style_darkMode_1 += style_darkMode_1_x; - } - } else { // 如果是其他暗黑模式,则需要确保为白天模式 + // 如果开启了 [暗黑模式跟随浏览器] 且 当前浏览器是暗黑模式 + if (menu_value('menu_darkModeAuto') && !window.matchMedia('(prefers-color-scheme: dark)').matches) { + // 如果是暗黑模式,则需要改为白天模式 if (getTheme() === 'dark') { - document.cookie='theme=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/'; - document.lastChild.setAttribute('data-theme', 'light'); - location.reload(); // 刷新网页 + setTheme('light'); + } + } else { + // 如果暗黑模式为 1 + if (menu_value('menu_darkModeType') === 1) { + // 如果当前知乎主题为白天模式,那就是改为暗黑模式 + if (getTheme() === 'light') { + setTheme('dark'); + } + // 如果是问题日志页,则改为暗黑模式 + if (location.pathname.indexOf('/log') > -1) { + document.documentElement.setAttribute('data-theme', 'dark'); + style_darkMode_1 += style_darkMode_1_x; + } + } else { // 如果是其他暗黑模式,则需要确保为白天模式 + if (getTheme() === 'dark') { + setTheme('light'); + } + if (navigator.userAgent.toLowerCase().indexOf('firefox') > -1) { + style_darkMode_2 = style_darkMode_2_firefox + style_darkMode_3 = style_darkMode_3_firefox + style_darkMode_4 = style_darkMode_4_firefox + } } - if (navigator.userAgent.toLowerCase().indexOf('firefox') > -1) { - style_darkMode_2 = style_darkMode_2_firefox - style_darkMode_3 = style_darkMode_3_firefox - style_darkMode_4 = style_darkMode_4_firefox + switch(menu_value('menu_darkModeType')) { + case 1: + style += style_darkMode_1; + break; + case 2: + style += style_darkMode_2; + break; + case 3: + style += style_darkMode_3; + break; + case 4: + style += style_darkMode_4; + break; } } - switch(menu_value('menu_darkModeType')) { - case 1: - style += style_darkMode_1; - break; - case 2: - style += style_darkMode_2; - break; - case 3: - style += style_darkMode_3; - break; - case 4: - style += style_darkMode_4; - break; - } } else { if (getTheme() === 'dark'){ - document.cookie='theme=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/'; - document.lastChild.setAttribute('data-theme', 'light'); - location.reload(); // 刷新网页 + setTheme('light'); } } @@ -379,12 +380,28 @@ html {filter: brightness(75%) sepia(30%) !important; background-image: url();} // 获取知乎 Cookie 中的主题类型 function getTheme() { - let name = "theme=", + let name = 'theme=', ca = document.cookie.split(';'); for (let i=0; i Date: Sun, 15 Aug 2021 19:04:38 +0800 Subject: [PATCH 0035/1990] =?UTF-8?q?=E6=96=B0=E5=A2=9E=20[=E6=9A=97?= =?UTF-8?q?=E9=BB=91=E6=A8=A1=E5=BC=8F=E8=B7=9F=E9=9A=8F=E6=B5=8F=E8=A7=88?= =?UTF-8?q?=E5=99=A8]=20=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DarkMode.user.js | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/DarkMode.user.js b/DarkMode.user.js index df2081cfb..f6ec04ad4 100644 --- a/DarkMode.user.js +++ b/DarkMode.user.js @@ -1,6 +1,6 @@ // ==UserScript== // @name 护眼模式 -// @version 1.2.5 +// @version 1.2.6 // @author X.I.U // @description 简单有效的全网通用护眼模式、夜间模式、暗黑模式 // @match *://*/* @@ -29,6 +29,7 @@ var menu_ALL = [ ['menu_disable', '✅ 已启用 (点击对当前网站禁用)', '❌ 已禁用 (点击对当前网站启用)', []], ['menu_runDuringTheDay', '白天保持开启 (比晚上亮一点点)', '白天保持开启', true], + ['menu_darkModeAuto', '护眼模式跟随浏览器', '护眼模式跟随浏览器', false], ['menu_autoRecognition', '智能排除自带暗黑模式的网页 (beta)', '智能排除自带暗黑模式的网页 (beta)', true], ['menu_forcedToEnable', '✅ 已强制当前网站启用护眼模式 (👆)', '❌ 未强制当前网站启用护眼模式 (👆)', []], ['menu_darkModeType', '点击切换模式', '点击切换模式', 1], @@ -56,6 +57,10 @@ menu_ID[i] = GM_registerMenuCommand(`${menu_ALL[i][2]}`, function(){menu_disable('del')}); return } else { + if (GM_getValue('menu_darkModeAuto') && !window.matchMedia('(prefers-color-scheme: dark)').matches) { + menu_ID[i] = GM_registerMenuCommand(`❌ 当前浏览器为白天模式 (点击关闭 [护眼模式跟随浏览器])`, function(){GM_setValue('menu_darkModeAuto', false);location.reload();}); + return + } menu_ID[i] = GM_registerMenuCommand(`${menu_ALL[i][1]}`, function(){menu_disable('add')}); } } @@ -327,9 +332,9 @@ // 为了避免 body 还没加载导致无法检查是否设置背景颜色 let timer = setInterval(function(){ // 每 5 毫秒检查一下 body 是否已存在 if (document.body) { - clearInterval(timer); // 取消定时器(每 10 毫秒一次的) + clearInterval(timer); // 取消定时器(每 5 毫秒一次的) setTimeout(function(){ // 为了避免太快 body 的 CSS 还没加载上,先延迟 150 毫秒(缺点就是可能会出现短暂一闪而过的暗黑滤镜) - console.log('html:', window.getComputedStyle(document.lastChild).backgroundColor, 'body:', window.getComputedStyle(document.body).backgroundColor) + console.log('[护眼模式] html:', window.getComputedStyle(document.lastChild).backgroundColor, 'body:', window.getComputedStyle(document.body).backgroundColor) if (window.getComputedStyle(document.body).backgroundColor === 'rgba(0, 0, 0, 0)' && window.getComputedStyle(document.lastChild).backgroundColor === 'rgba(0, 0, 0, 0)') { // 如果 body 没有 CSS 背景颜色,那就需要添加一个背景颜色,否则影响滤镜效果 let style_Add2 = document.createElement('style'); @@ -341,7 +346,7 @@ for (let i=0;i 0 && getColorValue(document.body) < 898989 || getColorValue(document.lastChild) > 0 && getColorValue(document.lastChild) < 898989 || window.getComputedStyle(document.body).backgroundColor === 'rgba(0, 0, 0, 0)' && window.getComputedStyle(document.lastChild).backgroundColor === 'rgb(0, 0, 0)') { // 如果是黑色 (等于0,0,0) 或深色 (小于 89,89,89),就停用本脚本滤镜 if (menu_value('menu_autoRecognition')) { // 排除自带暗黑模式的网页 (beta) @@ -358,7 +363,7 @@ if (websiteList[i] === location.host) return } if (remove) return - console.log('检测到当前网页自带暗黑模式,停用本脚本滤镜...') + console.log('[护眼模式] 检测到当前网页自带暗黑模式,停用本脚本滤镜...') if (document.getElementById('XIU2DarkMode')) document.getElementById('XIU2DarkMode').remove(); if (document.getElementById('XIU2DarkMode2')) document.getElementById('XIU2DarkMode2').remove(); } @@ -369,7 +374,7 @@ // 用来解决一些 CSS 加载缓慢的网站,可能会出现没有正确排除的问题,在没有找到更好的办法之前,先这样凑活着用 /*setTimeout(function(){ - console.log('html:', window.getComputedStyle(document.lastChild).backgroundColor, 'body:', window.getComputedStyle(document.body).backgroundColor) + console.log('[护眼模式] html:', window.getComputedStyle(document.lastChild).backgroundColor, 'body:', window.getComputedStyle(document.body).backgroundColor) if (window.getComputedStyle(document.body).backgroundColor === 'rgb(0, 0, 0)' || getColorValue(document.body) > 0 && getColorValue(document.body) < 898989 || getColorValue(document.lastChild) > 0 && getColorValue(document.lastChild) < 898989) { // 如果是黑色 (等于0,0,0) 或深色 (小于 89,89,89),就停用本脚本滤镜 if (menu_value('menu_autoRecognition')) { // 排除自带暗黑模式的网页 (beta) @@ -377,7 +382,7 @@ if (websiteList[i] === location.host) return } if (remove) return - console.log('检测到当前网页自带暗黑模式,停用本脚本滤镜...') + console.log('[护眼模式] 检测到当前网页自带暗黑模式,停用本脚本滤镜...') if (document.getElementById('XIU2DarkMode')) document.getElementById('XIU2DarkMode').remove(); if (document.getElementById('XIU2DarkMode2')) document.getElementById('XIU2DarkMode2').remove(); } From 3cf6d3bb7dd1c8e477ffa2dbebf8379b9114f997 Mon Sep 17 00:00:00 2001 From: xiu2 <54703944+XIU2@users.noreply.github.com> Date: Sun, 15 Aug 2021 22:58:12 +0800 Subject: [PATCH 0036/1990] =?UTF-8?q?=E4=BC=98=E5=8C=96=20[=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E5=A4=8D=E5=88=B6=E5=88=86=E4=BA=AB=E9=93=BE=E6=8E=A5?= =?UTF-8?q?]=20=E5=8A=9F=E8=83=BD=EF=BC=88=E6=98=BE=E7=A4=BA=E5=B7=B2?= =?UTF-8?q?=E5=A4=8D=E5=88=B6=E7=9A=84=E6=8F=90=E7=A4=BA=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=EF=BC=89;=20=E4=BC=98=E5=8C=96=20=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Lanzou-Enhanced.user.js | 73 +++++++++++++---------------------------- 1 file changed, 23 insertions(+), 50 deletions(-) diff --git a/Lanzou-Enhanced.user.js b/Lanzou-Enhanced.user.js index f8b501b73..dbefbd1c3 100644 --- a/Lanzou-Enhanced.user.js +++ b/Lanzou-Enhanced.user.js @@ -1,6 +1,6 @@ // ==UserScript== // @name 蓝奏云网盘增强 -// @version 1.3.1 +// @version 1.3.2 // @author X.I.U // @description 刷新不回根目录、后退返回上一级、右键文件显示菜单、自动显示更多文件、自动打开分享链接、自动复制分享链接、带密码的分享链接自动输密码、拖入文件自动显示上传框、输入密码后回车确认、调整描述(话说)编辑框初始大小 // @match *://*.lanzous.com/* @@ -22,6 +22,7 @@ // @grant GM_getValue // @grant GM_setValue // @grant GM_notification +// @grant GM_setClipboard // @grant unsafeWindow // @noframes // @license GPL-3.0 License @@ -31,8 +32,8 @@ // @homepageURL https://github.com/XIU2/UserScript // ==/UserScript== -'use strict'; (function() { + 'use strict'; var menu_ALL = [ ['menu_open_fileSha', '自动打开分享链接', '自动打开分享链接', true], ['menu_copy_fileSha', '自动复制分享链接', '自动复制分享链接', true], @@ -117,7 +118,7 @@ // 获取 iframe 框架 function iframe() { mainframe = document.getElementById('mainframe'); - if (mainframe) { // 只有找到 iframe 框架时才会继续运行脚本 + if (mainframe) { // 只有找到 iframe 框架时才会继续运行脚本 mainframe = mainframe.contentWindow; if(menu_value('menu_refreshCorrection')){ refreshCorrection(); // 刷新不返回根目录(F5) @@ -202,8 +203,8 @@ let list_ = mainframe.document.getElementById(list_id_name); if (list_) { // 文件/文件夹列表 list_.oncontextmenu = function(e){ - e.preventDefault(); // 屏蔽浏览器自身右键菜单 - let left = e.pageX - 30; // 右键菜单弹出位置 + e.preventDefault(); // 屏蔽浏览器自身右键菜单 + let left = e.pageX - 30; // 右键菜单弹出位置 let list_ID = e.target.id; if (e.target.nodeName === 'FONT') { list_ID = e.target.parentNode.parentNode.id @@ -224,8 +225,8 @@ // 自动显示更多文件(后台页) function fileMore() { let filemore = mainframe.document.getElementById('filemore'); // 寻找 [显示更多文件] 按钮 - if (filemore && filemore.style.display === 'block') { // 判断按钮是否存在且可见 - if (filemore.children[0]) { // 判断按钮元素下第一个元素是否存在 + if (filemore && filemore.style.display === 'block') { // 判断按钮是否存在且可见 + if (filemore.children[0]) { // 判断按钮元素下第一个元素是否存在 filemore.children[0].click(); // 点击 [显示更多文件] 按钮 } } @@ -241,7 +242,7 @@ if (document.documentElement.scrollHeight <= document.documentElement.clientHeight + scrollTop + scrollDelta) { let filemore = document.getElementById('filemore'); // 寻找 [显示更多文件] 按钮 if (filemore && filemore.style.display != 'none') { // 如果正在加载,就不再点击 - if (filemore.textContent.indexOf('更多') > -1){ // 避免已经在加载了,重复点击 + if (filemore.textContent.indexOf('更多') > -1){ // 避免已经在加载了,重复点击 filemore.click(); // 点击 [显示更多文件] 按钮 } } @@ -319,45 +320,29 @@ } - // 自动打开分享链接(点击文件时) + // 自动打开分享链接(点击文件时/右键菜单 - [打开分享连接]) function fileSha_Open() { - if (menu_value('menu_open_fileSha')) { // 脚本菜单开启时才继续 - let code = mainframe.document.getElementById('code').title; // 获取分享链接(下载链接) - if (code != '') { // 确保分享链接(下载链接)不是空 - window.GM_openInTab(code, {active: true,insert: true,setParent: true}) // 打开分享链接(下载链接) + if (menu_value('menu_open_fileSha')) { // 脚本菜单开启时才继续 + let code = mainframe.document.getElementById('code'); // 获取分享链接(下载链接) + if (code && code.title != '') { // 确保分享链接(下载链接)不是空 + window.GM_openInTab(code.title, {active: true,insert: true,setParent: true}) // 打开分享链接(下载链接) } } } - // 自动复制分享链接(点击文件时) + // 自动复制分享链接(点击文件时/右键菜单 - [复制分享连接]) function fileSha_Copy() { - if (menu_value('menu_copy_fileSha')) { // 脚本菜单开启时才继续 - let f_sha1 = mainframe.document.getElementById('f_sha1').textContent; // 获取分享链接(下载链接) - if (f_sha1 != '') { // 确保分享链接(下载链接)不是空 - copyToClipboard(f_sha1); // 复制到剪切板 + if (menu_value('menu_copy_fileSha')) { // 脚本菜单开启时才继续 + let f_sha1 = mainframe.document.getElementById('f_sha1'); // 获取分享链接(下载链接) + if (f_sha1 && f_sha1.textContent != '') { // 确保分享链接(下载链接)不是空 + GM_setClipboard(f_sha1.textContent, 'text'); // 复制到剪切板 + GM_notification({text: '已复制分享链接~', timeout: 2000}); // 已复制提示 } } } - // 复制到剪切板 - function copyToClipboard(s){ - if (window.clipboardData) { - window.clipboardData.setData('text',s); - } else { - (function(s){ - document.oncopy=function(e){ - e.clipboardData.setData('text',s); - e.preventDefault(); - document.oncopy=null; - } - })(s); - document.execCommand('Copy'); - } - } - - // 隐藏分享链接窗口(这样自动打开/复制分享链接时,不会一闪而过) function hideSha(){ if (menu_value('menu_open_fileSha') || menu_value('menu_copy_fileSha')) { // [自动复制分享链接] 或 [自动打开分享链接] 任意一个功能开启时才继续 @@ -392,9 +377,9 @@ // 获取上个文件夹 ID(用于浏览器后退事件) function getLastFolderID() { lastFolderID = null - let f_tpspan = mainframe.document.querySelectorAll("span.f_tpspan"); + let f_tpspan = mainframe.document.querySelectorAll('span.f_tpspan'); if (f_tpspan.length > 1) { - lastFolderID = /-?\d+/.exec(f_tpspan[f_tpspan.length - 2].getAttribute("onclick"))[0]; + lastFolderID = /-?\d+/.exec(f_tpspan[f_tpspan.length - 2].getAttribute('onclick'))[0]; } } @@ -409,7 +394,7 @@ } - // 监听 XMLHttpRequest 事件并执行(新方法,只有在产生事件时才会执行 [自动显示更多文件],平时不会执行,更优雅~) + // 监听 XMLHttpRequest 事件并执行 function EventXMLHttpRequest() { var _send = mainframe.XMLHttpRequest.prototype.send function sendReplacement(data) { @@ -447,16 +432,4 @@ const observer = new MutationObserver(callback); observer.observe(mainframe.document, { childList: true, subtree: true }); } - - - /*(function (open) { - mainframe.XMLHttpRequest.prototype.open = function () { - this.addEventListener("readystatechange", function () { - if(this.responseURL != "") { - console.log(this.responseURL); - } - }, false); - open.apply(this, arguments); - }; - })(mainframe.XMLHttpRequest.prototype.open);*/ })(); \ No newline at end of file From 83499ae81692926d34e68f0845db3ca9b14a0b37 Mon Sep 17 00:00:00 2001 From: xiu2 <54703944+XIU2@users.noreply.github.com> Date: Sun, 15 Aug 2021 23:47:30 +0800 Subject: [PATCH 0037/1990] =?UTF-8?q?=E6=96=B0=E5=A2=9E=20[=E8=87=AA?= =?UTF-8?q?=E5=AE=9A=E4=B9=89=E5=88=86=E4=BA=AB=E9=93=BE=E6=8E=A5=E5=9F=9F?= =?UTF-8?q?=E5=90=8D]=20=E5=8A=9F=E8=83=BD;=20=E4=BC=98=E5=8C=96=20[?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E6=89=93=E5=BC=80/=E5=A4=8D=E5=88=B6?= =?UTF-8?q?=E5=88=86=E4=BA=AB=E9=93=BE=E6=8E=A5]=20=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Lanzou-Enhanced.user.js | 92 +++++++++++++++++++---------------------- 1 file changed, 42 insertions(+), 50 deletions(-) diff --git a/Lanzou-Enhanced.user.js b/Lanzou-Enhanced.user.js index dbefbd1c3..7853b0e87 100644 --- a/Lanzou-Enhanced.user.js +++ b/Lanzou-Enhanced.user.js @@ -1,8 +1,8 @@ // ==UserScript== // @name 蓝奏云网盘增强 -// @version 1.3.2 +// @version 1.3.3 // @author X.I.U -// @description 刷新不回根目录、后退返回上一级、右键文件显示菜单、自动显示更多文件、自动打开分享链接、自动复制分享链接、带密码的分享链接自动输密码、拖入文件自动显示上传框、输入密码后回车确认、调整描述(话说)编辑框初始大小 +// @description 刷新不回根目录、后退返回上一级、右键文件显示菜单、自动显示更多文件、自定义分享链接域名、自动打开/复制分享链接、带密码的分享链接自动输密码、拖入文件自动显示上传框、输入密码后回车确认、调整描述(话说)编辑框初始大小 // @match *://*.lanzous.com/* // @match *://*.lanzoux.com/* // @match *://*.lanzoui.com/* @@ -35,6 +35,7 @@ (function() { 'use strict'; var menu_ALL = [ + ['menu_customFileSha', '自定义分享链接域名', '自定义分享链接域名', ''], ['menu_open_fileSha', '自动打开分享链接', '自动打开分享链接', true], ['menu_copy_fileSha', '自动复制分享链接', '自动复制分享链接', true], ['menu_refreshCorrection', '刷新不返回根目录', '刷新不返回根目录', true], @@ -57,6 +58,8 @@ menu_ALL[i][3] = GM_getValue(menu_ALL[i][0]); if (menu_ALL[i][0] == 'menu_refreshCorrection') { menu_ID[i] = GM_registerMenuCommand(`${menu_ALL[i][3]?'✅':'❌'} ${menu_ALL[i][1]}`, function(){if(menu_value('menu_refreshCorrection')){UNrefreshCorrection();}else{refreshCorrection();};menu_switch(`${menu_ALL[i][3]}`,`${menu_ALL[i][0]}`,`${menu_ALL[i][2]}`)}); + } else if (menu_ALL[i][0] === 'menu_customFileSha') { + menu_ID[i] = GM_registerMenuCommand(`#️⃣ ${menu_ALL[i][1]}`, function(){customFileSha()}); } else { menu_ID[i] = GM_registerMenuCommand(`${menu_ALL[i][3]?'✅':'❌'} ${menu_ALL[i][1]}`, function(){menu_switch(`${menu_ALL[i][3]}`,`${menu_ALL[i][0]}`,`${menu_ALL[i][2]}`)}); } @@ -120,11 +123,9 @@ mainframe = document.getElementById('mainframe'); if (mainframe) { // 只有找到 iframe 框架时才会继续运行脚本 mainframe = mainframe.contentWindow; - if(menu_value('menu_refreshCorrection')){ - refreshCorrection(); // 刷新不返回根目录(F5) - } - setTimeout(folderDescdes, 200); // 调整话说编辑框初始大小 - setTimeout(hideSha, 200); // 隐藏分享链接窗口(这样自动打开/复制分享链接时,不会一闪而过) + if (menu_value('menu_refreshCorrection')) refreshCorrection(); // 刷新不返回根目录(F5) + setTimeout(folderDescdes, 500); // 调整话说编辑框初始大小 + setTimeout(hideSha, 500); // 隐藏分享链接窗口(这样自动打开/复制分享链接时,不会一闪而过) fobiddenBack(); // 禁止浏览器返回(并绑定新的返回事件) EventXMLHttpRequest(); // 监听 XMLHttpRequest 事件并执行 [自动显示更多文件] @@ -191,10 +192,9 @@ // 右键文件显示菜单 function rightClickMenu() { - if (menu_value('menu_rightClickMenu')) { // 脚本菜单开启时才继续 - rightClickMenu_('sub_folder_list', 'fols', 'folse') // 文件夹 - rightClickMenu_('filelist', 'fs', 'fse') // 文件 - } + if (!menu_value('menu_rightClickMenu')) return + rightClickMenu_('sub_folder_list', 'fols', 'folse') // 文件夹 + rightClickMenu_('filelist', 'fs', 'fse') // 文件 } @@ -270,19 +270,18 @@ // 调整话说编辑框初始大小 function folderDescdes() { - if (menu_value('menu_folderDescdesMenu')) { - let folderdescdes = mainframe.document.getElementById('folder_descdes'); // 寻找话说(描述)编辑框 - if (folderdescdes) { // 判断话说(描述)元素是否存在 - folderdescdes.style.cssText='margin: 15px 0px; width: 550px; height: 125px;' - } - let folderdescdes2 = mainframe.document.getElementById('fol_credes'); // 寻找话说(描述)编辑框 - if (folderdescdes2) { // 判断话说(描述)元素是否存在 - folderdescdes2.style.cssText='margin: 15px 0px; width: 550px; height: 125px;' - } - let folderdescdes3 = mainframe.document.getElementById('file_desc'); // 寻找话说(描述)编辑框 - if (folderdescdes3) { // 判断话说(描述)元素是否存在 - folderdescdes3.style.cssText='margin: 15px 0px; width: 550px; height: 125px;' - } + if (!menu_value('menu_folderDescdesMenu')) return + let folderdescdes = mainframe.document.getElementById('folder_descdes'); // 寻找话说(描述)编辑框 + if (folderdescdes) { // 判断话说(描述)元素是否存在 + folderdescdes.style.cssText='margin: 15px 0px; width: 550px; height: 125px;' + } + let folderdescdes2 = mainframe.document.getElementById('fol_credes'); // 寻找话说(描述)编辑框 + if (folderdescdes2) { // 判断话说(描述)元素是否存在 + folderdescdes2.style.cssText='margin: 15px 0px; width: 550px; height: 125px;' + } + let folderdescdes3 = mainframe.document.getElementById('file_desc'); // 寻找话说(描述)编辑框 + if (folderdescdes3) { // 判断话说(描述)元素是否存在 + folderdescdes3.style.cssText='margin: 15px 0px; width: 550px; height: 125px;' } } @@ -301,7 +300,6 @@ mainframe.addEventListener('drop', function (e) { e.preventDefault(); //e.stopPropagation(); - //console.log('111111') //console.log(e.dataTransfer.files) }); } @@ -309,36 +307,30 @@ // 分享链接相关(点击文件时) function fileSha() { - var f_sha = mainframe.document.getElementById('f_sha'); // 寻找分享链接(下载链接)信息框 - if (f_sha && f_sha.style.display === 'block') { // 判断信息框是否存在且可见 - fileSha_Open(); // 自动打开分享链接(点击文件时) - fileSha_Copy(); // 自动复制分享链接(点击文件时) - if (menu_value('menu_open_fileSha') || menu_value('menu_copy_fileSha')) { - f_sha.style.display = 'none'; // 隐藏分享链接(下载链接)信息框 - } - } - } - - - // 自动打开分享链接(点击文件时/右键菜单 - [打开分享连接]) - function fileSha_Open() { - if (menu_value('menu_open_fileSha')) { // 脚本菜单开启时才继续 - let code = mainframe.document.getElementById('code'); // 获取分享链接(下载链接) - if (code && code.title != '') { // 确保分享链接(下载链接)不是空 - window.GM_openInTab(code.title, {active: true,insert: true,setParent: true}) // 打开分享链接(下载链接) + var f_sha = mainframe.document.getElementById('f_sha'); // 寻找分享链接(下载链接)信息框 + if (f_sha && f_sha.style.display === 'block') { // 判断信息框是否存在且可见 + let f_sha1 = mainframe.document.getElementById('f_sha1'); // 获取分享链接(下载链接) + if (f_sha1 && f_sha1.textContent != '') { // 确保分享链接(下载链接)不是空 + // 自定义分享链接域名 + if (menu_value('menu_customFileSha')) {f_sha1.innerText = f_sha1.innerText.replace(/\/\/.+\//i, '//' + menu_value('menu_customFileSha') + '/');} + // 打开分享链接 + if (menu_value('menu_open_fileSha')) {f_sha.style.display = 'none';GM_openInTab(f_sha1.textContent, {active: true,insert: true,setParent: true});} + // 复制分享链接(并已复制的提示信息) + if (menu_value('menu_copy_fileSha')) {f_sha.style.display = 'none';GM_setClipboard(f_sha1.textContent, 'text');GM_notification({text: '已复制分享链接~', timeout: 2000});} } } } - // 自动复制分享链接(点击文件时/右键菜单 - [复制分享连接]) - function fileSha_Copy() { - if (menu_value('menu_copy_fileSha')) { // 脚本菜单开启时才继续 - let f_sha1 = mainframe.document.getElementById('f_sha1'); // 获取分享链接(下载链接) - if (f_sha1 && f_sha1.textContent != '') { // 确保分享链接(下载链接)不是空 - GM_setClipboard(f_sha1.textContent, 'text'); // 复制到剪切板 - GM_notification({text: '已复制分享链接~', timeout: 2000}); // 已复制提示 - } + // 自定义分享链接域名 + function customFileSha() { + let newDomain = prompt('请输入 [自定义分享链接域名],点击确定后立即生效\n蓝奏云分享链接末尾的 ID 是唯一的,而前面的域名用谁的都一样\n示例:pan.lanzoui.com 或 wwe.lanzoui.com 或 xiu.lanzoui.com', GM_getValue('menu_customFileSha')); + if (newDomain === '') { + GM_setValue('menu_customFileSha', ''); + registerMenuCommand(); // 重新注册脚本菜单 + } else if (newDomain != null) { + GM_setValue('menu_customFileSha', newDomain); + registerMenuCommand(); // 重新注册脚本菜单 } } From bf7e59938edc3131ff5dea736a2f0e0e363d74b2 Mon Sep 17 00:00:00 2001 From: xiu2 <54703944+XIU2@users.noreply.github.com> Date: Mon, 16 Aug 2021 13:37:23 +0800 Subject: [PATCH 0038/1990] README.md --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 5f8b6fb50..ae8a06fb3 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ # XIU2/UserScript -[![GitHub license](https://img.shields.io/github/license/XIU2/UserScript.svg?style=flat-square&color=4285dd)](https://github.com/XIU2/UserScript/blob/master/LICENSE) -[![GitHub Star](https://img.shields.io/github/stars/XIU2/UserScript.svg?style=flat-square&label=Star&color=4285dd)](https://github.com/XIU2/UserScript/stargazers) -[![GitHub Fork](https://img.shields.io/github/forks/XIU2/UserScript.svg?style=flat-square&label=Fork&color=4285dd)](https://github.com/XIU2/UserScript/network/members) +[![GitHub license](https://img.shields.io/github/license/XIU2/UserScript.svg?style=flat-square&color=4285dd&logo=github)](https://github.com/XIU2/UserScript/) +[![GitHub Star](https://img.shields.io/github/stars/XIU2/UserScript.svg?style=flat-square&label=Star&color=4285dd&logo=github)](https://github.com/XIU2/UserScript/) +[![GitHub Fork](https://img.shields.io/github/forks/XIU2/UserScript.svg?style=flat-square&label=Fork&color=4285dd&logo=github)](https://github.com/XIU2/UserScript/) [![](https://img.shields.io/static/v1?label=%20&message=GreasyFork&style=flat-square&labelColor=7B0000&color=960000&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH3ggEBCQHM3fXsAAAAVdJREFUOMudkz2qwkAUhc/goBaGJBgUtBCZyj0ILkpwAW7Bws4yO3AHLiCtEFD8KVREkoiFxZzX5A2KGfN4F04zMN+ce+5c4LMUgDmANYBnrnV+plBSi+FwyHq9TgA2LQpvCiEiABwMBtzv95RSfoNEHy8DYBzHrNVqVEr9BWKcqNFoxF6vx3a7zc1mYyC73a4MogBg7vs+z+czO50OW60Wt9stK5UKp9Mpj8cjq9WqDTBHnjAdxzGQZrPJw+HA31oulzbAWgLoA0CWZVBKIY5jzGYzdLtdE9DlcrFNrY98zobqOA6TJKHW2jg4nU5sNBpFDp6mhVe5rsvVasUwDHm9Xqm15u12o+/7Hy0gD8KatOd5vN/v1FozTVN6nkchxFuI6hsAAIMg4OPxMJCXdtTbR7JJCMEgCJhlGUlyPB4XfumozInrupxMJpRSRtZlKoNYl+m/6/wDuWAjtPfsQuwAAAAASUVORK5CYII=)](https://greasyfork.org/zh-CN/users/457025-x-i-u) 🔨 自用的一些乱七八糟油猴脚本,**有什么需求、建议、问题直接提 [Issues](https://github.com/XIU2/UserScript/issues/new/choose)**,觉得**好用请点个⭐鼓励一下下~** From 862bede892e4be1408f3f40e5b61f79cf115237b Mon Sep 17 00:00:00 2001 From: xiu2 <54703944+XIU2@users.noreply.github.com> Date: Mon, 16 Aug 2021 13:37:48 +0800 Subject: [PATCH 0039/1990] =?UTF-8?q?=E6=8E=92=E9=99=A4=20Safari=20?= =?UTF-8?q?=E6=B5=8F=E8=A7=88=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Zhihu-Beautification.user.js | 1 + Zhihu-Enhanced.user.js | 1 + 2 files changed, 2 insertions(+) diff --git a/Zhihu-Beautification.user.js b/Zhihu-Beautification.user.js index efbde2988..d266fba72 100644 --- a/Zhihu-Beautification.user.js +++ b/Zhihu-Beautification.user.js @@ -14,6 +14,7 @@ // @grant GM_notification // @license GPL-3.0 License // @run-at document-start +// @incompatible safari // @namespace https://greasyfork.org/scripts/412212 // @supportURL https://github.com/XIU2/UserScript // @homepageURL https://github.com/XIU2/UserScript diff --git a/Zhihu-Enhanced.user.js b/Zhihu-Enhanced.user.js index 21cede5d2..931fb89e0 100644 --- a/Zhihu-Enhanced.user.js +++ b/Zhihu-Enhanced.user.js @@ -16,6 +16,7 @@ // @grant GM_info // @license GPL-3.0 License // @run-at document-end +// @incompatible safari // @namespace https://greasyfork.org/scripts/4122051 // @supportURL https://github.com/XIU2/UserScript // @homepageURL https://github.com/XIU2/UserScript From e1a70ffbc32f4a6a41d35ae65ec8d9fa09687a63 Mon Sep 17 00:00:00 2001 From: xiu2 <54703944+XIU2@users.noreply.github.com> Date: Mon, 16 Aug 2021 16:26:18 +0800 Subject: [PATCH 0040/1990] =?UTF-8?q?=E4=BC=98=E5=8C=96=20[=E7=9B=B4?= =?UTF-8?q?=E8=BE=BE=E9=97=AE=E9=A2=98=E6=8C=89=E9=92=AE]=20=E6=A0=B7?= =?UTF-8?q?=E5=BC=8F=E5=8F=8A=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Zhihu-Enhanced.user.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/Zhihu-Enhanced.user.js b/Zhihu-Enhanced.user.js index 931fb89e0..143e91e67 100644 --- a/Zhihu-Enhanced.user.js +++ b/Zhihu-Enhanced.user.js @@ -1,6 +1,6 @@ // ==UserScript== // @name 知乎增强 -// @version 1.6.3 +// @version 1.6.4 // @author X.I.U // @description 移除登录弹窗、默认收起回答、一键收起回答、收起当前回答/评论(点击两侧空白处)、快捷回到顶部(右键两侧空白处)、屏蔽用户 (发布的内容)、屏蔽关键词(标题/评论)、屏蔽盐选内容、展开问题描述、置顶显示时间、显示问题时间、区分问题文章、直达问题按钮、默认高清原图、默认站外直链 // @match *://www.zhihu.com/* @@ -927,13 +927,12 @@ function addTypeTips() { function addToQuestion() { if (!menu_value('menu_toQuestion')) return - // 添加按钮样式 - document.lastChild.appendChild(document.createElement('style')).textContent = `svg.zhihu_e_toQuestion {-webkit-transform: rotate(270deg);transform: rotate(270deg);} a.zhihu_e_toQuestion {font-size: 14px;font-weight: normal;padding: 3px 5px;margin-left: 3px;border-radius: 3px;}`; - - // 一开始加载的信息流 + // 一开始加载的信息流 + 添加按钮样式 if (location.pathname === '/search') { + document.lastChild.appendChild(document.createElement('style')).textContent = `a.zhihu_e_toQuestion {font-size: 14px !important;font-weight: normal !important;padding: 0 6px 2px !important;border-radius: 3px !important;display: inline-block !important;vertical-align: top !important;height: 23px !important;}`; addSetInterval_('h2.ContentItem-title a:not(.zhihu_e_tips)'); } else { + document.lastChild.appendChild(document.createElement('style')).textContent = `a.zhihu_e_toQuestion {font-size: 14px !important;font-weight: normal !important;padding: 2px 6px !important;border-radius: 3px !important;display: inline-block !important;vertical-align: top !important;}`; document.querySelectorAll('h2.ContentItem-title a:not(.zhihu_e_tips)').forEach(function(item){addTypeTips_(item);}) } @@ -955,8 +954,11 @@ function addToQuestion() { function addTypeTips_(titleA) { if (!titleA) return // 判断是否为真 if (titleA.parentElement.querySelector('a.zhihu_e_toQuestion')) return // 判断是否已添加 + if (titleA.textContent.indexOf('?') != -1) { // 把问题末尾英文问好 [?] 的替换为中文问好 [?],这样按钮与标题之间的间距就刚刚好~ + titleA.innerHTML = titleA.innerHTML.replace('?', "?") + } if (/answer\/\d+/.test(titleA.href)) { // 如果是指向回答的问题(而非指向纯问题的链接) - titleA.insertAdjacentHTML('afterend', `直达问题`); + titleA.insertAdjacentHTML('afterend', `直达问题`); } } From 4cfea6ba1151a7d9fbab42a8b38009c773594e41 Mon Sep 17 00:00:00 2001 From: xiu2 <54703944+XIU2@users.noreply.github.com> Date: Mon, 16 Aug 2021 17:47:16 +0800 Subject: [PATCH 0041/1990] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20Description?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Zhihu-Enhanced.user.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Zhihu-Enhanced.user.js b/Zhihu-Enhanced.user.js index 143e91e67..2d33aee9c 100644 --- a/Zhihu-Enhanced.user.js +++ b/Zhihu-Enhanced.user.js @@ -2,7 +2,7 @@ // @name 知乎增强 // @version 1.6.4 // @author X.I.U -// @description 移除登录弹窗、默认收起回答、一键收起回答、收起当前回答/评论(点击两侧空白处)、快捷回到顶部(右键两侧空白处)、屏蔽用户 (发布的内容)、屏蔽关键词(标题/评论)、屏蔽盐选内容、展开问题描述、置顶显示时间、显示问题时间、区分问题文章、直达问题按钮、默认高清原图、默认站外直链 +// @description 移除登录弹窗、默认收起回答、一键收起回答、收起当前回答/评论(点击两侧空白处)、快捷回到顶部(右键两侧空白处)、屏蔽用户 (发布的内容)、屏蔽关键词(标题/评论)、屏蔽盐选内容、展开问题描述、置顶显示时间、完整问题时间、区分问题文章、直达问题按钮、默认高清原图、默认站外直链 // @match *://www.zhihu.com/* // @match *://zhuanlan.zhihu.com/* // @icon https://static.zhihu.com/heifetz/favicon.ico From 715ac4bbc2350139f5fdf12aa3425d741127a0b5 Mon Sep 17 00:00:00 2001 From: xiu2 <54703944+XIU2@users.noreply.github.com> Date: Mon, 16 Aug 2021 20:58:43 +0800 Subject: [PATCH 0042/1990] =?UTF-8?q?=E4=BC=98=E5=8C=96=20[=E5=8C=BA?= =?UTF-8?q?=E5=88=86=E9=97=AE=E9=A2=98=E6=96=87=E7=AB=A0]=E3=80=81[?= =?UTF-8?q?=E7=9B=B4=E8=BE=BE=E9=97=AE=E9=A2=98=E6=8C=89=E9=92=AE]=20?= =?UTF-8?q?=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Zhihu-Enhanced.user.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/Zhihu-Enhanced.user.js b/Zhihu-Enhanced.user.js index 2d33aee9c..32c0c8fed 100644 --- a/Zhihu-Enhanced.user.js +++ b/Zhihu-Enhanced.user.js @@ -1,6 +1,6 @@ // ==UserScript== // @name 知乎增强 -// @version 1.6.4 +// @version 1.6.5 // @author X.I.U // @description 移除登录弹窗、默认收起回答、一键收起回答、收起当前回答/评论(点击两侧空白处)、快捷回到顶部(右键两侧空白处)、屏蔽用户 (发布的内容)、屏蔽关键词(标题/评论)、屏蔽盐选内容、展开问题描述、置顶显示时间、完整问题时间、区分问题文章、直达问题按钮、默认高清原图、默认站外直链 // @match *://www.zhihu.com/* @@ -854,13 +854,12 @@ function blockYanXuan() { function addTypeTips() { if (!menu_value('menu_typeTips')) return - // 添加标签样式 - document.lastChild.appendChild(document.createElement('style')).textContent = `small.zhihu_e_tips {font-weight: bold;font-size: 13px;padding: 0 4px;border-radius: 2px;display: inline-block;height: 20px;}`; - - // 一开始加载的信息流 + // 一开始加载的信息流 + 添加标签样式 if (location.pathname === '/search') { + document.lastChild.appendChild(document.createElement('style')).textContent = `small.zhihu_e_tips {font-weight: bold;font-size: 13px;padding: 1px 4px 0;border-radius: 2px;display: inline-block;vertical-align: top;margin-top: 2px;}`; addSetInterval_('h2.ContentItem-title a:not(.zhihu_e_toQuestion)'); } else { + document.lastChild.appendChild(document.createElement('style')).textContent = `small.zhihu_e_tips {font-weight: bold;font-size: 13px;padding: 1px 4px 0;border-radius: 2px;display: inline-block;vertical-align: top;margin-top: 4px;}`; document.querySelectorAll('h2.ContentItem-title a:not(.zhihu_e_toQuestion)').forEach(function(item){addTypeTips_(item);}) } @@ -929,10 +928,10 @@ function addToQuestion() { // 一开始加载的信息流 + 添加按钮样式 if (location.pathname === '/search') { - document.lastChild.appendChild(document.createElement('style')).textContent = `a.zhihu_e_toQuestion {font-size: 14px !important;font-weight: normal !important;padding: 0 6px 2px !important;border-radius: 3px !important;display: inline-block !important;vertical-align: top !important;height: 23px !important;}`; + document.lastChild.appendChild(document.createElement('style')).textContent = `a.zhihu_e_toQuestion {font-size: 13px !important;font-weight: normal !important;padding: 1px 6px 0 !important;border-radius: 2px !important;display: inline-block !important;vertical-align: top !important;height: 21px !important;line-height: 21px !important;margin-top: 1.9px !important;}`; addSetInterval_('h2.ContentItem-title a:not(.zhihu_e_tips)'); } else { - document.lastChild.appendChild(document.createElement('style')).textContent = `a.zhihu_e_toQuestion {font-size: 14px !important;font-weight: normal !important;padding: 2px 6px !important;border-radius: 3px !important;display: inline-block !important;vertical-align: top !important;}`; + document.lastChild.appendChild(document.createElement('style')).textContent = `a.zhihu_e_toQuestion {font-size: 13px !important;font-weight: normal !important;padding: 1px 6px 0 !important;border-radius: 2px !important;display: inline-block !important;vertical-align: top !important;margin-top: 4px !important;}`; document.querySelectorAll('h2.ContentItem-title a:not(.zhihu_e_tips)').forEach(function(item){addTypeTips_(item);}) } From 624e22655812e9f3d88a0f50f4917e4df20e24f2 Mon Sep 17 00:00:00 2001 From: xiu2 <54703944+XIU2@users.noreply.github.com> Date: Mon, 16 Aug 2021 21:16:08 +0800 Subject: [PATCH 0043/1990] =?UTF-8?q?=E4=BC=98=E5=8C=96=20[=E5=8C=BA?= =?UTF-8?q?=E5=88=86=E9=97=AE=E9=A2=98=E6=96=87=E7=AB=A0]=E3=80=81[?= =?UTF-8?q?=E7=9B=B4=E8=BE=BE=E9=97=AE=E9=A2=98=E6=8C=89=E9=92=AE]=20?= =?UTF-8?q?=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Zhihu-Enhanced.user.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Zhihu-Enhanced.user.js b/Zhihu-Enhanced.user.js index 32c0c8fed..3ec407085 100644 --- a/Zhihu-Enhanced.user.js +++ b/Zhihu-Enhanced.user.js @@ -928,7 +928,7 @@ function addToQuestion() { // 一开始加载的信息流 + 添加按钮样式 if (location.pathname === '/search') { - document.lastChild.appendChild(document.createElement('style')).textContent = `a.zhihu_e_toQuestion {font-size: 13px !important;font-weight: normal !important;padding: 1px 6px 0 !important;border-radius: 2px !important;display: inline-block !important;vertical-align: top !important;height: 21px !important;line-height: 21px !important;margin-top: 1.9px !important;}`; + document.lastChild.appendChild(document.createElement('style')).textContent = `a.zhihu_e_toQuestion {font-size: 13px !important;font-weight: normal !important;padding: 1px 6px 0 !important;border-radius: 2px !important;display: inline-block !important;vertical-align: top !important;height: 20.67px !important;line-height: 20.67px !important;margin-top: 2px !important;}`; addSetInterval_('h2.ContentItem-title a:not(.zhihu_e_tips)'); } else { document.lastChild.appendChild(document.createElement('style')).textContent = `a.zhihu_e_toQuestion {font-size: 13px !important;font-weight: normal !important;padding: 1px 6px 0 !important;border-radius: 2px !important;display: inline-block !important;vertical-align: top !important;margin-top: 4px !important;}`; From 51ea58e4f2262608745c85a6309beabedb1ceb57 Mon Sep 17 00:00:00 2001 From: xiu2 <54703944+XIU2@users.noreply.github.com> Date: Tue, 17 Aug 2021 11:54:55 +0800 Subject: [PATCH 0044/1990] =?UTF-8?q?=E4=BC=98=E5=8C=96=20=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Zhihu-Enhanced.user.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Zhihu-Enhanced.user.js b/Zhihu-Enhanced.user.js index 3ec407085..c6732c739 100644 --- a/Zhihu-Enhanced.user.js +++ b/Zhihu-Enhanced.user.js @@ -1,6 +1,6 @@ // ==UserScript== // @name 知乎增强 -// @version 1.6.5 +// @version 1.6.6 // @author X.I.U // @description 移除登录弹窗、默认收起回答、一键收起回答、收起当前回答/评论(点击两侧空白处)、快捷回到顶部(右键两侧空白处)、屏蔽用户 (发布的内容)、屏蔽关键词(标题/评论)、屏蔽盐选内容、展开问题描述、置顶显示时间、完整问题时间、区分问题文章、直达问题按钮、默认高清原图、默认站外直链 // @match *://www.zhihu.com/* @@ -1329,9 +1329,9 @@ function questionInvitation(){ } function start(){ - collapsedAnswer(); // 一键收起回答 + if (location.hostname != 'zhuanlan.zhihu.com') collapsedAnswer(); // 一键收起回答 + if (location.hostname != 'zhuanlan.zhihu.com') questionInvitation(); //默认折叠邀请 closeFloatingComments(); // 快捷关闭悬浮评论(监听点击事件,点击网页两侧空白处) - questionInvitation(); // 默认折叠邀请 blockKeywords('comment'); // 屏蔽指定关键词(评论) if (location.pathname.indexOf('question') > -1) { // 回答页 // if (location.pathname.indexOf('waiting') == -1) { From 7c0ac79d8b159eb62b127386b2db55f3987f37d1 Mon Sep 17 00:00:00 2001 From: xiu2 <54703944+XIU2@users.noreply.github.com> Date: Tue, 17 Aug 2021 11:55:55 +0800 Subject: [PATCH 0045/1990] =?UTF-8?q?=E6=96=B0=E5=A2=9E=20[=E5=AE=BD?= =?UTF-8?q?=E5=B1=8F=E6=98=BE=E7=A4=BA=20-=20=E9=A6=96=E9=A1=B5]=E3=80=81[?= =?UTF-8?q?=E5=AE=BD=E5=B1=8F=E6=98=BE=E7=A4=BA=20-=20=E9=97=AE=E9=A2=98?= =?UTF-8?q?=E9=A1=B5]=E3=80=81[=E5=AE=BD=E5=B1=8F=E6=98=BE=E7=A4=BA=20-=20?= =?UTF-8?q?=E6=90=9C=E7=B4=A2=E9=A1=B5]=E3=80=81[=E5=AE=BD=E5=B1=8F?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=20-=20=E6=94=B6=E8=97=8F=E9=A1=B5]=20?= =?UTF-8?q?=E8=84=9A=E6=9C=AC=E8=8F=9C=E5=8D=95=E5=BC=80=E5=85=B3;=20?= =?UTF-8?q?=E4=BC=98=E5=8C=96=20=E6=9A=97=E9=BB=91=E6=A8=A1=E5=BC=8F?= =?UTF-8?q?=E6=A0=B7=E5=BC=8F=E4=B8=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Zhihu-Beautification.user.js | 57 +++++++++++++++++++++++------------- 1 file changed, 37 insertions(+), 20 deletions(-) diff --git a/Zhihu-Beautification.user.js b/Zhihu-Beautification.user.js index d266fba72..af9958bb3 100644 --- a/Zhihu-Beautification.user.js +++ b/Zhihu-Beautification.user.js @@ -1,6 +1,6 @@ // ==UserScript== // @name 知乎美化 -// @version 1.3.0 +// @version 1.3.1 // @author X.I.U // @description 宽屏显示、暗黑模式(4种)、暗黑模式跟随浏览器、隐藏文章开头大图、调整图片最大高度、向下翻时自动隐藏顶栏、文章编辑页面与实际文章宽度一致、屏蔽登录提示 // @match *://www.zhihu.com/* @@ -24,6 +24,10 @@ 'use strict'; var menu_ALL = [ ['menu_widescreenDisplay', '宽屏显示', '宽屏显示', true], + ['menu_widescreenDisplayIndex', '宽屏显示 - 首页', '宽屏显示 - 首页', true], + ['menu_widescreenDisplayQuestion', '宽屏显示 - 问题页', '宽屏显示 - 问题页', true], + ['menu_widescreenDisplaySearch', '宽屏显示 - 搜索页', '宽屏显示 - 搜索页', true], + ['menu_widescreenDisplayCollection', '宽屏显示 - 收藏页', '宽屏显示 - 收藏页', true], ['menu_darkMode', '暗黑模式', '暗黑模式', true], ['menu_darkModeType', '暗黑模式切换(1~4)', '暗黑模式切换', 1], ['menu_darkModeAuto', '暗黑模式跟随浏览器', '暗黑模式跟随浏览器', false], @@ -52,6 +56,10 @@ GM_setValue('menu_darkModeType', menu_ALL[i][3]); } menu_ID[i] = GM_registerMenuCommand(`${menu_num(menu_ALL[i][3])} ${menu_ALL[i][1]}`, function(){menu_toggle(`${menu_ALL[i][3]}`,`${menu_ALL[i][0]}`)}); + } else if (menu_ALL[i][0] === 'menu_widescreenDisplayIndex' || menu_ALL[i][0] === 'menu_widescreenDisplayQuestion' || menu_ALL[i][0] === 'menu_widescreenDisplaySearch' || menu_ALL[i][0] === 'menu_widescreenDisplayCollection') { + if (menu_value('menu_widescreenDisplay')) { + menu_ID[i] = GM_registerMenuCommand(`${menu_ALL[i][3]?'✅':'❌'} ${menu_ALL[i][1]}`, function(){menu_switch(`${menu_ALL[i][3]}`,`${menu_ALL[i][0]}`,`${menu_ALL[i][2]}`)}); + } } else { menu_ID[i] = GM_registerMenuCommand(`${menu_ALL[i][3]?'✅':'❌'} ${menu_ALL[i][1]}`, function(){menu_switch(`${menu_ALL[i][3]}`,`${menu_ALL[i][0]}`,`${menu_ALL[i][2]}`)}); } @@ -122,7 +130,7 @@ // 添加样式 function addStyle() { - let style = `/* 屏蔽登录提示 */ + let style = `/* 屏蔽登录提示(问题页中间的元素) */ .Question-mainColumnLogin {display: none !important;} /* 屏蔽首页广告 */ .TopstoryItem--advertCard {display: none !important;} @@ -131,19 +139,23 @@ /* 屏蔽文章页推荐文章 */ .Recommendations-Main {display: none !important;} `, - style_1 = `/* 宽屏显示 */ -.GlobalSideBar, .Question-sideColumn, .ContentLayout-sideColumn, .SearchSideBar, .Card.QuestionHeaderTopicMeta, .ClubSideBar { - display: none !important; -} -.Topstory-mainColumn, .Question-mainColumn, .ContentLayout-mainColumn,.SearchMain, .QuestionWaiting-mainColumn, .Club-mainColumn, .Post-mainColumn { - width: 1000px !important; -} -.QuestionWaiting-mainColumn { - margin-right: 0 !important; -} -.ImageMessage-ImageView { - z-index: 999 !important; -}`, + style_widescreenDisplayIndex = `/* 宽屏显示 - 首页 */ +.Topstory-mainColumn {width: 1000px !important;} +.GlobalSideBar {display: none !important;} +`, + style_widescreenDisplayQuestion = `/* 宽屏显示 - 问题页 */ +.Question-mainColumn, .ListShortcut {width: 1000px !important;} +.Question-sideColumn {display: none !important;} +.QuestionWaiting-mainColumn {margin-right: 0 !important;} +`, + style_widescreenDisplaySearch = `/* 宽屏显示 - 搜索页 */ +.SearchMain, .ContentLayout-mainColumn, .QuestionWaiting-mainColumn, .Club-mainColumn, .Post-mainColumn {width: 1000px !important;} +.SearchSideBar, .ContentLayout-sideColumn, .Card.QuestionHeaderTopicMeta, .ClubSideBar {display: none !important;} +`, + style_widescreenDisplayCollection = `/* 宽屏显示 - 收藏页 */ +.CollectionsDetailPage-mainColumn {width: 1000px !important;} +.CollectionDetailPageSideBar {display: none !important;} +`, style_2 = `/* 隐藏在各列表中查看文章时开头显示的大图,不影响文章、专栏页面 */ .RichContent img.ArticleItem-image {display: none !important;} `, @@ -175,8 +187,8 @@ html[data-theme=dark] .Highlight em {color: #c33c39 !important;} /* 背景颜色 - 网页 */ html[data-theme=dark] body, html[data-theme=dark] .Select-option:focus {background: #22272E !important;} /* 背景颜色 - 问题 */ -html[data-theme=dark] .AppHeader, html[data-theme=dark] .QuestionHeader, html[data-theme=dark] .QuestionHeader-footer, html[data-theme=dark] .EmoticonsFooter-item--selected, html[data-theme=dark] .Card, html[data-theme=dark] .ContentItem-actions, html[data-theme=dark] .MoreAnswers .List-headerText, html[data-theme=dark] .CommentsV2-withPagination, html[data-theme=dark] .Topbar, html[data-theme=dark] .CommentsV2-footer, html[data-theme=dark] .CommentEditorV2-inputWrap--active, html[data-theme=dark] .InputLike, html[data-theme=dark] .Popover-content, html[data-theme=dark] .Notifications-footer, html[data-theme=dark] .Messages-footer, html[data-theme=dark] .Modal-inner, html[data-theme=dark] .Emoticons, html[data-theme=dark] .EmoticonsFooter, html[data-theme=dark] .SearchTabs, html[data-theme=dark] .Popover-arrow:after, html[data-theme=dark] .CommentEditorV2-inputWrap, html[data-theme=dark] .ProfileHeader-wrapper, html[data-theme=dark] .UserCover, html[data-theme=dark] .AnswerForm-footer, html[data-theme=dark] .Editable-toolbar, html[data-theme=dark] .AnswerForm-fullscreenContent .Editable-toolbar, html[data-theme=dark] .KfeCollection-PcCollegeCard-wrapper, html[data-theme=dark] .KfeCollection-PcCollegeCard-root, html[data-theme=dark] .HotItem, html[data-theme=dark] .HotList, html[data-theme=dark] .HotListNavEditPad, html[data-theme=dark] .QuestionWaiting-typesTopper, html[data-theme=dark] .QuestionWaiting-types, html[data-theme=dark] .PostItem, html[data-theme=dark] .ClubSideBar section, html[data-theme=dark] .SearchSubTabs, html[data-theme=dark] .Club-SearchPosts-Content, html[data-theme=dark] .Club-content, html[data-theme=dark] .ClubJoinOrCheckinButton, html[data-theme=dark] .ClubEdit, html[data-theme=dark] .CornerButton, html[data-theme=dark] .Notifications-Section-header, html[data-theme=dark] .NotificationList, .NotificationList-Item.NotificationList-Item:after, .NotificationList-DateSplit.NotificationList-DateSplit:after, html[data-theme=dark] .Chat, .ChatUserListItem:after, .ChatListGroup-SectionTitle--bottomBorder:after, html[data-theme=dark] .ActionMenu, .ChatSideBar-Search--active, html[data-theme=dark] .ChatSideBar-Search-ResultListWrap, html[data-theme=dark] .QuestionMainDivider-inner, html[data-theme=dark] .Topic-bar, html[data-theme=dark] .AnnotationTag, html[data-theme=dark] .HoverCard, html[data-theme=dark] .HoverCard-loading, html[data-theme=dark] .ExploreSpecialCard, html[data-theme=dark] .ExploreHomePage-ContentSection-moreButton a, html[data-theme=dark] .ExploreRoundtableCard, html[data-theme=dark] .ExploreCollectionCard, html[data-theme=dark] .ExploreColumnCard, html[data-theme=dark] .RichText .lazy[data-lazy-status], html[data-theme=dark] #TopstoryContent > div:first-child, html[data-theme=dark] .Topstory-newUserFollowCountPanel {background: #2D333B !important;} -html[data-theme=dark] .CommentListV2-header-divider, html[data-theme=dark] .CommentsV2-openComment-divider, html[data-theme=dark] .AnswerForm-fullscreenScroller, html[data-theme=dark] .HotListNav-item, html[data-theme=dark] .AutoInviteItem-wrapper--desktop, html[data-theme=dark] .ExploreSpecialCard-contentTag, html[data-theme=dark] .ExploreCollectionCard-contentTypeTag, html[data-theme=dark] .Reward-TipjarDialog-tagLine {background-color: #222933 !important;} +html[data-theme=dark] .AppHeader, html[data-theme=dark] .QuestionHeader, html[data-theme=dark] .QuestionHeader-footer, html[data-theme=dark] .EmoticonsFooter-item--selected, html[data-theme=dark] .Card, html[data-theme=dark] .ContentItem-actions, html[data-theme=dark] .MoreAnswers .List-headerText, html[data-theme=dark] .CommentsV2-withPagination, html[data-theme=dark] .Topbar, html[data-theme=dark] .CommentsV2-footer, html[data-theme=dark] .CommentEditorV2-inputWrap--active, html[data-theme=dark] .InputLike, html[data-theme=dark] .Popover-content, html[data-theme=dark] .Notifications-footer, html[data-theme=dark] .Messages-footer, html[data-theme=dark] .Modal-inner, html[data-theme=dark] .Emoticons, html[data-theme=dark] .EmoticonsFooter, html[data-theme=dark] .SearchTabs, html[data-theme=dark] .Popover-arrow:after, html[data-theme=dark] .CommentEditorV2-inputWrap, html[data-theme=dark] .ProfileHeader-wrapper, html[data-theme=dark] .UserCover, html[data-theme=dark] .AnswerForm-footer, html[data-theme=dark] .Editable-toolbar, html[data-theme=dark] .AnswerForm-fullscreenContent .Editable-toolbar, html[data-theme=dark] .KfeCollection-PcCollegeCard-wrapper, html[data-theme=dark] .KfeCollection-PcCollegeCard-root, html[data-theme=dark] .HotItem, html[data-theme=dark] .HotList, html[data-theme=dark] .HotListNavEditPad, html[data-theme=dark] .QuestionWaiting-typesTopper, html[data-theme=dark] .QuestionWaiting-types, html[data-theme=dark] .PostItem, html[data-theme=dark] .ClubSideBar section, html[data-theme=dark] .SearchSubTabs, html[data-theme=dark] .Club-SearchPosts-Content, html[data-theme=dark] .Club-content, html[data-theme=dark] .ClubJoinOrCheckinButton, html[data-theme=dark] .ClubEdit, html[data-theme=dark] .CornerButton, html[data-theme=dark] .Notifications-Section-header, html[data-theme=dark] .NotificationList, .NotificationList-Item.NotificationList-Item:after, .NotificationList-DateSplit.NotificationList-DateSplit:after, html[data-theme=dark] .Chat, .ChatUserListItem:after, .ChatListGroup-SectionTitle--bottomBorder:after, html[data-theme=dark] .ActionMenu, .ChatSideBar-Search--active, html[data-theme=dark] .ChatSideBar-Search-ResultListWrap, html[data-theme=dark] .QuestionMainDivider-inner, html[data-theme=dark] .Topic-bar, html[data-theme=dark] .AnnotationTag, html[data-theme=dark] .HoverCard, html[data-theme=dark] .HoverCard-loading, html[data-theme=dark] .ExploreSpecialCard, html[data-theme=dark] .ExploreHomePage-ContentSection-moreButton a, html[data-theme=dark] .ExploreRoundtableCard, html[data-theme=dark] .ExploreCollectionCard, html[data-theme=dark] .ExploreColumnCard, html[data-theme=dark] .RichText .lazy[data-lazy-status], html[data-theme=dark] #TopstoryContent > div:first-child, html[data-theme=dark] .Topstory-newUserFollowCountPanel, html[data-theme=dark] .AnswerForm-fullscreenContent .RichText {background: #2D333B !important;} +html[data-theme=dark] .CommentListV2-header-divider, html[data-theme=dark] .CommentsV2-openComment-divider, html[data-theme=dark] .AnswerForm-fullscreenScroller, html[data-theme=dark] .HotListNav-item, html[data-theme=dark] .AutoInviteItem-wrapper--desktop, html[data-theme=dark] .ExploreSpecialCard-contentTag, html[data-theme=dark] .ExploreCollectionCard-contentTypeTag, html[data-theme=dark] .Reward-TipjarDialog-tagLine, html[data-theme=dark] .AnswerForm-footer.useNewEditorSetting > div, html[data-theme=dark] .AnswerForm-fullscreenContent > div:first-child, html[data-theme=dark] .Editable-toolbar button:hover, html[data-theme=dark] .AuthorInfo.AnswerAdd-info + div {background-color: #222933 !important;} html[data-theme=dark] .CornerButton:hover {background: #3f4752 !important;} /* 右下角按钮 */ /* 背景颜色 - 引用 */ @@ -225,8 +237,8 @@ html[data-theme=dark] img {opacity: 0.8 !important;} html[data-theme=dark] .GifPlayer img, html[data-theme=dark] .ImageView-img {opacity: 1 !important;} /* 边框 */ -html[data-theme=dark] .Topbar, html[data-theme=dark] .CommentsV2-footer, html[data-theme=dark] .Topstory-mainColumnCard .Card:not(.Topstory-tabCard), html[data-theme=dark] .NestComment:not(:last-child):after, html[data-theme=dark] .NestComment--rootComment:after, html[data-theme=dark] .NestComment .NestComment--child:after, html[data-theme=dark] .NestComment .NestComment--child:after, html[data-theme=dark] .CommentsV2-replyNum, html[data-theme=dark] .CommentItemV2:not(:first-child):after, html[data-theme=dark] .Tabs, html[data-theme=dark] .Popover-arrow:after {border-bottom: 1px solid #282d35 !important;} -html[data-theme=dark] .CommentEditorV2-inputWrap--active, html[data-theme=dark] .CommentEditorV2-inputWrap, html[data-theme=dark] .PostItem {border: none !important;} +html[data-theme=dark] .Topbar, html[data-theme=dark] .CommentsV2-footer, html[data-theme=dark] .Topstory-mainColumnCard .Card:not(.Topstory-tabCard), html[data-theme=dark] .NestComment:not(:last-child):after, html[data-theme=dark] .NestComment--rootComment:after, html[data-theme=dark] .NestComment .NestComment--child:after, html[data-theme=dark] .NestComment .NestComment--child:after, html[data-theme=dark] .CommentsV2-replyNum, html[data-theme=dark] .CommentItemV2:not(:first-child):after, html[data-theme=dark] .Tabs, html[data-theme=dark] .Popover-arrow:after, html[data-theme=dark] .SelfCollectionItem-innerContainer, html[data-theme=dark] .CollectionDetailPageItem-innerContainer {border-bottom: 1px solid #282d35 !important;} +html[data-theme=dark] .CommentEditorV2-inputWrap--active, html[data-theme=dark] .CommentEditorV2-inputWrap, html[data-theme=dark] .PostItem, html[data-theme=dark] .AnswerForm .Editable-toolbar, html[data-theme=dark] .Editable-toolbar span {border: none !important;} html[data-theme=dark] .InputLike {border: 1px solid #424b56 !important;} html[data-theme=dark] .Popover .InputLike {border: 1px solid #2d333b !important;} html[data-theme=dark] .HotLanding-contentItem:not(:last-child) {border-bottom: 1px solid #424b56 !important;} @@ -355,7 +367,12 @@ html {filter: brightness(75%) sepia(30%) !important; background-image: url();} } // 宽屏显示 - if (menu_value('menu_widescreenDisplay')) style += style_1; + if (menu_value('menu_widescreenDisplay')){ + if (menu_value('menu_widescreenDisplayIndex')) style += style_widescreenDisplayIndex; + if (menu_value('menu_widescreenDisplayQuestion') && location.pathname.indexOf('/question/') > -1) style += style_widescreenDisplayQuestion; + if (menu_value('menu_widescreenDisplaySearch') && (location.pathname === '/search' || location.pathname.indexOf('/club/') > -1 || location.pathname.indexOf('/topic/') > -1)) style += style_widescreenDisplaySearch; + if (menu_value('menu_widescreenDisplayCollection') && location.pathname.indexOf('/collection/') > -1) style += style_widescreenDisplayCollection; + } // 调整图片最大高度 if (menu_value('menu_picHeight')) style += style_5; // 隐藏文章开头大图 From 330e0ea1f726fd5f3b6e5519282e0fcf36f8802a Mon Sep 17 00:00:00 2001 From: xiu2 <54703944+XIU2@users.noreply.github.com> Date: Tue, 17 Aug 2021 12:37:58 +0800 Subject: [PATCH 0046/1990] =?UTF-8?q?=E6=96=B0=E5=A2=9E=20[=E8=B0=B7?= =?UTF-8?q?=E6=AD=8C=E6=90=9C=E7=B4=A2]=20=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Autopage.user.js | 40 ++++++++++++++++++++++++++++++---------- 1 file changed, 30 insertions(+), 10 deletions(-) diff --git a/Autopage.user.js b/Autopage.user.js index b645f4277..f273c060d 100644 --- a/Autopage.user.js +++ b/Autopage.user.js @@ -1,8 +1,8 @@ // ==UserScript== // @name 自动无缝翻页 -// @version 1.5.2 +// @version 1.5.3 // @author X.I.U -// @description 自动无缝翻页,目前支持:[所有使用「Discuz!、Flarum、DUX(WordPress)」的网站]、百度、豆瓣、微博、千图网、3DM、游侠网、游民星空、Steam 创意工坊、423Down、不死鸟、小众软件、微当下载、异次元软件、老殁殁漂遥、异星软件空间、古风漫画网、砂之船动漫家、RARBG、PubMed、AfreecaTV、GreasyFork、AlphaCoders、Crackhub213、FitGirl Repacks... +// @description 自动无缝翻页,目前支持:[所有使用「Discuz!、Flarum、DUX(WordPress)」的网站]、百度、谷歌、豆瓣、微博、千图网、3DM、游侠网、游民星空、Steam 创意工坊、423Down、不死鸟、小众软件、微当下载、异次元软件、老殁殁漂遥、异星软件空间、古风漫画网、砂之船动漫家、RARBG、PubMed、AfreecaTV、GreasyFork、AlphaCoders、Crackhub213、FitGirl Repacks... // @match *://*/* // @connect www.gamersky.com // @icon https://i.loli.net/2021/03/07/rdijeYm83pznxWq.png @@ -23,7 +23,7 @@ 'use strict'; var webType, curSite = {SiteTypeID: 0}; // 目前支持的网站 - const websiteList = ['www.baidu.com', 'movie.douban.com', 'weibo.com', 'www.58pic.com', + const websiteList = ['www.baidu.com', 'www.google.com', 'movie.douban.com', 'weibo.com', 'www.58pic.com', 'www.3dmgame.com', 'www.ali213.net', 'gl.ali213.net', 'www.gamersky.com', 'steamcommunity.com', 'www.423down.com', 'iao.su', 'www.appinn.com', 'www.weidown.com', 'www.iplaysoft.com', 'www.mpyit.com', 'www.yxssp.com', 'www.gufengmh8.com', 'www.szcdmj.com', @@ -177,6 +177,17 @@ scrollDelta: 1200 } }, + google: { + SiteTypeID: 0, + pager: { + type: 1, + nextLink: '//a[@id="pnnext"][@href]', + pageElement: 'css;#res > *', + HT_insert: ['css;#res', 3], + replaceE: '//div[@id="navcnt"] | //div[@id="rcnt"]//div[@role="navigation"]', + scrollDelta: 1500 + } + }, douban_subject_comments: { SiteTypeID: 0, pager: { @@ -576,6 +587,7 @@ // 用于脚本判断(针对部分特殊的网站) const SiteType = { + GOOGLE: DBSite.google.SiteTypeID, GAMERSKY_GL: DBSite.gamersky_gl.SiteTypeID, STEAMCOMMUNITY: DBSite.steamcommunity.SiteTypeID }; @@ -587,6 +599,9 @@ case 'www.baidu.com': // < 百度搜索 > if (location.pathname === '/s') curSite = DBSite.baidu; break; + case 'www.google.com': // < 谷歌搜索 > + if (location.pathname === '/search') curSite = DBSite.google; + break; case 'movie.douban.com': // < 豆瓣评论 > if (location.pathname.indexOf('/subject') > -1 && location.pathname.indexOf('/comments') > -1) { // 短评列表 curSite = DBSite.douban_subject_comments; @@ -1145,7 +1160,7 @@ if (curSite.pager) { let curPageEle = getElementByXpath(curSite.pager.nextLink); var url = this.getFullHref(curPageEle); - //console.log(`${url} ${curPageEle} ${curSite.pageUrl}`); + console.log(`${url} ${curPageEle} ${curSite.pageUrl}`); if (url === '') return; if (curSite.pageUrl === url) return;// 避免重复加载相同的页面 curSite.pageUrl = url; @@ -1161,7 +1176,7 @@ var newBody = ShowPager.createDocumentByString(response.responseText); let pageElems = getAllElements(curSite.pager.pageElement, newBody, newBody), toElement = getAllElements(curSite.pager.HT_insert[0])[0]; - //console.log(curSite.pager.pageElement, pageElems) + console.log(curSite.pager.pageElement, pageElems) if (pageElems.length >= 0) { // 如果有插入前函数就执行函数 @@ -1179,15 +1194,20 @@ if (curSite.SiteTypeID === SiteType.STEAMCOMMUNITY) { pageElems.forEach(function (one) { if (one.tagName === 'SCRIPT') { // 对于