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 0001/1989] =?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 0002/1989] =?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 += ``
}
html.insertAdjacentHTML('afterend', _html);
}
@@ -271,7 +255,7 @@
}
for (let i=0;i${svg[1]}
`
+ _html += ``
}
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 0003/1989] =?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 0004/1989] =?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 0005/1989] =?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 0006/1989] =?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 0007/1989] =?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 0008/1989] =?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 0009/1989] =?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 0010/1989] =?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 0011/1989] =?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 0012/1989] =?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 0013/1989] =?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 0014/1989] =?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 0015/1989] =?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 0016/1989] 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 0017/1989] 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 0018/1989] 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 0019/1989] =?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 0020/1989] =?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 0021/1989] =?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 0022/1989] =?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 0023/1989] 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
-[](https://github.com/XIU2/UserScript/blob/master/LICENSE)
-[](https://github.com/XIU2/UserScript/stargazers)
-[](https://github.com/XIU2/UserScript/network/members)
+[](https://github.com/XIU2/UserScript/)
+[](https://github.com/XIU2/UserScript/)
+[](https://github.com/XIU2/UserScript/)
[](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 0024/1989] =?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 0025/1989] =?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 0026/1989] =?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 0027/1989] =?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 0028/1989] =?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 0029/1989] =?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 0030/1989] =?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 0031/1989] =?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') { // 对于