更新 [默认高清原图] 为 [默认高清原图(无水印)] (感谢 @pgdhao123 提供方法)

This commit is contained in:
xiu2
2024-06-26 11:03:59 +08:00
parent 12c8103a39
commit f811ad3cb2
+12 -11
View File
@@ -3,10 +3,10 @@
// @name:zh-CN 知乎增强
// @name:zh-TW 知乎增強
// @name:en Zhihu enhancement
// @version 2.3.1
// @version 2.3.2
// @author X.I.U
// @description 移除登录弹窗、屏蔽首页视频、默认收起回答、快捷收起回答/评论(左键两侧)、快捷回到顶部(右键两侧)、屏蔽用户、屏蔽关键词、移除高亮链接、屏蔽盐选内容/热榜杂项、净化搜索热门、净化标题消息、展开问题描述、显示问题作者、置顶显示时间、完整问题时间、区分问题文章、直达问题按钮、默认高清原图、默认站外直链
// @description:zh-TW 移除登錄彈窗、屏蔽首頁視頻、默認收起回答、快捷收起回答/評論、快捷回到頂部、屏蔽用戶、屏蔽關鍵詞、移除高亮鏈接、屏蔽鹽選內容、淨化搜索熱門、淨化標題消息、置頂顯示時間、完整問題時間、區分問題文章、默認高清原圖、默認站外直鏈...
// @description 屏蔽首页视频、默认收起回答、快捷收起回答/评论(左键两侧)、快捷回到顶部(右键两侧)、屏蔽用户、屏蔽关键词、移除高亮链接、屏蔽盐选内容/热榜杂项、净化搜索热门、净化标题消息、展开问题描述、显示问题作者、置顶显示时间、完整问题时间、区分问题文章、直达问题按钮、默认高清原图(无水印)、默认站外直链
// @description:zh-TW 屏蔽首頁視頻、默認收起回答、快捷收起回答/評論、快捷回到頂部、屏蔽用戶、屏蔽關鍵詞、移除高亮鏈接、屏蔽鹽選內容、淨化搜索熱門、淨化標題消息、置頂顯示時間、完整問題時間、區分問題文章、默認高清原圖、默認站外直鏈...
// @description:en A more personalized Zhihu experience~
// @match *://www.zhihu.com/*
// @match *://zhuanlan.zhihu.com/*
@@ -1371,15 +1371,15 @@ function getUTC8(t) {
}
// 默认站外直链,修改自:https://greasyfork.org/scripts/402808(从 JQuery 改为原生 JavaScript,且精简、优化了代码)
function directLink () {
document.querySelectorAll('a.external[href*="link.zhihu.com/?target="], a.LinkCard[href*="link.zhihu.com/?target="]:not(.MCNLinkCard):not(.ZVideoLinkCard):not(.ADLinkCardContainer)').forEach(function (_this) {_this.href = decodeURIComponent(_this.href.substring(_this.href.indexOf('link.zhihu.com/?target=') + 23));});
// 默认高清原图(无水印)
function originalPic(){
document.querySelectorAll('img[data-original][data-original-token][data-lazy-status]:not([data-original-xiu]):not(.comment_sticker):not(.Avatar)').forEach(function(one){one.src = 'https://' + one.dataset.original.split('/')[2] + '/' + one.dataset.originalToken + '.webp'; one.dataset.originalXiu = 'true';});
}
// 默认高清原图,修改自:https://greasyfork.org/scripts/402808(从 JQuery 改为原生 JavaScript,且精简、优化了代码)
function originalPic(){
document.querySelectorAll('img[data-original]:not(.comment_sticker):not(.Avatar)').forEach(function(one){if (one.src != one.dataset.original) {one.src = one.dataset.original}});
// 默认站外直链,修改自:https://greasyfork.org/scripts/402808(从 JQuery 改为原生 JavaScript,且精简、优化了代码)
function directLink () {
document.querySelectorAll('a.external[href*="link.zhihu.com/?target="], a.LinkCard[href*="link.zhihu.com/?target="]:not(.MCNLinkCard):not(.ZVideoLinkCard):not(.ADLinkCardContainer)').forEach(function (_this) {_this.href = decodeURIComponent(_this.href.substring(_this.href.indexOf('link.zhihu.com/?target=') + 23));});
}
@@ -1494,8 +1494,9 @@ function blockHotOther() {
function start(){
removeHighlightLink(); // 移除高亮链接
setInterval(originalPic,100); // 默认高清原图
setInterval(directLink, 100); // 默认站外直链
originalPic();directLink(); // 先立即执行一次
setInterval(originalPic,500); // 默认高清原图(无水印)
setInterval(directLink, 500); // 默认站外直链
if (location.hostname != 'zhuanlan.zhihu.com') {
if (location.pathname.indexOf('/column/') === -1) cleanSearch(); //净化搜索热门
collapsedAnswer(); // 一键收起回答