Skip to content

Commit db4fceb

Browse files
committed
修复 [屏蔽关键词] 功能未在热榜生效的问题
1 parent f3b7733 commit db4fceb

1 file changed

Lines changed: 12 additions & 4 deletions

File tree

Zhihu-Enhanced.user.js

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// @name:zh-CN 知乎增强
44
// @name:zh-TW 知乎增強
55
// @name:en Zhihu enhancement
6-
// @version 2.0.7
6+
// @version 2.0.8
77
// @author X.I.U
88
// @description 移除登录弹窗、屏蔽首页视频、默认收起回答、快捷收起回答/评论(左键两侧)、快捷回到顶部(右键两侧)、屏蔽用户、屏蔽关键词、移除高亮链接、屏蔽盐选内容、净化搜索热门、净化标题消息、展开问题描述、显示问题作者、置顶显示时间、完整问题时间、区分问题文章、直达问题按钮、默认高清原图、默认站外直链
99
// @description:zh-TW 移除登錄彈窗、屏蔽首頁視頻、默認收起回答、快捷收起回答/評論、快捷回到頂部、屏蔽用戶、屏蔽關鍵詞、移除高亮鏈接、屏蔽鹽選內容、淨化搜索熱門、淨化標題消息、置頂顯示時間、完整問題時間、區分問題文章、默認高清原圖、默認站外直鏈...
@@ -762,6 +762,7 @@ function blockKeywords(type) {
762762
// 前几条因为是直接加载的,而不是动态插入网页的,所以需要单独判断
763763
function blockKeywords_now() {
764764
if (location.pathname === '/hot') {
765+
console.log('222222222222')
765766
document.querySelectorAll('.HotItem').forEach(function(item1){blockKeywords_1(item1, 'h2.HotItem-title');})
766767
} else {
767768
document.querySelectorAll(className1).forEach(function(item1){blockKeywords_1(item1, 'h2.ContentItem-title meta[itemprop="name"], meta[itemprop="headline"]');})
@@ -1369,6 +1370,7 @@ function questionInvitation(){
13691370
setInterval(originalPic,100); // 默认高清原图
13701371
setInterval(directLink, 100); // 默认站外直链
13711372
window.addEventListener('urlchange', function(){ // 针对的是从单个回答页跳转到完整回答页时
1373+
console.log(location.pathname)
13721374
if (location.pathname.indexOf('question') > -1 && location.pathname.indexOf('waiting') === -1 && location.pathname.indexOf('/answer/') === -1) { // 回答页 //
13731375
setTimeout(function(){
13741376
collapsedNowAnswer('.QuestionPage'); // 收起当前回答 + 快捷返回顶部
@@ -1378,9 +1380,13 @@ function questionInvitation(){
13781380
blockYanXuan(); // 屏蔽盐选内容
13791381
}, 300);
13801382
} else if (location.pathname == '/') {
1381-
blockUsers('index'); // 屏蔽指定用户
1382-
blockKeywords('index'); // 屏蔽指定关键词
1383-
blockType(); // 屏蔽指定类别(视频/文章等)
1383+
setTimeout(()=>{
1384+
blockUsers('index'); // 屏蔽指定用户
1385+
blockKeywords('index'); // 屏蔽指定关键词
1386+
blockType(); // 屏蔽指定类别(视频/文章等)
1387+
}, 500);
1388+
} else if (location.pathname == '/hot') {
1389+
setTimeout(()=>{blockKeywords('index');}, 500);// 屏蔽指定关键词
13841390
}
13851391
})
13861392

@@ -1484,6 +1490,8 @@ function questionInvitation(){
14841490
blockUsers('index'); // 屏蔽指定用户
14851491
blockKeywords('index'); // 屏蔽指定关键词
14861492
blockType(); // 屏蔽指定类别(视频/文章等)
1493+
} else if (location.pathname == '/hot') {
1494+
blockKeywords('index'); // 屏蔽指定关键词
14871495
} else {
14881496
blockUsers();
14891497
}

0 commit comments

Comments
 (0)