From 17041d118325aa42ffe71cc7c03b2fd5008e4abe Mon Sep 17 00:00:00 2001 From: Buger Date: Wed, 8 Jul 2026 19:10:00 +0800 Subject: [PATCH 01/10] =?UTF-8?q?=E5=8E=BB=E9=99=A4=E5=B7=B2=E7=BB=8F?= =?UTF-8?q?=E6=8C=82=E4=BA=86=E7=9A=84=E5=8A=A0=E9=80=9F=E6=BA=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit github.tbedu.top 找不到DNS rapidgit.jjda.de5.net 522连接超时,卡在Cloudflare --- GithubEnhanced-High-Speed-Download.user.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/GithubEnhanced-High-Speed-Download.user.js b/GithubEnhanced-High-Speed-Download.user.js index 32ab3a23d..6cfd921f5 100644 --- a/GithubEnhanced-High-Speed-Download.user.js +++ b/GithubEnhanced-High-Speed-Download.user.js @@ -34,7 +34,7 @@ const download_url_us = [ ['https://gh.h233.eu.org/https://github.com', '美国', '[美国 Cloudflare CDN] - 该公益加速源由 [@X.I.U/XIU2] 提供'], //['https://gh.api.99988866.xyz/https://github.com', '美国', '[美国 Cloudflare CDN] - 该公益加速源由 [github.com/hunshcn/gh-proxy] 提供'], // 官方演示站用的人太多了 - ['https://rapidgit.jjda.de5.net/https://github.com', '美国', '[美国 Cloudflare CDN] - 该公益加速源由 [热心网友] 提供'], + //['https://rapidgit.jjda.de5.net/https://github.com', '美国', '[美国 Cloudflare CDN] - 该公益加速源由 [热心网友] 提供'],//挂了,522超时 ['https://gh.ddlc.top/https://github.com', '美国', '[美国 Cloudflare CDN] - 该公益加速源由 [@mtr-static-official] 提供'], ['https://gh-proxy.org/https://github.com', '美国', '[美国 Cloudflare CDN] - 该公益加速源由 [gh-proxy.com] 提供'], //['https://hk.gh-proxy.org/https://github.com', '其他', '[中国香港] - 该公益加速源由 [gh-proxy.com] 提供'], @@ -46,7 +46,7 @@ ['https://gh.jasonzeng.dev/https://github.com', '美国', '[美国 Cloudflare CDN] - 该公益加速源由 [gh.jasonzeng.dev] 提供'], ['https://gh.monlor.com/https://github.com', '美国', '[美国 Cloudflare CDN] - 该公益加速源由 [gh.monlor.com] 提供'], //['https://fastgit.cc/https://github.com', '美国', '[美国 Cloudflare CDN] - 该公益加速源由 [fastgit.cc] 提供'], // 挂了 - ['https://github.tbedu.top/https://github.com', '美国', '[美国 Cloudflare CDN] - 该公益加速源由 [github.tbedu.top] 提供'], + //['https://github.tbedu.top/https://github.com', '美国', '[美国 Cloudflare CDN] - 该公益加速源由 [github.tbedu.top] 提供'],//挂了 DNS_PROBE_FINISHED_NXDOMAIN ['https://github.geekery.cn/https://github.com', '美国', '[美国 Cloudflare CDN] - 该公益加速源由 [github.geekery.cn] 提供'], ['https://github.ednovas.xyz/https://github.com', '美国', '[美国 Cloudflare CDN] - 该公益加速源由 [github.ednovas.xyz] 提供'], ['https://ghfile.geekertao.top/https://github.com', '美国', '[美国 Cloudflare CDN] - 该公益加速源由 [ghfile.geekertao.top] 提供'], @@ -505,4 +505,4 @@ window.dispatchEvent(new Event('urlchange')) }); } -})(); \ No newline at end of file +})(); From fd9c482cfd35cf5176d437dfdfe1aa8b6e0653b4 Mon Sep 17 00:00:00 2001 From: xiu2 <54703944+XIU2@users.noreply.github.com> Date: Sat, 25 Jul 2026 16:47:55 +0800 Subject: [PATCH 02/10] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20=E6=9A=97=E9=BB=91?= =?UTF-8?q?=E6=A8=A1=E5=BC=8F1;=20=E4=BF=AE=E5=A4=8D=20=E5=AE=BD=E5=B1=8F?= =?UTF-8?q?=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Zhihu-Beautification.user.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Zhihu-Beautification.user.js b/Zhihu-Beautification.user.js index 584671e36..83b10a82e 100644 --- a/Zhihu-Beautification.user.js +++ b/Zhihu-Beautification.user.js @@ -1,6 +1,6 @@ // ==UserScript== // @name 知乎美化 -// @version 1.5.20 +// @version 1.5.21 // @author X.I.U // @description 宽屏显示、暗黑模式(4种)、暗黑模式跟随浏览器、屏蔽首页活动广告、隐藏文章开头大图、调整图片最大高度、向下翻时自动隐藏顶栏 // @match *://www.zhihu.com/* @@ -217,12 +217,12 @@ html[data-theme=light] .AppHeader-notifications:not([aria-label=通知])>div:fir @media only screen and (max-width: ${Number(GM_getValue('menu_widescreenDisplayWidth'))+50}px) {.Topstory-container {width: 97% !important;}} `, style_widescreenDisplayQuestion = `/* 宽屏显示 - 问题页 */ -.Question-mainColumn, .ListShortcut, .QuestionWaiting-mainColumn {width: inherit !important;} +.ListShortcut, .QuestionWaiting-mainColumn {width: inherit !important;} .Question-mainColumn+div,[data-za-detail-view-path-module="RightSideBar"], .Question-sideColumn, .GlobalSideBar {display: none !important;} .QuestionWaiting-mainColumn {margin-right: 0 !important;} -.Question-main {width: ${GM_getValue('menu_widescreenDisplayWidth')}px;} -@media only screen and (max-width: ${Number(GM_getValue('menu_widescreenDisplayWidth'))+50}px) {.Question-main {width: auto !important;}} -@media only screen and (max-width: ${GM_getValue('menu_widescreenDisplayWidth')-100}px) {.Question-main {width: 98.5% !important;}} +.Question-mainColumn {width: ${GM_getValue('menu_widescreenDisplayWidth')}px; margin: auto!important;} +@media only screen and (max-width: ${Number(GM_getValue('menu_widescreenDisplayWidth'))+50}px) {.Question-mainColumn {width: auto !important;}} +@media only screen and (max-width: ${GM_getValue('menu_widescreenDisplayWidth')-100}px) {.Question-mainColumn {width: 98.5% !important;}} .AuthorInfo {max-width: 100% !important;} `, style_widescreenDisplaySearch = `/* 宽屏显示 - 搜索页 */ @@ -477,7 +477,7 @@ html {filter: brightness(65%) sepia(30%) !important; background-image: url();} // 宽屏显示 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_widescreenDisplaySearch')) style += style_widescreenDisplaySearch; if (menu_value('menu_widescreenDisplayCollection') && location.pathname.indexOf('/collection/') > -1) style += style_widescreenDisplayCollection; if (menu_value('menu_widescreenDisplayPost') && location.hostname.indexOf('zhuanlan') > -1 && (location.pathname.indexOf('/edit') === -1 || location.pathname.indexOf('/write') === -1)) style += style_widescreenDisplayPost; if (menu_value('menu_widescreenDisplayPeople') && location.pathname.indexOf('/people/') > -1) style += style_widescreenDisplayPeople; @@ -523,7 +523,7 @@ html {filter: brightness(65%) sepia(30%) !important; background-image: url();} // 获取知乎 Cookie 中的主题类型 function getTheme() { - let name = 'theme=', + let name = 'themeApp=', ca = document.cookie.split(';'); for (let i=0; i Date: Sat, 25 Jul 2026 17:19:52 +0800 Subject: [PATCH 03/10] =?UTF-8?q?=E4=BC=98=E5=8C=96=20=E5=AE=BD=E5=B1=8F?= =?UTF-8?q?=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Zhihu-Beautification.user.js | 39 ++++++++++++++++++++++++++++++------ 1 file changed, 33 insertions(+), 6 deletions(-) diff --git a/Zhihu-Beautification.user.js b/Zhihu-Beautification.user.js index 83b10a82e..a43bbbbf0 100644 --- a/Zhihu-Beautification.user.js +++ b/Zhihu-Beautification.user.js @@ -1,6 +1,6 @@ // ==UserScript== // @name 知乎美化 -// @version 1.5.21 +// @version 1.5.22 // @author X.I.U // @description 宽屏显示、暗黑模式(4种)、暗黑模式跟随浏览器、屏蔽首页活动广告、隐藏文章开头大图、调整图片最大高度、向下翻时自动隐藏顶栏 // @match *://www.zhihu.com/* @@ -13,6 +13,7 @@ // @grant GM_getValue // @grant GM_setValue // @grant GM_notification +// @grant window.onurlchange // @sandbox JavaScript // @license GPL-3.0 License // @run-at document-start @@ -43,7 +44,11 @@ if (GM_getValue(menu_ALL[i][0]) == null){GM_setValue(menu_ALL[i][0], menu_ALL[i][3])}; } registerMenuCommand(); + if (window.onurlchange === undefined) {addUrlChangeEvent();} // Tampermonkey v4.11 版本添加的 onurlchange 事件 grant,可以监控 pjax 等网页的 URL 变化 addStyle(); + window.addEventListener('urlchange', function(){ // 网页 URL 动态变化后再次执行(针对在任何页面搜索时) + if (menu_value('menu_widescreenDisplaySearch') && (location.pathname === '/search' || location.pathname.indexOf('/club/') > -1 || location.pathname.indexOf('/topic/') > -1)) {addStyle()}; + }) // 向下翻时自动隐藏顶栏 if (menu_value('menu_hideTitle')) setTimeout(hideTitle, 2000); @@ -217,12 +222,12 @@ html[data-theme=light] .AppHeader-notifications:not([aria-label=通知])>div:fir @media only screen and (max-width: ${Number(GM_getValue('menu_widescreenDisplayWidth'))+50}px) {.Topstory-container {width: 97% !important;}} `, style_widescreenDisplayQuestion = `/* 宽屏显示 - 问题页 */ -.ListShortcut, .QuestionWaiting-mainColumn {width: inherit !important;} +.QuestionWaiting-mainColumn {width: inherit !important;} .Question-mainColumn+div,[data-za-detail-view-path-module="RightSideBar"], .Question-sideColumn, .GlobalSideBar {display: none !important;} .QuestionWaiting-mainColumn {margin-right: 0 !important;} -.Question-mainColumn {width: ${GM_getValue('menu_widescreenDisplayWidth')}px; margin: auto!important;} -@media only screen and (max-width: ${Number(GM_getValue('menu_widescreenDisplayWidth'))+50}px) {.Question-mainColumn {width: auto !important;}} -@media only screen and (max-width: ${GM_getValue('menu_widescreenDisplayWidth')-100}px) {.Question-mainColumn {width: 98.5% !important;}} +.Question-mainColumn, .ListShortcut {width: ${GM_getValue('menu_widescreenDisplayWidth')}px; margin: auto!important;} +@media only screen and (max-width: ${Number(GM_getValue('menu_widescreenDisplayWidth'))+50}px) {.Question-mainColumn, .ListShortcut {width: auto !important;}} +@media only screen and (max-width: ${GM_getValue('menu_widescreenDisplayWidth')-100}px) {.Question-mainColumn, .ListShortcut {width: 98.5% !important;}} .AuthorInfo {max-width: 100% !important;} `, style_widescreenDisplaySearch = `/* 宽屏显示 - 搜索页 */ @@ -477,7 +482,7 @@ html {filter: brightness(65%) sepia(30%) !important; background-image: url();} // 宽屏显示 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')) style += style_widescreenDisplaySearch; + 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_widescreenDisplayPost') && location.hostname.indexOf('zhuanlan') > -1 && (location.pathname.indexOf('/edit') === -1 || location.pathname.indexOf('/write') === -1)) style += style_widescreenDisplayPost; if (menu_value('menu_widescreenDisplayPeople') && location.pathname.indexOf('/people/') > -1) style += style_widescreenDisplayPeople; @@ -547,4 +552,26 @@ html {filter: brightness(65%) sepia(30%) !important; background-image: url();} break; } } + + + // 自定义 urlchange 事件(用来监听 URL 变化) + function addUrlChangeEvent() { + history.pushState = ( f => function pushState(){ + var ret = f.apply(this, arguments); + window.dispatchEvent(new Event('pushstate')); + window.dispatchEvent(new Event('urlchange')); + return ret; + })(history.pushState); + + history.replaceState = ( f => function replaceState(){ + var ret = f.apply(this, arguments); + window.dispatchEvent(new Event('replacestate')); + window.dispatchEvent(new Event('urlchange')); + return ret; + })(history.replaceState); + + window.addEventListener('popstate',()=>{ + window.dispatchEvent(new Event('urlchange')) + }); + } })(); \ No newline at end of file From 67f9fddab2fc4a44f5fba849e134f1aaa04b9d18 Mon Sep 17 00:00:00 2001 From: xiu2 <54703944+XIU2@users.noreply.github.com> Date: Sat, 25 Jul 2026 19:14:23 +0800 Subject: [PATCH 04/10] =?UTF-8?q?=E4=BC=98=E5=8C=96=20=E5=AE=BD=E5=B1=8F?= =?UTF-8?q?=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Zhihu-Beautification.user.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Zhihu-Beautification.user.js b/Zhihu-Beautification.user.js index a43bbbbf0..ef314e2d1 100644 --- a/Zhihu-Beautification.user.js +++ b/Zhihu-Beautification.user.js @@ -1,6 +1,6 @@ // ==UserScript== // @name 知乎美化 -// @version 1.5.22 +// @version 1.5.23 // @author X.I.U // @description 宽屏显示、暗黑模式(4种)、暗黑模式跟随浏览器、屏蔽首页活动广告、隐藏文章开头大图、调整图片最大高度、向下翻时自动隐藏顶栏 // @match *://www.zhihu.com/* @@ -28,9 +28,9 @@ ['menu_widescreenDisplay', '宽屏显示', '勾选 = 该页面开启宽屏显示(刷新后查看效果)', ''], ['menu_widescreenDisplayIndex', '首页', '宽屏显示', true], ['menu_widescreenDisplayQuestion', '问题页', '宽屏显示', true], - ['menu_widescreenDisplaySearch', '搜索页、话题页、圈子', '宽屏显示', true], + ['menu_widescreenDisplaySearch', '搜索页、话题页', '宽屏显示', true], ['menu_widescreenDisplayCollection', '收藏页', '宽屏显示', true], - ['menu_widescreenDisplayPost', '文章页', '宽屏显示', false], + ['menu_widescreenDisplayPost', '文章页(暂不可用)', '宽屏显示', false], ['menu_widescreenDisplayPeople', '用户主页', '用户主页', false], ['menu_widescreenDisplayWidth', '宽屏宽度', '宽屏宽度 (默认 1000)', '1000'], ['menu_darkMode', '暗黑模式', '暗黑模式', true], @@ -231,10 +231,10 @@ html[data-theme=light] .AppHeader-notifications:not([aria-label=通知])>div:fir .AuthorInfo {max-width: 100% !important;} `, style_widescreenDisplaySearch = `/* 宽屏显示 - 搜索页 */ -.SearchMain, .ContentLayout-mainColumn, .Club-mainColumn, .Post-mainColumn, [data-za-detail-view-path-module=TopicItem]>div:first-child {width: inherit !important;} -.SearchMain+div, .ContentLayout-sideColumn, .Card.QuestionHeaderTopicMeta, .ClubSideBar, [data-za-detail-view-path-module=TopicItem]>div:not(:first-child) {display: none !important;} -.Search-container, .ContentLayout, .Club-container, .Post-container, [data-za-detail-view-path-module=TopicItem] {width: ${GM_getValue('menu_widescreenDisplayWidth')}px;} -@media only screen and (max-width: ${Number(GM_getValue('menu_widescreenDisplayWidth'))+50}px) {.Search-container, .ContentLayout, .Club-container, .Post-container, [data-za-detail-view-path-module=TopicItem] {width: 97.5% !important;}} +.SearchMain, .App-main>[data-za-detail-view-path-module=TopicItem]>div:first-child {width: inherit !important;} +.SearchMain+div, .App-main>[data-za-detail-view-path-module=TopicItem]>div:not(:first-child) {display: none !important;} +.Search-container, .App-main>[data-za-detail-view-path-module=TopicItem] {width: ${GM_getValue('menu_widescreenDisplayWidth')}px;} +@media only screen and (max-width: ${Number(GM_getValue('menu_widescreenDisplayWidth'))+50}px) {.Search-container, .App-main>[data-za-detail-view-path-module=TopicItem] {width: 97.5% !important;}} `, style_widescreenDisplayCollection = `/* 宽屏显示 - 收藏页 */ .CollectionsDetailPage-mainColumn {width: inherit !important;} From 9a6dac1582788edbebe9c9f6770d65bf76732220 Mon Sep 17 00:00:00 2001 From: Buger Date: Sat, 25 Jul 2026 22:27:55 +0800 Subject: [PATCH 05/10] =?UTF-8?q?=E5=8E=BB=E9=99=A4=E5=A4=B1=E6=95=88?= =?UTF-8?q?=E5=8A=A0=E9=80=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- GithubEnhanced-High-Speed-Download.user.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GithubEnhanced-High-Speed-Download.user.js b/GithubEnhanced-High-Speed-Download.user.js index 6cfd921f5..2591e1fba 100644 --- a/GithubEnhanced-High-Speed-Download.user.js +++ b/GithubEnhanced-High-Speed-Download.user.js @@ -99,7 +99,7 @@ //['https://jsd.proxy.aks.moe/gh', '香港 2', '[中国 香港] - 该公益加速源由 [cdn.akass.cn] 提供'], // 证书错误 ['https://wget.la/https://raw.githubusercontent.com', '香港 1', '[中国香港、中国台湾、日本、美国等](CDN 不固定) - 该公益加速源由 [ucdn.me] 提供 - 缓存:无(或很短)'], ['https://hk.gh-proxy.org/https://raw.githubusercontent.com', '香港 2', '[中国香港] - 该公益加速源由 [gh-proxy.com] 提供 - 缓存:有(官方注明 2 小时)'], - ['https://hub.glowp.xyz/https://raw.githubusercontent.com', '香港 3', '[中国香港] - 该公益加速源由 [hub.glowp.xyz] 提供 - 缓存:有'], + //['https://hub.glowp.xyz/https://raw.githubusercontent.com', '香港 3', '[中国香港] - 该公益加速源由 [hub.glowp.xyz] 提供 - 缓存:有'], //域名到期失效 //['https://gitproxy.click/https://raw.githubusercontent.com', '香港', '[中国 香港] - 该公益加速源由 [gitproxy.click] 提供'], // 输出错误 //['https://cdn.moran233.xyz/https://raw.githubusercontent.com', '香港', '[中国 香港] - 该公益加速源由 [cdn.moran233.xyz] 提供'], // 404 //['https://gitdl.cn/https://raw.githubusercontent.com', '香港 3', '[中国香港] - 该公益加速源由 [gitdl] 提供 - 缓存:有'], // 输出文件错误 From a4d1659b7d9cdcb5d9e55a81bb14e85e875e3f49 Mon Sep 17 00:00:00 2001 From: xiu2 <54703944+XIU2@users.noreply.github.com> Date: Sun, 26 Jul 2026 17:51:33 +0800 Subject: [PATCH 06/10] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20=E5=9B=9E=E7=AD=94/?= =?UTF-8?q?=E9=97=AE=E9=A2=98=E9=A1=B5=E9=83=A8=E5=88=86=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E5=A4=B1=E6=95=88=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 | 182 +++++++++++++++++++++-------------------- 1 file changed, 94 insertions(+), 88 deletions(-) diff --git a/Zhihu-Enhanced.user.js b/Zhihu-Enhanced.user.js index 222676ddb..4fc7b4455 100644 --- a/Zhihu-Enhanced.user.js +++ b/Zhihu-Enhanced.user.js @@ -3,7 +3,7 @@ // @name:zh-CN 知乎增强 // @name:zh-TW 知乎增強 // @name:ru Улучшение Zhihu -// @version 2.3.29 +// @version 2.3.30 // @author X.I.U // @description A more personalized Zhihu experience~ // @description:zh-CN 移除登录弹窗、屏蔽指定类别(视频、盐选、文章、想法、关注[赞同/关注了XX]等)、屏蔽低赞/低评、屏蔽用户、屏蔽关键词、默认收起回答、快捷收起回答/评论(左键两侧)、快捷回到顶部(右键两侧)、区分问题文章、移除高亮链接、净化搜索热门、净化标题消息、展开问题描述、显示问题作者、默认高清原图(无水印)、置顶显示时间、完整问题时间、直达问题按钮、默认站外直链... @@ -295,119 +295,122 @@ function collapsedAnswer() { function collapsedNowAnswer(selectors) { backToTop(selectors) // 快捷回到顶部 if (!menu_value('menu_collapsedNowAnswer')) return - document.querySelector(selectors).onclick = function(event){ - 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') - //console.log('111') - if (commentCollapseButton && commentCollapseButton.textContent.indexOf('收起评论') > -1) commentCollapseButton.click(); - // 再去收起回答 - rightButton = rightButton.querySelector('.ContentItem-rightButton[data-zop-retract-question]') - //console.log('222') - if (rightButton) rightButton.click(); - - } else { // 固定在回答底部的 [收起回答](此时正在浏览回答内容 [尾部区域]) - - // 悬浮的 [收起评论](此时正在浏览评论内容 [中间区域]) - //if (getXpath('//button[text()="收起评论"]',document.querySelector('.Comments-container'))) {getXpath('//button[text()="收起评论"]',document.querySelector('.Comments-container')).click();console.log('asfaf')} - - 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') - // 如果展开了评论,就收起评论 - //console.log('333') - //if (commentCollapseButton && commentCollapseButton.textContent.indexOf('收起评论') > -1) commentCollapseButton.click(); - if (commentCollapseButton && commentCollapseButton.textContent.indexOf('收起评论') > -1) { - commentCollapseButton.click(); - if (!isElementInViewport(commentCollapseButton)) scrollTo(0,el.offsetTop+50) - } - //console.log('444') - el.click() // 再去收起回答 - answerCollapseButton_ = true; // 如果找到并点击收起了,就没必要执行下面的代码了(可视区域中没有 [收起回答] 时) - break - } - } - // 针对完全看不到 [收起回答] 按钮时(如 [头部区域],以及部分明明很长却不显示悬浮横条的回答) - if (!answerCollapseButton_) { - for (let el of document.querySelectorAll('.List-item, .Card.AnswerCard, .Card.TopstoryItem')) { // 遍历所有回答主体元素 - if (isElementInViewport_(el)) { // 判断该回答是否在可视区域内 + let element = document.querySelector(selectors) + if (element) { + element.onclick = function(event){ + 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') + //console.log('111') + if (commentCollapseButton && commentCollapseButton.textContent.indexOf('收起评论') > -1) commentCollapseButton.click(); + // 再去收起回答 + rightButton = rightButton.querySelector('.ContentItem-rightButton[data-zop-retract-question]') + //console.log('222') + if (rightButton) rightButton.click(); + + } else { // 固定在回答底部的 [收起回答](此时正在浏览回答内容 [尾部区域]) + + // 悬浮的 [收起评论](此时正在浏览评论内容 [中间区域]) + //if (getXpath('//button[text()="收起评论"]',document.querySelector('.Comments-container'))) {getXpath('//button[text()="收起评论"]',document.querySelector('.Comments-container')).click();console.log('asfaf')} + + let answerCollapseButton_ = false; + for (let el of document.querySelectorAll('.ContentItem-rightButton[data-zop-retract-question]')) { // 遍历所有回答底部的 [收起] 按钮 + if (isElementInViewport(el)) { // 判断该 [收起] 按钮是否在可视区域内 // 固定的 [收起评论](先看看是否展开评论,即存在 [收起评论] 按钮) - let commentCollapseButton = el.querySelector('button.Button.ContentItem-action.Button--plain.Button--withIcon.Button--withLabel:first-of-type') + let commentCollapseButton = el.parentNode.querySelector('button.Button.ContentItem-action.Button--plain.Button--withIcon.Button--withLabel:first-of-type') // 如果展开了评论,就收起评论 - //console.log('555',commentCollapseButton) + //console.log('333') + //if (commentCollapseButton && commentCollapseButton.textContent.indexOf('收起评论') > -1) commentCollapseButton.click(); if (commentCollapseButton && commentCollapseButton.textContent.indexOf('收起评论') > -1) { commentCollapseButton.click(); if (!isElementInViewport(commentCollapseButton)) scrollTo(0,el.offsetTop+50) } - let answerCollapseButton__ = el.querySelector('.ContentItem-rightButton[data-zop-retract-question]'); - //console.log('666') - if (answerCollapseButton__) answerCollapseButton__.click() // 再去收起回答 + //console.log('444') + el.click() // 再去收起回答 + answerCollapseButton_ = true; // 如果找到并点击收起了,就没必要执行下面的代码了(可视区域中没有 [收起回答] 时) break } } - } - } - - // 下面这段只针对 [收起评论](如果展开了的话) - let commentCollapseButton_ = false, commentCollapseButton__ = false; - // 悬浮的 [收起评论](此时正在浏览评论内容 [中间区域]) - let commentCollapseButton = getXpath('//button[text()="收起评论"]',document.querySelector('.Comments-container')) - if (commentCollapseButton) { - //console.log('777', commentCollapseButton) - commentCollapseButton.click(); - } else { // 固定的 [收起评论](此时正在浏览评论内容 [头部区域]) - let commentCollapseButton_1 = document.querySelectorAll('.ContentItem-actions > button.Button.ContentItem-action.Button--plain.Button--withIcon.Button--withLabel:first-of-type, .ContentItem-action > button.Button.Button--plain.Button--withIcon.Button--withLabel:first-of-type') - if (commentCollapseButton_1.length > 0) { - for (let el of commentCollapseButton_1) { - if (el.textContent.indexOf('收起评论') > -1) { - if (isElementInViewport(el)) { - //console.log('888') - el.click() - commentCollapseButton_ = true // 如果找到并点击了,就没必要执行下面的代码了(可视区域中没有 [收起评论] 时) + // 针对完全看不到 [收起回答] 按钮时(如 [头部区域],以及部分明明很长却不显示悬浮横条的回答) + if (!answerCollapseButton_) { + for (let el of document.querySelectorAll('.List-item, .Card.AnswerCard, .Card.TopstoryItem')) { // 遍历所有回答主体元素 + if (isElementInViewport_(el)) { // 判断该回答是否在可视区域内 + // 固定的 [收起评论](先看看是否展开评论,即存在 [收起评论] 按钮) + let commentCollapseButton = el.querySelector('button.Button.ContentItem-action.Button--plain.Button--withIcon.Button--withLabel:first-of-type') + // 如果展开了评论,就收起评论 + //console.log('555',commentCollapseButton) + if (commentCollapseButton && commentCollapseButton.textContent.indexOf('收起评论') > -1) { + commentCollapseButton.click(); + if (!isElementInViewport(commentCollapseButton)) scrollTo(0,el.offsetTop+50) + } + let answerCollapseButton__ = el.querySelector('.ContentItem-rightButton[data-zop-retract-question]'); + //console.log('666') + if (answerCollapseButton__) answerCollapseButton__.click() // 再去收起回答 break } } } } - if (commentCollapseButton_ == false) { // 可视区域中没有 [收起评论] 时(此时正在浏览评论内容 [头部区域] + [尾部区域](不上不下的,既看不到固定的 [收起评论] 又看不到悬浮的 [收起评论])),需要判断可视区域中是否存在评论元素 - let commentCollapseButton_1 = document.querySelectorAll('.Comments-container') + + // 下面这段只针对 [收起评论](如果展开了的话) + let commentCollapseButton_ = false, commentCollapseButton__ = false; + // 悬浮的 [收起评论](此时正在浏览评论内容 [中间区域]) + let commentCollapseButton = getXpath('//button[text()="收起评论"]',document.querySelector('.Comments-container')) + if (commentCollapseButton) { + //console.log('777', commentCollapseButton) + commentCollapseButton.click(); + } else { // 固定的 [收起评论](此时正在浏览评论内容 [头部区域]) + let commentCollapseButton_1 = document.querySelectorAll('.ContentItem-actions > button.Button.ContentItem-action.Button--plain.Button--withIcon.Button--withLabel:first-of-type, .ContentItem-action > button.Button.Button--plain.Button--withIcon.Button--withLabel:first-of-type') if (commentCollapseButton_1.length > 0) { for (let el of commentCollapseButton_1) { - if (isElementInViewport(el)) { - let parentElement = findParentElement(el, 'List-item') || findParentElement(el, 'Card '), - commentCollapseButton = parentElement.querySelector('.ContentItem-actions > button.Button.ContentItem-action.Button--plain.Button--withIcon.Button--withLabel:first-of-type') - if (commentCollapseButton.textContent.indexOf('收起评论') > -1) { - //console.log('999') - commentCollapseButton.click() - if (!isElementInViewport(commentCollapseButton)) {console.log(parentElement,parentElement.offsetTop,parentElement.offsetHeight);scrollTo(0,parentElement.offsetTop+parentElement.offsetHeight-50)} - commentCollapseButton__ = true // 如果找到并点击了,就没必要执行下面的代码了(可视区域中没有 评论元素 时) + if (el.textContent.indexOf('收起评论') > -1) { + if (isElementInViewport(el)) { + //console.log('888') + el.click() + commentCollapseButton_ = true // 如果找到并点击了,就没必要执行下面的代码了(可视区域中没有 [收起评论] 时) break } } } } - if (commentCollapseButton__ == false) { // 如果上面的都没找到,那么就尝试寻找评论末尾的 [评论回复框] - let commentCollapseButton_2 = document.querySelectorAll('.Editable-content') - if (commentCollapseButton_2.length > 0) { - for (let el of commentCollapseButton_2) { + if (commentCollapseButton_ == false) { // 可视区域中没有 [收起评论] 时(此时正在浏览评论内容 [头部区域] + [尾部区域](不上不下的,既看不到固定的 [收起评论] 又看不到悬浮的 [收起评论])),需要判断可视区域中是否存在评论元素 + let commentCollapseButton_1 = document.querySelectorAll('.Comments-container') + if (commentCollapseButton_1.length > 0) { + for (let el of commentCollapseButton_1) { if (isElementInViewport(el)) { let parentElement = findParentElement(el, 'List-item') || findParentElement(el, 'Card '), - commentCollapseButton = parentElement.querySelector('.ContentItem-actions > button.Button.ContentItem-action.Button--plain.Button--withIcon.Button--withLabel:first-of-type') - //console.log(commentCollapseButton) + commentCollapseButton = parentElement.querySelector('.ContentItem-actions > button.Button.ContentItem-action.Button--plain.Button--withIcon.Button--withLabel:first-of-type') if (commentCollapseButton.textContent.indexOf('收起评论') > -1) { - //console.log('101010') + //console.log('999') commentCollapseButton.click() if (!isElementInViewport(commentCollapseButton)) {console.log(parentElement,parentElement.offsetTop,parentElement.offsetHeight);scrollTo(0,parentElement.offsetTop+parentElement.offsetHeight-50)} + commentCollapseButton__ = true // 如果找到并点击了,就没必要执行下面的代码了(可视区域中没有 评论元素 时) break } } } } + if (commentCollapseButton__ == false) { // 如果上面的都没找到,那么就尝试寻找评论末尾的 [评论回复框] + let commentCollapseButton_2 = document.querySelectorAll('.Editable-content') + if (commentCollapseButton_2.length > 0) { + for (let el of commentCollapseButton_2) { + if (isElementInViewport(el)) { + let parentElement = findParentElement(el, 'List-item') || findParentElement(el, 'Card '), + commentCollapseButton = parentElement.querySelector('.ContentItem-actions > button.Button.ContentItem-action.Button--plain.Button--withIcon.Button--withLabel:first-of-type') + //console.log(commentCollapseButton) + if (commentCollapseButton.textContent.indexOf('收起评论') > -1) { + //console.log('101010') + commentCollapseButton.click() + if (!isElementInViewport(commentCollapseButton)) {console.log(parentElement,parentElement.offsetTop,parentElement.offsetHeight);scrollTo(0,parentElement.offsetTop+parentElement.offsetHeight-50)} + break + } + } + } + } + } } } } @@ -419,10 +422,13 @@ function collapsedNowAnswer(selectors) { // 回到顶部(监听点击事件,鼠标右键点击网页两侧空白处) function backToTop(selectors) { if (!menu_value('menu_backToTop')) return - document.querySelector(selectors).oncontextmenu = function(event){ - if (event.target == this) { - event.preventDefault(); - window.scrollTo(0,0) + let element = document.querySelector(selectors) + if (element) { + element.oncontextmenu = function(event){ + if (event.target == this) { + event.preventDefault(); + window.scrollTo(0,0) + } } } } @@ -1682,7 +1688,7 @@ function switchHomeRecommend() { if (location.pathname.indexOf('question') > -1 && location.href.indexOf('/log') == -1) { // 回答页 // if (location.pathname.indexOf('waiting') == -1) { collapsedNowAnswer('.QuestionPage'); // 收起当前回答 + 快捷返回顶部 - collapsedNowAnswer('.Question-main'); // 收起当前回答 + 快捷返回顶部 + collapsedNowAnswer('.QuestionPage>#AnswerFormPortalContainer+div>div:first-child'); //收起当前回答 + 快捷返回顶部 questionRichTextMore(); // 展开问题描述 if (location.pathname.indexOf('answer') == -1) { // 问题页而不是回答页 blockLowCount('question'); // 屏蔽低赞/低评回答/文章 From 8fa9899f112f59d5cbe1513b058e1415936c2dcd Mon Sep 17 00:00:00 2001 From: xiu2 <54703944+XIU2@users.noreply.github.com> Date: Thu, 30 Jul 2026 15:04:22 +0800 Subject: [PATCH 07/10] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20=E6=9A=97=E9=BB=91?= =?UTF-8?q?=E6=A8=A1=E5=BC=8F1=E4=B8=8B=E9=A6=96=E9=A1=B5=E5=B7=A5?= =?UTF-8?q?=E5=85=B7=E6=9D=A1=E5=AE=BD=E5=BA=A6=E4=B8=8D=E9=BD=90=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 --- Zhihu-Beautification.user.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Zhihu-Beautification.user.js b/Zhihu-Beautification.user.js index ef314e2d1..92c3a6708 100644 --- a/Zhihu-Beautification.user.js +++ b/Zhihu-Beautification.user.js @@ -1,6 +1,6 @@ // ==UserScript== // @name 知乎美化 -// @version 1.5.23 +// @version 1.5.24 // @author X.I.U // @description 宽屏显示、暗黑模式(4种)、暗黑模式跟随浏览器、屏蔽首页活动广告、隐藏文章开头大图、调整图片最大高度、向下翻时自动隐藏顶栏 // @match *://www.zhihu.com/* @@ -267,6 +267,8 @@ html[data-theme=light] .AppHeader-notifications:not([aria-label=通知])>div:fir .ztext .content_image, .ztext .origin_image, .GifPlayer img {max-height: 500px !important;width: auto !important;} `, style_darkMode_1 = `/* 暗黑模式(方案 1) */ +/* 首页工具条宽度 */ +html[data-theme=dark] .Card.TopstoryItem.TopstoryItem-isRecommend .ContentItem-actions, .Card.TopstoryItem.TopstoryItem-isFollow .ContentItem-actions {margin: 0 -16px -10px;} /* 右上角 通知/私信 红点颜色 */ html[data-theme=dark] .AppHeader-notifications:not([aria-label=通知])>div:first-of-type, html[data-theme=dark] .AppHeader-messages:not([aria-label=私信])>div:first-of-type {color: #ffffff !important;border: 2px solid #2d333b !important;} /* 文字颜色 */ From 04386b973a72f2a16fcf52234cf46174b7d81e66 Mon Sep 17 00:00:00 2001 From: xiu2 <54703944+XIU2@users.noreply.github.com> Date: Thu, 30 Jul 2026 15:12:51 +0800 Subject: [PATCH 08/10] =?UTF-8?q?=E9=80=82=E9=85=8D=20Github=20=E7=BD=91?= =?UTF-8?q?=E9=A1=B5=E5=8F=98=E5=8A=A8(=E4=BF=AE=E5=A4=8D=20Code=20?= =?UTF-8?q?=E4=B8=8B=E4=B8=8D=E6=98=BE=E7=A4=BA=E5=8A=A0=E9=80=9F=E6=BA=90?= =?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 --- GithubEnhanced-High-Speed-Download.user.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/GithubEnhanced-High-Speed-Download.user.js b/GithubEnhanced-High-Speed-Download.user.js index 2591e1fba..cced16688 100644 --- a/GithubEnhanced-High-Speed-Download.user.js +++ b/GithubEnhanced-High-Speed-Download.user.js @@ -3,7 +3,7 @@ // @name:zh-CN Github 增强 - 高速下载 // @name:zh-TW Github 增強 - 高速下載 // @name:ru Улучшение GitHub – быстрое скачивание -// @version 2.6.38 +// @version 2.6.39 // @author X.I.U // @description High-speed download of Git Clone/SSH, Release, Raw, Code(ZIP) and other files (Based on public welfare), project list file quick download (☁) // @description:zh-CN 高速下载 Git Clone/SSH、Release、Raw、Code(ZIP) 等文件 (公益加速)、项目列表单文件快捷下载 (☁) @@ -189,7 +189,7 @@ if (target.tagName === 'DIV' && target.dataset.viewComponent === 'true' && target.classList[0] === 'Box') addRelease(); } } - } else if (document.querySelector('#repository-container-header:not([hidden])')) { // 项目首页 + } else if (document.querySelector('#repo-title-component')) { // 项目首页 for (const mutation of mutationsList) { for (const target of mutation.addedNodes) { if (target.nodeType !== 1) return From bbfe62c646f954d42e8773e008e15f5256c22262 Mon Sep 17 00:00:00 2001 From: xiu2 <54703944+XIU2@users.noreply.github.com> Date: Thu, 30 Jul 2026 21:55:26 +0800 Subject: [PATCH 09/10] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20[=E4=B8=80=E9=94=AE?= =?UTF-8?q?=E6=94=B6=E8=B5=B7=E5=9B=9E=E7=AD=94/=E8=AF=84=E8=AE=BA]=20?= =?UTF-8?q?=E6=8C=89=E9=92=AE=E6=98=BE=E7=A4=BA=E5=BC=82=E5=B8=B8=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 --- Zhihu-Enhanced.user.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Zhihu-Enhanced.user.js b/Zhihu-Enhanced.user.js index 4fc7b4455..729d2a777 100644 --- a/Zhihu-Enhanced.user.js +++ b/Zhihu-Enhanced.user.js @@ -3,7 +3,7 @@ // @name:zh-CN 知乎增强 // @name:zh-TW 知乎增強 // @name:ru Улучшение Zhihu -// @version 2.3.30 +// @version 2.3.31 // @author X.I.U // @description A more personalized Zhihu experience~ // @description:zh-CN 移除登录弹窗、屏蔽指定类别(视频、盐选、文章、想法、关注[赞同/关注了XX]等)、屏蔽低赞/低评、屏蔽用户、屏蔽关键词、默认收起回答、快捷收起回答/评论(左键两侧)、快捷回到顶部(右键两侧)、区分问题文章、移除高亮链接、净化搜索热门、净化标题消息、展开问题描述、显示问题作者、默认高清原图(无水印)、置顶显示时间、完整问题时间、直达问题按钮、默认站外直链... @@ -248,7 +248,7 @@ function collapsedAnswer() { //console.log('1111', document.querySelector('.CornerAnimayedFlex')) if (document.querySelector('.CornerAnimayedFlex') && !document.getElementById('collapsed-button')) { // 向网页中插入收起全部回答按钮+样式+绑定点击事件 - document.head.appendChild(document.createElement('style')).textContent = '.CornerButton{margin-bottom:8px !important;}.CornerButtons{bottom:45px !important;}'; + document.head.appendChild(document.createElement('style')).textContent = '.CornerButton{margin-bottom:8px !important;}.CornerButtons{bottom:25px !important;} .CornerAnimayedFlex {height: auto;}'; document.querySelector('.CornerAnimayedFlex').insertAdjacentHTML('afterBegin', ''); document.getElementById('collapsed-button').onclick = function () { From 77b9f742b2c291b2908bd092a1805783e78747d7 Mon Sep 17 00:00:00 2001 From: xiu2 <54703944+XIU2@users.noreply.github.com> Date: Wed, 5 Aug 2026 16:34:36 +0800 Subject: [PATCH 10/10] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20[=E4=B8=80=E9=94=AE?= =?UTF-8?q?=E6=94=B6=E8=B5=B7=E5=9B=9E=E7=AD=94+=E8=AF=84=E8=AE=BA]=20?= =?UTF-8?q?=E5=8F=B3=E4=B8=8B=E8=A7=92=E6=8C=89=E9=92=AE=E6=A0=B7=E5=BC=8F?= =?UTF-8?q?=E9=80=82=E9=85=8D=E7=9F=A5=E4=B9=8E=E6=94=B9=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Zhihu-Enhanced.user.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Zhihu-Enhanced.user.js b/Zhihu-Enhanced.user.js index 729d2a777..07258f8a1 100644 --- a/Zhihu-Enhanced.user.js +++ b/Zhihu-Enhanced.user.js @@ -3,7 +3,7 @@ // @name:zh-CN 知乎增强 // @name:zh-TW 知乎增強 // @name:ru Улучшение Zhihu -// @version 2.3.31 +// @version 2.3.32 // @author X.I.U // @description A more personalized Zhihu experience~ // @description:zh-CN 移除登录弹窗、屏蔽指定类别(视频、盐选、文章、想法、关注[赞同/关注了XX]等)、屏蔽低赞/低评、屏蔽用户、屏蔽关键词、默认收起回答、快捷收起回答/评论(左键两侧)、快捷回到顶部(右键两侧)、区分问题文章、移除高亮链接、净化搜索热门、净化标题消息、展开问题描述、显示问题作者、默认高清原图(无水印)、置顶显示时间、完整问题时间、直达问题按钮、默认站外直链... @@ -249,7 +249,7 @@ function collapsedAnswer() { if (document.querySelector('.CornerAnimayedFlex') && !document.getElementById('collapsed-button')) { // 向网页中插入收起全部回答按钮+样式+绑定点击事件 document.head.appendChild(document.createElement('style')).textContent = '.CornerButton{margin-bottom:8px !important;}.CornerButtons{bottom:25px !important;} .CornerAnimayedFlex {height: auto;}'; - document.querySelector('.CornerAnimayedFlex').insertAdjacentHTML('afterBegin', ''); + document.querySelector('.CornerAnimayedFlex').insertAdjacentHTML('afterBegin', ''); document.getElementById('collapsed-button').onclick = function () { // 收起所有评论(悬浮的 [收起评论])