├── .eslintrc
├── .gitignore
├── AnnoyancesInterception.md
├── AnnoyancesInterception.user.js
├── AutoDarkMode.md
├── AutoDarkMode.user.js
├── AutoUnfold.md
├── AutoUnfold.user.js
├── DoubanAssistant.md
├── DoubanAssistant.user.js
├── GptCleaner.user.js
├── JenkinsAssistant.user.js
├── LICENSE
├── LinkManager.md
├── LinkManager.user.js
├── NetdiskAssistant.user.js
├── README.md
├── RemoveSuffix.md
└── RemoveSuffix.user.js
/.eslintrc:
--------------------------------------------------------------------------------
1 | {
2 | "env": {
3 | "browser": true,
4 | "es6": true,
5 | "greasemonkey": true
6 | },
7 | "extends": "eslint:recommended",
8 | "parserOptions": {
9 | "ecmaVersion": 6,
10 | "sourceType": "module"
11 | },
12 | "rules": {
13 | "no-unused-vars":"warn",
14 | "no-inner-declarations":"off"
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | Changelog*
2 | WebSite*
--------------------------------------------------------------------------------
/AnnoyancesInterception.md:
--------------------------------------------------------------------------------
1 | [](https://github.com/airbashX/UserScript/)
2 | [](https://github.com/airbashX/UserScript/)
3 | [](https://github.com/airbashX/UserScript/)
4 | [](https://www.jsdelivr.com/package/gh/airbashX/UserScript)
5 | [](https://greasyfork.org/zh-CN/users/698573-厌学的骚年)
6 |
7 | # 相关功能:
8 |
9 | 骚扰拦截:PC+手机全平台通用;
10 |
11 | 拦截或删除`app打开弹窗`、`下载弹窗`、`悬浮按钮`、`小程序`、`登录提示`等影响用户体验的骚扰元素
12 |
13 | 本脚本不拦截广告,广告拦截的话请订阅[easylist-china](https://easylist-downloads.adblockplus.org/easylistchina.txt)广告过滤规则
14 |
15 | # 相关脚本:
16 | | 名称 | 功能 |
17 | | :----------- | :----------------------------------------------------------- |
18 | | **[自动展开](https://greasyfork.org/zh-CN/scripts/438656)** | 自动展开文章或新闻等`隐藏`、`折叠`部分 |
19 | | **[骚扰拦截](https://greasyfork.org/zh-CN/scripts/440871)** | 自动拦截`下载弹窗`、`悬浮按钮`、`登录弹窗`等影响用户体验的骚扰元素 |
20 | | **[链接管理](https://greasyfork.org/zh-CN/scripts/443670)** | 取消点击链接后跳转到安全页面 |
21 | | **[移除复制后缀](https://greasyfork.org/zh-CN/scripts/472307)** | 移除复制后附带的`后缀`、`网站声明` |
22 |
23 | # 适配网站:
24 | |网站名|PC|Phone|app弹窗|悬浮按钮|其他功能|
25 | |-|-|-|-|-|-|
26 | |CSDN|✔|✔|✔|✔|去除登录提示+学生认证|
27 | |掘金|✔|✔|✔|✔|去除登录提示|
28 | |简书|✔|✔|✔|✔|去除登录提示|
29 | |知乎|✔|✔|✔|✔|去除登录提示|
30 | |知乎专栏|✔|✔|✔|✔|去除登录提示|
31 | |百度贴吧|✔|✔|✔|✔||
32 | |百度文库|✔|✔|✔|✔||
33 | |百家号|✔|✔|✔|✔||
34 | |百家资讯|✔|✔|✔|✔||
35 | |百度新闻|✔|✔|✔|✔||
36 | |新浪新闻|✔|✔|✔|✔||
37 | |搜狐新闻|✔|✔|✔|✔||
38 | |腾讯视频|✔|✔|✔|✔||
39 | |优酷视频|✔|✔|✔|✔||
40 | |爱奇艺|✔|✔|✔|✔|去除登录提示|
41 | |好看视频|✔|✔|✔|✔|去除登录提示+播放暂停时下载App提示|
42 | |m1905电影网|✔|✔|✔|✔||
43 | |百度搜索|✔|✔|✔|✔|去除搜索结果中的:小程序+百度手机助手|
44 | |必应搜索|✔|✔|✔|✔|去除搜索结果中的:下载必应APP|
45 | |哔哩哔哩|✔|✔|✔|✔|去除登录提示|
46 | |西瓜视频|✔|✔|✔|✔|去除登录提示|
47 | |B站专栏|✔|✔|✔|✔|去除登录提示|
48 | |B站笔记|✔|✔|✔|✔|去除登录提示|
49 | |丁香园|✔|✔|✔|✔||
50 | |健康界|✔|✔|✔|✔||
51 | |微博|✔|✔|✔|✔||
52 | |新浪财经|✔|✔|✔|✔||
53 | |东方财富网|✔|✔|✔|✔||
54 | |抖音|✔|✔|✔|✔|去除登录提示,去除登陆后查看评论|
55 | |电子发烧友|✔|✔|✔|✔||
56 | |人民网|✔|✔|✔|✔||
57 | |新京报|✔|✔|✔|✔||
58 | |观察者网|✔|✔|✔|✔||
59 | |澎湃新闻|✔|✔|✔|✔||
60 | |凤凰新闻|✔|✔|✔|✔||
61 | |网易新闻|✔|✔|✔|✔||
62 | |今日头条|✔|✔|✔|✔||
63 | |东方资讯|✔|✔|✔|✔||
64 | |虎嗅|✔|✔|✔|✔||
65 | |虎扑|✔|✔|✔|✔||
66 | |豆瓣|✔|✔|✔|✔||
67 | |中关村在线|✔|✔|✔|✔||
68 | |太平洋电脑|✔|✔|✔|✔||
69 | |太平洋汽车网|✔|✔|✔|✔||
70 | |汽车之家|✔|✔|✔|✔|去除登录提示|
71 | |taptap|✔|✔|✔|✔||
72 | |it之家|✔|✔|✔|✔||
73 | |360doc|✔|✔|✔|✔|去除登录提示|
74 | |开源中国|✔|✔|✔|✔||
75 | |segmentfault|✔|✔|✔|✔|去除登录提示|
76 | |W3CSchool|✔|✔|✔|✔|去除登录提示|
77 | |阿里云开发者社区|✔|✔|✔|✔||
78 | |腾讯云开发者社区|✔|✔|✔|✔||
79 | |华为云开发者社区|✔|✔|✔|✔||
80 | |36氪|✔|✔|✔|✔||
81 | |雪球|✔|✔|✔|✔|去除登录提示|
82 | |天眼查|✔|✔|✔|✔||
83 | |站酷|✔|✔|✔|✔|去除登录提示|
84 | |小红书|✔|✔|✔|✔|去除登录提示|
85 | |喜马拉雅|✔|✔|✔|✔||
86 | |中国知网|✔|✔|✔|✔||
87 | |装备在线|✔|✔|✔|✔||
88 | |什么值得买|✔|✔|✔|✔||
89 | 持续支持中...
--------------------------------------------------------------------------------
/AnnoyancesInterception.user.js:
--------------------------------------------------------------------------------
1 | // ==UserScript==
2 | // @name 骚扰拦截
3 | // @version 1.4.18
4 | // @namespace airbash/AnnoyancesInterception
5 | // @homepageURL https://github.com/AirBashX/UserScript
6 | // @author airbash
7 | // @description 手机、电脑全平台通用:自动拦截或删除`下载弹窗`、`悬浮按钮`等影响用户体验的元素;长期维护:CSDN、简书、知乎、知乎专栏、百度搜索、百家号、百度贴吧、百度文库、百度新闻、新浪新闻、腾讯视频、优酷视频、爱奇艺、好看视频、哔哩哔哩、B站专栏、B站笔记、西瓜视频、抖音、丁香园、健康界、微博、新浪财经、东方财富网、电子发烧友、人民网、新京报、观察者网、澎湃新闻、凤凰新闻、网易新闻、今日头条、东方资讯、虎嗅、虎扑、豆瓣、中关村在线、太平洋电脑、太平洋汽车网、汽车之家、太平洋汽车网、taptap、it之家、360doc、开源中国、segmentfault、W3CSchool、阿里云开发者社区、腾讯云开发者社区、华为云开发者社区、36氪、雪球、天眼查、站酷、小红书、中国知网、装备前线、必应搜索、什么值得买
8 | // @match *://*.csdn.net/*
9 | // @match *://*.jianshu.com/*
10 | // @match *://juejin.cn/*
11 | // @match *://*.zhihu.com/*
12 | // @match *://tieba.baidu.com/*
13 | // @match *://baijiahao.baidu.com/s*
14 | // @match *://mbd.baidu.com/newspage/data/*
15 | // @match *://news.baidu.com/news*
16 | // @match *://m.baidu.com/sf_baijiahao/*
17 | // @match *://view.inews.qq.com/*
18 | // @match *://xw.qq.com/*
19 | // @match *://m.sohu.com/a/*
20 | // @match *://m.v.qq.com/*
21 | // @match *://*.youku.com/*
22 | // @match *://*.iqiyi.com/*
23 | // @match *://haokan.baidu.com/*
24 | // @match *://*.1905.com/*
25 | // @match *://*.baidu.com/*
26 | // @match *://*.bilibili.com/*
27 | // @match *://3g.dxy.cn/*
28 | // @match *://www.cn-healthcare.com/*
29 | // @match *://*.sina.cn/*
30 | // @match *://m.weibo.cn/*
31 | // @match *://wap.eastmoney.com/*
32 | // @match *://mguba.eastmoney.com/*
33 | // @match *://*.ixigua.com/*
34 | // @match *://www.douyin.com/*
35 | // @match *://m.elecfans.com/*
36 | // @match *://app.people.cn/*
37 | // @match *://m.bjnews.com.cn/detail/*
38 | // @match *://*.guancha.cn/*
39 | // @match *://m.thepaper.cn/newsDetail_forward*
40 | // @match *://*.ifeng.com/*
41 | // @match *://m.163.com/*
42 | // @match *://3g.163.com/*
43 | // @match *://m.toutiao.com/*
44 | // @match *://www.toutiao.com/*
45 | // @match *://mini.eastday.com/nsa/*
46 | // @match *://m.huxiu.com/*
47 | // @match *://m.hupu.com/*
48 | // @match *://m.douban.com/*
49 | // @match *://g.pconline.com.cn/*
50 | // @match *://m.zol.com.cn/*
51 | // @match *://wap.zol.com.cn/*
52 | // @match *://www.autohome.com.cn/*
53 | // @match *://*.m.autohome.com.cn/*
54 | // @match *://m.autohome.com.cn/*
55 | // @match *://m.pcauto.com.cn/*
56 | // @match *://www.taptap.cn/*
57 | // @match *://m.taptap.cn/*
58 | // @match *://m.ithome.com/*
59 | // @match *://www.360doc.com/content/*
60 | // @match *://www.oschina.net/*
61 | // @match *://developer.aliyun.com/article/*
62 | // @match *://huaweicloud.csdn.net/*
63 | // @match *://m.36kr.com/p/*
64 | // @match *://xueqiu.com/*
65 | // @match *://segmentfault.com/q/*
66 | // @match *://www.w3cschool.cn/*
67 | // @match *://m.tianyancha.com/*
68 | // @match *://*.zcool.com.cn/*
69 | // @match *://m.ximalaya.com/*
70 | // @match *://www.xiaohongshu.com/*
71 | // @match *://wap.cnki.net/*
72 | // @match *://www.zfrontier.com/*
73 | // @match *://*.m.smzdm.com/*
74 | // @icon data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAAAXNSR0IArs4c6QAAEi5JREFUeF69Wwl0VVWy3fVCCCCTYLfDl8a2GUImSAIJUSERRI2KCMikIIIKAjYyqsgURBFbZdKPiooDICiKIggOEEBEEkKAJJAEsL9zN7a2okAgybu1/zr3hQc3yRsywF2LtVgv595z9q46VXWq6gjO48MtKfXQ5OSVQEgTWNoUFpvY01s4CZUTUPkJGnZYrt166nwtS87lRMy5ui3IW0ArHpT2ULQBUQcKgGX/lJ7/n/lNofgO1FyoawtgbcOO3TmSZo+o9afWCeCBxAhQ7oIlvUCEwwPwG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vrbv/aaOrduB7hWQhEDlfn4a+FDshpWMODNmCoR4NWGUab2zlegbAzK0zjacI6s9l+vL78gm5gjxc1Qx3IhRI7J6uAk5l1DfHwDhB6bCorJ/R8DcY/sPnhur8w41G5MeHMU13nKnAhBmo6Lx1Gky2rb+lcgLiKiLpq6h0LFtM23BGUVVCZIdsG/g5X62eOqpQEOIu6O6QLqs6bhwPTgQbEAISErZFngLHJVFsxEk8xwDzbNWiBagJIJi1Mk++CWqnyn/NgaE+BVySGm5AyTJzBt9pZJpEJpmiDSZU3Bt9VZJFPCr0CpaZPVPqZ3uezabTog87Gr8CNf3qAqc9UaAV4iBrSLgrpMA2NvEBFe66+yG9BDsFgAdf0HqkdRB8dQKoSwMUpdTQEtuzrramvfMFP+DaS5V2w0ayUYskyy8u0Gx9p6ap0Ax/boGx0OtymSMA5kB4+LO+vytG39y12eVhCE6VgxfclfQlybsLPQZG9rfE22MtLOKQEVDJg5ndULawkNaQrVpqDx/XTBjWK48CugR1Bc9K3s/KFC719tSbz8d/4fEkbgH4G71qYAAAAASUVORK5CYII=
75 | // @run-at document-body
76 | // @grant none
77 | // @license GPL-3.0
78 | // ==/UserScript==
79 |
80 | (function () {
81 | "use strict";
82 |
83 | /**
84 | * 规则列表
85 | * @type {name/url/items}
86 | */
87 | const websites = [
88 | {
89 | name: "CSDN",
90 | url: "csdn.net",
91 | items: [
92 | //下载弹窗
93 | ".weixin-shadowbox",
94 | //悬浮按钮:打开:狐猴浏览器中的bug
95 | ".feed-Sign-weixin",
96 | //悬浮按钮:APP内打开+登录/打开注册(主页)
97 | ".feed-Sign-span",
98 | //PC端:弹窗:学生认证
99 | "#csdn-highschool-window",
100 | //PC端:登录弹窗(顶部)
101 | "#csdn-toolbar-profile-nologin",
102 | //PC端:登录弹窗(底部)
103 | ".passport-login-tip-container",
104 | ],
105 | fun: function () {
106 | /**
107 | * PC端:屏蔽登录弹窗
108 | * @param {list} mutationsList The mutations list
109 | */
110 | let removeLoginNotice = function (mutationsList) {
111 | for (let mutation of mutationsList) {
112 | for (let node of mutation.addedNodes) {
113 | if (document.querySelector(".passport-login-container")) {
114 | //有登陆弹窗时:模拟点击关闭按钮
115 | let button = node.querySelector("img");
116 | if (button) {
117 | if (LoginFlag == true) {
118 | button.click();
119 | } else {
120 | LoginFlag = true;
121 | }
122 | return;
123 | }
124 | }
125 | }
126 | }
127 | };
128 |
129 | let loginBtn = document.querySelector(".toolbar-btn-login>.toolbar-btn-loginfun");
130 | //未登录:
131 | if (loginBtn) {
132 | //添加事件,不拦截
133 | loginBtn.addEventListener("click", function () {
134 | LoginFlag = false;
135 | });
136 | //执行监听
137 | let observer = new MutationObserver(removeLoginNotice);
138 | observer.observe(document, { childList: true, subtree: true });
139 | }
140 | //移动版登录弹窗
141 | if (document.querySelector(".toolbarBack")) {
142 | addStyle(".passport-login-container {display: none !important}");
143 | }
144 | },
145 | },
146 | {
147 | name: "简书",
148 | url: "jianshu.com",
149 | items: [
150 | //下载弹窗
151 | ".download-app-guidance",
152 | //悬浮按钮:打开App,看更多相似好文
153 | ".call-app-btn",
154 | //悬浮按钮:打开App,看更多好文(首页)
155 | ".index_call-app-btn",
156 | //PC端:透明遮挡
157 | "._23ISFX-mask",
158 | //PC端:登录弹窗
159 | "._23ISFX-wrap",
160 | ],
161 | overflow: true,
162 | },
163 | {
164 | name: "掘金",
165 | url: "juejin.cn",
166 | items: [
167 | //悬浮按钮:APP内打开
168 | ".open-button",
169 | //下载弹窗
170 | ".app-open-drawer",
171 | //PC端:下方拓展弹窗(主页)
172 | ".recommend-box",
173 | //PC端:登录弹窗(右上角)
174 | ".login-popover",
175 | //PC端:登录弹窗(右下角)
176 | ".bottom-login-guide",
177 | ],
178 | overflow: true,
179 | },
180 | {
181 | name: "知乎发现页",
182 | url: "www.zhihu.com/explore",
183 | items: [
184 | //PC端:登录按钮(发现页)
185 | ".ExploreHomePage-specialsLogin",
186 | ],
187 | fun: function () {
188 | //发现页:热点和问题高度保持一致;
189 | if (location.href.includes("www.zhihu.com/explore")) {
190 | addStyle(".ExploreHomePage-square > div:nth-child(3){margin: 0px}");
191 | }
192 | },
193 | },
194 | {
195 | name: "知乎",
196 | url: "zhihu.com",
197 | items: [
198 | //悬浮按钮:是否在知乎app内阅读全文
199 | ".MobileModal-wrapper",
200 | //悬浮按钮:打开知乎(主页),打开
201 | ".OpenInAppButton",
202 | ],
203 | overflow: true,
204 | fun: function () {
205 | //PC端拦截登录弹窗
206 | if (!/Mobile|Android|iPhone/i.test(navigator.userAgent)) {
207 | window.addEventListener("DOMContentLoaded", function () {
208 | let loginBtn = document.querySelector(".css-1rwz7is");
209 | //检验是否登录
210 | if (loginBtn) {
211 | //执行监听
212 | let observer = new MutationObserver(removeLoginNotice);
213 | observer.observe(document, { childList: true, subtree: true });
214 |
215 | onload = function () {
216 | loginBtn.addEventListener("click", function () {
217 | LoginFlag = false;
218 | });
219 | };
220 | }
221 | });
222 | /**
223 | * 删除登录弹窗
224 | *
225 | * @param {MutationRecord[]} mutationsList The mutations list
226 | * @param {MutationObserver} observer The observer
227 | */
228 | function removeLoginNotice(mutationsList) {
229 | for (let mutation of mutationsList) {
230 | for (let node of mutation.addedNodes) {
231 | //有登陆弹窗1时:模拟点击关闭按钮
232 | if (node.querySelector(".signFlowModal")) {
233 | let button = node.querySelector(".Button.Modal-closeButton.Button--plain");
234 | if (button) {
235 | if (LoginFlag == true) {
236 | button.click();
237 | } else {
238 | LoginFlag = true;
239 | }
240 | return;
241 | }
242 | }
243 | //拦截登录弹窗2
244 | if (getXpath('//button[text()="立即登录/注册"]', node)) {
245 | getXpath('//button[text()="立即登录/注册"]', node).parentElement.parentElement.remove();
246 | }
247 | }
248 | }
249 | }
250 | }
251 | },
252 | },
253 | {
254 | name: "百度",
255 | url: "baidu.com",
256 | items: [
257 | //悬浮按钮:打开百度
258 | "#J-invoke-baiduApp-float",
259 | ],
260 | },
261 | {
262 | name: "百度贴吧",
263 | url: "tieba.baidu.com",
264 | items: [
265 | //悬浮按钮:打开百度贴吧
266 | ".nav-bar-bottom",
267 | ],
268 | },
269 | {
270 | name: "百度文库1",
271 | url: "/wk.baidu.com/view/",
272 | items: [
273 | //悬浮按钮(上方):百度文库
274 | ".wk-student-defense",
275 | ],
276 | },
277 | {
278 | name: "百度文库2",
279 | url: "tanbi.baidu.com/h5apptopic/browse/",
280 | items: [
281 | //悬浮按钮(上方):百度文库
282 | ".wk-student-limit-jump",
283 | ".bartop",
284 | //悬浮按钮(下方):下载App,继续阅读
285 | ".wk-bottom-btn",
286 | ],
287 | },
288 | {
289 | name: "百家号",
290 | url: "baijiahao.baidu.com/s",
291 | items: [
292 | //悬浮按钮:百度APP内打开
293 | "#bdrainrwDragButton",
294 | ],
295 | },
296 | {
297 | name: "百度资讯+百度首页",
298 | url: "mbd.baidu.com/newspage/data",
299 | items: [
300 | //悬浮按钮:百度APP内打开
301 | "#bdrainrwDragButton",
302 | //悬浮按钮:百度APP内播放
303 | ".drag-bottom",
304 | ],
305 | },
306 | {
307 | name: "腾讯新闻1",
308 | url: "view.inews.qq.com/",
309 | items: [
310 | //固定按钮:打开
311 | ".slider-top-bar_sliderWrapper__1Nize",
312 | //悬浮按钮:打开腾讯新闻,看更多热点资讯
313 | ".bottom-bar_buttonWrap__NXBe-",
314 | ],
315 | },
316 | {
317 | name: "腾讯新闻2",
318 | url: "xw.qq.com/",
319 | items: [
320 | //固定按钮:打开(首页)
321 | "#opeApp",
322 | ],
323 | },
324 | {
325 | name: "腾讯视频",
326 | url: "m.v.qq.com",
327 | items: [
328 | //下载弹窗
329 | ".at-app-banner",
330 | //打开APP查看高清内容
331 | ".open_app_bottom",
332 | ],
333 | },
334 | {
335 | name: "优酷视频",
336 | url: "youku.com",
337 | items: [
338 | //下载弹窗
339 | ".callEnd_box",
340 | //悬浮按钮(主页):打开优酷APP更流畅
341 | ".callEnd_fixed_box",
342 | //悬浮按钮:打开优酷APP更流畅
343 | ".undefined",
344 | //悬浮按钮:红包
345 | ".Corner-container",
346 | ],
347 | },
348 | {
349 | name: "爱奇艺",
350 | url: "iqiyi.com/",
351 | items: [
352 | //下载弹窗
353 | ".m-iqyGuide-layer",
354 | //打开爱奇艺APP,看精彩视频
355 | "[class^=ChannelHomeBanner]",
356 | //PC端:登录提示上侧
357 | ".pl__1",
358 | ],
359 | },
360 | {
361 | name: "好看视频",
362 | url: "haokan.baidu.com/",
363 | items: [
364 | //悬浮按钮:打开好看app(中间)
365 | ".open-app-top",
366 | //固定文字:打开APP(多)
367 | ".top-video-card-img-app",
368 | //固定按钮:下载APP(视频播放时)
369 | ".video-player-download-tips",
370 | //固定按钮:打开(底部)
371 | ".open-app-bottom",
372 | //固定按钮:打开(底部:个别)
373 | ".NewOpenApp",
374 | //PC端固定按钮:下载APP(视频暂停时)
375 | ".player-lefttip-inner",
376 | //PC端登录提示:登录提示
377 | "#passport-login-pop",
378 | //PC端登录提示:朦胧背板
379 | ".pop-mask",
380 | //PC端登录提示:悬浮提示
381 | ".page-top-rightinfo-popover",
382 | ],
383 | },
384 | {
385 | name: "m1905电影网",
386 | url: "1905.com/",
387 | items: [
388 | //悬浮弹窗:打开app
389 | "#popupModule",
390 | //悬浮按钮:
391 | ".open-link",
392 | ],
393 | },
394 | {
395 | name: "百度搜索",
396 | url: "baidu.com",
397 | items: [
398 | //搜索结果:小程序
399 | "[srcid=xcx_multi]",
400 | //搜索结果:百度手机助手
401 | "[srcid=app_mobile_simple]",
402 | //搜索结果:百度手机助手:安全下载
403 | "[srcid=app_mobile_simple_safety]",
404 | //搜索结果:百度应用搜索(IOS)
405 | "[srcid=app_mobile_ios]",
406 | ],
407 | },
408 | {
409 | name: "哔哩哔哩",
410 | url: "bilibili.com",
411 | items: [
412 | //悬浮按钮:打开app,看你感兴趣的内容(主页)
413 | ".m-open-app.fixed-openapp",
414 | //悬浮按钮:打开app(UP主页)
415 | ".m-space-float-openapp",
416 | //悬浮按钮:打开app,看高清内容(视频全屏)
417 | ".mplayer-widescreen-callapp",
418 | //悬浮按钮:bilibili内打开(底部)
419 | ".m-float-openapp",
420 | //悬浮弹窗:bilibili内打开
421 | ".openapp-dialog",
422 | //固定按钮:播放时下载
423 | ".mplayer-widescreen-callapp",
424 | //PC端:登录提示(右下角)
425 | ".lt-row",
426 | //PC端:登录提示(右上角)
427 | ".login-panel-popover:has(.login-tip-content)",
428 | //PC端:登录提示(播放器)
429 | ".bpx-player-toast-wrap",
430 | //PC端:登录提示(右上角)
431 | "div:has(.unlogin-popover-avatar)",
432 | //PC端:滑动提示(正下方:首次)
433 | ".trial-feed-wrap",
434 | ],
435 | fun: function () {
436 | let add;
437 | function mutationCallback(record, observer) {
438 | //已确定登录:停止监听
439 | let login = document.querySelector(".header-entry-mini");
440 | if (login) {
441 | observer.disconnect();
442 | }
443 | //已确定未登录:执行函数
444 | let loginBtn = document.querySelector(".header-login-entry");
445 | if (loginBtn) {
446 | if (!add) {
447 | console.log("脚本注入成功");
448 | //添加事件:不拦截
449 | loginBtn.addEventListener("click", function () {
450 | LoginFlag = false;
451 | });
452 | add = true;
453 | }
454 | for (let arr of record) {
455 | for (let node of arr.addedNodes) {
456 | let button;
457 | try {
458 | button = node.querySelector(".bili-mini-close-icon");
459 | } catch (error) {
460 | /* empty */
461 | }
462 | if (button) {
463 | //有登陆弹窗时:模拟点击关闭按钮
464 | if (LoginFlag == true) {
465 | console.log(LoginFlag);
466 | console.log("自动拦截");
467 | button.click();
468 |
469 | console.log("恢复播放");
470 | let video = document.querySelector(".bpx-player-video-wrap video");
471 | video.play();
472 | } else {
473 | console.log(LoginFlag);
474 | console.log("手动拦截");
475 | LoginFlag = true;
476 | }
477 | return;
478 | }
479 | }
480 | }
481 | }
482 | }
483 | let observer = new MutationObserver(mutationCallback);
484 | observer.observe(document, { childList: true, subtree: true });
485 | },
486 | },
487 | {
488 | name: "B站笔记",
489 | url: "bilibili.com/opus/",
490 | items: [
491 | //PC端:登录提示
492 | "div:has(.unlogin-popover-avatar)",
493 | ],
494 | },
495 | {
496 | name: "西瓜视频",
497 | url: "ixigua.com",
498 | items: [
499 | //打开弹窗:打开
500 | ".landing_guide",
501 | //PC端:登录提示
502 | ".loginBenefitNotification",
503 | //悬浮按钮:打开西瓜视频,看全网超清视频
504 | ".xigua-download",
505 | ],
506 | },
507 | {
508 | name: "抖音电脑版",
509 | url: "www.douyin.com",
510 | items: [
511 | //PC端:下载电脑客户端
512 | "#douyin-web-download-guide-container",
513 | //PC端:右下角登录提示(画质)
514 | ".login-clarity-new",
515 | //PC端:登陆后查看评论
516 | "#related-video-card-login-guide",
517 | //PC端:底部登录提示
518 | ".wwNZW6za",
519 | ],
520 | fun: function () {
521 | //登陆后查看评论模糊
522 | addStyle("._61cgy6j3{filter: none !important}");
523 | //拦截登录弹窗
524 | onload = function () {
525 | //增加点击事件
526 | let inter = setInterval(() => {
527 | let loginBtn = getXpath('//div[text()="登录"] | //p[text()="登录"]', document).parentElement;
528 | if (loginBtn) {
529 | loginBtn.addEventListener("click", function () {
530 | LoginFlag = false;
531 | });
532 | clearInterval(inter);
533 | }
534 | }, 1000);
535 | };
536 |
537 | /**
538 | * Removes a login notice.
539 | *
540 | * @param {MutationRecord[]} mutationsList The mutations list
541 | * @param {MutationObserver} observer The observer
542 | */
543 | let removeLoginNotice = function (mutationsList) {
544 | for (let mutation of mutationsList) {
545 | for (let node of mutation.addedNodes) {
546 | if (node.nodeType == Node.ELEMENT_NODE) {
547 | let closeBtn = document.querySelector(".lR1QBof5");
548 | //关闭登录弹窗
549 | if (closeBtn) {
550 | if (LoginFlag == true) {
551 | closeBtn.click();
552 | }
553 | }
554 | return;
555 | }
556 | }
557 | }
558 | };
559 | //执行监听
560 | let observer = new MutationObserver(removeLoginNotice);
561 | observer.observe(document, { childList: true, subtree: true });
562 | },
563 | },
564 | {
565 | name: "丁香园",
566 | url: "3g.dxy.cn",
567 | items: [
568 | //悬浮按钮:APP内打开
569 | "[class^=fixedBtn]",
570 | //悬浮按钮:App内打开(主页)
571 | ".wrap",
572 | ],
573 | },
574 | {
575 | name: "健康界",
576 | url: "www.cn-healthcare.com/",
577 | items: [
578 | //悬浮按钮:打开(底部滚动)
579 | "footer",
580 | ],
581 | },
582 | {
583 | name: "微博",
584 | url: "m.weibo.cn",
585 | items: [
586 | //悬浮按钮:在微博内打开(百度热议)
587 | ".app-btn-box",
588 | //悬浮按钮:登录/注册
589 | ".login-btn",
590 | //小程序
591 | ".wrap",
592 | ],
593 | },
594 | {
595 | name: "新浪新闻",
596 | url: "sina.cn/",
597 | items: [
598 | //悬浮按钮:打开APP
599 | ".callApp_fl_btn",
600 | ],
601 | },
602 | {
603 | name: "新浪财经",
604 | url: "sina.cn/",
605 | items: [
606 | //悬浮弹窗:立即更新(主页:首次访问)
607 | "#SFA_newVersion_pop",
608 | //悬浮按钮:打开App中查看(主页:底部)
609 | ".m-client-call2",
610 | //固定按钮:立即登录(主页:资讯)
611 | ".login-box",
612 | //悬浮按钮:立即查看(资讯:底部,首次访问)
613 | ".wap-msg-bar-wap",
614 | //悬浮按钮:去APP听语音播报(资讯:中间)
615 | ".broadcast",
616 | //悬浮按钮:打开APP(资讯:顶部,有bug)
617 | ".m-sentiment-blk",
618 | //悬浮按钮:打开APP(资讯:底部)
619 | ".m-guss-caijing",
620 | //固定按钮:立即体验(资讯:底部)
621 | "#norm_qrcode_link_auto",
622 | //悬浮按钮:打开APP(子栏1:底部)
623 | "#subPage_bottom_callup_btn",
624 | //悬浮按钮:打开APP(子栏2:底部)
625 | "#__callup_bottom_new",
626 | //悬浮按钮:打开APP(子栏2:顶部,有bug)
627 | ".js-app-header",
628 | //悬浮按钮:新版本抢先体验(底部)
629 | "#SNP_bottom_bar",
630 | ],
631 | fun: function () {
632 | //修复上述规则产生的bug
633 | let inter = setInterval(() => {
634 | let item = document.querySelector(".compatibility-mode");
635 | if (item.style.marginTop == "0px") {
636 | clearInterval(inter);
637 | } else {
638 | item.style.marginTop = "0px";
639 | }
640 | }, 1000);
641 | },
642 | },
643 | {
644 | name: "东方财富网",
645 | url: "wap.eastmoney.com/",
646 | items: [
647 | //悬浮按钮:打开APP(顶部)
648 | ".fixed_top",
649 | //固定按钮:下载(主页:顶部)
650 | "#IndexDT",
651 | //悬浮按钮:打开下载(主页:顶部)
652 | ".emwapas_xldt_fixed",
653 | //悬浮按钮:打开APP(主页:底部)
654 | ".open-inapp",
655 | ],
656 | },
657 | {
658 | name: "东方财富网:股吧",
659 | url: "mguba.eastmoney.com/",
660 | items: [
661 | //悬浮弹窗:打开APP
662 | "#appbox",
663 | //悬浮按钮:东方财富APP内打开(底部)
664 | "#open_app",
665 | ],
666 | },
667 | {
668 | name: "电子发烧友",
669 | url: "m.elecfans.com",
670 | items: [
671 | //悬浮按钮:主页右侧
672 | ".hm_quick",
673 | //悬浮按钮:登陆/注册
674 | ".login-reg-fixed",
675 | //悬浮按钮:上方打开app
676 | ".open_app",
677 | ],
678 | },
679 | {
680 | name: "人民网",
681 | url: "app.people.cn",
682 | items: [
683 | //悬浮按钮:打开(底部)
684 | ".app-bot-wrap",
685 | ],
686 | },
687 | {
688 | name: "新京报",
689 | url: "m.bjnews.com.cn/detail/",
690 | items: [
691 | //悬浮按钮:立即打开(顶部)
692 | ".xjb-top",
693 | ],
694 | },
695 | {
696 | name: "观察者网",
697 | url: "guancha.cn",
698 | items: [
699 | //固定按钮:点击下载(顶部)
700 | ".g_header44",
701 | //悬浮按钮:APP专享(底部)
702 | ".g_swiper_container",
703 | ],
704 | },
705 | {
706 | name: "澎湃新闻",
707 | url: "m.thepaper.cn/newsDetail_forward",
708 | items: [
709 | //悬浮按钮:新闻滚条(底部)
710 | "[class^=index_footer_banner]",
711 | "[.index_footer_banner__Mcr_R]",
712 | ],
713 | },
714 | {
715 | name: "凤凰新闻",
716 | url: "ifeng.com",
717 | items: [
718 | //悬浮按钮:立即打开(主页)
719 | "[class^=index_fixSlide_]",
720 | //悬浮按钮:滚动新闻(新闻底部)
721 | "[class^=index_bottom_box_]",
722 | //悬浮按钮:立即打开(财经底部)
723 | "[class^=index_bottomSlide_]",
724 | //悬浮按钮:滚动新闻(卫视底部)
725 | "[class^=index_fixBottom_]",
726 | ],
727 | },
728 | {
729 | name: "网易新闻",
730 | url: "3g.163.com",
731 | items: [
732 | //固定按钮:App内打开(底部)
733 | ".backflow-floating",
734 | ],
735 | },
736 | {
737 | name: "网易新闻",
738 | url: "m.163.com",
739 | items: [
740 | //固定按钮:App内打开(底部)
741 | ".backflow-floating",
742 | ],
743 | },
744 | {
745 | name: "搜狐新闻",
746 | url: "m.sohu.com/a/",
747 | items: [
748 | //悬浮按钮:打开APP
749 | "#CallAppContainer",
750 | ".CallAppContainer",
751 | ],
752 | },
753 | {
754 | name: "今日头条:移动端",
755 | url: "m.toutiao.com/",
756 | items: [
757 | //悬浮按钮:App内打开(底部)
758 | ".m-bottom-container",
759 | //悬浮按钮:去首页(文章)
760 | ".m-index-tag",
761 | ],
762 | },
763 | {
764 | name: "今日头条:PC端",
765 | url: "www.toutiao.com/",
766 | items: [
767 | //悬浮弹窗:添加今日头条到电脑桌面
768 | ".add-panel",
769 | //悬浮弹窗:扫码下载今日头条
770 | "download-panel",
771 | ],
772 | },
773 | {
774 | name: "东方资讯",
775 | url: "mini.eastday.com/nsa/",
776 | items: [
777 | //PC端:悬浮弹窗:添加到桌面
778 | "#dftt-message-wrapper",
779 | ],
780 | },
781 | {
782 | name: "虎嗅",
783 | url: "m.huxiu.com",
784 | items: [
785 | //悬浮按钮:go!(主页)
786 | ".guide-wrap",
787 | //悬浮按钮:打开(顶部)
788 | ".js-top-fixed",
789 | //悬浮按钮:打开(底部)
790 | ".bottom-open-app-btn",
791 | ],
792 | },
793 | {
794 | name: "虎扑",
795 | url: "m.hupu.com",
796 | items: [
797 | //悬浮按钮:App内打开
798 | ".open-hupu",
799 | ],
800 | },
801 | {
802 | name: "豆瓣",
803 | url: "m.douban.com",
804 | items: [
805 | //固定按钮:用App打开(电影详情页)
806 | ".subject-banner",
807 | //悬浮按钮:豆瓣APP内打开
808 | ".talion-nav-footer",
809 | ],
810 | },
811 | {
812 | name: "太平洋电脑",
813 | url: "g.pconline.com.cn",
814 | items: [
815 | //悬浮按钮:打开app(底部)
816 | ".btnForAppOpenImg",
817 | //悬浮按钮:打开知科技App
818 | ".btnForAppOpenA",
819 | //固定按钮:立即打开(底部)
820 | ".WakeUptop",
821 | //悬浮按钮:打开(底部)
822 | ".page-float-box",
823 | ],
824 | },
825 | {
826 | name: "中关村在线",
827 | url: "m.zol.com.cn",
828 | items: [
829 | //悬浮按钮:打开APP
830 | ".cover-back_s",
831 | //悬浮按钮:APP内打开
832 | "#bottom-fixed-wrapper > span",
833 | ],
834 | },
835 | {
836 | name: "中关村在线2(报价+论坛)",
837 | url: "wap.zol.com.cn",
838 | items: [
839 | //悬浮按钮:打开APP
840 | ".cover-back_s",
841 | //悬浮按钮:APP内打开
842 | "#bottom-fixed-wrapper > span",
843 | ],
844 | },
845 | {
846 | name: "汽车之家PC版",
847 | url: "www.autohome.com.cn",
848 | items: [
849 | //悬浮按钮:登录提示(PC端)
850 | "#loginGuide",
851 | ],
852 | },
853 | {
854 | name: "汽车之家移动版",
855 | url: "m.autohome.com.cn",
856 | items: [
857 | //悬浮按钮: App内打开
858 | "#float_new_button",
859 | ],
860 | },
861 | {
862 | name: "太平洋汽车",
863 | url: "m.pcauto.com.cn/",
864 | items: [
865 | //悬浮弹窗: App内打开
866 | "#home-bottom-half-dialog",
867 | //悬浮按钮: 轮播评论
868 | "#dmListOuter",
869 | ],
870 | },
871 | {
872 | //www.taptap.com
873 | name: "taptap",
874 | url: "www.taptap.cn",
875 | items: [
876 | //悬浮按钮:打开taptap
877 | ".open-app-global-float",
878 | ],
879 | },
880 | {
881 | //m.taptap.com
882 | name: "taptap",
883 | url: "m.taptap.cn",
884 | items: [
885 | //悬浮按钮:打开taptap查看更多精彩内容
886 | ".app-download__wrapper",
887 | //苹果端:悬浮按钮:添加到桌面
888 | ".show-add-to-screen",
889 | //苹果端:固定按钮:添加到桌面
890 | ".add-to-screen-wrap",
891 | ],
892 | },
893 | {
894 | //https://m.ithome.com/
895 | name: "it之家",
896 | url: "m.ithome.com",
897 | items: [
898 | //固定按钮(底部):立即打开
899 | ".open-app-banner",
900 | ],
901 | },
902 | {
903 | name: "360docPC版",
904 | url: "www.360doc.com/content/",
905 | items: [
906 | //登录弹窗
907 | "iframe",
908 | //登录弹窗:朦胧模板
909 | "iframe~div",
910 | ],
911 | },
912 | {
913 | name: "开源中国",
914 | url: "www.oschina.net",
915 | items: [
916 | //悬浮按钮(底部):立即打开
917 | ".app-download-banner-box",
918 | ],
919 | },
920 | {
921 | name: "segmentfault思否",
922 | url: "segmentfault.com/q",
923 | items: [
924 | //登录弹窗
925 | ".modal-dialog-centered",
926 | ],
927 | },
928 | {
929 | name: "阿里云开发者社区",
930 | url: "developer.aliyun.com/article/",
931 | items: [
932 | //阿里云App内打开
933 | ".app-fixed-btn",
934 | ],
935 | },
936 | {
937 | name: "华为云开发者社区",
938 | url: "huaweicloud.csdn.net/",
939 | items: [
940 | //加入社区
941 | ".user-desc-fix",
942 | ],
943 | },
944 | {
945 | //https://m.36kr.com/p/1964588951470856
946 | name: "36氪",
947 | url: "m.36kr.com/p/",
948 | items: [
949 | //悬浮按钮(顶部):打开
950 | ".article-top-swiper-goapp",
951 | ],
952 | },
953 | {
954 | name: "雪球",
955 | url: "xueqiu.com/",
956 | items: [
957 | //悬浮按钮:加群学习(主页)
958 | ".FloatDownloadButton_mobile_xiaoxue-button_1jZ",
959 | //悬浮按钮:加群学习(文章)
960 | ".index_xiaoxue-button_1Av",
961 | //悬浮按钮:登录提示
962 | ".widget__download-app",
963 | ],
964 | fun: function () {
965 | //悬浮按钮:打开app(话题)
966 | document.onreadystatechange = function () {
967 | if (document.readyState === "complete") {
968 | document.querySelector("[class^=FloatDownloadButton_mobile_openapp__fix_]").remove();
969 | }
970 | };
971 |
972 | /**
973 | * Removes a login notice.
974 | *
975 | * @param {MutationRecord[]} mutationsList The mutations list
976 | * @param {MutationObserver} observer The observer
977 | */
978 | let removeLoginNotice = function (mutationsList) {
979 | for (let mutation of mutationsList) {
980 | for (let node of mutation.addedNodes) {
981 | let closeBtn = document.querySelector(".modal__login .close");
982 | //关闭登录弹窗
983 | if (LoginFlag == true) {
984 | closeBtn.click();
985 | } else {
986 | LoginFlag == true;
987 | }
988 | return;
989 | }
990 | }
991 | };
992 | //拦截登录弹窗
993 | document.addEventListener("DOMContentLoaded", function () {
994 | let loginBtn = document.querySelector(".loginBtn");
995 | //检验是否登录
996 | if (loginBtn.textContent === "登录") {
997 | //增加点击事件
998 | loginBtn.addEventListener("click", function () {
999 | LoginFlag = false;
1000 | //未知bug:导致第一次点击无法生效,所以这里再点击一次
1001 | loginBtn.click();
1002 | });
1003 | }
1004 | //执行监听
1005 | let observer = new MutationObserver(removeLoginNotice);
1006 | observer.observe(document, { childList: true, subtree: true });
1007 | });
1008 | },
1009 | },
1010 | {
1011 | name: "天眼查",
1012 | url: "m.tianyancha.com/",
1013 | items: [
1014 | //悬浮按钮:打开app(主页)
1015 | ".swiper-container",
1016 | //悬浮按钮:下载APP(企业)
1017 | "#banner_mobile_v2",
1018 | ],
1019 | },
1020 | {
1021 | name: "站酷移动版",
1022 | url: "m.zcool.com.cn/",
1023 | items: [
1024 | //悬浮按钮:打开app(主页)
1025 | ".bottom-App",
1026 | //悬浮按钮:打开app
1027 | "[class^=wapHeader_footer-button]",
1028 | ],
1029 | },
1030 | {
1031 | name: "站酷PC版",
1032 | url: "www.zcool.com.cn/",
1033 | items: [
1034 | //登录按钮
1035 | ".sideUnlogin",
1036 | //登录弹窗
1037 | ".ReactModal__Overlay--after-open:not(.ReactModal__Overlay_content-page)",
1038 | ],
1039 | fun: function () {
1040 | //登录弹窗导致的页面无法滑动
1041 | addStyle("html,body {overscroll-behavior: unset !important;overflow: unset !important;}");
1042 | },
1043 | },
1044 | {
1045 | name: "小红书",
1046 | url: "www.xiaohongshu.com",
1047 | items: [
1048 | //App内打开(视频)
1049 | ".bottom-button-box",
1050 | //App内打开(笔记)
1051 | ".bottom-bar",
1052 | ],
1053 | fun: function () {
1054 | let mo = new MutationObserver(function (mutations) {
1055 | for (let mutation of mutations) {
1056 | for (let node of mutation.addedNodes) {
1057 | let button = node.querySelector(".icon-btn-wrapper");
1058 | if (button) {
1059 | if (LoginFlag) {
1060 | button.click();
1061 | } else {
1062 | LoginFlag = true;
1063 | }
1064 | return;
1065 | }
1066 | }
1067 | }
1068 | });
1069 | let loginBtn = document.querySelector(".login-btn");
1070 | if (loginBtn) {
1071 | loginBtn.addEventListener(
1072 | "click",
1073 | function () {
1074 | LoginFlag = false;
1075 | },
1076 | true,
1077 | );
1078 | mo.observe(document, { childList: true, subtree: true });
1079 | }
1080 | },
1081 | },
1082 | {
1083 | name: "喜马拉雅",
1084 | url: "m.ximalaya.com/",
1085 | items: [
1086 | //悬浮按钮:打开APP,完整收听1
1087 | ".album-btn-container",
1088 | //悬浮按钮:打开APP,完整收听2
1089 | ".btn-open",
1090 | //打开APP2
1091 | ".downloadButton",
1092 | ],
1093 | },
1094 | {
1095 | //https://wap.cnki.net/touch/web/Journal/Article/WLAQ202302061.html
1096 | name: "中国知网",
1097 | url: "wap.cnki.net/",
1098 | items: [
1099 | //App内打开
1100 | ".Appopen",
1101 | //滚动新闻
1102 | "#fix-bottom",
1103 | ],
1104 | },
1105 | {
1106 | name: "zfrontier",
1107 | url: "www.zfrontier.com",
1108 | items: [
1109 | //App内打开
1110 | ".app-opener",
1111 | ],
1112 | },
1113 | {
1114 | name: "必应搜索",
1115 | url: "bing.com",
1116 | items: [
1117 | //必应中打开(Chrome中专属)
1118 | ".bnp_rich_div_visible",
1119 | ],
1120 | },
1121 | {
1122 | name: "w3cschool",
1123 | url: "www.w3cschool.cn/",
1124 | items: [],
1125 | fun: function () {
1126 | //复制文件时的弹窗
1127 | onload = function () {
1128 | let mo = new MutationObserver(function (mutations) {
1129 | for (let mutation of mutations) {
1130 | for (let node of mutation.addedNodes) {
1131 | if (node.nodeName == "DIV" && node.className == "") {
1132 | node.style.display = "none";
1133 | }
1134 | }
1135 | }
1136 | });
1137 | mo.observe(document, { childList: true, subtree: true });
1138 | };
1139 | },
1140 | },
1141 | {
1142 | name: "什么值得买",
1143 | url: "m.smzdm.com/",
1144 | items: [
1145 | //app内打开
1146 | ".footer-banner-wrap",
1147 | //国内好价:qpp内打开
1148 | ".wrapper",
1149 | ".foot-banner",
1150 | ],
1151 | },
1152 | ];
1153 |
1154 | /**
1155 | * 主体部分
1156 | */
1157 | for (let website of websites) {
1158 | if (location.href.indexOf(website.url) != -1) {
1159 | //隐藏/拦截骚扰元素
1160 | if (website.items) {
1161 | for (let item of website.items) {
1162 | addStyle(item + "{display: none !important}");
1163 | }
1164 | }
1165 | //修复移动版页面不允许滑动
1166 | if (website.overflow) {
1167 | addStyle("body{overflow: auto !important}");
1168 | }
1169 | //执行额外方案
1170 | if (website.fun) {
1171 | website.fun();
1172 | }
1173 | }
1174 | }
1175 |
1176 | //默认监听
1177 | let LoginFlag = true;
1178 | //默认添加
1179 | let ClickFlag = true;
1180 |
1181 | /**
1182 | * 通过内容(xpath)获取节点
1183 | *
1184 | * @param {string} xpath 内容
1185 | * @param {Node} parent 父元素
1186 | * @return {Node} 元素
1187 | */
1188 | function getXpath(xpath, parent) {
1189 | let xpathResult = document.evaluate(xpath, parent || document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null);
1190 | return xpathResult.singleNodeValue;
1191 | }
1192 |
1193 | /**
1194 | * 向head标签内添加样式
1195 | *
1196 | * @param {string} text CSS样式
1197 | */
1198 | function addStyle(text) {
1199 | let css = document.createElement("style");
1200 | css.innerText += text;
1201 | document.head.append(css);
1202 | }
1203 | })();
1204 |
--------------------------------------------------------------------------------
/AutoDarkMode.md:
--------------------------------------------------------------------------------
1 | # AutoDarkMode UserScript
2 |
3 | [](https://github.com/airbashX/UserScript/)
4 | [](https://github.com/airbashX/UserScript/)
5 | [](https://github.com/airbashX/UserScript/)
6 |
7 | ## 相关功能
8 |
9 | - 在支持多主题模式的网站中,系统会根据用户设定的时间自动切换到相应的主题模式
10 |
11 | ## 相关脚本
12 |
13 | | 名称 | 功能 |
14 | | :-------------------------------------------------------------- | :--------------------------------------------------------------------- |
15 | | **[自动展开](https://greasyfork.org/zh-CN/scripts/438656)** | 自动展开文章或新闻等`隐藏`、`折叠`部分 |
16 | | **[骚扰拦截](https://greasyfork.org/zh-CN/scripts/440871)** | 自动拦截`下载弹窗`、`悬浮按钮`、`登录弹窗`等影响用户体验的骚扰元素 |
17 | | **[链接管理](https://greasyfork.org/zh-CN/scripts/443670)** | 取消点击链接后跳转到安全页面 |
18 | | **[移除复制后缀](https://greasyfork.org/zh-CN/scripts/472307)** | 移除复制后附带的`后缀`、`网站声明` |
19 | | **[自动切换主题](https://greasyfork.org/zh-CN/scripts/532308)** | 在用户设定的时间点,自动切换网站的`主题模式`,如`白天模式`与`黑夜模式` |
20 |
21 | ## 适配网站
22 |
23 | | 网站名 | PC | Phone | 注释 |
24 | | --------- | --- | ----- | ------------------------------------------------------------------------ |
25 | | BiliBili | ✔ | | |
26 | | ChatGPT | ✔ | | |
27 | | GitHub | ✔ | | 需要一些操作才能使功能生效,具体查看 [GitHub 切换说明](#github-切换说明) |
28 | | Pixiv | ✔ | | |
29 | | Wikipedia | ✔ | | |
30 | | 风车动漫 | ✔ | | |
31 |
32 | 持续支持中...
33 |
34 | ## 注释
35 |
36 | ### GitHub 切换说明
37 |
38 | - 由于 GitHub 的主题切换功能隐藏得极为隐蔽,无法使用正常手段切换。唯一的方式需依赖还在测试阶段的 `Command Palette` 功能使用命令进行切换
39 |
40 | - 开启方式:`My Profile` -> `Feature preview` 中,将 `Command Palette` 设置为 `Enable`
41 |
--------------------------------------------------------------------------------
/AutoDarkMode.user.js:
--------------------------------------------------------------------------------
1 | // ==UserScript==
2 | // @name 自动主题切换
3 | // @namespace airbash/Rocy-June/AutoDarkMode
4 | // @homepage https://github.com/AirBashX/UserScript
5 | // @version 25.06.24.01
6 | // @description 根据用户设定时间段, 自动切换已适配网站的黑白主题
7 | // @author airbash / R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esyYPps26hfYi54WLHR8FXOd7g8AaUD3yduvTF8gEQMiEEe0kWoNCdCC5k2iGBzGNRQlIaf5cw7dvGvK0JuMs1++bvR7EhUYiZLHReP7aaSNBvxcpTIkoW2Om/9TO6/G9LrGZD7ganNQATUuxkZZQXcVOShDbi81QXj5jgmL/hIAPD2G/N9MiNf/3N9MXPLr6xSA6pad+b+elvfzDr/Pf2oPrAJ6zWhcAAAAASUVORK5CYII=
10 | // @run-at document-body
11 | // @grant GM_registerMenuCommand
12 | // @grant GM_unregisterMenuCommand
13 | // @grant GM_setValue
14 | // @grant GM_getValue
15 | // @license GPL-3.0
16 | // ==/UserScript==
17 |
18 | (function () {
19 | "use strict";
20 |
21 | // 调试模式开关
22 | const DEBUG = false;
23 | // 调试模式: 是否在报错时中断脚本运行
24 | const DEBUG_INTERRUPT_ON_ERROR = false;
25 | // 调试模式: 是否强制切换主题
26 | let DEBUG_FORCE_TOGGLE = false;
27 |
28 | // 日志函数
29 | const log = console.log.bind(console, "[AutoDarkMode Script]");
30 | const warn = console.warn.bind(console, "[AutoDarkMode Script]");
31 | const error = console.error.bind(console, "[AutoDarkMode Script]");
32 | const debug = (() =>
33 | DEBUG
34 | ? console.error.bind(console, "[AutoDarkMode Script] [Debug Mode]")
35 | : () => {})();
36 |
37 | debug("Debug mode is on");
38 |
39 | // 失败检测计数器
40 | let fail_count = 0;
41 | // 失败检查时间间隔, 单位: 毫秒
42 | let fail_check_time = 10000;
43 |
44 | const sim_events = {
45 | pointer_down: () =>
46 | new PointerEvent("pointerdown", {
47 | bubbles: true,
48 | cancelable: true,
49 | pointerType: "mouse",
50 | }),
51 | mouse_over: () =>
52 | new MouseEvent("mouseover", {
53 | bubbles: true,
54 | cancelable: true,
55 | relatedTarget: null,
56 | }),
57 | mouse_leave: () =>
58 | new MouseEvent("mouseleave", {
59 | bubbles: true,
60 | cancelable: true,
61 | relatedTarget: null,
62 | }),
63 | mouse_enter: () =>
64 | new MouseEvent("mouseenter", {
65 | bubbles: true,
66 | cancelable: true,
67 | relatedTarget: null,
68 | }),
69 | key: (is_down, key, modifiers = {}) => {
70 | const key_codes = {
71 | control: "ControlLeft",
72 | alt: "AltLeft",
73 | shift: "ShiftLeft",
74 | meta: "MetaLeft",
75 | enter: "Enter",
76 | };
77 |
78 | const key_code =
79 | key_codes[key.toLowerCase()] || `Key${key.toUpperCase()}`;
80 |
81 | const {
82 | ctrl = false,
83 | meta = false,
84 | shift = false,
85 | alt = false,
86 | bubbles = true,
87 | cancelable = true,
88 | } = modifiers;
89 |
90 | return new KeyboardEvent(is_down ? "keydown" : "keyup", {
91 | key: key.toUpperCase(),
92 | code: key_code,
93 | ctrlKey: ctrl,
94 | metaKey: meta,
95 | shiftKey: shift,
96 | altKey: alt,
97 | bubbles,
98 | cancelable,
99 | });
100 | },
101 | };
102 |
103 | log("脚本开始运行");
104 |
105 | // 设置对象
106 | const settings = {
107 | // 默认明亮主题起始时间
108 | light_time: "08:00",
109 | // 默认黑夜主题起始时间
110 | dark_time: "18:00",
111 | // 油猴菜单: 明亮主题设置菜单ID
112 | light_menu_id: null,
113 | // 油猴菜单: 黑夜主题设置菜单ID
114 | dark_menu_id: null,
115 | // 油猴菜单: Debug强制切换菜单ID
116 | debug_toggle_id: null,
117 |
118 | // 默认快速检查时间 (Debug 模式且开启报错中断时将延长)
119 | fast_check_default_time: DEBUG && DEBUG_INTERRUPT_ON_ERROR ? 3000 : 200,
120 | // 快速检查过后的常态检查时间 (Debug 模式且开启报错中断时将延长)
121 | after_check_default_time: DEBUG && DEBUG_INTERRUPT_ON_ERROR ? 3600000 : 10000,
122 | };
123 |
124 | // 初始化设置
125 | initSettings();
126 |
127 | // 所有适配的站点
128 | /*
129 | {
130 | "domain (站点域名匹配, 防止后续匹配项过多, 提高加载速度)": [{
131 | url: 匹配站点正则,
132 | check: 检查当前主题函数(返回 "dark" 或 "light"),
133 | toggle: 切换主题函数(可选, 为 null 时 toLight 和 toDark 函数会被调用),
134 | toLight: 切换到明亮主题函数(可选, toggle 为 null 时必需设定),
135 | toDark: 切换到黑夜主题函数(可选, toggle 为 null 时必需设定),
136 | fastCheckTime: 未成功检查 / 切换主题前的检查主题间隔时间(可选, 为 null 时默认 1 秒),
137 | afterCheckTime: 无需切换或切换成功后, 再次检查主题间隔时间(可选, 为 null 时默认 10 秒),
138 | }]
139 | }
140 |
141 | tip:
142 | 如果新增站点有新的顶级域名,
143 | 记得同步增加到 sites 下方的 domain_suffixes
144 | */
145 | const sites = {
146 | // Pixiv
147 | "pixiv.net": [
148 | {
149 | url: /^https?:\/\/.*?pixiv\.net.*/,
150 | check: () =>
151 | html().getAttribute("data-theme") === "dark" ? "dark" : "light",
152 | toLight: () => {
153 | $single(".gtm-darkmode-toggle-on-user-menu-to-light").click();
154 | },
155 | toDark: () => {
156 | $single(".gtm-darkmode-toggle-on-user-menu-to-dark").click();
157 | },
158 | },
159 | ],
160 | // 风车动漫
161 | "fengchedmp.com": [
162 | {
163 | url: /^https?:\/\/.*?fengchedmp\.com.*/,
164 | check: () =>
165 | $single("#cssFile").getAttribute("href").includes("black")
166 | ? "dark"
167 | : "light",
168 | toLight: () => {
169 | $single("i.icon-rijian").click();
170 | },
171 | toDark: () => {
172 | $single("i.icon-yejian").click();
173 | },
174 | },
175 | ],
176 | // Wikipedia
177 | "wikipedia.org": [
178 | {
179 | url: /^https?:\/\/.*?wikipedia\.org.*/,
180 | check: () =>
181 | html().classList.contains("skin-theme-clientpref-night")
182 | ? "dark"
183 | : "light",
184 | toLight: () => {
185 | $single("#skin-client-pref-skin-theme-value-day").click();
186 | },
187 | toDark: () => {
188 | $single("#skin-client-pref-skin-theme-value-night").click();
189 | },
190 | },
191 | ],
192 | // ChatGPT
193 | "chatgpt.com": [
194 | {
195 | url: /^https?:\/\/.*?chatgpt\.com.*/,
196 | check: () => (html().classList.contains("dark") ? "dark" : "light"),
197 | toLight: async () => {
198 | $single(
199 | "#conversation-header-actions button[data-testid=profile-button]"
200 | ).dispatchEvent(sim_events.pointer_down());
201 | (
202 | await $singleAsync("div[data-radix-popper-content-wrapper]")
203 | ).style.opacity = 0;
204 |
205 | $single("div[data-testid=settings-menu-item]").click();
206 | (
207 | await $singleAsync("div[data-testid=modal-settings]")
208 | ).style.opacity = 0;
209 |
210 | $single(
211 | "div.flex.items-center.justify-between button[role=combobox]"
212 | ).dispatchEvent(sim_events.pointer_down());
213 | (
214 | await $singleAsync("div[data-radix-popper-content-wrapper]")
215 | ).style.opacity = 0;
216 |
217 | $single(
218 | "div[data-radix-select-viewport] div[role=option]:nth-child(3)"
219 | ).click();
220 | $single("button[data-testid=close-button]").click();
221 | },
222 | toDark: async () => {
223 | $single(
224 | "#conversation-header-actions button[data-testid=profile-button]"
225 | ).dispatchEvent(sim_events.pointer_down());
226 | (
227 | await $singleAsync("div[data-radix-popper-content-wrapper]")
228 | ).style.opacity = 0;
229 |
230 | $single("div[data-testid=settings-menu-item]").click();
231 | (
232 | await $singleAsync("div[data-testid=modal-settings]")
233 | ).style.opacity = 0;
234 |
235 | $single(
236 | "div.flex.items-center.justify-between button[role=combobox]"
237 | ).dispatchEvent(sim_events.pointer_down());
238 | (
239 | await $singleAsync("div[data-radix-popper-content-wrapper]")
240 | ).style.opacity = 0;
241 |
242 | $single(
243 | "div[data-radix-select-viewport] div[role=option]:nth-child(2)"
244 | ).click();
245 | $single("button[data-testid=close-button]").click();
246 | },
247 | load: () => {
248 | document.addEventListener("visibilitychange", function () {
249 | if (document.visibilityState === "visible") {
250 | let modal_settings = $single("div[data-testid=modal-settings]");
251 | if (!modal_settings) {
252 | return;
253 | }
254 |
255 | $single("button[data-testid=close-button]").click();
256 | }
257 | });
258 | }
259 | },
260 | ],
261 | // GitHub
262 | "github.com": [
263 | {
264 | url: /^https?:\/\/.*?github\.com.*/,
265 | check: () =>
266 | html().getAttribute("data-color-mode") === "dark" ? "dark" : "light",
267 | toLight: async () => {
268 | document.body.dispatchEvent(
269 | sim_events.key(true, "k", { ctrl: true, shift: true })
270 | );
271 | const command_container = $single("#command-palette-pjax-container");
272 | command_container.style.opacity = 0;
273 |
274 | const command_palette = $single(
275 | "input[aria-controls=command-palette-page-stack]"
276 | );
277 | command_palette.value = ">switch theme";
278 |
279 | (
280 | await $singleAsync("div[role=listbox]>command-palette-item>span")
281 | ).click();
282 |
283 | let flag = await waitForAsync(() => {
284 | return $single("svg[aria-label=Loading]").parentNode.hasAttribute(
285 | "hidden"
286 | );
287 | });
288 | if (!flag) {
289 | throw new Error("Waiting for load ready failed");
290 | }
291 |
292 | command_palette.value = "default light";
293 |
294 | (
295 | await $selectSingleAsync(
296 | "div[role=listbox]>command-palette-item>span",
297 | (e) => {
298 | return e.innerText.toLowerCase().includes("default light");
299 | }
300 | )
301 | ).click();
302 | command_container.style.opacity = 1;
303 | },
304 | toDark: async () => {
305 | document.body.dispatchEvent(
306 | sim_events.key(true, "k", { ctrl: true, shift: true })
307 | );
308 | const command_container = $single("#command-palette-pjax-container");
309 | command_container.style.opacity = 0;
310 |
311 | const command_palette = $single(
312 | "input[aria-controls=command-palette-page-stack]"
313 | );
314 | command_palette.value = ">switch theme";
315 |
316 | (
317 | await $singleAsync("div[role=listbox]>command-palette-item>span")
318 | ).click();
319 |
320 | let flag = await waitForAsync(() => {
321 | return $single("svg[aria-label=Loading]").parentNode.hasAttribute(
322 | "hidden"
323 | );
324 | });
325 | if (!flag) {
326 | throw new Error("Waiting for load ready failed");
327 | }
328 |
329 | command_palette.value = "default dark";
330 |
331 | (
332 | await $selectSingleAsync(
333 | "div[role=listbox]>command-palette-item>span",
334 | (e) => {
335 | return e.innerText.toLowerCase().includes("default dark");
336 | }
337 | )
338 | ).click();
339 | command_container.style.opacity = 1;
340 | },
341 | },
342 | ],
343 | // Bilibili
344 | "bilibili.com": [
345 | {
346 | url: /^https?:\/\/.*?bilibili\.com.*/,
347 | check: () =>
348 | html().classList.contains("night-mode") ? "dark" : "light",
349 | toLight: async () => {
350 | let flag = await waitForTimerAsync(() => $single("li.v-popover-wrap.header-avatar-wrap") != null, 200, 10000);
351 | if (!flag) {
352 | throw new Error("Waiting for links-item created failed");
353 | }
354 |
355 | let avatar = $single("li.v-popover-wrap.header-avatar-wrap")
356 | avatar.dispatchEvent(sim_events.mouse_enter());
357 | await nextFrame();
358 | avatar.dispatchEvent(sim_events.mouse_leave());
359 |
360 | flag = await waitForTimerAsync(() => $all(".links-item").length > 0, 200, 10000);
361 | if (!flag) {
362 | throw new Error("Waiting for links-item created failed");
363 | }
364 |
365 | let links_item = $all(".links-item");
366 | let single_link_item = $single(links_item[links_item.length - 1], ".single-link-item")
367 | single_link_item.dispatchEvent(sim_events.mouse_enter());
368 |
369 | flag = await waitForAsync(() => single_link_item.nextElementSibling?.classList.contains("v-popover"));
370 | if (!flag) {
371 | throw new Error("Waiting for popover created failed");
372 | }
373 |
374 | let popover = single_link_item.nextElementSibling;
375 | let options = $all(popover, ".single-link-item.sub-link-item")
376 | options[1].click();
377 | },
378 | toDark: async () => {
379 | let avatar = $single("li.v-popover-wrap.header-avatar-wrap")
380 | avatar.dispatchEvent(sim_events.mouse_enter());
381 | await nextFrame();
382 | avatar.dispatchEvent(sim_events.mouse_leave());
383 |
384 | let flag = await waitForTimerAsync(() => $all(".links-item").length > 0, 200, 10000);
385 | if (!flag) {
386 | throw new Error("Waiting for links-item created failed");
387 | }
388 |
389 | let links_item = $all(".links-item");
390 | let single_link_item = $single(links_item[links_item.length - 1], ".single-link-item")
391 | single_link_item.dispatchEvent(sim_events.mouse_enter());
392 |
393 | flag = await waitForAsync(() => single_link_item.nextElementSibling?.classList.contains("v-popover"));
394 | if (!flag) {
395 | throw new Error("Waiting for popover created failed");
396 | }
397 |
398 | let popover = single_link_item.nextElementSibling;
399 | let options = $all(popover, ".single-link-item.sub-link-item")
400 | options[0].click();
401 | },
402 | load: () => {
403 | document.addEventListener("visibilitychange", async function () {
404 | if (document.visibilityState === "visible") {
405 | await nextTick();
406 | $single("li.v-popover-wrap.header-avatar-wrap>.v-popover").dispatchEvent(
407 | sim_events.mouse_leave()
408 | );
409 | }
410 | });
411 | }
412 | },
413 | ],
414 | };
415 |
416 | const domain_suffixes = [
417 | ".com.cn",
418 | ".com",
419 | ".org",
420 | ".net",
421 | ".edu",
422 | ".gov",
423 | ".cn",
424 | ];
425 |
426 | // 匹配到的域名设置
427 | const no_www_domain = getRootDomain(location.hostname);
428 |
429 | const domain_setting = sites[no_www_domain];
430 | if (!domain_setting) {
431 | log(`未找到适配的站点: ${no_www_domain}`);
432 | return;
433 | }
434 |
435 | // 匹配到的网站设置
436 | const site_setting = domain_setting.find((s) => s.url.test(location.href));
437 | if (!site_setting) {
438 | log(`未找到当前页面的适配操作`);
439 | return;
440 | }
441 |
442 | // 加载完成后开始检查主题
443 | addEventListener("load", async () => {
444 |
445 | site_setting.load?.();
446 |
447 | const timer = new Timer(
448 | intervalFunc,
449 | site_setting.afterCheckTime || settings.after_check_default_time
450 | );
451 |
452 | await intervalFunc();
453 |
454 | timer.start();
455 |
456 | async function intervalFunc() {
457 | try {
458 | await checkAndChangeTheme();
459 |
460 | fail_count = 0;
461 | timer.delay = site_setting.afterCheckTime || settings.after_check_default_time;
462 |
463 | log("检查/操作完成, 切换到慢速模式");
464 | } catch (ex) {
465 | if (DEBUG) {
466 | if (DEBUG_INTERRUPT_ON_ERROR) {
467 | debug("检查/操作失败, 中断脚本运行", ex);
468 | return;
469 | }
470 |
471 | debug("检查/操作失败", ex);
472 | }
473 |
474 | fail_count++;
475 | if (
476 | fail_count >=
477 | fail_check_time /
478 | (site_setting.fastCheckTime || settings.fast_check_default_time)
479 | ) {
480 | timer.delay =
481 | site_setting.afterCheckTime || settings.after_check_default_time;
482 | error("失败超出时长限制, 切换到慢速模式");
483 | return;
484 | }
485 |
486 | timer.delay =
487 | site_setting.fastCheckTime || settings.fast_check_default_time;
488 | error("检查/操作失败, 切换到高速模式", ex);
489 | }
490 | }
491 | });
492 |
493 | // 查找元素, 用法类似于 jQuery
494 | function $single(arg1, arg2) {
495 | if (arguments.length == 2) {
496 | return $single2(arg1, arg2);
497 | }
498 | return $single1(arg1);
499 | }
500 | function $single1(selector) {
501 | return document.querySelector(selector);
502 | }
503 | function $single2(dom, selector) {
504 | return dom.querySelector(selector);
505 | }
506 |
507 | /*
508 | 类似 jQuery 的元素查找函数
509 |
510 | 适用于连续操作中可能影响用户操作体验的场景, 该方式会尽可能在渲染的同一帧内找到该 DOM 元素,
511 | 以缩短元素变更对用户交互的干扰时间 (如弹窗在显示帧立即点击关闭按钮)
512 |
513 | 与 singleTimerAsync 不同的是, 本函数每一帧都会进行查询, 因此可能对性能造成一定影响
514 | 如果操作不会显著影响用户体验, 则推荐使用 singleTimerAsync
515 | */
516 | async function $singleAsync(selector, timeout = 1000) {
517 | const start = Date.now();
518 | while (Date.now() - start < timeout) {
519 | const ele = $single(selector);
520 | if (ele) {
521 | return ele;
522 | }
523 |
524 | await nextFrame();
525 | }
526 |
527 | throw new Error("Timeout");
528 | }
529 |
530 | /*
531 | 类似 jQuery 的元素查找函数
532 |
533 | 适用于不会改变页面结构、或不影响用户操作体验的场景
534 | 使用自定义 Timer 以固定间隔查询元素, 性能开销较小, 但查找速度相对较慢
535 |
536 | 与 singleAsync 不同的是, 该函数通过节流方式降低性能消耗,
537 | 更适合异步检查某些静态区域元素是否已加载完成等情况
538 | */
539 | function $singleTimerAsync(selector, interval = 100, timeout = 1000) {
540 | return promise(async (resolve, reject) => {
541 | const start = Date.now();
542 | const timer = new Timer(() => {
543 | const ele = $single(selector);
544 | if (ele) {
545 | resolve(ele);
546 | timer.stop();
547 | return;
548 | }
549 | if (Date.now() - start >= timeout) {
550 | reject(new Error("Timeout"));
551 | timer.stop();
552 | return;
553 | }
554 | }, interval);
555 | timer.start(true);
556 | });
557 | }
558 |
559 | // 用于查找无法单纯使用 CSS 选择器的复杂元素
560 | async function $selectSingleAsync(selector, filter, timeout = 1000) {
561 | const start = Date.now();
562 | while (Date.now() - start < timeout) {
563 | const eles = $all(selector);
564 | if (eles.length) {
565 | let selected = Array.from(eles).filter(filter);
566 | if (selected.length) {
567 | return selected[0];
568 | }
569 | }
570 |
571 | await nextFrame();
572 | }
573 |
574 | throw new Error("Timeout");
575 | }
576 |
577 | function $all(arg1, arg2) {
578 | if (arguments.length == 2) {
579 | return $all2(arg1, arg2);
580 | }
581 | return $all1(arg1);
582 | }
583 | function $all1(selector) {
584 | return document.querySelectorAll(selector);
585 | }
586 | function $all2(dom, selector) {
587 | return dom.querySelectorAll(selector);
588 | }
589 |
590 | function html() {
591 | return document.documentElement;
592 | }
593 |
594 | // 初始化设置
595 | function initSettings() {
596 | log("初始化设置");
597 |
598 | settings.light_time = GM_getValue("light_time", settings.light_time);
599 | settings.dark_time = GM_getValue("dark_time", settings.dark_time);
600 |
601 | refreshMenuCommand();
602 | }
603 |
604 | // 获取根域名
605 | function getRootDomain(domain) {
606 | for (const suffix of domain_suffixes) {
607 | if (!domain.endsWith(suffix)) {
608 | continue;
609 | }
610 |
611 | const index = domain.lastIndexOf(".", suffix.length);
612 | return domain.substring(index + 1);
613 | }
614 | }
615 |
616 | // 检查当前时间是否需要切换主题
617 | async function checkAndChangeTheme() {
618 | log("开始检查主题");
619 |
620 | const light_minutes = timeToMinutes(settings.light_time);
621 | const dark_minutes = timeToMinutes(settings.dark_time);
622 |
623 | let now = nowMinutes();
624 |
625 | const current_theme = site_setting.check();
626 | log(`当前主题:${current_theme}`);
627 |
628 | if (DEBUG && DEBUG_FORCE_TOGGLE) {
629 | debug("强制切换主题");
630 | if (
631 | now >= light_minutes &&
632 | now < dark_minutes &&
633 | current_theme === "light"
634 | ) {
635 | now = dark_minutes;
636 | debug("将当前时间设置为黑夜时间");
637 | } else if (
638 | (now >= dark_minutes || now < light_minutes) &&
639 | current_theme === "dark"
640 | ) {
641 | now = light_minutes;
642 | debug("将当前时间设置为明亮时间");
643 | }
644 | }
645 |
646 | if (now >= light_minutes && now < dark_minutes) {
647 | if (current_theme === "light") {
648 | log("当前时间为明亮主题时间, 无需切换");
649 | return;
650 | }
651 | if (site_setting.toggle) {
652 | log("切换到明亮主题 - toggle");
653 | await site_setting.toggle();
654 | log("切换完成");
655 | return;
656 | }
657 | if (site_setting.toLight) {
658 | log("切换到明亮主题 - toLight");
659 | await site_setting.toLight();
660 | log("切换完成");
661 | return;
662 | }
663 |
664 | error("切换到明亮主题 - 未指定切换函数");
665 | } else {
666 | if (current_theme === "dark") {
667 | log("当前时间为黑夜主题时间, 无需切换");
668 | return;
669 | }
670 | if (site_setting.toggle) {
671 | log("切换到黑夜主题 - toggle");
672 | await site_setting.toggle();
673 | log("切换完成");
674 | return;
675 | }
676 | if (site_setting.toDark) {
677 | log("切换到黑夜主题 - toDark");
678 | await site_setting.toDark();
679 | log("切换完成");
680 | return;
681 | }
682 |
683 | error("切换到黑夜主题 - 未指定切换函数");
684 | }
685 | }
686 |
687 | // 刷新菜单
688 | function refreshMenuCommand() {
689 | log("刷新脚本菜单");
690 |
691 | if (settings.light_menu_id) {
692 | GM_unregisterMenuCommand(settings.light_menu_id);
693 | }
694 | if (settings.dark_menu_id) {
695 | GM_unregisterMenuCommand(settings.dark_menu_id);
696 | }
697 | if (settings.debug_toggle_id) {
698 | GM_unregisterMenuCommand(settings.debug_toggle_id);
699 | }
700 |
701 | settings.light_menu_id = GM_registerMenuCommand(
702 | `设置明亮时间 (${settings.light_time})`,
703 | () => setTimePrompt("light_time", "明亮时间")
704 | );
705 | settings.dark_menu_id = GM_registerMenuCommand(
706 | `设置黑夜时间 (${settings.dark_time})`,
707 | () => setTimePrompt("dark_time", "黑夜时间")
708 | );
709 | if (DEBUG) {
710 | settings.debug_toggle_id = GM_registerMenuCommand(
711 | `调试模式: 强制切换主题`,
712 | async () => {
713 | DEBUG_FORCE_TOGGLE = true;
714 | try {
715 | await checkAndChangeTheme();
716 | }
717 | finally {
718 | DEBUG_FORCE_TOGGLE = false;
719 | }
720 | }
721 | );
722 | }
723 | }
724 |
725 | // 设置时间提示框
726 | function setTimePrompt(key, label) {
727 | log(`设置${label}提示框`);
728 |
729 | const old_val = GM_getValue(key, settings[key]);
730 |
731 | log(`旧${label}:${old_val}`);
732 |
733 | const new_val = prompt(`设置${label}(格式 HH:mm):`, old_val);
734 | log(`用户输入: ${new_val}`);
735 | if (!new_val) {
736 | return;
737 | }
738 | if (
739 | !new_val ||
740 | !/^([0-1][0-9]|2[0-3])[::]([0-5][0-9])$/.test(new_val)
741 | ) {
742 | alert('格式不正确, 时间格式为 "08:00"');
743 | return;
744 | }
745 | const standard_new_val = new_val.replace(":", ":");
746 |
747 | log(`新${label}:${standard_new_val}`);
748 |
749 | const tmp = standard_new_val;
750 | settings[key] = standard_new_val;
751 | if (
752 | timeToMinutes(settings.light_time) > timeToMinutes(settings.dark_time)
753 | ) {
754 | log("黑夜时间不能早于明亮时间");
755 |
756 | settings[key] = tmp;
757 | alert("黑夜时间不能早于明亮时间");
758 | return;
759 | }
760 |
761 | GM_setValue(key, standard_new_val);
762 |
763 | log(`${label} 已设置为:${standard_new_val}`);
764 |
765 | alert(`${label} 已设置为:${standard_new_val}`);
766 |
767 | refreshMenuCommand();
768 | }
769 |
770 | // 将时间字符串转为分钟
771 | function timeToMinutes(time) {
772 | const [hour, minute] = time.split(":").map(Number);
773 | return hour * 60 + minute;
774 | }
775 |
776 | // 获取当前时间的分钟数
777 | function nowMinutes() {
778 | const now = new Date();
779 | return now.getHours() * 60 + now.getMinutes();
780 | }
781 |
782 | // 将函数加入下一轮事件循环
783 | function nextTick(func) {
784 | return Promise.resolve().then(() => {
785 | func();
786 | });
787 | }
788 |
789 | // 等待下一帧
790 | function nextFrame(func) {
791 | return new Promise((resolve) => {
792 | requestAnimationFrame((timestamp) => {
793 | func?.(timestamp);
794 | resolve(timestamp);
795 | });
796 | });
797 | }
798 |
799 | // 异步函数返回 Promise
800 | function promise(func) {
801 | return new Promise((resolve, reject) => {
802 | try {
803 | func(resolve, reject);
804 | } catch (ex) {
805 | reject(ex);
806 | }
807 | });
808 | }
809 |
810 | // 等待指定时间
811 | function waitTimeAsync(time) {
812 | return new Promise((resolve) => {
813 | setTimeout(() => {
814 | resolve();
815 | }, time);
816 | });
817 | }
818 |
819 | /*
820 | 等待某个元素达到某个状态
821 |
822 | 适用于连续操作中可能影响用户操作体验的场景, 该方式会在渲染的每一帧内检测该 DOM 元素的状态,
823 | 以缩短元素变更对用户交互的干扰时间 (如弹窗在显示帧立即点击关闭按钮)
824 |
825 | 与 waitForTimerAsync 不同的是, 本函数每一帧都会进行查询, 因此可能对性能造成一定影响
826 | 如果操作不会显著影响用户体验, 则推荐使用 waitForTimerAsync
827 | */
828 | async function waitForAsync(detector, timeout = 1000) {
829 | if (!detector) throw new Error("detector can not be null.");
830 |
831 | const start = Date.now();
832 | while (Date.now() - start < timeout) {
833 | if (detector()) {
834 | return true;
835 | }
836 |
837 | await nextFrame();
838 | }
839 |
840 | return false;
841 | }
842 |
843 | /* 等待某个元素达到某个状态
844 |
845 | 适用于不会改变页面结构、或不影响用户操作体验的场景
846 | 使用自定义 Timer 以固定间隔查询元素, 性能开销较小, 但查找速度相对较慢
847 |
848 | 与 waitForAsync 不同的是, 该函数通过节流方式降低性能消耗,
849 | 更适合异步检查某些静态区域元素是否已加载完成等情况
850 | */
851 | function waitForTimerAsync(detector, interval = 100, timeout = 1000) {
852 | if (!detector) throw new Error("detector can not be null.");
853 |
854 | return promise(async (resolve, reject) => {
855 | const start = Date.now();
856 | const timer = new Timer(() => {
857 | if (detector()) {
858 | resolve(true);
859 | timer.stop();
860 | return;
861 | }
862 | if (Date.now() - start >= timeout) {
863 | reject(new Error("Timeout"));
864 | timer.stop();
865 | return;
866 | }
867 | }, interval);
868 | timer.start(true);
869 | });
870 | }
871 |
872 | // 自建定时器
873 | class Timer {
874 | #timer = null;
875 | #func = null;
876 | delay = 0;
877 |
878 | constructor(func, delay) {
879 | this.#func = func;
880 | this.delay = delay;
881 | }
882 |
883 | start(immediate = false) {
884 | this.stop();
885 |
886 | let start_new = async () => {
887 | if (immediate) {
888 | await this.#func();
889 | }
890 |
891 | this.#timer = setTimeout(async () => {
892 | await this.#func();
893 | this.start();
894 | }, this.delay);
895 | };
896 | start_new();
897 | }
898 |
899 | stop() {
900 | clearTimeout(this.#timer);
901 | }
902 | }
903 | })();
904 |
--------------------------------------------------------------------------------
/AutoUnfold.md:
--------------------------------------------------------------------------------
1 | # AutoUnfold UserScript
2 |
3 | [](https://github.com/airbashX/UserScript/)
4 | [](https://github.com/airbashX/UserScript/)
5 | [](https://github.com/airbashX/UserScript/)
6 | [](https://www.jsdelivr.com/package/gh/airbashX/UserScript)
7 | [](https://greasyfork.org/zh-CN/users/698573-厌学的骚年)
8 |
9 | ## 相关功能
10 |
11 | 自动展开隐藏的内容(拦截悬浮弹窗需要安装我的另一个脚本[骚扰拦截](https://greasyfork.org/zh-CN/scripts/440871))
12 |
13 | ## 注意事项
14 |
15 | 本脚本在`1.3`版本之后将`骚扰拦截`+`悬浮图标`+`app弹窗`+`百度搜索小程序`+`登录提示`功能单独做成了[骚扰拦截](https://greasyfork.org/zh-CN/scripts/440871)脚本,以方便用户自行选择,有需求的同学可以去[骚扰拦截](https://greasyfork.org/zh-CN/scripts/440871)页面安装;
16 |
17 | 友情提示:两个脚本搭配使用效果更佳奥!
18 |
19 | 代码中尽量不使用正则表达式,以获得最佳体验
20 |
21 | > 知乎官网默认不支持未登录查看内容了,暂无解决方案,需要登录后才能展开
22 |
23 | ## 相关脚本
24 |
25 | | 名称 | 功能 |
26 | | :-------------------------------------------------------------- | :--------------------------------------------------------------------- |
27 | | **[自动展开](https://greasyfork.org/zh-CN/scripts/438656)** | 自动展开文章或新闻等`隐藏`、`折叠`部分 |
28 | | **[骚扰拦截](https://greasyfork.org/zh-CN/scripts/440871)** | 自动拦截`下载弹窗`、`悬浮按钮`、`登录弹窗`等影响用户体验的骚扰元素 |
29 | | **[链接管理](https://greasyfork.org/zh-CN/scripts/443670)** | 取消点击链接后跳转到安全页面 |
30 | | **[移除复制后缀](https://greasyfork.org/zh-CN/scripts/472307)** | 移除复制后附带的`后缀`、`网站声明` |
31 | | **[自动切换主题](https://greasyfork.org/zh-CN/scripts/532308)** | 在用户设定的时间点,自动切换网站的`主题模式`,如`白天模式`与`黑夜模式` |
32 |
33 | ## 适配网站
34 |
35 | | 网站名 | PC | Phone | 其他功能 |
36 | | ---------------- | --- | ----- | ---------- |
37 | | CSDN | ✔ | ✔ | 免关注查看 |
38 | | CSDN 问答 | ✔ | ✔ | |
39 | | 编程之家 | ✔ | ✔ | 免验证查看 |
40 | | 简书 | ✔ | ✔ | |
41 | | 知乎 | ✔ | ✔ | 仅限登陆后 |
42 | | 百家号 | ✔ | ✔ | |
43 | | 百家资讯 | ✔ | ✔ | |
44 | | 百家百科 | ✔ | ✔ | |
45 | | 百度经验 | ✔ | ✔ | |
46 | | 百度知道 | ✔ | ✔ | |
47 | | 百度贴吧 | ✔ | ✔ | |
48 | | 百度文库 | | ✔ | |
49 | | 百度题库 | | ✔ | |
50 | | 百度新闻 | ✔ | ✔ | |
51 | | 新浪新闻 | ✔ | ✔ | |
52 | | 腾讯新闻 | ✔ | ✔ | |
53 | | 搜狐新闻 | ✔ | ✔ | |
54 | | 网易新闻 | ✔ | ✔ | |
55 | | 凤凰新闻 | ✔ | ✔ | |
56 | | 澎湃新闻 | ✔ | ✔ | |
57 | | 新京报 | ✔ | ✔ | |
58 | | 环球网 | ✔ | ✔ | |
59 | | 央广网 | ✔ | ✔ | |
60 | | 人民日报 | ✔ | ✔ | |
61 | | 人民网 | ✔ | ✔ | |
62 | | 中华网 | ✔ | ✔ | |
63 | | 今日头条 | ✔ | ✔ | |
64 | | 东方资讯 | ✔ | ✔ | |
65 | | 36 氪 | ✔ | ✔ | |
66 | | 果壳 | ✔ | ✔ | |
67 | | 虎扑 | ✔ | ✔ | |
68 | | 虎嗅 | ✔ | ✔ | |
69 | | 头条 | ✔ | ✔ | |
70 | | 丁香园 | ✔ | ✔ | |
71 | | 健康界 | ✔ | ✔ | |
72 | | 有来医生 | ✔ | ✔ | |
73 | | 哔哩哔哩 | ✔ | ✔ | |
74 | | B 站文章 | ✔ | ✔ | |
75 | | B 站笔记 | ✔ | ✔ | |
76 | | 微博文章 | ✔ | | 免关注查看 |
77 | | 豆瓣 | ✔ | ✔ | |
78 | | 豆瓣文章 | ✔ | ✔ | |
79 | | 开源中国 | ✔ | ✔ | |
80 | | 阿里云开发者社区 | ✔ | ✔ | 免关注查看 |
81 | | 腾讯云开发者社区 | ✔ | ✔ | 免关注查看 |
82 | | 华为云开发者社区 | ✔ | ✔ | 免关注查看 |
83 | | 360 图书馆 | ✔ | ✔ | |
84 | | 太平洋电脑网 | ✔ | ✔ | |
85 | | 中关村在线 | ✔ | ✔ | |
86 | | 汽车之家 | ✔ | ✔ | |
87 | | 游侠网 | ✔ | ✔ | |
88 | | 游民星空 | ✔ | ✔ | |
89 | | 网易大神 | ✔ | ✔ | |
90 | | 360 文档 | ✔ | ✔ | |
91 | | 天眼查 | ✔ | ✔ | |
92 | | 天涯社区 | ✔ | ✔ | |
93 | | 新浪财经 | ✔ | ✔ | |
94 | | 东方财富网 | ✔ | ✔ | |
95 | | 喜马拉雅 | ✔ | ✔ | |
96 | | 古诗文网 | ✔ | | |
97 | | it1352 | ✔ | ✔ | 免验证查看 |
98 | | 淘嘟嘟 | ✔ | ✔ | |
99 | | 代码随想录 | ✔ | ✔ | 免验证查看 |
100 | | 程序猿 DD | ✔ | ✔ | 免验证查看 |
101 | | 好网角收藏夹 | ✔ | ✔ | 免验证查看 |
102 | | 科中资源网 | ✔ | ✔ | |
103 | | tofacebook | ✔ | ✔ | |
104 |
105 | 持续支持中...
106 |
--------------------------------------------------------------------------------
/AutoUnfold.user.js:
--------------------------------------------------------------------------------
1 | // ==UserScript==
2 | // @name 自动展开
3 | // @version 1.3.81
4 | // @namespace https://github.com/AirBashX/AutoUnfold/
5 | // @homepageURL https://github.com/AirBashX/UserScript
6 | // @author airbash
7 | // @description 自动展开文档 隐藏部分;长期维护、PC+手机全平台支持;全平台支持:CSDN、编程之家、简书、知乎、百家号、百度资讯、百度百科、百度经验、百度知道、百度贴吧、百度新闻、新浪新闻、腾讯新闻、搜狐新闻、网易新闻、凤凰新闻、澎湃新闻、新京报、央广网、环球网、人民日报、人民网、中华网、今日头条、东方资讯、丁香园、有来医生、健康界、36氪、果壳、虎扑、虎嗅、头条、B站专栏、B站笔记、微博文章、豆瓣文章、豆瓣小组、开源中国、阿里云开发者社区、腾讯云开发者社区、华为云开发者社区、360图书馆、太平洋电脑网、中关村在线、汽车之家、游侠网、游民星空、网易大神、360问答、天眼查、天涯社区、新浪财经、东方财富网、喜马拉雅、it1352、代码随想录、古诗文网
8 | // @match *://*.blog.csdn.net/*
9 | // @match *://blog.csdn.net/*
10 | // @match *://ask.csdn.net/questions/*
11 | // @match *://download.csdn.net/download/*
12 | // @match *://wenku.csdn.net/answer/*
13 | // @match *://*.jb51.cc/*
14 | // @match *://*.jianshu.com/*
15 | // @match *://www.zhihu.com/question/*
16 | // @match *://zhuanlan.zhihu.com/p/*
17 | // @match *://jingyan.baidu.com/article*
18 | // @match *://zhidao.baidu.com/question*
19 | // @match *://baike.baidu.com/item/*
20 | // @match *://tieba.baidu.com/p*
21 | // @match *://wk.baidu.com/view/*
22 | // @match *://tanbi.baidu.com/h5apptopic/browse/*
23 | // @match *://baijiahao.baidu.com/s*
24 | // @match *://easylearn.baidu.com/edu-page/*
25 | // @match *://mbd.baidu.com/newspage/data/*
26 | // @match *://news.baidu.com/news*
27 | // @match *://m.baidu.com/sf_baijiahao/*
28 | // @match *://*.sina.cn/*
29 | // @match *://3g.163.com/*
30 | // @match *://*.sohu.com/a/*
31 | // @match *://view.inews.qq.com/*
32 | // @match *://*.ifeng.com/*
33 | // @match *://m.thepaper.cn/newsDetail_forward*
34 | // @match *://m.bjnews.com.cn/detail/*
35 | // @match *://*.huanqiu.com/article/*
36 | // @match *://3w.huanqiu.com/a/*
37 | // @match *://3g.china.com/act/*
38 | // @match *://m.toutiao.com/article/*
39 | // @match *://mini.eastday.com/*
40 | // @match *://*.dxy.cn/*
41 | // @match *://www.cn-healthcare.com/*
42 | // @match *://m.youlai.cn/*
43 | // @match *://space.bilibili.com/*/dynamic*
44 | // @match *://t.bilibili.com/*
45 | // @match *://www.bilibili.com/read/mobile*
46 | // @match *://m.bilibili.com/opus/*
47 | // @match *://weibo.com/ttarticle/p/show?id=*
48 | // @match *://card.weibo.com/article/m/show/id*
49 | // @match *://*.douban.com/*
50 | // @match *://www.oschina.net/p/*
51 | // @match *://developer.aliyun.com/article/*
52 | // @match *://cloud.tencent.com/developer/article/*
53 | // @match *://cloud.tencent.com/developer/beta/article/*
54 | // @match *://huaweicloud.csdn.net/*
55 | // @match *://www.360doc.cn/article/*
56 | // @match *://www.360doc.com/content/*
57 | // @match *://g.pconline.com.cn/x/*
58 | // @match *://m.zol.com.cn/article/*
59 | // @match *://m.autohome.com.cn/news/*
60 | // @match *://chejiahao.m.autohome.com.cn/info/*
61 | // @match *://*.cnr.cn/*
62 | // @match *://club.m.autohome.com.cn/bbs/*
63 | // @match *://3g.ali213.net/*
64 | // @match *://wap.gamersky.com/*
65 | // @match *://m.ds.163.com/*
66 | // @match *://wenda.so.com/q/*
67 | // @match *://m.wenda.so.com/q/*
68 | // @match *://n.tianyancha.com/content/*
69 | // @match *://bbs.tianya.cn/m/*
70 | // @match *://wap.eastmoney.com/a/*
71 | // @match *://mguba.eastmoney.com/*
72 | // @match *://emcreative.eastmoney.com/*
73 | // @match *://*.ximalaya.com/*
74 | // @match *://www.gushiwen.cn/*
75 | // @match *://*.it1352.com/*
76 | // @match *://www.taodudu.cc/news/*
77 | // @match *://programmercarl.com/*
78 | // @match *://blog.didispace.com/*
79 | // @match *://*.wang1314.com/doc/*
80 | // @match *://*.k4china.com/*
81 | // @match *://www.tofacebook.com/*
82 | // @run-at document-start
83 | // @icon data:image/png;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAAAXNSR0IArs4c6QAAA29JREFUeF7tmMvrT08Yx1/fnViwVcq/gqKQa8gtd0Kyk8Vv81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gdkwTpDk1YHzNBhZdlqdUAWrDM06eQd8Acza/FB2qWb3AAAAABJRU5ErkJggg==
84 | // @grant none
85 | // @license GPL-3.0
86 | // ==/UserScript==
87 | (function () {
88 | "use strict";
89 |
90 | /**
91 | * 网站列表
92 | * @type {name/url/操作类型}
93 | */
94 | const websites = [
95 | {
96 | name: "CSDN",
97 | url: "blog.csdn.net",
98 | handles: [
99 | //PC端:自动展开代码块
100 | {
101 | type: "click",
102 | item: ".hide-preCode-bt",
103 | },
104 | //PC端:关注博主即可阅读全文
105 | {
106 | type: "display",
107 | item: ".hide-article-box",
108 | },
109 | //阅读全文
110 | {
111 | type: "display",
112 | item: ".btn_mod",
113 | },
114 | {
115 | type: "height",
116 | item: ".article_content",
117 | },
118 | {
119 | type: "display",
120 | item: ".readall_box",
121 | },
122 | //展开评论
123 | {
124 | type: "click",
125 | item: ".btn_comment_readmore",
126 | },
127 | ],
128 | },
129 | {
130 | name: "CSDN问答",
131 | url: "ask.csdn.net/questions",
132 | handles: [
133 | //PC端:展开全部
134 | {
135 | type: "display",
136 | item: ".expandBtn",
137 | },
138 | {
139 | type: "height",
140 | item: ".normal-style",
141 | },
142 | //PC端:查看等多回答
143 | {
144 | type: "click",
145 | item: ".ic_ask_down_reeow",
146 | },
147 | ],
148 | },
149 | {
150 | name: "CSDN下载",
151 | url: "download.csdn.net/download",
152 | handles: [
153 | {
154 | type: "click",
155 | item: ".fl",
156 | },
157 | //展开全部
158 | {
159 | type: "click",
160 | item: ".unfold-font",
161 | },
162 | //查看更多
163 | {
164 | type: "click",
165 | item: ".el-button--text",
166 | },
167 | ],
168 | },
169 | {
170 | name: "CSDN文库",
171 | url: "wenku.csdn.net/answer/",
172 | handles: [
173 | //展开全部
174 | {
175 | type: "click",
176 | item: ".text-all",
177 | },
178 | ],
179 | },
180 | {
181 | name: "it1352",
182 | url: "it1352.com",
183 | handles: [
184 | //PC端:查看全文:解除公众号限制
185 | {
186 | type: "display",
187 | item: ".arc-body-main-more",
188 | },
189 | {
190 | type: "height",
191 | item: ".arc-body-main",
192 | },
193 | ],
194 | },
195 | {
196 | name: "编程之家",
197 | url: "jb51.cc",
198 | handles: [
199 | //PC端:阅读全文
200 | {
201 | type: "display",
202 | item: "#read-more-wrap",
203 | },
204 | {
205 | type: "height",
206 | item: "#container",
207 | },
208 | //展开
209 | {
210 | type: "height",
211 | item: ".read-more-hidden",
212 | },
213 | ],
214 | },
215 | {
216 | name: "简书",
217 | url: "jianshu.com/p",
218 | handles: [
219 | //阅读全文
220 | {
221 | type: "display",
222 | item: ".collapse-tips",
223 | },
224 | {
225 | type: "height",
226 | item: ".collapse-free-content",
227 | },
228 | //允许滑动
229 | {
230 | type: "overflow",
231 | item: "body",
232 | },
233 | ],
234 | //删除遮挡栏
235 | fun: function () {
236 | let css = document.createElement("style");
237 | css.innerText = ".collapse-free-content::after {height: 0px !important}";
238 | document.head.appendChild(css);
239 | },
240 | },
241 | {
242 | name: "知乎",
243 | url: "www.zhihu.com/question",
244 | handles: [
245 | {
246 | type: "display",
247 | item: ".ContentItem-rightButton",
248 | },
249 | {
250 | type: "height",
251 | item: ".RichContent-inner--collapsed",
252 | },
253 | ],
254 | fun: function () {
255 | let css = document.createElement("style");
256 | //空白遮挡
257 | css.innerText += ".RichContent--unescapable.is-collapsed .RichContent-inner {mask-image: unset !important;}";
258 | //点击按钮
259 | css.innerText += ".RichContent.is-collapsed {cursor: unset !important;}";
260 | document.head.append(css);
261 | },
262 | },
263 | {
264 | name: "百度经验",
265 | url: "jingyan.baidu.com/article",
266 | handles: [
267 | //PC端:展开内容
268 | {
269 | type: "display",
270 | item: ".read-whole-mask",
271 | },
272 | {
273 | type: "height",
274 | item: ".exp-content-container",
275 | },
276 | //展开内容
277 | {
278 | type: "click",
279 | item: ".more-img-opt",
280 | },
281 | ],
282 | },
283 | {
284 | name: "百度知道",
285 | url: "zhidao.baidu.com/question",
286 | handles: [
287 | //展开剩余
288 | {
289 | type: "display",
290 | item: ".w-detail-display-btn",
291 | },
292 | {
293 | type: "height",
294 | item: ".w-detail-container",
295 | },
296 | //PC端:展开全部(1)
297 | {
298 | type: "display",
299 | item: ".wgt-best-mask",
300 | },
301 | {
302 | type: "height",
303 | item: ".best-text",
304 | },
305 | //PC端:展开全部(2)
306 | {
307 | type: "display",
308 | item: ".wgt-answers-mask",
309 | },
310 | {
311 | type: "height",
312 | item: ".answer-text",
313 | },
314 | //PC端:更多回答1
315 | {
316 | type: "display",
317 | item: "#show-hide-container",
318 | },
319 | {
320 | type: "classList",
321 | item: ".answer",
322 | remove: "answer-hide",
323 | },
324 | //PC端:更多回答2
325 | {
326 | type: "display",
327 | item: ".show-answer-dispute",
328 | },
329 | {
330 | type: "classList",
331 | item: ".answer",
332 | remove: "answer-dispute-hide",
333 | },
334 | ],
335 | },
336 | {
337 | name: "百度百科",
338 | url: "baike.baidu.com/item",
339 | handles: [
340 | //展开全部
341 | {
342 | type: "click",
343 | item: ".layout-icons_down-arrow",
344 | },
345 | //点击加载更多
346 | {
347 | type: "display",
348 | item: "#ui_refresh_down",
349 | },
350 | ],
351 | fun: function () {
352 | //点击加载更多
353 | let button = document.querySelector(".yx-load-more-inner");
354 | button.dispatchEvent(new Event("tap"));
355 | },
356 | },
357 | {
358 | name: "百度贴吧",
359 | url: "tieba.baidu.com/p",
360 | handles: [
361 | //PC端:自动展开图片
362 | {
363 | type: "display",
364 | item: ".replace_tip",
365 | },
366 | {
367 | type: "height",
368 | item: ".replace_div",
369 | },
370 | //PC端:自动展开回复
371 | {
372 | type: "click",
373 | item: ".j_lzl_m",
374 | },
375 | ],
376 | },
377 | {
378 | name: "百度文库手机版1",
379 | url: "wk.baidu.com/view",
380 | handles: [
381 | //自动展开
382 | {
383 | type: "height",
384 | item: ".reader-copy",
385 | },
386 | {
387 | //透明遮挡
388 | type: "display",
389 | item: ".blur-bg",
390 | },
391 | ],
392 | fun: function () {
393 | //工具相关内容下移,避免遮挡
394 | let item = document.querySelector(".fold-pager");
395 | if (item) {
396 | item.style.setProperty("margin-top", "0px");
397 | }
398 | },
399 | },
400 | {
401 | name: "百度文库手机版2",
402 | url: "tanbi.baidu.com/h5apptopic/browse/",
403 | handles: [
404 | {
405 | //下载app,继续阅读
406 | type: "display",
407 | item: ".continue-read-wrap",
408 | },
409 | ],
410 | fun: function () {
411 | let item = document.querySelector("#read-view");
412 | item.setAttribute("scrolling", "yes");
413 | },
414 | },
415 | {
416 | name: "百家题库",
417 | url: "easylearn.baidu.com/edu-page/",
418 | handles: [
419 | //阅读全文
420 | {
421 | type: "display",
422 | item: ".shiti-answer .mask",
423 | },
424 | {
425 | type: "height",
426 | item: ".shiti-answer .analysis-text",
427 | },
428 | // 显示完整题目
429 | {
430 | type: "height",
431 | item: ".question-cont .tigan",
432 | },
433 | // 移除遮罩
434 | {
435 | type: "height",
436 | item: ".question-cont .tigan .mask",
437 | },
438 | ],
439 | },
440 | {
441 | name: "百家号",
442 | url: "baijiahao.baidu.com/s",
443 | handles: [
444 | //阅读全文
445 | {
446 | type: "display",
447 | item: ".oPadding",
448 | },
449 | {
450 | type: "height",
451 | item: ".mainContent",
452 | },
453 | //点击展开全文:狐猴浏览器特有bug
454 | {
455 | type: "height",
456 | item: "#mainContentContainer",
457 | },
458 | {
459 | type: "display",
460 | item: ".foldMaskWrapper",
461 | },
462 | ],
463 | },
464 | {
465 | name: "百度新闻",
466 | url: "mbd.baidu.com/newspage/data",
467 | handles: [
468 | //打开百度app:普通新闻
469 | {
470 | type: "display",
471 | item: "[class^=foldMaskWrapper-]",
472 | },
473 | {
474 | type: "height",
475 | item: "#dynamicItem",
476 | },
477 | //打开百度app:百度首页
478 | {
479 | type: "display",
480 | item: ".foldMaskWrapper",
481 | },
482 | {
483 | type: "height",
484 | item: "#mainContentContainer",
485 | },
486 | ],
487 | },
488 | {
489 | name: "新浪新闻",
490 | url: "sina.cn",
491 | handles: [
492 | //展开
493 | {
494 | type: "display",
495 | item: ".look_more",
496 | },
497 | {
498 | type: "height",
499 | item: ".s_card",
500 | },
501 | ],
502 | },
503 | {
504 | name: "网易新闻",
505 | url: "3g.163.com",
506 | handles: [
507 | //展开
508 | {
509 | type: "display",
510 | item: ".show_article",
511 | },
512 | {
513 | type: "height",
514 | item: "article",
515 | },
516 | ],
517 | },
518 | {
519 | name: "搜狐新闻",
520 | url: "sohu.com/a",
521 | handles: [
522 | {
523 | type: "display",
524 | item: ".lookall-box",
525 | },
526 | {
527 | type: "height",
528 | item: "#mp-editor",
529 | },
530 | ],
531 | fun: function () {
532 | onload = function () {
533 | let item = document.querySelector("#artLookAll");
534 | item.click();
535 | clearInterval(interval);
536 | };
537 | },
538 | },
539 | {
540 | name: "腾讯新闻",
541 | url: "view.inews.qq.com/",
542 | handles: [
543 | //点击展开全文
544 | {
545 | type: "display",
546 | item: "[class^=show-more_outer__]",
547 | },
548 | {
549 | type: "display",
550 | item: "[class^=show-more-article_cover__]",
551 | },
552 | {
553 | type: "height",
554 | item: "[class^=show-more_height-not-full__]",
555 | },
556 | ],
557 | },
558 | {
559 | name: "凤凰新闻",
560 | url: "ifeng.com/",
561 | handles: [
562 | //点击展开全文(新闻)
563 | {
564 | type: "display",
565 | item: "[class^=index_more_]",
566 | },
567 | {
568 | type: "display",
569 | item: "[class^=index_tip_",
570 | },
571 | {
572 | type: "height",
573 | item: "[class^=index_main_content_]",
574 | },
575 |
576 | //点击查看完整内容(房产)
577 | {
578 | type: "display",
579 | item: ".showall",
580 | },
581 | {
582 | type: "height",
583 | item: ".article",
584 | },
585 | //展开全文(汽车)
586 | {
587 | type: "display",
588 | item: "[class^=more]",
589 | },
590 | {
591 | type: "height",
592 | item: "[class^=main_content]",
593 | },
594 | //展开(视频简介)
595 | {
596 | type: "click",
597 | item: "[class^=index_videoBrefTextBtn_]",
598 | },
599 | ],
600 | },
601 | {
602 | name: "澎湃新闻",
603 | url: "m.thepaper.cn/newsDetail_forward",
604 | handles: [
605 | //展开全文
606 | {
607 | type: "display",
608 | item: "#clickForMore",
609 | },
610 | {
611 | type: "height",
612 | item: ".newsdetail_body",
613 | },
614 | ],
615 | },
616 | {
617 | name: "新京报",
618 | url: "m.bjnews.com.cn/detail/",
619 | handles: [
620 | //展开全文
621 | {
622 | type: "display",
623 | item: ".shade",
624 | },
625 | {
626 | type: "height",
627 | item: ".article",
628 | },
629 | ],
630 | },
631 | {
632 | name: "央广网",
633 | url: "cnr.cn",
634 | handles: [
635 | //展开全文
636 | {
637 | type: "display",
638 | item: "#readmore",
639 | },
640 | {
641 | type: "height",
642 | item: "#perny-main",
643 | },
644 | ],
645 | },
646 | {
647 | name: "环球网1",
648 | url: "huanqiu.com/article/",
649 | handles: [
650 | //展开全文
651 | {
652 | type: "click",
653 | item: ".unfold-btn",
654 | },
655 | ],
656 | },
657 | {
658 | name: "环球网2",
659 | url: "3w.huanqiu.com/a/",
660 | handles: [
661 | //展开全文
662 | {
663 | type: "click",
664 | item: "#more",
665 | },
666 | ],
667 | },
668 | {
669 | name: "中华网",
670 | url: "3g.china.com/act/",
671 | handles: [
672 | //点击查看全文(剩余n%)
673 | {
674 | type: "display",
675 | item: "#js-continue-reading",
676 | },
677 | {
678 | type: "height",
679 | item: "#artiCon",
680 | },
681 | ],
682 | },
683 | {
684 | name: "今日头条:移动版",
685 | url: "m.toutiao.com/article/",
686 | handles: [
687 | //点击查看完整内容
688 | {
689 | type: "display",
690 | item: ".toggle-button-container",
691 | },
692 | {
693 | type: "display",
694 | item: ".content-shadow",
695 | },
696 | {
697 | type: "height",
698 | item: ".content",
699 | },
700 | ],
701 | },
702 | {
703 | name: "东方资讯",
704 | url: "mini.eastday.com/",
705 | handles: [
706 | //查看全文
707 | {
708 | type: "display",
709 | item: ".Unfolded-btn",
710 | },
711 | {
712 | type: "height",
713 | item: ".article-content",
714 | },
715 | ],
716 | },
717 | {
718 | name: "丁香园",
719 | url: "dxy.cn",
720 | handles: [
721 | //显示第一条评论
722 | {
723 | type: "height",
724 | item: ".dicussion-text",
725 | },
726 | //展开阅读全文
727 | {
728 | type: "display",
729 | item: "[class^=contentWrapBottom___]",
730 | },
731 | {
732 | type: "height",
733 | item: "[class^=contentWrap___]",
734 | },
735 | //机构号:展开阅读全文
736 | {
737 | type: "display",
738 | item: ".show-all",
739 | },
740 | {
741 | type: "height",
742 | item: ".article__content",
743 | },
744 | ],
745 | },
746 | {
747 | name: "健康界",
748 | url: "www.cn-healthcare.com/",
749 | handles: [
750 | //阅读全文
751 | {
752 | type: "display",
753 | item: ".mask",
754 | },
755 | {
756 | type: "height",
757 | item: "#artbody",
758 | },
759 | ],
760 | },
761 | {
762 | name: "有来医生",
763 | url: "m.youlai.cn/",
764 | handles: [
765 | //阅读全文
766 | {
767 | type: "display",
768 | item: ".showBtn--nqouA",
769 | },
770 | {
771 | type: "height",
772 | item: ".show-more",
773 | },
774 | ],
775 | },
776 | {
777 | name: "B站动态",
778 | url: "space.bilibili.com/",
779 | handles: [],
780 | fun: function () {
781 | //PC端展开简介
782 | let item1s = document.querySelectorAll(".folded");
783 | for (let item of item1s) {
784 | item.className = "bili-rich-text__content";
785 | }
786 | let item2s = document.querySelectorAll(".bili-rich-text__action");
787 | for (let item2 of item2s) {
788 | item2.innerText = "收起";
789 | }
790 | },
791 | },
792 | {
793 | name: "B站专栏",
794 | url: "m.bilibili.com/opus/",
795 | handles: [
796 | //展开阅读全文
797 | {
798 | type: "display",
799 | item: ".opus-read-more",
800 | },
801 | {
802 | type: "classList",
803 | item: ".opus-module-content",
804 | remove: "limit",
805 | },
806 | {
807 | type: "classList",
808 | item: ".opus-module-content",
809 | remove: "show-read-text",
810 | },
811 | ],
812 | },
813 | {
814 | name: "微博文章PC版",
815 | url: "weibo.com/ttarticle/p/show?id=",
816 | handles: [
817 | {
818 | type: "height",
819 | item: ".WB_editor_iframe_new",
820 | },
821 | {
822 | type: "display",
823 | item: ".btn_line",
824 | },
825 | ],
826 | },
827 | {
828 | name: "豆瓣",
829 | url: "douban.com",
830 | handles: [
831 | //点击展开全文
832 | {
833 | type: "display",
834 | item: ".oia-readall",
835 | },
836 | {
837 | type: "height",
838 | item: ".note-content",
839 | },
840 | ],
841 | fun: function () {
842 | //展开(简介)
843 | let item1 = document.querySelector(".subject-intro p");
844 | try {
845 | let str = item1.getAttribute("data-content");
846 | if (str) {
847 | item1.innerText = str;
848 | }
849 | } catch (error) {
850 | /* empty */
851 | }
852 | onload = function () {
853 | //展开(评论)
854 | let items2 = document.querySelectorAll(".LinesEllipsis-readmore");
855 | for (let item of items2) {
856 | item.click();
857 | }
858 |
859 | //展开(PC端:评论;简介;人物简介)
860 | let items3 = document.querySelectorAll(".expand,.a_show_full,.fold-switch");
861 | for (let item of items3) {
862 | item.click();
863 | }
864 | };
865 | },
866 | },
867 | {
868 | name: "开源中国",
869 | url: "www.oschina.net/p/",
870 | handles: [
871 | //展开阅读全文
872 | {
873 | type: "display",
874 | item: ".collapse-bar",
875 | },
876 | {
877 | type: "height",
878 | item: ".article-detail",
879 | },
880 | ],
881 | },
882 | {
883 | name: "阿里云开发者社区",
884 | url: "developer.aliyun.com/article",
885 | handles: [
886 | //关注
887 | {
888 | type: "height",
889 | item: ".article-hide-content",
890 | },
891 | {
892 | type: "display",
893 | item: ".article-hide-box",
894 | },
895 | ],
896 | },
897 | {
898 | name: "腾讯云开发者社区",
899 | url: "cloud.tencent.com/developer/article/",
900 | handles: [
901 | //旧版:展开阅读全文
902 | {
903 | type: "height",
904 | item: ".com-markdown-collpase-main",
905 | },
906 | {
907 | type: "display",
908 | item: ".com-markdown-collpase-toggle",
909 | },
910 | //新版:展开阅读全文
911 | {
912 | type: "height",
913 | item: ".cdc-expand-area__main",
914 | },
915 | {
916 | type: "display",
917 | item: ".cdc-expand-area__toggle",
918 | },
919 | ],
920 | },
921 | {
922 | name: "华为云开发者社区",
923 | url: "huaweicloud.csdn.net/",
924 | handles: [
925 | //展开阅读全文
926 | {
927 | type: "height",
928 | item: ".user-article",
929 | },
930 | {
931 | type: "display",
932 | item: ".article-show-more",
933 | },
934 | ],
935 | },
936 | {
937 | name: "360图书馆手机版",
938 | url: "www.360doc.cn/article/",
939 | handles: [
940 | //移动版:展开剩余内容
941 | {
942 | type: "display",
943 | item: ".article_showall",
944 | },
945 | {
946 | type: "height",
947 | item: ".article",
948 | },
949 | ],
950 | },
951 | {
952 | name: "360图书馆PC版",
953 | url: "www.360doc.com/content/",
954 | handles: [
955 | {
956 | type: "classList",
957 | item: "body",
958 | remove: "articleMaxH",
959 | },
960 | ],
961 | },
962 | {
963 | name: "太平洋电脑网",
964 | url: "g.pconline.com.cn/x/",
965 | handles: [
966 | //展开全文
967 | {
968 | type: "display",
969 | item: ".show_article",
970 | },
971 | {
972 | type: "height",
973 | item: ".art-content",
974 | },
975 | ],
976 | },
977 | {
978 | name: "中关村在线",
979 | url: "m.zol.com.cn/article/",
980 | handles: [
981 | //展开全文
982 | {
983 | type: "display",
984 | item: ".unfold-article-btn",
985 | },
986 | {
987 | type: "height",
988 | item: ".article-content",
989 | },
990 | ],
991 | },
992 | {
993 | name: "汽车之家:新闻",
994 | url: "m.autohome.com.cn/news/",
995 | handles: [
996 | //点击展开剩余部分
997 | {
998 | type: "display",
999 | item: "#continue_reading",
1000 | },
1001 | {
1002 | type: "classList",
1003 | item: "#content .fn-hide",
1004 | remove: "fn-hide",
1005 | },
1006 | ],
1007 | },
1008 | {
1009 | name: "汽车之家:车家号",
1010 | url: "chejiahao.m.autohome.com.cn/info/",
1011 | handles: [
1012 | //点击展开剩余部分
1013 | {
1014 | type: "display",
1015 | item: "#continue_reading_new",
1016 | },
1017 | {
1018 | type: "classList",
1019 | item: ".pgc-details .fn-hide",
1020 | remove: "fn-hide",
1021 | },
1022 | ],
1023 | },
1024 | {
1025 | name: "汽车之家:论坛",
1026 | url: "club.m.autohome.com.cn/bbs/",
1027 | handles: [
1028 | //点击展开剩余部分
1029 | {
1030 | type: "display",
1031 | item: "#continue_reading",
1032 | },
1033 | {
1034 | type: "height",
1035 | item: "#topicContentSection",
1036 | },
1037 | {
1038 | type: "classList",
1039 | item: "#topicContentSection .fn-hide",
1040 | remove: "fn-hide",
1041 | },
1042 | ],
1043 | },
1044 | {
1045 | name: "游侠网",
1046 | url: "3g.ali213.net",
1047 | handles: [
1048 | //阅读全文
1049 | {
1050 | type: "display",
1051 | item: ".read-all-con",
1052 | },
1053 | {
1054 | type: "display",
1055 | item: ".read-all-con2",
1056 | },
1057 | {
1058 | type: "height",
1059 | item: ".detail-content",
1060 | },
1061 | ],
1062 | },
1063 | {
1064 | name: "游民星空",
1065 | url: "wap.gamersky.com/",
1066 | handles: [
1067 | //展开全文
1068 | {
1069 | type: "display",
1070 | item: ".gsAreaContextOpen",
1071 | },
1072 | {
1073 | type: "height",
1074 | item: "#gsAreaContext",
1075 | },
1076 | ],
1077 | },
1078 | {
1079 | name: "网易大神",
1080 | url: "m.ds.163.com/",
1081 | handles: [
1082 | //展开全文
1083 | {
1084 | type: "display",
1085 | item: ".feed-page-main-controller",
1086 | },
1087 | {
1088 | type: "height",
1089 | item: ".feed-page__main-content",
1090 | },
1091 | ],
1092 | },
1093 | {
1094 | name: "360文档",
1095 | url: "wenda.so.com/q/",
1096 | handles: [
1097 | //PC端:展开问答
1098 | {
1099 | type: "display",
1100 | item: ".answer-part__has-folder__btn",
1101 | },
1102 | {
1103 | type: "height",
1104 | item: ".answer-part__has-folder",
1105 | },
1106 | //PC端:更多回答
1107 | {
1108 | type: "display",
1109 | item: ".js-unfold-page",
1110 | },
1111 | {
1112 | type: "classList",
1113 | item: ".hide.js-unfold-answer.answer-fold-box",
1114 | remove: "hide",
1115 | },
1116 | //展开完整答案
1117 | {
1118 | type: "display",
1119 | item: ".overflow-cover",
1120 | },
1121 | {
1122 | type: "height",
1123 | item: ".max-height",
1124 | },
1125 | //更多回答
1126 | {
1127 | type: "display",
1128 | item: ".js-rest-icon",
1129 | },
1130 | {
1131 | type: "classList",
1132 | item: ".ans-box.hide",
1133 | remove: "hide",
1134 | },
1135 | ],
1136 | },
1137 | {
1138 | name: "天眼查",
1139 | url: "n.tianyancha.com/content",
1140 | handles: [
1141 | //展开剩余内容
1142 | {
1143 | type: "display",
1144 | item: "[class^=index_other-content-more__]",
1145 | },
1146 | {
1147 | type: "height",
1148 | item: "[class^=index_other-content-container__]",
1149 | },
1150 | ],
1151 | },
1152 | {
1153 | name: "天涯社区",
1154 | url: "bbs.tianya.cn/m/",
1155 | handles: [
1156 | //点击展开完整贴文
1157 | {
1158 | type: "display",
1159 | item: ".openFullPost",
1160 | },
1161 | {
1162 | type: "height",
1163 | item: ".onhide",
1164 | },
1165 | ],
1166 | //删除透明遮挡
1167 | fun: function () {
1168 | let css = document.createElement("style");
1169 | css.innerHTML = ".item-lz .bd.onhide:before{content:none}";
1170 | document.head.append(css);
1171 | },
1172 | },
1173 | {
1174 | name: "新浪财经",
1175 | url: "cj.sina.cn/article",
1176 | handles: [
1177 | //打开app阅读全文
1178 | {
1179 | type: "display",
1180 | item: ".read-unfold-box",
1181 | },
1182 | {
1183 | type: "height",
1184 | item: ".main-article-body",
1185 | },
1186 | ],
1187 | },
1188 | {
1189 | name: "东方财富网",
1190 | url: "wap.eastmoney.com/a/",
1191 | handles: [
1192 | //点击展开完整贴文
1193 | {
1194 | type: "display",
1195 | item: ".fold-btn",
1196 | },
1197 | {
1198 | type: "display",
1199 | item: ".fold-arrow",
1200 | },
1201 | {
1202 | type: "height",
1203 | item: "#articleContent",
1204 | },
1205 | //删除透明遮挡
1206 | {
1207 | type: "display",
1208 | item: ".fold-mask",
1209 | },
1210 | ],
1211 | },
1212 | {
1213 | name: "东方财富网:社区",
1214 | url: "emcreative.eastmoney.com/",
1215 | handles: [
1216 | //点击阅读全文
1217 | {
1218 | type: "display",
1219 | item: ".my_ad_wrap",
1220 | },
1221 | {
1222 | type: "height",
1223 | item: "#text-content",
1224 | },
1225 | ],
1226 | },
1227 | {
1228 | name: "东方财富网:股吧",
1229 | url: "mguba.eastmoney.com/",
1230 | handles: [
1231 | //点击阅读全文
1232 | {
1233 | type: "display",
1234 | item: "#foldup_box",
1235 | },
1236 | {
1237 | type: "height",
1238 | item: "#content",
1239 | },
1240 | ],
1241 | },
1242 | {
1243 | name: "喜马拉雅",
1244 | url: "www.ximalaya.com/",
1245 | handles: [
1246 | //简介
1247 | {
1248 | type: "display",
1249 | item: ".more-intro-wrapper",
1250 | },
1251 | {
1252 | type: "height",
1253 | item: ".layout-main div>article",
1254 | },
1255 | ],
1256 | },
1257 | {
1258 | name: "喜马拉雅",
1259 | url: "m.ximalaya.com/",
1260 | handles: [
1261 | //简介+评论
1262 | {
1263 | type: "height",
1264 | item: ".stretch-box",
1265 | },
1266 | ],
1267 | fun: function () {
1268 | onload = function () {
1269 | let item1 = document.querySelector(".stretch-more");
1270 | let item2 = item1.parentElement;
1271 | item2.remove();
1272 | };
1273 | },
1274 | },
1275 | {
1276 | name: "古诗文网",
1277 | url: "www.gushiwen.cn/",
1278 | handles: [],
1279 | fun: function () {
1280 | let item1s = document.evaluate("//a[contains(text(), '阅读全文')]", document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
1281 | for (let i = 0; i < item1s.snapshotLength; i++) {
1282 | item1s.snapshotItem(i).click();
1283 | }
1284 | clearInterval(interval);
1285 | },
1286 | },
1287 | {
1288 | name: "淘嘟嘟",
1289 | url: "www.taodudu.cc/news/",
1290 | handles: [
1291 | //阅读全文,人机检测
1292 | {
1293 | type: "display",
1294 | item: "#vip",
1295 | },
1296 | {
1297 | type: "height",
1298 | item: "#article_content",
1299 | },
1300 | ],
1301 | },
1302 | {
1303 | name: "代码随想录",
1304 | url: "programmercarl.com/",
1305 | handles: [
1306 | //阅读全文
1307 | {
1308 | type: "display",
1309 | item: "#read-more-wrap",
1310 | },
1311 | {
1312 | type: "height",
1313 | item: "#container",
1314 | },
1315 | ],
1316 | },
1317 | {
1318 | name: "程序猿DD",
1319 | url: "blog.didispace.com",
1320 | handles: [
1321 | //阅读全文,人机检测
1322 | {
1323 | type: "display",
1324 | item: "#read-more-wrap",
1325 | },
1326 | {
1327 | type: "height",
1328 | item: ".article",
1329 | },
1330 | ],
1331 | },
1332 | {
1333 | name: "好网角收藏夹",
1334 | url: "wang1314.com/doc",
1335 | handles: [
1336 | //PC端:阅读全文,人机检测
1337 | {
1338 | type: "display",
1339 | item: "#show_content_bar",
1340 | },
1341 | {
1342 | type: "height",
1343 | item: "#art_body",
1344 | },
1345 | //阅读原文全部内容
1346 | {
1347 | type: "display",
1348 | item: "#show_content_bar",
1349 | },
1350 | {
1351 | type: "height",
1352 | item: "#body_content",
1353 | },
1354 | ],
1355 | },
1356 | {
1357 | name: "科中资源网",
1358 | url: "k4china.com",
1359 | handles: [
1360 | //点击阅读全文
1361 | {
1362 | type: "click",
1363 | item: ".readmore",
1364 | },
1365 | ],
1366 | },
1367 | {
1368 | name: "tofacebook",
1369 | url: "www.tofacebook.com",
1370 | handles: [
1371 | //阅读全部
1372 | {
1373 | type: "height",
1374 | item: ".panel-default",
1375 | },
1376 | {
1377 | type: "display",
1378 | item: ".more-box",
1379 | },
1380 | ],
1381 | },
1382 | ];
1383 | let time = 0;
1384 | let interval = setInterval(() => {
1385 | if (++time == 100) {
1386 | clearInterval(interval);
1387 | }
1388 | for (let website of websites) {
1389 | if (location.href.indexOf(website.url) != -1) {
1390 | if (website.fun) {
1391 | website.fun();
1392 | }
1393 | for (let handle of website.handles) {
1394 | let items = document.querySelectorAll(handle.item);
1395 | if (items.length != 0) {
1396 | if (handle.type == "display") {
1397 | //隐藏遮挡部分
1398 | for (let item of items) {
1399 | item.style.display = "none";
1400 | }
1401 | } else if (handle.type == "height") {
1402 | //加长内容部分
1403 | for (let item of items) {
1404 | item.style.setProperty("height", "unset", "important");
1405 | item.style.setProperty("min-height", "unset", "important");
1406 | item.style.setProperty("max-height", "unset", "important");
1407 | }
1408 | } else if (handle.type == "overflow") {
1409 | //防止无法滑动
1410 | for (let item of items) {
1411 | item.style.setProperty("overflow", "unset", "important");
1412 | }
1413 | } else if (handle.type == "classList") {
1414 | //删除className
1415 | for (let item of items) {
1416 | item.classList.remove(handle.remove);
1417 | }
1418 | } else if (handle.type == "click") {
1419 | //模拟一次点击
1420 | for (let item of items) {
1421 | if (item != null && item.getAttribute("opened") != "yes") {
1422 | item.click();
1423 | item.setAttribute("opened", "yes");
1424 | }
1425 | }
1426 | } else {
1427 | //模拟多次点击
1428 | for (let item of items) {
1429 | if (item) {
1430 | item.click();
1431 | }
1432 | }
1433 | }
1434 | }
1435 | }
1436 | }
1437 | }
1438 | }, 100);
1439 | })();
1440 |
--------------------------------------------------------------------------------
/DoubanAssistant.md:
--------------------------------------------------------------------------------
1 | [](https://github.com/airbashX/UserScript/)
2 | [](https://github.com/airbashX/UserScript/)
3 | [](https://github.com/airbashX/UserScript/)
4 | [](https://www.jsdelivr.com/package/gh/airbashX/UserScript)
5 | [](https://greasyfork.org/zh-CN/users/698573-厌学的骚年)
6 |
7 | # 相关功能:
8 |
9 | 1. 自动抓取IMDB评分
10 |
11 | 2. 恢复点击豆瓣中IMDB电影编号跳转到IMDB的功能;
12 |
13 | 3. 自动校验和快捷搜索6v电影网、电影天堂、新电影天堂、WebHD、rargb、海盗湾、watchsomuch、EXT、tgx资源的功能;
14 |
15 | 4. 增加快捷搜索SubHD、字幕库、射手网、opensubtitle中字幕的功能;
16 |
17 | 5. 增加快捷搜索腾讯、优酷、爱奇艺、哔哩哔哩、西瓜视频、欢喜首映中影视的功能;
18 |
19 | 
20 |
21 | # 现代化UI
22 |
23 | 
24 |
25 | # 增加链接:
26 | |链接|功能|其他功能|
27 | |-|-|---|
28 | |IMDB|✔|显示IMDB评分|
29 | |SubHD|✔||
30 | |字幕库|✔||
31 | |射手网|✔||
32 | |opensubtitle|✔||
33 | |WebHD|✔||
34 | |rargb|✔||
35 | |海盗船|✔||
36 | |1337X|✔||
37 | |watchsomuch|✔||
38 | |tgx|✔||
39 | |EXT|✔||
40 | |6v电影|✔|自动验证|
41 | |电影天堂|✔||
42 | |迅雷电影天堂|✔||
43 | |腾讯视频|✔||
44 | |优酷视频|✔||
45 | |爱奇艺|✔||
46 | |哔哩哔哩|✔||
47 | |西瓜视频|✔||
48 | |欢喜首映|✔||
49 |
50 | 持续支持中...
--------------------------------------------------------------------------------
/DoubanAssistant.user.js:
--------------------------------------------------------------------------------
1 | // ==UserScript==
2 | // @name 豆瓣助手
3 | // @version 0.0.20
4 | // @namespace airbash/DoubanAssistant
5 | // @homepageURL https://github.com/AirBashX/UserScript
6 | // @author airbash
7 | // @description 恢复IMDB的链接,展示IMDB评分,以及增加快捷搜索SubHD、字幕库、射手网、opensubtitle、6V电影网、电影天堂、新电影天堂、WebHD、rargb、海盗湾、watchsomuch、tgx、EXT、腾讯视频、优酷视频、爱奇艺、哔哩哔哩、西瓜视频、欢喜首映中资源的功能
8 | // @match *://movie.douban.com/subject/*
9 | // @connect www.hao6v.me
10 | // @connect www.imdb.com
11 | // @connect dy2018.com
12 | // @grant GM_registerMenuCommand
13 | // @grant GM_unregisterMenuCommand
14 | // @grant GM_setValue
15 | // @grant GM_getValue
16 | // @grant GM_xmlhttpRequest
17 | // @grant GM_addStyle
18 | // @license GPL-3.0
19 | // @icon https://img1.doubanio.com/favicon.ico
20 | // @require https://fastly.jsdelivr.net/npm/sweetalert2@11/dist/sweetalert2.all.min.js
21 | // @require https://fastly.jsdelivr.net/npm/encode-gb2312@0.0.2/encodeToGb2312.min.js
22 | // @run-at document-end
23 | // ==/UserScript==
24 | /* global encodeToGb2312 Swal*/
25 | ///
";
87 | imdb_id_item.after(div);
88 | //删除原本的idmb链接
89 | imdb_item.remove();
90 | imdb_id_item.remove();
91 | }
92 |
93 | /**
94 | * 获取IMDB评分
95 | */
96 | function imdb_score() {
97 | GM_xmlhttpRequest({
98 | url: "https://www.imdb.com/title/" + imdb_id,
99 | onload: function (response) {
100 | let text = response.responseText;
101 | let dp = new DOMParser();
102 | let html = dp.parseFromString(text, "text/html");
103 | let item = html.querySelector("[data-testid=hero-rating-bar__aggregate-rating__score] span");
104 | let imdb_score = item.innerText;
105 |
106 | let str = html.querySelector("#__NEXT_DATA__").textContent;
107 | let json = JSON.parse(str);
108 | let imdb_vote = json.props.pageProps.aboveTheFoldData.ratingsSummary.voteCount;
109 |
110 | let self = document.querySelector(".rating_self").cloneNode(true);
111 | let logo = document.querySelector(".rating_logo").cloneNode(true);
112 | let sectl = document.querySelector("#interest_sectl");
113 | sectl.append(logo);
114 | sectl.append(self);
115 |
116 | //增加IMDB名
117 | logo.innerText = "IMDB评分";
118 | //修改文字评分
119 | self.querySelector(".rating_num").innerText = imdb_score;
120 | //修改图形评分
121 | let classList = self.querySelector(".bigstar").classList;
122 | classList.replace(classList.item(2), "bigstar" + (Math.floor(imdb_score) / 2) * 10);
123 | //修改IMDB人数
124 | self.querySelector(".rating_people span").innerText = imdb_vote;
125 | self.querySelector(".rating_people").href = "https://www.imdb.com/title/" + imdb_id + "/ratings";
126 |
127 | // let div = document.createElement("div");
128 | // div.innerHTML = "IMDb评分:" + score + "
";
129 | // document.querySelector(".rating_wrap").after(div);
130 | },
131 | });
132 | }
133 |
134 | /**
135 | * 侧边栏功能列表
136 | */
137 | const webSites = [
138 | {
139 | id: "group1",
140 | name: "字幕搜索",
141 | links: [
142 | {
143 | name: "SubHD",
144 | url: "subhd.tv",
145 | search: "https://subhd.tv/search/" + douban_cn_name,
146 | },
147 | {
148 | name: "射手网",
149 | url: "assrt.net",
150 | search: "https://assrt.net/sub/?searchword=" + douban_cn_name,
151 | },
152 | {
153 | name: "字幕库",
154 | url: "zimuku.org",
155 | search: "https://so.zimuku.org/search?q=" + douban_cn_name,
156 | },
157 | {
158 | name: "OpenSub",
159 | url: "opensubtitles.org",
160 | search: "https://www.opensubtitles.com/zh-CN/zh-CN/search-all/q-" + imdb_id + "/hearing_impaired-include/machine_translated-/trusted_sources-",
161 | },
162 | ],
163 | },
164 | {
165 | id: "group2",
166 | name: "英文资源",
167 | links: [
168 | {
169 | name: "rargb",
170 | url: "rargb.to",
171 | search: "https://rargb.to/search/?search=" + douban_en_name,
172 | },
173 | {
174 | name: "海盗湾",
175 | url: "thepiratebay10.xyz",
176 | search: "https://thepiratebay10.xyz/search/" + douban_en_name,
177 | },
178 | {
179 | name: "WSM",
180 | url: "watchsomuch.to",
181 | search: "https://watchsomuch.to/Movies/" + douban_en_name,
182 | },
183 | {
184 | name: "tgx",
185 | url: "tgx.rs",
186 | search: "https://tgx.rs/torrents.php?search=" + douban_en_name,
187 | },
188 | {
189 | name: "1377x",
190 | url: "www.1377x.to",
191 | search: "https://www.1377x.to/search/" + douban_en_name + "/1/",
192 | },
193 | {
194 | name: "EXT",
195 | url: "extranet.torrentbay.st",
196 | search: "https://extranet.torrentbay.st/browse/?q=" + douban_en_name,
197 | },
198 | ],
199 | },
200 | {
201 | id: "group3",
202 | name: "中文资源",
203 | links: [
204 | {
205 | name: "6v电影网",
206 | url: "www.hao6v.tv",
207 | search: "https://www.hao6v.me/e/search/index.php",
208 | data: "show=title%2Csmalltext&tempid=1&keyboard=" + douban_cn_name_gbk + "&tbname=article&x=0&y=0",
209 | type: "xhr",
210 | anonymous: true,
211 | },
212 | {
213 | name: "电影天堂",
214 | url: "www.dygod.net",
215 | search: "https://www.dygod.net/",
216 | },
217 | {
218 | name: "新电影天堂",
219 | url: "www.xl720.com",
220 | search: "https://www.xl720.com/?s=" + douban_cn_name,
221 | },
222 | ],
223 | },
224 | {
225 | id: "group4",
226 | name: "正版资源",
227 | links: [
228 | {
229 | name: "腾讯视频",
230 | url: "v.qq.com",
231 | search: "https://v.qq.com/x/search/?q=" + douban_cn_name,
232 | },
233 | {
234 | name: "优酷视频",
235 | url: "youku.com",
236 | search: "https://so.youku.com/search_video/q_" + douban_cn_name,
237 | },
238 | {
239 | name: "爱奇艺",
240 | url: "iqiyi.com",
241 | search: "https://so.iqiyi.com/so/q_" + douban_cn_name,
242 | },
243 | {
244 | name: "哔哩哔哩",
245 | url: "bilibili.com",
246 | search: "https://search.bilibili.com/all?keyword=" + douban_cn_name,
247 | },
248 | {
249 | name: "西瓜视频",
250 | url: "www.ixigua.com",
251 | search: "https://www.ixigua.com/search/" + douban_cn_name,
252 | },
253 | {
254 | name: "欢喜首映",
255 | url: "www.huanxi.com",
256 | search: "https://www.huanxi.com/search.shtml?sv=" + douban_cn_name,
257 | },
258 | ],
259 | },
260 | ];
261 |
262 | /**
263 | * 功能列表
264 | */
265 | const GMValues = [
266 | {
267 | id: "imdb_link",
268 | name: "IMDB链接",
269 | fun: imdb_link,
270 | },
271 | {
272 | id: "imdb_score",
273 | name: "IMDB评分",
274 | fun: imdb_score,
275 | },
276 | ];
277 |
278 | if (imdb_id) {
279 | for (let GMValue of GMValues) {
280 | if (GM_getValue(GMValue.id, true)) {
281 | GMValue.fun();
282 | }
283 | }
284 | }
285 |
286 | aside();
287 |
288 | /**
289 | * 脚本工具菜单
290 | */
291 | GM_registerMenuCommand("配置", () => {
292 | configuration();
293 | });
294 |
295 | /**
296 | * 侧边栏功能
297 | */
298 | function aside() {
299 | let aside = document.querySelector(".aside");
300 | for (let webSite of webSites) {
301 | let div = document.createElement("div");
302 | div.className = "resource";
303 | if (GM_getValue(webSite.id, true)) {
304 | div.innerHTML = "