From 4f646b3d2a05e1604dadd2fc187a16b64293dd0b Mon Sep 17 00:00:00 2001 From: xiu2 <54703944+XIU2@users.noreply.github.com> Date: Sat, 20 Nov 2021 20:48:15 +0800 Subject: [PATCH 0001/1653] =?UTF-8?q?=E6=96=B0=E5=A2=9E=20[=E5=B1=8F?= =?UTF-8?q?=E8=94=BD=E5=85=B3=E9=94=AE=E8=AF=8D]=20=E5=AF=B9=E7=83=AD?= =?UTF-8?q?=E6=A6=9C=E7=9A=84=E6=94=AF=E6=8C=81;=20=E4=BC=98=E5=8C=96=20[?= =?UTF-8?q?=E5=B1=8F=E8=94=BD=E5=85=B3=E9=94=AE=E8=AF=8D]=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 | 73 ++++++++++++++---------------------------- 1 file changed, 24 insertions(+), 49 deletions(-) diff --git a/Zhihu-Enhanced.user.js b/Zhihu-Enhanced.user.js index 48a62df1d..2da272aeb 100644 --- a/Zhihu-Enhanced.user.js +++ b/Zhihu-Enhanced.user.js @@ -1,6 +1,6 @@ // ==UserScript== // @name 知乎增强 -// @version 1.7.8 +// @version 1.7.9 // @author X.I.U // @description 移除登录弹窗、屏蔽首页视频、默认收起回答、快捷收起当前回答/评论(左键两侧空白处)、快捷回到顶部(右键两侧空白处)、屏蔽用户 (发布的内容)、屏蔽关键词(标题/评论)、屏蔽盐选内容、净化标题消息、展开问题描述、置顶显示时间、完整问题时间、区分问题文章、直达问题按钮、默认高清原图、默认站外直链 // @match *://www.zhihu.com/* @@ -727,18 +727,11 @@ function blockKeywords(type) { function blockKeywords_(className1, className2) { // 前几条因为是直接加载的,而不是动态插入网页的,所以需要单独判断 function blockKeywords_now() { - document.querySelectorAll(className1).forEach(function(item1){ - let item = item1.querySelector('h2.ContentItem-title meta[itemprop="name"], meta[itemprop="headline"]'); // 标题所在元素 - if (item) { - for (const keyword of menu_value('menu_customBlockKeywords')) { // 遍历关键词黑名单 - if (item.content.toLowerCase().indexOf(keyword.toLowerCase()) > -1) { // 找到就删除该信息流 - console.log(item.content); - item1.hidden = true; - break; - } - } - } - }) + if (location.pathname === '/hot') { + document.querySelectorAll('.HotItem').forEach(function(item1){blockKeywords_1(item1, 'h2.HotItem-title');}) + } else { + document.querySelectorAll(className1).forEach(function(item1){blockKeywords_1(item1, 'h2.ContentItem-title meta[itemprop="name"], meta[itemprop="headline"]');}) + } } blockKeywords_now(); @@ -751,18 +744,7 @@ function blockKeywords(type) { for (const mutation of mutationsList) { for (const target of mutation.addedNodes) { if (target.nodeType != 1) return - if (target.className === className2) { - let item = target.querySelector('h2.ContentItem-title meta[itemprop="name"], meta[itemprop="headline"]'); // 标题所在元素 - if (item) { - for (const keyword of menu_value('menu_customBlockKeywords')) { // 遍历关键词黑名单 - if (item.content.toLowerCase().indexOf(keyword.toLowerCase()) > -1) { // 找到就删除该信息流 - console.log(item.content); - target.hidden = true; - break; - } - } - } - } + if (target.className === className2) {blockKeywords_1(target, 'h2.ContentItem-title meta[itemprop="name"], meta[itemprop="headline"]');} } } }; @@ -774,18 +756,7 @@ function blockKeywords(type) { function blockKeywords_search() { function blockKeywords_now() { if (location.search.indexOf('type=content') === -1) return // 目前只支持搜索页的 [综合] - document.querySelectorAll('.Card.SearchResult-Card[data-za-detail-view-path-module="AnswerItem"], .Card.SearchResult-Card[data-za-detail-view-path-module="PostItem"]').forEach(function(item1){ - let item = item1.querySelector('a[data-za-detail-view-id]'); // 标题所在元素 - if (item) { - for (const keyword of menu_value('menu_customBlockKeywords')) { // 遍历关键词黑名单 - if (item.textContent.toLowerCase().indexOf(keyword.toLowerCase()) > -1) { // 找到就删除该信息流 - console.log(item.textContent); - item1.hidden = true; - break; - } - } - } - }) + document.querySelectorAll('.HotLanding-contentItem, .Card.SearchResult-Card[data-za-detail-view-path-module="AnswerItem"], .Card.SearchResult-Card[data-za-detail-view-path-module="PostItem"]').forEach(function(item1){blockKeywords_1(item1, 'a[data-za-detail-view-id]');}) } setTimeout(blockKeywords_now, 500); @@ -798,18 +769,7 @@ function blockKeywords(type) { for (const mutation of mutationsList) { for (const target of mutation.addedNodes) { if (target.nodeType != 1) return - if (target.className === 'Card SearchResult-Card' && (target.dataset.zaDetailViewPathModule === 'AnswerItem' || target.dataset.zaDetailViewPathModule === 'PostItem')) { - let item = target.querySelector('a[data-za-detail-view-id]'); // 标题所在元素 - if (item) { - for (const keyword of menu_value('menu_customBlockKeywords')) { // 遍历关键词黑名单 - if (item.textContent.toLowerCase().indexOf(keyword.toLowerCase()) > -1) { // 找到就删除该信息流 - console.log(item.textContent); - target.hidden = true; - break; - } - } - } - } + if (target.className === 'Card SearchResult-Card' && (target.dataset.zaDetailViewPathModule === 'AnswerItem' || target.dataset.zaDetailViewPathModule === 'PostItem')) {blockKeywords_1(target, 'a[data-za-detail-view-id]');} } } }; @@ -854,6 +814,21 @@ function blockKeywords(type) { const observer = new MutationObserver(callback); observer.observe(document, { childList: true, subtree: true }); } + + function blockKeywords_1(item1, css) { + let item = item1.querySelector(css); // 标题所在元素 + if (item) { + for (const keyword of menu_value('menu_customBlockKeywords')) { // 遍历关键词黑名单 + let text = item.content || item.textContent; + if (text.toLowerCase().indexOf(keyword.toLowerCase()) > -1) { // 找到就删除该信息流 + console.log(text); + item1.hidden = true; + item1.style.display = 'none'; + break; + } + } + } + } } From 37a569a13c9e15dd938dd5083d5e6aefabe8afa4 Mon Sep 17 00:00:00 2001 From: xiu2 <54703944+XIU2@users.noreply.github.com> Date: Sun, 21 Nov 2021 11:00:02 +0800 Subject: [PATCH 0002/1653] =?UTF-8?q?=E4=BC=98=E5=8C=96=20[=E8=B0=B7?= =?UTF-8?q?=E6=AD=8C=E6=90=9C=E7=B4=A2]=20=E8=A7=84=E5=88=99=20(=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E8=A7=86=E9=A2=91=E7=BB=93=E6=9E=9C=E6=98=BE=E7=A4=BA?= =?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 | 43 +++++++++++++++++++++++++++++++------------ 1 file changed, 31 insertions(+), 12 deletions(-) diff --git a/Autopage.user.js b/Autopage.user.js index b7b3aa0cb..f2b846e1d 100644 --- a/Autopage.user.js +++ b/Autopage.user.js @@ -1,6 +1,6 @@ // ==UserScript== // @name 自动无缝翻页 -// @version 3.5.3 +// @version 3.5.4 // @author X.I.U // @description 无缝拼接下一页内容(瀑布流),目前支持:[所有「Discuz!、Flarum、phpBB、Xiuno、XenForo、DUX/XIU/D8/Begin(WP主题)」网站]、百度、谷歌、必应、搜狗、头条搜索、360 搜索、微信搜索、贴吧、豆瓣、微博、NGA、V2EX、B 站(Bilibili)、蓝奏云、煎蛋网、糗事百科、龙的天空、起点小说、IT之家、千图网、Pixabay、3DM、游侠网、游民星空、NexusMods、Steam 创意工坊、CS.RIN.RU、片库、茶杯狐、NO视频、低端影视、奈菲影视、音范丝、BT之家、萌番组、动漫花园、樱花动漫、爱恋动漫、AGE 动漫、Nyaa、SrkBT、RARBG、SubHD、423Down、不死鸟、扩展迷、极简插件、小众软件、动漫狂、漫画猫、漫画 DB、动漫之家、拷贝漫画、包子漫画、古风漫画网、Mangabz、PubMed、GreasyFork、Github、StackOverflow(以上仅一小部分,更多的写不下了... // @match *://*/* @@ -110,9 +110,10 @@ 5 = 插入该元素末尾(针对小说网站等文本类的) replaceE: 要替换为下一页内容的元素(比如页码) scriptT: 单独插入