├── .gitignore
├── .eslintrc
├── GptCleaner.user.js
├── RemoveSuffix.user.js
├── RemoveSuffix.md
├── DoubanAssistant.md
├── JenkinsAssistant.user.js
├── AutoDarkMode.md
├── LinkManager.md
├── AnnoyancesInterception.md
├── README.md
├── NetdiskAssistant.user.js
├── AutoUnfold.md
├── DoubanAssistant.user.js
├── LinkManager.user.js
├── AutoDarkMode.user.js
├── AutoUnfold.user.js
├── LICENSE
└── AnnoyancesInterception.user.js
/.gitignore:
--------------------------------------------------------------------------------
1 | Changelog*
2 | WebSite*
--------------------------------------------------------------------------------
/.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 |
--------------------------------------------------------------------------------
/GptCleaner.user.js:
--------------------------------------------------------------------------------
1 | // ==UserScript==
2 | // @name GPT清理助手
3 | // @namespace airbash/GptCleaner
4 | // @author airbash
5 | // @homepageURL https://github.com/AirBashX/UserScript
6 | // @version 0.0.2
7 | // @description 每次进入gpt页面,删除之前的聊天记录
8 | // @match *://*.aichatos.xyz/*
9 | // @license GPL-3.0
10 | // @run-at document-start
11 | // ==/UserScript==
12 |
13 | (function () {
14 | "use strict";
15 | localStorage.removeItem("chatStorage");
16 | })();
--------------------------------------------------------------------------------
/RemoveSuffix.user.js:
--------------------------------------------------------------------------------
1 | // ==UserScript==
2 | // @name 移除复制后缀
3 | // @version 1.0.3
4 | // @namespace airbash/RemoveSuffix
5 | // @homepage https://github.com/AirBashX/UserScript
6 | // @author airbash
7 | // @description 移除复制后缀,手机、电脑全平台通用,长期维护:CSDN、简书、掘金、知乎专栏、B站专栏、力扣
8 | // @match *://*.csdn.net/*
9 | // @match *://*.juejin.cn/*
10 | // @match *://*.jianshu.com/*
11 | // @match *://www.zhihu.com/*
12 | // @match *://www.bilibili.com/read/*
13 | // @match *://leetcode.cn/*
14 | // @run-at document-start
15 | // @grant none
16 | // @license GPL-3.0
17 | // ==/UserScript==
18 |
19 | (function () {
20 | "use strict";
21 |
22 | function copy() {
23 | document.addEventListener(
24 | "copy",
25 | function (event) {
26 | event.stopPropagation();
27 | },
28 | true
29 | );
30 | }
31 |
32 | function userSelect() {
33 | let style = document.createElement("style");
34 | style.append("*{user-select:auto !important}");
35 | document.head.append(style);
36 | }
37 |
38 | copy();
39 | userSelect();
40 | })();
41 |
--------------------------------------------------------------------------------
/RemoveSuffix.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 |
10 | # 相关脚本:
11 | | 名称 | 功能 |
12 | | :----------- | :----------------------------------------------------------- |
13 | | **[自动展开](https://greasyfork.org/zh-CN/scripts/438656)** | 自动展开文章或新闻等`隐藏`、`折叠`部分 |
14 | | **[骚扰拦截](https://greasyfork.org/zh-CN/scripts/440871)** | 自动拦截`下载弹窗`、`悬浮按钮`、`登录弹窗`等影响用户体验的骚扰元素 |
15 | | **[链接管理](https://greasyfork.org/zh-CN/scripts/443670)** | 取消点击链接后跳转到安全页面 |
16 | | **[移除复制后缀](https://greasyfork.org/zh-CN/scripts/472307)** | 移除复制后附带的`后缀`、`网站声明` |
17 |
18 | # 适配网站:
19 | |网站名|PC|Phone|
20 | |-|-|-|
21 | |CSDN|✔|✔|
22 | |掘金|✔|✔|
23 | |简书|✔|✔|
24 | |知乎专栏|✔|✔|
25 | |B站专栏|✔|✔|
26 | |力扣|✔|✔|
27 | 持续支持中...
--------------------------------------------------------------------------------
/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 | # 增加链接:
22 | |链接|功能|其他功能|
23 | |-|-|---|
24 | |IMDB|✔|显示IMDB评分|
25 | |SubHD|✔||
26 | |字幕库|✔||
27 | |射手网|✔||
28 | |opensubtitle|✔||
29 | |imbt|✔||
30 | |rargb|✔||
31 | |海盗船|✔||
32 | |1337X|✔||
33 | |watchsomuch|✔||
34 | |limetorrents|✔||
35 | |EXT|✔||
36 | |yts|✔||
37 | |6v电影|✔|自动验证|
38 | |电影天堂|✔||
39 | |soali|✔||
40 | |混合盘|✔||
41 | |伏羲盘|✔||
42 | |小云搜索|✔||
43 | |V盘搜|✔||
44 | |懒盘搜索|✔||
45 | |夸克盘搜|✔||
46 | |阿里盘搜|✔||
47 | |盘了个盘|✔||
48 | |腾讯视频|✔||
49 | |优酷视频|✔||
50 | |爱奇艺|✔||
51 | |哔哩哔哩|✔||
52 | |搜音视频|✔||
53 | |欢喜首映|✔||
54 |
55 | 持续支持中...
--------------------------------------------------------------------------------
/JenkinsAssistant.user.js:
--------------------------------------------------------------------------------
1 | // ==UserScript==
2 | // @name Jenkins助手
3 | // @author airbash
4 | // @version 0.0.1
5 | // @namespace airbash/JenkinsAssistant
6 | // @homepageURL https://github.com/AirBashX/UserScript
7 | // @description 过滤健康程度低、不经常更新的jenkins插件
8 | // @match *://plugins.jenkins.io/ui/search*
9 | // @grant GM_addStyle
10 | // @grant GM_getValue
11 | // @grant GM_setValue
12 | // @icon https://www.jenkins.io/favicon.ico
13 | // @run-at document-end
14 | // @license GPL-3.0
15 | // ==/UserScript==
16 | ///
17 | (function () {
18 | "use strict";
19 | let inter = setInterval(() => {
20 | let CategoryList = document.querySelector(".CategoryList");
21 | if (CategoryList) {
22 | let li = document.createElement("li");
23 | li.className = "Other";
24 | //
25 | li.innerHTML = '';
26 | CategoryList.prepend(li);
27 | let health = document.querySelector("[name=health]");
28 | let display = GM_getValue("display", false);
29 | health.checked = display;
30 | saerchHandler(health)
31 | checkedHandler(health);
32 | health.addEventListener("change", function () {
33 | checkedHandler(health);
34 | });
35 | clearInterval(inter);
36 | }
37 | }, 10000);
38 |
39 | function saerchHandler(health) {
40 | let button = document.querySelectorAll(".btn-primary");
41 | button[1].onclick = function () {
42 | health.checked=false;
43 | GM_setValue("display", false);
44 | };
45 | let items = document.querySelectorAll(".headerContainer label:not(.exclude),[name=showAll]");
46 | for (let item of items) {
47 | item.onclick=function(){
48 | health.checked=false;
49 | GM_setValue("display", false);
50 | }
51 | }
52 |
53 | }
54 |
55 | function checkedHandler(health) {
56 | let items = document.querySelectorAll(".SearchResults--ItemBox");
57 | if (health.checked) {
58 | for (let item of items) {
59 | if (item.querySelector(".bg-warning,.bg-danger")) {
60 | GM_setValue("display", true);
61 | item.style.display = "none";
62 | }
63 | }
64 | } else {
65 | for (let item of items) {
66 | GM_setValue("display", false);
67 | item.style.display = "unset";
68 | }
69 | }
70 | }
71 | })();
72 |
--------------------------------------------------------------------------------
/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 | | DeepSeek | ✔ | | |
28 | | GitHub | ✔ | | 需要一些操作才能使功能生效,具体查看 [GitHub 切换说明](#github-切换说明) |
29 | | Pixiv | ✔ | | |
30 | | Wikipedia | ✔ | | |
31 | | 风车动漫 | ✔ | | |
32 |
33 | 持续支持中...
34 |
35 | ## 注释
36 |
37 | ### GitHub 切换说明
38 |
39 | - 由于 GitHub 的主题切换功能隐藏得极为隐蔽,无法使用正常手段切换。唯一的方式需依赖还在测试阶段的 `Command Palette` 功能使用命令进行切换
40 |
41 | - 开启方式:`My Profile` -> `Feature preview` 中,将 `Command Palette` 设置为 `Enable`
42 |
--------------------------------------------------------------------------------
/LinkManager.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. 绕过搜索引擎(百度、搜狗、360、必应)搜索结果中的重定向链接,直链访问原始网站(受搜索引擎的限制,现在仅支持部分结果);
10 | 2. 删除网站重定向到安全页面,减少操作步骤和响应时间;
11 | 3. 自动跳转中文文档:默认关闭,需要在`Tampermonkey`+`Violentmonkey`+`ScriptCat`+`Via`等油猴插件菜单中开启;
12 |
13 | # 相关脚本:
14 | | 名称 | 功能 |
15 | | :----------- | :----------------------------------------------------------- |
16 | | **[自动展开](https://greasyfork.org/zh-CN/scripts/438656)** | 自动展开文章或新闻等`隐藏`、`折叠`部分 |
17 | | **[骚扰拦截](https://greasyfork.org/zh-CN/scripts/440871)** | 自动拦截`下载弹窗`、`悬浮按钮`、`登录弹窗`等影响用户体验的骚扰元素 |
18 | | **[链接管理](https://greasyfork.org/zh-CN/scripts/443670)** | 取消点击链接后跳转到安全页面 |
19 | | **[移除复制后缀](https://greasyfork.org/zh-CN/scripts/472307)** | 移除复制后附带的`后缀`、`网站声明` |
20 |
21 | # 适配网站:
22 | |网站名|PC|Phone|其他功能|
23 | |-|-|-|-|
24 | |百度搜索|✔|✔||
25 | |搜狗搜索|✔|✔||
26 | |360搜索|✔|✔||
27 | |必应搜索|✔|✔||
28 | |谷歌搜索|✔|✔||
29 | |CSDN|✔|✔||
30 | |简书|✔|✔||
31 | |掘金|✔|✔||
32 | |知乎|✔|✔||
33 | |知乎专栏|✔|✔||
34 | |百度贴吧|✔|✔||
35 | |开源中国|✔|✔||
36 | |gitee|✔|✔||
37 | |leetcode|✔|✔||
38 | |51CTO|✔|✔||
39 | |423down|✔|✔||
40 | |酷安|✔|✔||
41 | |eslint文档|✔|✔|跳转中文文档|
42 | |MDN火狐|✔|✔|跳转中文文档|
43 | |微软文档|✔|✔|跳转中文文档|
44 | |tampermonkey|✔|✔|跳转中文文档|
45 |
46 | 感谢:[Maritedo](https://github.com/AirBashX/UserScript/issues/25)对本项目的代码提交
--------------------------------------------------------------------------------
/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 | |夸克网盘|✔|✔|✔|✔|去除登录提示|
90 | 持续支持中...
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # aibrashX/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 | 🔨 自用的油猴脚本,支持手机和PC双平台,**有什么需求、建议、问题直接提 [Issues](https://github.com/airbashX/UserScript/issues/new/choose)**也可以前往 GreasyFork 脚本页向我反馈,觉得**好用请点个 ⭐ 鼓励一下叭~**
10 |
11 | ## 脚本列表
12 |
13 | | 脚本 | 名称 | 功能 | 安装 |
14 | | :--------------------: | :----------- | :----------------------------------------------------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: |
15 | | AutoUnfold | **自动展开** | 自动展开文章或新闻等`隐藏`、`折叠`部分 | **[GreasyFork](https://greasyfork.org/zh-CN/scripts/438656)**
**[github](https://github.com/AirBashX/UserScript/raw/master/AutoUnfold.user.js)**
**[jsdelivr](https://cdn.jsdelivr.net/gh/AirBashX/UserScript@master/AutoUnfold.user.js)** |
16 | | AnnoyancesInterception | **骚扰拦截** | 自动拦截或删除`下载弹窗`、`悬浮按钮`等影响用户体验的骚扰元素 | **[GreasyFork](https://greasyfork.org/zh-CN/scripts/440871)**
**[github](https://github.com/AirBashX/UserScript/raw/master/AnnoyancesInterception.user.js)**
**[jsdelivr](https://cdn.jsdelivr.net/gh/AirBashX/UserScript@master/AnnoyancesInterception.user.js)** |
17 | | LinkManager | **链接管理** | 取消点击链接后跳转到安全页面 | **[GreasyFork](https://greasyfork.org/zh-CN/scripts/443670)**
**[github](https://github.com/AirBashX/UserScript/raw/master/LinkManager.user.js)**
**[jsdelivr](https://cdn.jsdelivr.net/gh/AirBashXt@master/UserScript/LinkManager.user.js)** |
18 | | DoubanAssistant | **豆瓣助手** | 恢复IMDB链接,快速搜索字幕资源 | **[GreasyFork](https://greasyfork.org/zh-CN/scripts/456585)**
**[github](https://github.com/AirBashX/UserScript/raw/master/DoubanAssistant.user.js)**
**[jsdelivr](https://cdn.jsdelivr.net/gh/AirBashXt@master/UserScript/DoubanAssistant.user.js)** |
19 |
20 | > _jsdelivr 安装途径会比其他途径晚 24 小时刷新_
21 |
22 | ---
23 |
24 |
25 | ## License
26 |
27 | The GPL-3.0 License.
28 |
29 | 所有脚本仅供学习交流,请勿用于商用等其他用途。
30 |
31 | 脚本所有权归 AirBashX(厌学的骚年) 所有。
--------------------------------------------------------------------------------
/NetdiskAssistant.user.js:
--------------------------------------------------------------------------------
1 | // ==UserScript==
2 | // @name 网盘助手
3 | // @version 0.0.1
4 | // @namespace airbash/Netdiskassistant
5 | // @homepageURL https://github.com/AirBashX/UserScript
6 | // @author airbash
7 | // @description 点击文件直接下载或跳转:蓝凑云、猫狸盘搜
8 | // @match *://*.lanzoub.com/*
9 | // @match *://*.lanzouc.com/*
10 | // @match *://*.lanzoue.com/*
11 | // @match *://*.lanzouf.com/*
12 | // @match *://*.lanzouh.com/*
13 | // @match *://*.lanzoui.com/*
14 | // @match *://*.lanzouj.com/*
15 | // @match *://*.lanzouk.com/*
16 | // @match *://*.lanzoul.com/*
17 | // @match *://*.lanzoum.com/*
18 | // @match *://*.lanzouo.com/*
19 | // @match *://*.lanzoup.com/*
20 | // @match *://*.lanzouq.com/*
21 | // @match *://*.lanzout.com/*
22 | // @match *://*.lanzouu.com/*
23 | // @match *://*.lanzouv.com/*
24 | // @match *://*.lanzouw.com/*
25 | // @match *://*.lanzoux.com/*
26 | // @match *://*.lanzouy.com/*
27 | // @match *://*.lanzob.com/*
28 | // @match *://*.lanzoe.com/*
29 | // @match *://*.lanzof.com/*
30 | // @match *://*.lanzoh.com/*
31 | // @match *://*.lanzoi.com/*
32 | // @match *://*.lanzoj.com/*
33 | // @match *://*.lanzol.com/*
34 | // @match *://*.lanzom.com/*
35 | // @match *://*.lanzoo.com/*
36 | // @match *://*.lanzop.com/*
37 | // @match *://*.lanzoq.com/*
38 | // @match *://*.lanzov.com/*
39 | // @match *://*.lanzow.com/*
40 | // @match *://*.lanzox.com/*
41 | // @match *://*.lanzoy.com/*
42 | // @match *://pan.lanzou.com/*
43 | // @match *://pc.woozooo.com/*
44 | // @match *://www.alipansou.com/*
45 | // @connect www.aliyundrive.com
46 | // @grant GM_openInTab
47 | // @grant GM_xmlhttpRequest
48 | // @grant window.close
49 | // @license GPL-3.0
50 | // @run-at document-start
51 | // ==/UserScript==
52 |
53 | (function () {
54 | "use strict";
55 | const website_url = location.href;
56 | //猫狸网盘:文件页
57 | if (website_url.search("www.alipansou.com/search?") != -1) {
58 | onload = function () {
59 | let file_lists = document.querySelectorAll('.van-row a[href^="/s/"]');
60 | for (let list of file_lists) {
61 | list.parentElement.addEventListener("click", function (e) {
62 | e.preventDefault(); // 阻止默认打开链接事件
63 | //自动打开网盘
64 | GM_xmlhttpRequest({
65 | url: list.href.replace("/s/", "/cv/"),
66 | headers: {
67 | referer: list.href,
68 | },
69 | onload: function (response) {
70 | GM_openInTab(response.finalUrl, { active: true });
71 | },
72 | });
73 | });
74 | }
75 | };
76 | //猫狸网盘:跳转页
77 | } else if (website_url.search("www.alipansou.com/s/") != -1) {
78 | //关闭关注提示:可有可无
79 | document.cookie = "no_show_donate=1;max-age=100000000";
80 |
81 | GM_xmlhttpRequest({
82 | url: website_url.replace("/s/", "/cv/"),
83 | headers: {
84 | referer: website_url,
85 | },
86 | onload: function (response) {
87 | GM_openInTab(response.finalUrl, { active: true });
88 | window.close();
89 | },
90 | });
91 | } else {
92 | let inter = setInterval(() => {
93 | //蓝凑云盘:列表页
94 | let file_lists = document.querySelectorAll("#infos a");
95 | if (file_lists.length > 0) {
96 | for (let list of file_lists) {
97 | list.addEventListener("click", function (e) {
98 | e.preventDefault(); // 阻止默认打开链接事件
99 | GM_openInTab(list.href); // 后台打开
100 | });
101 | }
102 | clearInterval(inter);
103 | }
104 |
105 | //蓝凑云盘:跳转页
106 | let download_file = document.querySelector("#tourl a");
107 | if (download_file) {
108 | GM_openInTab(download_file.href);
109 | window.top.close();
110 | }
111 | }, 1000);
112 | }
113 | })();
114 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/DoubanAssistant.user.js:
--------------------------------------------------------------------------------
1 | // ==UserScript==
2 | // @name 豆瓣助手
3 | // @version 1.1.1
4 | // @namespace airbash/DoubanAssistant
5 | // @homepageURL https://github.com/AirBashX/UserScript
6 | // @author airbash
7 | // @description 恢复IMDB的链接,展示IMDB评分,以及增加快捷搜索SubHD、字幕库、射手网、opesubtitle、6V电影网、电影天堂、新电影天堂、rarbg、rargb、海盗湾、limetorrents、watchsomuch、EXT、yts、imbt、腾讯视频、优酷视频、爱奇艺、哔哩哔哩、抖音视频、欢喜首映、soali、混合盘、伏羲盘、小云搜索、V盘搜、懒盘搜索、夸克盘搜、阿里盘搜、盘了个盘中资源的功能
8 | // @match *://movie.douban.com/*
9 | // @match *://www.douban.com/personage/*
10 | // @connect www.hao6v.me
11 | // @connect www.imdb.com
12 | // @connect dy2018.com
13 | // @grant GM_registerMenuCommand
14 | // @grant GM_unregisterMenuCommand
15 | // @grant GM_setValue
16 | // @grant GM_getValue
17 | // @grant GM_xmlhttpRequest
18 | // @grant GM_addStyle
19 | // @license GPL-3.0
20 | // @icon https://img1.doubanio.com/favicon.ico
21 | // @require https://fastly.jsdelivr.net/npm/sweetalert2@11/dist/sweetalert2.all.min.js
22 | // @require https://fastly.jsdelivr.net/npm/encode-gb2312@0.0.2/encodeToGb2312.min.js
23 | // @run-at document-end
24 | // ==/UserScript==
25 | /* global encodeToGb2312 Swal*/
26 | ///
27 | ///
28 | (function () {
29 | // "use strict";
30 | const url = location.href;
31 | const head = document.head;
32 | let imdb_id_item, imdb_id, douban_en_name, douban_cn_name, douban_gbk_name;
33 |
34 | if (url.includes("www.douban.com/personage/")) {
35 | imdb_id_item = getImdbIdItem(".subject-property", '//span[contains(text(), "IMDb编号:")]/following::*[1]');
36 | imdb_id = imdb_id_item.textContent.trim();
37 | imdbLink("https://www.imdb.com/name/");
38 | }
39 |
40 | if (url.includes("movie.douban.com/subject/")) {
41 | imdb_id_item = getImdbIdItem("#info", '//span[contains(text(), "IMDb:")]/following::text()[1]');
42 | imdb_id = imdb_id_item.textContent.trim();
43 |
44 | //获取豆瓣中文名
45 | douban_cn_name = head.querySelector("title").innerText.slice(9, -6);
46 | //获取GBK编码的豆瓣中文名
47 | douban_gbk_name = encodeToGb2312(douban_cn_name).replace(/(.{2})/gi, "%$1");
48 |
49 | const doubanEnName1 = getDoubanEnName1();
50 | const doubanEnName2 = getDoubanEnName2();
51 |
52 | if (/^[a-zA-Z0-9]/.test(doubanEnName1)) {
53 | douban_en_name = doubanEnName1;
54 | } else if (doubanEnName2) {
55 | douban_en_name = doubanEnName2;
56 | } else {
57 | douban_en_name = douban_cn_name;
58 | }
59 | }
60 |
61 | /**
62 | * 获取imdb_id所在的元素
63 | *
64 | * @param {string} node The node selector
65 | * @param {string} imdb_id_Xpath The imdb_id xpath
66 | * @return {string} imdb_id_item
67 | */
68 | function getImdbIdItem(node, imdb_id_Xpath) {
69 | const info_item = document.querySelector(node);
70 | const imdb_id_item = document.evaluate(imdb_id_Xpath, info_item, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
71 | return imdb_id_item;
72 | }
73 |
74 | /**
75 | * 恢复IMDB链接
76 | *
77 | * @param {string} imdb_url The imdb url
78 | */
79 | function imdbLink(imdb_url) {
80 | //创建新的元素
81 | const span = document.createElement("span");
82 | span.innerHTML = '' + imdb_id + "
";
83 | imdb_id_item.after(span);
84 | //删除旧的元素
85 | imdb_id_item.remove();
86 | }
87 |
88 | /**
89 | * 获取豆瓣英文名
90 | *
91 | * @return {string} The douban en name 1.
92 | */
93 | function getDoubanEnName1() {
94 | const douban_en_names = document.querySelector("#content > h1 > span:nth-child(1)").innerHTML;
95 | const douban_en_name = douban_en_names.split(douban_cn_name)[1].trim();
96 | return douban_en_name;
97 | }
98 |
99 | /**
100 | * 获取备用豆瓣英文名
101 | *
102 | * @return {string} The douban en name 2.
103 | */
104 | function getDoubanEnName2() {
105 | const douban_items = document.querySelectorAll("#info .pl");
106 | for (const pl of douban_items) {
107 | if ("又名:" == pl.textContent) {
108 | const movieNames = pl.nextSibling.textContent.trim().split(" / ");
109 | for (const name of movieNames) {
110 | if (/^[a-zA-Z0-9]/.test(name)) {
111 | return name;
112 | }
113 | }
114 | }
115 | }
116 | }
117 |
118 | /**
119 | * 获取IMDB评分
120 | */
121 | function getImdbScore() {
122 | GM_xmlhttpRequest({
123 | url: "https://www.imdb.com/title/" + imdb_id,
124 | onload: function (response) {
125 | const text = response.responseText;
126 | const dp = new DOMParser();
127 | const html = dp.parseFromString(text, "text/html");
128 | const item = html.querySelector("[data-testid=hero-rating-bar__aggregate-rating__score] span");
129 | const imdb_score = item.innerText;
130 |
131 | const str = html.querySelector("#__NEXT_DATA__").textContent;
132 | const json = JSON.parse(str);
133 | const imdb_vote = json.props.pageProps.aboveTheFoldData.ratingsSummary.voteCount;
134 |
135 | const self = document.querySelector(".rating_self").cloneNode(true);
136 | const logo = document.querySelector(".rating_logo").cloneNode(true);
137 | const sectl = document.querySelector("#interest_sectl");
138 | sectl.append(logo);
139 | sectl.append(self);
140 |
141 | //增加IMDB名
142 | logo.innerText = "IMDB评分";
143 | //修改文字评分
144 | self.querySelector(".rating_num").innerText = imdb_score;
145 | //修改图形评分
146 | const classList = self.querySelector(".bigstar").classList;
147 | classList.replace(classList.item(2), "bigstar" + (Math.floor(imdb_score) / 2) * 10);
148 | //修改IMDB人数
149 | self.querySelector(".rating_people span").innerText = imdb_vote;
150 | self.querySelector(".rating_people").href = "https://www.imdb.com/title/" + imdb_id + "/ratings";
151 |
152 | // const div = document.createElement("div");
153 | // div.innerHTML = "IMDb评分:" + score + "
";
154 | // document.querySelector(".rating_wrap").after(div);
155 | },
156 | });
157 | }
158 |
159 | /**
160 | * 侧边栏功能列表
161 | */
162 | const webSites = [
163 | {
164 | id: "group1",
165 | name: "正版资源",
166 | links: [
167 | {
168 | name: "腾讯视频",
169 | url: "v.qq.com",
170 | search: "https://v.qq.com/x/search/?q=" + douban_cn_name,
171 | },
172 | {
173 | name: "优酷视频",
174 | url: "youku.com",
175 | search: "https://so.youku.com/search_video/q_" + douban_cn_name,
176 | },
177 | {
178 | name: "爱奇艺",
179 | url: "iqiyi.com",
180 | search: "https://so.iqiyi.com/so/q_" + douban_cn_name,
181 | },
182 | {
183 | name: "哔哩哔哩",
184 | url: "bilibili.com",
185 | search: "https://search.bilibili.com/all?keyword=" + douban_cn_name,
186 | },
187 | {
188 | name: "搜音视频",
189 | url: "www.ixigua.com",
190 | search: "https://www.douyin.com/root/search/" + douban_cn_name,
191 | },
192 | {
193 | name: "欢喜首映",
194 | url: "www.huanxi.com",
195 | search: "https://www.huanxi.com/search.shtml?sv=" + douban_cn_name,
196 | },
197 | ],
198 | },
199 | {
200 | id: "group2",
201 | name: "中文资源",
202 | links: [
203 | {
204 | name: "6v电影网",
205 | url: "www.hao6v.tv",
206 | search: "https://www.hao6v.me/e/search/index.php",
207 | data: "show=title%2Csmalltext&tempid=1&keyboard=" + douban_gbk_name + "&tbname=article&x=0&y=0",
208 | type: "xhr",
209 | anonymous: true,
210 | },
211 | {
212 | name: "电影天堂",
213 | url: "www.dygod.net",
214 | search: "https://www.dygod.net/",
215 | },
216 | {
217 | name: "新电影天堂",
218 | url: "www.xl720.com",
219 | search: "https://www.xl720.com/?s=" + douban_cn_name,
220 | },
221 | ],
222 | },
223 | {
224 | id: "group3",
225 | name: "英文资源",
226 | links: [
227 | {
228 | name: "rarbg",
229 | url: "rarbg.torrentbay.st",
230 | search: "https://rarbg.torrentbay.st/get-posts/keywords:" + douban_en_name,
231 | },
232 | {
233 | name: "海盗湾",
234 | url: "thepiratebay10.xyz",
235 | search: "https://thepiratebay10.xyz/search/" + douban_en_name,
236 | },
237 | {
238 | name: "Lime",
239 | url: "limetorrents.asia",
240 | search: "https://limetorrents.asia/search?catname=&q=" + douban_en_name,
241 | },
242 | {
243 | name: "imbt",
244 | url: "imbt.one",
245 | search: "https://imbt.one/i/" + imdb_id,
246 | },
247 | {
248 | name: "1377x",
249 | url: "www.1377x.to",
250 | search: "https://www.1377x.to/search/" + douban_en_name + "/1/",
251 | },
252 | {
253 | name: "EXT",
254 | url: "extranet.torrentbay.st",
255 | search: "https://extranet.torrentbay.st/browse/?q=" + douban_en_name,
256 | },
257 | {
258 | name: "yts",
259 | url: "yts.torrentbay.st",
260 | search: "https://yts.torrentbay.st/browse-movies/" + douban_en_name,
261 | },
262 | {
263 | name: "WSM",
264 | url: "watchsomuch.to",
265 | search: "https://watchsomuch.to/Movies/" + douban_en_name,
266 | },
267 | {
268 | name: "rargb",
269 | url: "rargb.to",
270 | search: "https://rargb.to/search/?search=" + douban_en_name,
271 | },
272 | ],
273 | },
274 | {
275 | id: "group4",
276 | name: "字幕搜索",
277 | links: [
278 | {
279 | name: "SubHD",
280 | url: "subhd.tv",
281 | search: "https://subhd.tv/search/" + douban_cn_name,
282 | },
283 | {
284 | name: "射手网",
285 | url: "assrt.net",
286 | search: "https://assrt.net/sub/?searchword=" + douban_cn_name,
287 | },
288 | {
289 | name: "字幕库",
290 | url: "zimuku.org",
291 | search: "https://so.zimuku.org/search?q=" + douban_cn_name,
292 | },
293 | {
294 | name: "OpenSub",
295 | url: "opensubtitles.org",
296 | search: "https://www.opensubtitles.com/zh-CN/zh-CN/search-all/q-" + imdb_id + "/hearing_impaired-include/machine_translated-/trusted_sources-",
297 | },
298 | ],
299 | },
300 | {
301 | id: "group5",
302 | name: "网盘搜索",
303 | links: [
304 | {
305 | name: "soali",
306 | url: "assrt.net",
307 | search: "https://soali.net/search?keyword=" + douban_cn_name + "&app=quark",
308 | },
309 | {
310 | name: "混合盘",
311 | url: "hunhepan.com",
312 | search: "https://hunhepan.com/search?enabled=true&q=" + douban_cn_name,
313 | },
314 | {
315 | name: "伏羲盘",
316 | url: "fuxipan.com",
317 | search: "https://fuxipan.com/search?q=" + douban_cn_name,
318 | },
319 | {
320 | name: "夸克盘搜",
321 | url: "qkpanso.com",
322 | search: "https://qkpanso.com/search?q=" + douban_cn_name,
323 | },
324 | {
325 | name: "阿里盘搜",
326 | url: "alipanx.com",
327 | search: "https://www.alipanx.com/search?q=" + douban_cn_name,
328 | },
329 | {
330 | name: "懒盘搜索",
331 | url: "www.lzpanx.com",
332 | search: "https://www.lzpanx.com/search?q=" + douban_cn_name,
333 | },
334 | {
335 | name: "小云搜索",
336 | url: "assrt.net",
337 | search: "https://www.yunso.net/index/user/s?wd=" + douban_cn_name,
338 | },
339 | {
340 | name: "盘了个盘",
341 | url: "qkpanso.com",
342 | search: "https://www.panlegepan.com/s/" + douban_cn_name,
343 | },
344 | {
345 | name: "V盘搜",
346 | url: "www.vpansou.com",
347 | search: "http://www.vpansou.com/query?wd=" + douban_cn_name,
348 | },
349 | ],
350 | },
351 | ];
352 |
353 | /**
354 | * 功能列表
355 | */
356 | const GMValues = [
357 | {
358 | id: "imdb_link",
359 | name: "IMDB链接",
360 | fun: function () {
361 | imdbLink("https://www.imdb.com/title/");
362 | },
363 | },
364 | {
365 | id: "imdb_score",
366 | name: "IMDB评分",
367 | fun: getImdbScore,
368 | },
369 | ];
370 |
371 | if (url.includes("movie.douban.com/subject/")) {
372 | for (const GMValue of GMValues) {
373 | if (GM_getValue(GMValue.id, true)) {
374 | GMValue.fun();
375 | }
376 | }
377 |
378 | aside();
379 | }
380 |
381 | /**
382 | * 脚本工具菜单
383 | */
384 | GM_registerMenuCommand("配置", () => {
385 | configuration();
386 | });
387 |
388 | /**
389 | * 侧边栏功能
390 | */
391 | function aside() {
392 | const aside = document.querySelector(".aside");
393 | const div_big = document.createElement("div");
394 | aside.prepend(div_big);
395 |
396 | for (const webSite of webSites) {
397 | const div = document.createElement("div");
398 | div_big.appendChild(div);
399 |
400 | if (GM_getValue(webSite.id, true)) {
401 | div.innerHTML = "" + webSite.name + "· · · · · ·
";
402 | const ul = document.createElement("ul");
403 | ul.className = "resources";
404 | div.appendChild(ul);
405 | for (const link of webSite.links) {
406 | if (link.type != "xhr") {
407 | const str = '' + link.name + "";
408 | const a = document.createRange().createContextualFragment(str);
409 | ul.appendChild(a);
410 | } else {
411 | GM_xmlhttpRequest({
412 | url: link.search,
413 | method: "POST",
414 | headers: {
415 | "Content-Type": "application/x-www-form-urlencoded",
416 | },
417 | timeout: 5000,
418 | anonymous: link.anonymous,
419 | data: link.data,
420 | onload: function (response) {
421 | //chrome+tm会出现兼容性问题:
422 | let finalUrl = response.finalUrl;
423 | if (finalUrl.search("/index.php/") != -1) {
424 | finalUrl = finalUrl.replace("/index.php", "");
425 | }
426 |
427 | let str;
428 | if (finalUrl == link.search) {
429 | str = '' + link.name + "";
430 | } else {
431 | str = '' + link.name + "";
432 | }
433 | const a = document.createRange().createContextualFragment(str);
434 | ul.appendChild(a);
435 | },
436 | });
437 | }
438 | }
439 | }
440 | }
441 |
442 | const resourceStyle = document.createElement("style");
443 | resourceStyle.innerHTML =
444 | ".resource {margin-bottom: 30px} .resources {padding: 0 12px;*letter-spacing: normal} .resources a {border-radius: 6px;color: #37A;display: inline-block;letter-spacing: normal;margin: 0 8px 8px 0;padding: 0 8px;text-align: center;width: 65px} .resources a:link, .resources a:visited {background-color: #f5f5f5;color: #37A} .resources a:hover, .resources a:active {background-color: #e8e8e8;color: #37A} .resources a.disabled {text-decoration: line-through} .resources a.available {background-color: #5ccccc;color: #006363} .resources a.available:hover, .resources a.available:active {background-color: #3cc} .resources a.honse {background-color: #fff0f5;color: #006363} .resources a.honse:hover, .resources a.honse:active {background-color: #3cc} .resources a.sites_r0 {text-decoration: line-through}";
445 | document.head.appendChild(resourceStyle);
446 | }
447 |
448 | /**
449 | * 配置
450 | */
451 | function configuration() {
452 | Swal.fire({
453 | title: "豆瓣助手 配置",
454 | html: swal_html,
455 | showCloseButton: true,
456 | didRender: () => {
457 | GM_addStyle(`
458 | .swal2-html-container{text-align:left !important;line-height:unset !important;}
459 | .smail_div{width:33%;float:left;}
460 | .switch{float:left;position:relative;top:3px;width:40px;height:20px;display:flex;}
461 | .checkbox{z-index:3;position:relative;width:100%;height:100%;cursor:pointer;opacity:0;}
462 | .bt{z-index:2;position:absolute;top:0;bottom:0;}
463 | .bt:before{position:absolute;top:2.5px;left:2.5px;content:"";width:15px;height:15px;background-color:red;border-radius:50%;transition:0.3s cubic-bezier(0.18,0.89,0.35,1.15) all;}
464 | .checkbox:checked + .bt:before{left:20px;background-color:#03a9f4;}
465 | .bg{z-index:1;position:absolute;top:0;right:0;bottom:0;left:0;border-radius:100px;background-color:#fcebeb;}
466 | .checkbox:checked ~ .bg{background-color:#ebf7fc;}`);
467 | /**
468 | * 侧边栏开关
469 | */
470 | for (const webSite of webSites) {
471 | if (GM_getValue(webSite.id, true)) {
472 | document.querySelector("#DA_div #" + webSite.id).checked = true;
473 | }
474 | }
475 | for (const GMValue of GMValues) {
476 | if (GM_getValue(GMValue.id, true)) {
477 | document.querySelector("#DA_div #" + GMValue.id).checked = true;
478 | }
479 | }
480 | },
481 | }).then((result) => {
482 | let change;
483 | if (result.isConfirmed) {
484 | for (const webSite of webSites) {
485 | if (document.querySelector("#DA_div #" + webSite.id).checked != GM_getValue(webSite.id, true)) {
486 | GM_setValue(webSite.id, document.querySelector("#DA_div #" + webSite.id).checked);
487 | change = true;
488 | }
489 | }
490 | for (const GMValue of GMValues) {
491 | if (document.querySelector("#DA_div #" + GMValue.id).checked != GM_getValue(GMValue.id, true)) {
492 | GM_setValue(GMValue.id, document.querySelector("#DA_div #" + GMValue.id).checked);
493 | change = true;
494 | }
495 | }
496 |
497 | if (change) {
498 | location.reload();
499 | }
500 | }
501 | });
502 | }
503 |
504 | let swal_html = "";
505 | for (const GMValue of GMValues) {
506 | swal_html += '
";
507 | }
508 | for (const webSite of webSites) {
509 | swal_html += '
";
510 | }
511 | swal_html += "
";
512 | })();
513 |
--------------------------------------------------------------------------------
/LinkManager.user.js:
--------------------------------------------------------------------------------
1 | // ==UserScript==
2 | // @name 链接管理
3 | // @version 1.3.27
4 | // @namespace airbash/LinkManager
5 | // @homepageURL https://github.com/AirBashX/UserScript
6 | // @author airbash
7 | // @description 绕过搜索引擎(百度、搜狗、360、必应、谷歌)搜索结果中的重定向链接,直链访问原始网站,删除网站重定向到安全页面,自动跳转中文文档,减少操作步骤和响应时间;长期维护、PC+手机全平台支持:CSDN+掘金+简书+知乎+知乎专栏+百度贴吧+开源中国+码云gitee+扣丁leetcode+51CTO+百度搜索+360搜索+搜狗搜索+必应搜索+423down+酷安+eslint+微软文档+火狐MDN+tampermonkey文档;
8 | // @match *://link.csdn.net/*
9 | // @match *://link.juejin.cn/*
10 | // @match *://juejin.cn/*
11 | // @match *://www.jianshu.com/p/*
12 | // @match *://www.jianshu.com/go-wild?*
13 | // @match *://*.zhihu.com/*
14 | // @match *://tieba.baidu.com/*
15 | // @match *://*.oschina.net/*
16 | // @match *://gitee.com/*
17 | // @match *://leetcode.cn/link/*
18 | // @match *://blog.51cto.com/*
19 | // @match *://*.baidu.com/*
20 | // @match *://m.so.com/s?*
21 | // @match *://www.so.com/s?*
22 | // @match *://www.sogou.com/web?*
23 | // @match *://*.bing.com/search*
24 | // @match *://www.423down.com/*
25 | // @match *://www.coolapk.com/link*
26 | // @match *://*.eslint.org/docs/latest/*
27 | // @match *://learn.microsoft.com/*
28 | // @match *://developer.mozilla.org/*
29 | // @match *://www.tampermonkey.net/*
30 | // @icon data:image/png;base64,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
31 | // @grant GM_registerMenuCommand
32 | // @grant GM_setValue
33 | // @grant GM_getValue
34 | // @grant GM_xmlhttpRequest
35 | // @grant GM_info
36 | // @license GPL-3.0
37 | // @run-at document-body
38 | // ==/UserScript==
39 | ///
40 |
41 | (function () {
42 | "use strict";
43 |
44 | /**
45 | * 安全页面重定向列表
46 | * @type {安全页面网站}
47 | */
48 | const safePages = [
49 | {
50 | //https://blog.csdn.net/weixin_50829653/article/details/118119039
51 | //https://link.csdn.net/?from_id=118119039&target=https://baidu.com
52 | name: "CSDN",
53 | url: "link.csdn.net",
54 | handlers: [
55 | {
56 | type: "forward",
57 | start: "&target=",
58 | },
59 | ],
60 | },
61 | {
62 | //https://link.zhihu.com/?target=https://www.apifox.cn/
63 | name: "知乎",
64 | url: "link.zhihu.com/?target=",
65 | handlers: [
66 | {
67 | type: "forward",
68 | start: "?target=",
69 | },
70 | ],
71 | },
72 | {
73 | //https://link.juejin.cn/?target=https://baidu.com
74 | name: "掘金",
75 | url: "link.juejin.cn/?target=",
76 | handlers: [
77 | {
78 | type: "forward",
79 | start: "?target=",
80 | },
81 | ],
82 | },
83 | {
84 | //https://www.jianshu.com/go-wild?ac=2&url=https://baidu.com
85 | name: "简书",
86 | url: "www.jianshu.com/go-wild?",
87 | handlers: [
88 | {
89 | type: "forward",
90 | start: "&url=",
91 | },
92 | ],
93 | },
94 | {
95 | //https://www.oschina.net/action/GoToLink?url=https://baidu.com
96 | name: "开源中国",
97 | url: "www.oschina.net/action/GoToLink?url=",
98 | handlers: [
99 | {
100 | type: "forward",
101 | start: "GoToLink?url=",
102 | },
103 | ],
104 | },
105 | {
106 | //https://gitee.com/link?target=https://baidu.com
107 | name: "码云",
108 | url: "gitee.com/link?target=",
109 | handlers: [
110 | {
111 | type: "forward",
112 | start: "?target=",
113 | },
114 | ],
115 | },
116 | {
117 | //https://leetcode.cn/link/?target=https://www.baidu.com
118 | name: "扣丁",
119 | url: "leetcode.cn",
120 | handlers: [
121 | {
122 | type: "forward",
123 | start: "link/?target=",
124 | },
125 | ],
126 | },
127 | {
128 | //https://blog.51cto.com/u_15127617/4063137
129 | //https://blog.51cto.com/transfer?https://baidu.com
130 | name: "51CTO",
131 | url: "blog.51cto.com/transfer?",
132 | handlers: [
133 | {
134 | type: "forward",
135 | start: "transfer?",
136 | },
137 | ],
138 | },
139 | {
140 | //https://www.coolapk.com/link?url=https%3A%2F%2Flanzoux.com
141 | name: "酷安",
142 | url: "www.coolapk.com/link?url=",
143 | handlers: [
144 | {
145 | type: "forward",
146 | start: "link?url=",
147 | },
148 | ],
149 | },
150 | {
151 | //https://mail.qq.com/cgi-bin/readtemplate?t=safety&check=false&gourl=https://www.baidu.com
152 | name: "酷安",
153 | url: "mail.qq.com/cgi-bin/readtemplate?",
154 | handlers: [
155 | {
156 | type: "forward",
157 | start: "gourl=",
158 | },
159 | ],
160 | },
161 | ];
162 |
163 | /**
164 | * 去除页面重定向列表
165 | * @type {重定向网站}
166 | */
167 | const websites = [
168 | {
169 | //https://www.zhihu.com/question/465346075/answer/2048804228
170 | //https://zhuanlan.zhihu.com/p/95937067
171 | name: "知乎",
172 | url: "zhihu.com",
173 | handlers: [
174 | {
175 | selector: ".external,.LinkCard",
176 | start: "?target=",
177 | type: "sub",
178 | },
179 | ],
180 | },
181 | {
182 | //https://juejin.cn/post/6844903688524267534
183 | name: "掘金",
184 | url: "juejin.cn",
185 | handlers: [
186 | {
187 | selector: "a[href]",
188 | start: "?target=",
189 | type: "sub",
190 | },
191 | ],
192 | },
193 | {
194 | //https://www.jianshu.com/p/cf7dc734dd6d
195 | name: "简书",
196 | url: "www.jianshu.com/p/",
197 | handlers: [
198 | {
199 | selector: "a[href]",
200 | start: "go?to=",
201 | type: "sub",
202 | },
203 | ],
204 | },
205 | {
206 | //https://tieba.baidu.com/p/6313991324
207 | name: "百度贴吧",
208 | url: "tieba.baidu.com/p/",
209 | handlers: [
210 | //PC版
211 | {
212 | selector: ".j-no-opener-url",
213 | start: "jump.bdimg.com",
214 | type: "text",
215 | },
216 | {
217 | selector: ".j-no-opener-url",
218 | start: "jump2.bdimg.com",
219 | type: "text",
220 | },
221 | //手机版
222 | {
223 | selector: ".rich-link",
224 | start: "checkurl?url=",
225 | end: "&urlrefer=",
226 | type: "sub",
227 | },
228 | ],
229 | },
230 | {
231 | //https://my.oschina.net/lorryluMyRest/blog/731722
232 | name: "开源中国",
233 | url: "oschina.net",
234 | handlers: [
235 | {
236 | selector: "a[href]",
237 | start: "GoToLink?url=",
238 | type: "sub",
239 | },
240 | ],
241 | },
242 | {
243 | //https://gitee.com/iflytek/iflearner
244 | name: "gitee",
245 | url: "gitee.com",
246 | handlers: [
247 | {
248 | selector: "a[href]",
249 | start: "link?target=",
250 | type: "sub",
251 | },
252 | ],
253 | },
254 | {
255 | //https://www.so.com/s?ie=UTF-8&q=123
256 | name: "360搜索PC版",
257 | url: "www.so.com/s",
258 | handlers: [
259 | {
260 | selector: "a[data-mdurl]",
261 | start: "link?m=",
262 | attribute: "data-mdurl",
263 | type: "attribute",
264 | },
265 | ],
266 | },
267 | {
268 | //https://m.so.com/s?q=%E4%BD%A0%E5%A5%BD
269 | name: "360搜索手机版",
270 | url: "m.so.com",
271 | handlers: [
272 | {
273 | selector: "a[href]",
274 | start: "jump?u=",
275 | end: "&m=",
276 | type: "sub",
277 | },
278 | ],
279 | },
280 | {
281 | //https://www.423down.com/10579.html
282 | name: "423down",
283 | url: "www.423down.com",
284 | handlers: [
285 | {
286 | selector: "p>a[href]",
287 | start: "/go.php?url=",
288 | type: "text",
289 | },
290 | ],
291 | },
292 | ];
293 |
294 | /**
295 | * 百度单独规则
296 | */
297 | if (location.href.includes("m.baidu.com") || location.href.includes("www.baidu.com")) {
298 | let interval = setInterval(() => {
299 | let flag = baidu_static();
300 | }, 100);
301 | }
302 | /**
303 | * 百度静态规则
304 | */
305 | function baidu_static() {
306 | //pc端
307 | let item1s = document.querySelectorAll("#content_left>div");
308 | for (let item of item1s) {
309 | let a = item.querySelector("a");
310 | if (a && a.href.includes("www.baidu.com/link?url=")) {
311 | let url = item.getAttribute("mu");
312 | //https://www.baidu.com/s?wd=一夜醒来欠地铁600多万?官方回应
313 | //智能精选
314 | if (url && url != "null" && !url.includes("nourl.ubs.baidu.com") && !url.includes("nourl.baidu.com")) {
315 | a.href = url;
316 | console.log(url);
317 | }
318 | }
319 | //single-card-wrapper: https://www.baidu.com/s?ie=UTF-8&wd=es6 xxx的最新相关信息
320 | //group-wrapper: https://www.baidu.com/s?ie=UTF-8&wd=五一消费成绩单折射市场活力 资讯
321 | let item_news = item.querySelectorAll("[class^=single-card-wrapper] div,[class^=group-wrapper] div");
322 | for (let item_new of item_news) {
323 | let data_url;
324 | let divs = item_new.querySelectorAll("div");
325 | for (let div of divs) {
326 | if ((data_url = div.getAttribute("data-url"))) {
327 | let a = item_new.querySelector("a");
328 | a.setAttribute("href", data_url);
329 | }
330 | }
331 | }
332 | }
333 |
334 | //移动端
335 | let item2s = document.querySelectorAll("#results>div");
336 | for (let item of item2s) {
337 | let rl_link_href = item.querySelector("[rl-link-href]");
338 | if (rl_link_href && rl_link_href != null) {
339 | let str = item.getAttribute("data-log");
340 | let json = JSON.parse(str);
341 | let url = json.mu;
342 | if (!url.startsWith("https://ks.baidu.com") && url) {
343 | //ks.baidu.com https://www.baidu.com/s?word=赵匡胤
344 | rl_link_href.setAttribute("rl-link-href", url);
345 | let as = item.querySelectorAll("a");
346 | for (let a of as) {
347 | a.href = url;
348 | }
349 | }
350 | }
351 | }
352 | return false;
353 | }
354 |
355 | /**
356 | * 必应单独规则
357 | * https://www.bing.com/search?q=必应
358 | */
359 | if (location.href.includes("bing.com/search")) {
360 | function handlerAnchor(a) {
361 | let url_ = a.href;
362 | if (url_.includes(".bing.com/ck/a?")) {
363 | // 截取 u= 及其后面的字符
364 | let tmp = url_.slice(url_.lastIndexOf("u="));
365 | // 找到 u= 后的第一个 `&`, 精确提取出 u
366 | tmp = tmp.slice("u=a1".length, tmp.indexOf("&"));
367 | const paddingNeeded = 4 - tmp.length % 4;
368 | // 如果长度不是4的倍数,则需要补充'='
369 | if (paddingNeeded != 4) {
370 | tmp += '='.repeat(paddingNeeded);
371 | }
372 | try {
373 | let ori_url = atob(tmp.replace('-', '+').replace('_', '/'));
374 | a.href = ori_url;
375 | } catch (e) {
376 | console.log("Error parsing", tmp);
377 | }
378 | }
379 | }
380 |
381 | function afterLoaded(f_) {
382 | if (document.readyState === 'loading') {
383 | document.addEventListener('DOMContentLoaded', f_);
384 | } else {
385 | typeof f_ === 'function' && f_();
386 | }
387 | }
388 |
389 | afterLoaded(() => {
390 | console.log("Started");
391 | document.querySelectorAll('a').forEach(handlerAnchor);
392 | // 使用 MutationObserver 监控 DOM 变化
393 | const observer = new MutationObserver((mutationsList) => {
394 | for (const mutation of mutationsList) {
395 | if (mutation.type === 'childList') {
396 | mutation.addedNodes.forEach(node => {
397 | if (node.nodeType === Node.ELEMENT_NODE) {
398 | node.querySelectorAll('a').forEach(handlerAnchor);
399 | }
400 | });
401 | }
402 | }
403 | });
404 |
405 | // 观察整个文档的 DOM 变化
406 | observer.observe(document.body, {
407 | childList: true,
408 | subtree: true
409 | });
410 | });
411 | }
412 |
413 | /**
414 | * 安全页面跳转:处理
415 | */
416 | for (let safePage of safePages) {
417 | if (location.href.includes(safePage.url)) {
418 | for (let handler of safePage.handlers) {
419 | let str = location.href.split(handler.start)[1];
420 | console.log(str);
421 | let url = decodeURIComponent(str);
422 | console.log(url);
423 | location.replace(url);
424 | }
425 | }
426 | }
427 |
428 | /**
429 | * 页面重定向跳转:处理
430 | */
431 | for (let website of websites) {
432 | if (location.href.includes(website.url)) {
433 | let time = 0;
434 | let interval = setInterval(() => {
435 | if (++time == 100) {
436 | clearInterval(interval);
437 | }
438 | for (let handler of website.handlers) {
439 | let items = document.querySelectorAll(handler.selector);
440 | for (let item of items) {
441 | //进一步校验需要修改的元素,防止修改错元素
442 | if (item.getAttribute("href").includes(handler.start)) {
443 | if (handler.type == "sub") {
444 | //从属性中截取地址
445 | let href = item.getAttribute("href");
446 | let start_index = href.indexOf(handler.start) + handler.start.length;
447 | let str;
448 | if (handler.end != null) {
449 | let end_index = href.indexOf(handler.end);
450 | str = href.substring(start_index, end_index);
451 | } else {
452 | str = href.substring(start_index);
453 | }
454 | let url = decodeURIComponent(str);
455 | item.setAttribute("href", url);
456 | } else if (handler.type == "attribute") {
457 | //从属性中获取地址
458 | item.setAttribute("href", item.getAttribute(handler.attribute));
459 | } else {
460 | //从文本中获取地址
461 | item.setAttribute("href", item.innerText);
462 | }
463 | }
464 | }
465 | }
466 | }, 100);
467 | }
468 | }
469 |
470 | /**
471 | * 跳转中文文档规则
472 | */
473 | const otherSites = [
474 | {
475 | //https://eslint.org/docs/latest/user-guide/configuring/configuration-files
476 | //https://zh-hans.eslint.org/docs/latest/user-guide/configuring/configuration-files
477 | name: "eslint",
478 | url: "https://eslint.org/docs/latest/",
479 | type: "host",
480 | zh_str: "zh-hans",
481 | },
482 | {
483 | //https://learn.microsoft.com/zh-cn/powershell/scripting/how-to-use-docs
484 | name: "microsoft",
485 | url: "https://learn.microsoft.com/",
486 | type: "pathName",
487 | zh_str: "zh-cn",
488 | },
489 | {
490 | //https://developer.mozilla.org/zh-CN/
491 | name: "MDN",
492 | url: "https://developer.mozilla.org/",
493 | type: "pathName",
494 | zh_str: "zh-CN",
495 | },
496 | {
497 | //https://www.tampermonkey.net/faq.php?locale=zh
498 | name: "tampermonkey",
499 | url: "https://www.tampermonkey.net",
500 | type: "search",
501 | zh_str: "locale=zh",
502 | },
503 | ];
504 |
505 | /**
506 | * GM相关APi的操作
507 | */
508 | if (GM_info) {
509 | const scriptHandler = GM_info.scriptHandler;
510 | /**
511 | * 仅在油侯插件上运行,避免无法点击注册开关
512 | */
513 | if (scriptHandler == "Tampermonkey" || scriptHandler == "Violentmonkey" || scriptHandler == "ScriptCat" || scriptHandler == "Via") {
514 | /**
515 | * 自动跳转中文文档
516 | */
517 | if (GM_getValue("forward_zh")) {
518 | GM_registerMenuCommand("[√]跳转中文文档", function () {
519 | GM_setValue("forward_zh", false);
520 | location.reload();
521 | });
522 | let web_url = location.href;
523 | for (let otherSite of otherSites) {
524 | if (web_url.startsWith(otherSite.url)) {
525 | let zh_index = location.href.search(otherSite.zh_str);
526 | // 当前页面不是中文文档
527 | if (zh_index == -1) {
528 | if (otherSite.type == "pathName") {
529 | let pathname = location.pathname;
530 | let str = pathname.split("/")[1];
531 | if (str != otherSite.zh_str) {
532 | let new_url = web_url.replace(str, otherSite.zh_str);
533 | location.replace(new_url);
534 | }
535 | } else if (otherSite.type == "host") {
536 | let host = location.host;
537 | let str = host.split(".")[0];
538 | if (str != otherSite.zh_str) {
539 | let new_host = otherSite.zh_str + "." + host;
540 | let new_url = web_url.replace(host, new_host);
541 | location.replace(new_url);
542 | }
543 | } else if (otherSite.type == "search") {
544 | let search = location.search;
545 | if (search) {
546 | //有参数
547 | let key = otherSite.zh_str.split("=")[0];
548 | let start_index = search.search(key);
549 | let end_index = start_index + otherSite.zh_str.length;
550 | if (start_index != -1) {
551 | //有指定参数
552 | let str = search.substring(start_index, end_index);
553 | if (str != otherSite.zh_str) {
554 | //数值不对
555 | let url = web_url.replace(str, otherSite.zh_str);
556 | location.replace(url);
557 | }
558 | } else {
559 | //没有指定参数
560 | let url = web_url + "&" + otherSite.zh_str;
561 | location.replace(url);
562 | }
563 | } else {
564 | //没有参数
565 | let url = web_url + "?" + otherSite.zh_str;
566 | location.replace(url);
567 | }
568 | }
569 | }
570 | }
571 | }
572 | } else {
573 | GM_registerMenuCommand("[x]跳转中文文档", function () {
574 | GM_setValue("forward_zh", true);
575 | location.reload();
576 | });
577 | }
578 | }
579 | }
580 | })();
581 |
--------------------------------------------------------------------------------
/AutoDarkMode.user.js:
--------------------------------------------------------------------------------
1 | // ==UserScript==
2 | // @name 自动主题切换
3 | // @namespace airbash/Rocy-June/AutoDarkMode
4 | // @homepage https://github.com/AirBashX/UserScript
5 | // @version 25.07.18.01
6 | // @description 根据用户设定时间段, 自动切换已适配网站的黑白主题
7 | // @author airbash / Rocy-June
8 | // @match *://*/*
9 | // @icon data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAMAAACdt4HsAAAAolBMVEVHcExYYm2zfUHYhC34jx74kRv4jx1naGllZWVlZWX3khxmZmb3kB73jx/4kB33kBxmZmZmZmZhYWFoaGj3kB5iY2RnZ2f5jBtqampubm5paWn3kh33kB73kB5aWlr3kR5mZmb6mhz2iSBkZGT3kR33kR1lZmY7Ozt3d3dISEj9uRG0fkGqeUX3kB5mZmZkZWb/lhRpaWn3kR9jY2NxcXGzfUGVB4hkAAAALXRSTlMA9+kD3YkOfEWWIYvnWLN47W03XvW04S8ZCs6fRMcnCFEY/r/PaqhTxWFHqnwtZ5kAAAACpUlEQVRYw9WX65qaMBCGbQFBRUARXEHF8x7aDMuh939rTRCimAHiw/Zpm18aM+/OTubwZTD419fU+uhlH5nE7AUYmqmq9AKo5G8DzJ4AFsSnAC+Pp+3T+Rn7mTOSSo4xvr/1AGQAFjGH2L7hAPiKjD0he2RfB7rmtYC4k4v3wwq1msvMfoq7D6DfWc+OdCP+9uszTcnCOpdORyFu7zrM3uPfV3qxQQHfP0mxTDtiP+xRe2VSnPZX1cZrAPAAIERds6OaKtrPj0lx2uDhiAEBEGIXf028/DwpDCbVxihJYhRANOxW3PJwwO3hth4AB4zgXo8m1Q3qeTOApFhij1gE8uoG5hm0AMhhiRGYA9vyQgKI2wDkNMAJVQRmAK0ekHSKFSFkZQ4qfidARQAeZGUId9AFIGQtdhGHJ+FFAhCKmcirYOV0A5A+7/IsNEDCA7JEOsGsnpXtAOEeaC3uHquoDVDU1JitIU+DHUdJAGhBRNaCLfWjBGSGWEetgHGtwCeQvD7pgWJv2LLGpVleAvRMOgb1TOa3IAUQUnHH58lc6l94nEvKFrJj+dnPugFiQa/82ClrYRR3pzLS1i68I88lamGJ9QPekoNOgCXa0yDwqWp0AtZYTwtuU8XrAIToxHYhPt66SxsAVwZFI6nmgtEGSNcNooHm8BsP6W2yCYBpk+qgqZC/V1/esyYPps26hfYi54WLHR8FXOd7g8AaUD3yduvTF8gEQMiEEe0kWoNCdCC5k2iGBzGNRQlIaf5cw7dvGvK0JuMs1++bvR7EhUYiZLHReP7aaSNBvxcpTIkoW2Om/9TO6/G9LrGZD7ganNQATUuxkZZQXcVOShDbi81QXj5jgmL/hIAPD2G/N9MiNf/3N9MXPLr6xSA6pad+b+elvfzDr/Pf2oPrAJ6zWhcAAAAASUVORK5CYII=
10 | // @run-at document-body
11 | // @grant unsafeWindow
12 | // @grant GM_registerMenuCommand
13 | // @grant GM_unregisterMenuCommand
14 | // @grant GM_setValue
15 | // @grant GM_getValue
16 | // @license GPL-3.0
17 | // ==/UserScript==
18 |
19 | (function () {
20 | "use strict";
21 |
22 | // 调试模式开关
23 | const DEBUG = false;
24 | // 调试模式: 是否在报错时中断脚本运行
25 | const DEBUG_INTERRUPT_ON_ERROR = false;
26 | // 调试模式: 是否强制切换主题
27 | let DEBUG_FORCE_TOGGLE = false;
28 |
29 | // 日志函数
30 | const log = console.log.bind(console, "[AutoDarkMode Script]");
31 | const warn = console.warn.bind(console, "[AutoDarkMode Script]");
32 | const error = console.error.bind(console, "[AutoDarkMode Script]");
33 | const debug = (() =>
34 | DEBUG
35 | ? console.error.bind(console, "[AutoDarkMode Script] [Debug Mode]")
36 | : () => {})();
37 |
38 | debug("Debug mode is on");
39 |
40 | // 失败检测计数器
41 | let fail_count = 0;
42 | // 失败检查时间间隔, 单位: 毫秒
43 | let fail_check_time = 10000;
44 |
45 | const sim_events = {
46 | pointer_down: () =>
47 | new PointerEvent("pointerdown", {
48 | bubbles: true,
49 | cancelable: true,
50 | pointerType: "mouse",
51 | }),
52 | mouse_over: () =>
53 | new MouseEvent("mouseover", {
54 | bubbles: true,
55 | cancelable: true,
56 | relatedTarget: null,
57 | }),
58 | mouse_leave: () =>
59 | new MouseEvent("mouseleave", {
60 | bubbles: true,
61 | cancelable: true,
62 | relatedTarget: null,
63 | }),
64 | mouse_enter: () =>
65 | new MouseEvent("mouseenter", {
66 | bubbles: true,
67 | cancelable: true,
68 | relatedTarget: null,
69 | }),
70 | key: (is_down, key, modifiers = {}) => {
71 | const key_codes = {
72 | control: "ControlLeft",
73 | alt: "AltLeft",
74 | shift: "ShiftLeft",
75 | meta: "MetaLeft",
76 | enter: "Enter",
77 | };
78 |
79 | const key_code =
80 | key_codes[key.toLowerCase()] || `Key${key.toUpperCase()}`;
81 |
82 | const {
83 | ctrl = false,
84 | meta = false,
85 | shift = false,
86 | alt = false,
87 | bubbles = true,
88 | cancelable = true,
89 | } = modifiers;
90 |
91 | return new KeyboardEvent(is_down ? "keydown" : "keyup", {
92 | key: key.toUpperCase(),
93 | code: key_code,
94 | ctrlKey: ctrl,
95 | metaKey: meta,
96 | shiftKey: shift,
97 | altKey: alt,
98 | bubbles,
99 | cancelable,
100 | });
101 | },
102 | };
103 |
104 | log("脚本开始运行");
105 |
106 | // 设置对象
107 | const settings = {
108 | // 默认明亮主题起始时间
109 | light_time: "08:00",
110 | // 默认黑夜主题起始时间
111 | dark_time: "18:00",
112 | // 油猴菜单: 明亮主题设置菜单ID
113 | light_menu_id: null,
114 | // 油猴菜单: 黑夜主题设置菜单ID
115 | dark_menu_id: null,
116 | // 油猴菜单: Debug强制切换菜单ID
117 | debug_toggle_id: null,
118 |
119 | // 默认快速检查时间 (Debug 模式且开启报错中断时将延长)
120 | fast_check_default_time: DEBUG && DEBUG_INTERRUPT_ON_ERROR ? 3000 : 200,
121 | // 快速检查过后的常态检查时间 (Debug 模式且开启报错中断时将延长)
122 | after_check_default_time:
123 | DEBUG && DEBUG_INTERRUPT_ON_ERROR ? 3600000 : 10000,
124 | };
125 |
126 | // 初始化设置
127 | initSettings();
128 |
129 | // 所有适配的站点
130 | /*
131 | {
132 | "domain (站点域名匹配, 防止后续匹配项过多, 提高加载速度)": [{
133 | url: 匹配站点正则,
134 | check: 检查当前主题函数(返回 "dark" 或 "light"),
135 | toggle: 切换主题函数(可选, 为 null 时 toLight 和 toDark 函数会被调用),
136 | toLight: 切换到明亮主题函数(可选, toggle 为 null 时必需设定),
137 | toDark: 切换到黑夜主题函数(可选, toggle 为 null 时必需设定),
138 | fastCheckTime: 未成功检查 / 切换主题前的检查主题间隔时间(可选, 为 null 时默认 1 秒),
139 | afterCheckTime: 无需切换或切换成功后, 再次检查主题间隔时间(可选, 为 null 时默认 10 秒),
140 | }]
141 | }
142 |
143 | tip:
144 | 如果新增站点有新的顶级域名,
145 | 记得同步增加到 sites 下方的 domain_suffixes
146 | */
147 | const sites = {
148 | // Pixiv
149 | "pixiv.net": [
150 | {
151 | url: /^https?:\/\/.*?pixiv\.net.*/,
152 | check: () =>
153 | html().getAttribute("data-theme") === "dark" ? "dark" : "light",
154 | toLight: () => {
155 | $single(".gtm-darkmode-toggle-on-user-menu-to-light").click();
156 | },
157 | toDark: () => {
158 | $single(".gtm-darkmode-toggle-on-user-menu-to-dark").click();
159 | },
160 | },
161 | ],
162 | // 风车动漫
163 | "fengchedmp.com": [
164 | {
165 | url: /^https?:\/\/.*?fengchedmp\.com.*/,
166 | check: () =>
167 | $single("#cssFile").getAttribute("href").includes("black")
168 | ? "dark"
169 | : "light",
170 | toLight: () => {
171 | $single("i.icon-rijian").click();
172 | },
173 | toDark: () => {
174 | $single("i.icon-yejian").click();
175 | },
176 | },
177 | ],
178 | // Wikipedia
179 | "wikipedia.org": [
180 | {
181 | url: /^https?:\/\/.*?wikipedia\.org.*/,
182 | check: () =>
183 | html().classList.contains("skin-theme-clientpref-night")
184 | ? "dark"
185 | : "light",
186 | toLight: () => {
187 | $single("#skin-client-pref-skin-theme-value-day").click();
188 | },
189 | toDark: () => {
190 | $single("#skin-client-pref-skin-theme-value-night").click();
191 | },
192 | },
193 | ],
194 | // ChatGPT
195 | "chatgpt.com": [
196 | {
197 | url: /^https?:\/\/.*?chatgpt\.com.*/,
198 | check: () => (html().classList.contains("dark") ? "dark" : "light"),
199 | toLight: async () => {
200 | $single("nav>:last-child>div").dispatchEvent(
201 | sim_events.pointer_down()
202 | );
203 | await $singleAsyncClick(
204 | "div[data-radix-popper-content-wrapper]>div>div>div:nth-child(4)"
205 | );
206 | (
207 | await $singleAsync("div[data-testid=modal-settings]")
208 | ).style.opacity = 0;
209 | $single(
210 | "div.absolute>div.fixed>div>div[role=dialog]>div>div>div:nth-child(2)>section>div>div>div>button"
211 | ).click();
212 | await $singleAsyncClick(
213 | "div[data-radix-popper-content-wrapper]>div>div>div:nth-child(3)"
214 | );
215 | $single("button[data-testid=close-button]").click();
216 | },
217 | toDark: async () => {
218 | $single("nav>:last-child>div").dispatchEvent(
219 | sim_events.pointer_down()
220 | );
221 | await $singleAsyncClick(
222 | "div[data-radix-popper-content-wrapper]>div>div>div:nth-child(4)"
223 | );
224 | (
225 | await $singleAsync("div[data-testid=modal-settings]")
226 | ).style.opacity = 0;
227 | $single(
228 | "div.absolute>div.fixed>div>div[role=dialog]>div>div>div:nth-child(2)>section>div>div>div>button"
229 | ).click();
230 | await $singleAsyncClick(
231 | "div[data-radix-popper-content-wrapper]>div>div>div:nth-child(2)"
232 | );
233 | $single("button[data-testid=close-button]").click();
234 | },
235 | load: () => {
236 | document.addEventListener("visibilitychange", function () {
237 | if (document.visibilityState === "visible") {
238 | let modal_settings = $single("div[data-testid=modal-settings]");
239 | if (!modal_settings) {
240 | return;
241 | }
242 |
243 | $single("button[data-testid=close-button]").click();
244 | }
245 | });
246 | },
247 | },
248 | ],
249 | // GitHub
250 | "github.com": [
251 | {
252 | url: /^https?:\/\/.*?github\.com.*/,
253 | check: () =>
254 | html().getAttribute("data-color-mode") === "dark" ? "dark" : "light",
255 | toLight: async () => {
256 | document.body.dispatchEvent(
257 | sim_events.key(true, "k", { ctrl: true, shift: true })
258 | );
259 | const command_container = $single("#command-palette-pjax-container");
260 | command_container.style.opacity = 0;
261 |
262 | const command_palette = $single(
263 | "input[aria-controls=command-palette-page-stack]"
264 | );
265 | command_palette.value = ">switch theme";
266 |
267 | (
268 | await $singleAsync("div[role=listbox]>command-palette-item>span")
269 | ).click();
270 |
271 | let flag = await waitForAsync(() => {
272 | return $single("svg[aria-label=Loading]").parentNode.hasAttribute(
273 | "hidden"
274 | );
275 | });
276 | if (!flag) {
277 | throw new Error("Waiting for load ready failed");
278 | }
279 |
280 | command_palette.value = "default light";
281 |
282 | (
283 | await $selectSingleAsync(
284 | "div[role=listbox]>command-palette-item>span",
285 | (e) => {
286 | return e.innerText.toLowerCase().includes("default light");
287 | }
288 | )
289 | ).click();
290 | command_container.style.opacity = 1;
291 | },
292 | toDark: async () => {
293 | document.body.dispatchEvent(
294 | sim_events.key(true, "k", { ctrl: true, shift: true })
295 | );
296 | const command_container = $single("#command-palette-pjax-container");
297 | command_container.style.opacity = 0;
298 |
299 | const command_palette = $single(
300 | "input[aria-controls=command-palette-page-stack]"
301 | );
302 | command_palette.value = ">switch theme";
303 |
304 | (
305 | await $singleAsync("div[role=listbox]>command-palette-item>span")
306 | ).click();
307 |
308 | let flag = await waitForAsync(() => {
309 | return $single("svg[aria-label=Loading]").parentNode.hasAttribute(
310 | "hidden"
311 | );
312 | });
313 | if (!flag) {
314 | throw new Error("Waiting for load ready failed");
315 | }
316 |
317 | command_palette.value = "default dark";
318 |
319 | (
320 | await $selectSingleAsync(
321 | "div[role=listbox]>command-palette-item>span",
322 | (e) => {
323 | return e.innerText.toLowerCase().includes("default dark");
324 | }
325 | )
326 | ).click();
327 | command_container.style.opacity = 1;
328 | },
329 | },
330 | ],
331 | // Bilibili
332 | "bilibili.com": [
333 | {
334 | url: /^https?:\/\/.*?bilibili\.com.*/,
335 | check: () =>
336 | html().classList.contains("night-mode") ? "dark" : "light",
337 | toLight: async () => {
338 | let flag = await waitForTimerAsync(
339 | () => $single("li.v-popover-wrap.header-avatar-wrap") != null,
340 | 200,
341 | 10000
342 | );
343 | if (!flag) {
344 | throw new Error("Waiting for links-item created failed");
345 | }
346 |
347 | let avatar = $single("li.v-popover-wrap.header-avatar-wrap");
348 | avatar.dispatchEvent(sim_events.mouse_enter());
349 | await nextTick();
350 | avatar.dispatchEvent(sim_events.mouse_leave());
351 |
352 | flag = await waitForTimerAsync(
353 | () => $all(".links-item").length > 0,
354 | 200,
355 | 10000
356 | );
357 | if (!flag) {
358 | throw new Error("Waiting for links-item created failed");
359 | }
360 |
361 | let links_item = $all(".links-item");
362 | let single_link_item = $single(
363 | links_item[links_item.length - 1],
364 | ".single-link-item"
365 | );
366 | single_link_item.dispatchEvent(sim_events.mouse_enter());
367 |
368 | flag = await waitForAsync(() =>
369 | single_link_item.nextElementSibling?.classList.contains("v-popover")
370 | );
371 | if (!flag) {
372 | throw new Error("Waiting for popover created failed");
373 | }
374 |
375 | let popover = single_link_item.nextElementSibling;
376 | let options = $all(popover, ".single-link-item.sub-link-item");
377 | options[1].click();
378 | },
379 | toDark: async () => {
380 | let avatar = $single("li.v-popover-wrap.header-avatar-wrap");
381 | avatar.dispatchEvent(sim_events.mouse_enter());
382 | await nextTick();
383 | avatar.dispatchEvent(sim_events.mouse_leave());
384 |
385 | let flag = await waitForTimerAsync(
386 | () => $all(".links-item").length > 0,
387 | 200,
388 | 10000
389 | );
390 | if (!flag) {
391 | throw new Error("Waiting for links-item created failed");
392 | }
393 |
394 | let links_item = $all(".links-item");
395 | let single_link_item = $single(
396 | links_item[links_item.length - 1],
397 | ".single-link-item"
398 | );
399 | single_link_item.dispatchEvent(sim_events.mouse_enter());
400 |
401 | flag = await waitForAsync(() =>
402 | single_link_item.nextElementSibling?.classList.contains("v-popover")
403 | );
404 | if (!flag) {
405 | throw new Error("Waiting for popover created failed");
406 | }
407 |
408 | let popover = single_link_item.nextElementSibling;
409 | let options = $all(popover, ".single-link-item.sub-link-item");
410 | options[0].click();
411 | },
412 | load: async () => {
413 | document.addEventListener("visibilitychange", async function () {
414 | if (document.visibilityState === "visible") {
415 | await nextTick();
416 |
417 | let popover = $single(
418 | "li.v-popover-wrap.header-avatar-wrap>.v-popover"
419 | );
420 | let flag = true;
421 | while (flag) {
422 | if (getComputedStyle(popover).display === "none") {
423 | flag = false;
424 | }
425 |
426 | popover.dispatchEvent(sim_events.mouse_leave());
427 |
428 | await nextFrame();
429 | }
430 | }
431 | });
432 | },
433 | },
434 | ],
435 | // DeepSeek
436 | "deepseek.com": [
437 | {
438 | url: /^https?:\/\/.*?deepseek\.com.*/,
439 | check: () =>
440 | document.body.classList.contains("dark") ? "dark" : "light",
441 | toLight: async () => {
442 | $single(
443 | "#root>div>div>div:nth-child(2)>div>div>div:last-child>div:last-child"
444 | ).click();
445 | (
446 | await $singleAsync(
447 | ".ds-floating-position-wrapper .ds-dropdown-menu .ds-dropdown-menu-option:nth-child(2)"
448 | )
449 | ).click();
450 | const theme_select = await $singleAsync(
451 | ".ds-modal-wrapper .ds-modal .ds-modal-content .ds-flex:nth-child(3) select"
452 | );
453 | theme_select.value = "light";
454 | theme_select.dispatchEvent(new Event("change", { bubbles: true }));
455 | $single(
456 | ".ds-modal-wrapper .ds-modal .ds-modal-content .ds-icon-button"
457 | ).click();
458 | },
459 | toDark: async () => {
460 | $single(
461 | "#root>div>div>div:nth-child(2)>div>div>div:last-child>div:last-child"
462 | ).click();
463 | (
464 | await $singleAsync(
465 | ".ds-floating-position-wrapper .ds-dropdown-menu .ds-dropdown-menu-option:nth-child(2)"
466 | )
467 | ).click();
468 | const theme_select = await $singleAsync(
469 | ".ds-modal-wrapper .ds-modal .ds-modal-content .ds-flex:nth-child(3) select"
470 | );
471 | theme_select.value = "dark";
472 | theme_select.dispatchEvent(new Event("change", { bubbles: true }));
473 | $single(
474 | ".ds-modal-wrapper .ds-modal .ds-modal-content .ds-icon-button"
475 | ).click();
476 | },
477 | },
478 | ],
479 | };
480 |
481 | const domain_suffixes = [
482 | ".com.cn",
483 | ".com",
484 | ".org",
485 | ".net",
486 | ".edu",
487 | ".gov",
488 | ".cn",
489 | ];
490 |
491 | // 匹配到的域名设置
492 | const no_www_domain = getRootDomain(location.hostname);
493 |
494 | const domain_setting = sites[no_www_domain];
495 | if (!domain_setting) {
496 | log(`未找到适配的站点: ${no_www_domain}`);
497 | return;
498 | }
499 |
500 | // 匹配到的网站设置
501 | const site_setting = domain_setting.find((s) => s.url.test(location.href));
502 | if (!site_setting) {
503 | log(`未找到当前页面的适配操作`);
504 | return;
505 | }
506 |
507 | // 加载完成后开始检查主题
508 | addEventListener("load", async () => {
509 | // 调试模式向 window 注册调试函数
510 | if (DEBUG) {
511 | warn("向 window 注册调试函数");
512 |
513 | const debug_functions = [
514 | ["$log", log],
515 | ["$warn", warn],
516 | ["$error", error],
517 | ["$debug", debug],
518 | ["$single", $single],
519 | ["$singleAsync", $singleAsync],
520 | ["$singleAsyncClick", $singleAsyncClick],
521 | ["$singleTimerAsync", $singleTimerAsync],
522 | ["$selectSingleAsync", $selectSingleAsync],
523 | ["$all", $all],
524 | ];
525 |
526 | for (const [name, func] of debug_functions) {
527 | unsafeWindow[name] = func;
528 | }
529 |
530 | warn("调试函数注册完毕");
531 | }
532 |
533 | site_setting.load?.();
534 |
535 | const timer = new Timer(
536 | intervalFunc,
537 | site_setting.afterCheckTime || settings.after_check_default_time
538 | );
539 |
540 | await intervalFunc();
541 |
542 | timer.start();
543 |
544 | document.addEventListener("visibilitychange", async function () {
545 | if (document.visibilityState === "visible") {
546 | log("页面可见, 重新开始检查主题");
547 |
548 | await checkAndChangeTheme();
549 | }
550 | });
551 |
552 | async function intervalFunc() {
553 | try {
554 | await checkAndChangeTheme();
555 |
556 | fail_count = 0;
557 | timer.delay =
558 | site_setting.afterCheckTime || settings.after_check_default_time;
559 |
560 | log("检查/操作完成, 切换到慢速模式");
561 | } catch (ex) {
562 | if (DEBUG) {
563 | if (DEBUG_INTERRUPT_ON_ERROR) {
564 | debug("检查/操作失败, 中断脚本运行", ex);
565 | return;
566 | }
567 |
568 | debug("检查/操作失败", ex);
569 | }
570 |
571 | fail_count++;
572 | if (
573 | fail_count >=
574 | fail_check_time /
575 | (site_setting.fastCheckTime || settings.fast_check_default_time)
576 | ) {
577 | timer.delay =
578 | site_setting.afterCheckTime || settings.after_check_default_time;
579 | error("失败超出时长限制, 切换到慢速模式");
580 | return;
581 | }
582 |
583 | timer.delay =
584 | site_setting.fastCheckTime || settings.fast_check_default_time;
585 | error("检查/操作失败, 切换到高速模式", ex);
586 | }
587 | }
588 | });
589 |
590 | // 查找元素, 用法类似于 jQuery
591 | function $single(arg1, arg2) {
592 | if (arguments.length == 2) {
593 | return $single2(arg1, arg2);
594 | }
595 | return $single1(arg1);
596 | }
597 | function $single1(selector) {
598 | return document.querySelector(selector);
599 | }
600 | function $single2(dom, selector) {
601 | return dom.querySelector(selector);
602 | }
603 |
604 | /*
605 | 类似 jQuery 的元素查找函数
606 |
607 | 适用于连续操作中可能影响用户操作体验的场景, 该方式会尽可能在渲染的同一帧内找到该 DOM 元素,
608 | 以缩短元素变更对用户交互的干扰时间 (如弹窗在显示帧立即点击关闭按钮)
609 |
610 | 与 singleTimerAsync 不同的是, 本函数每一帧都会进行查询, 因此可能对性能造成一定影响
611 | 如果操作不会显著影响用户体验, 则推荐使用 singleTimerAsync
612 | */
613 | async function $singleAsync(selector, timeout = 1000) {
614 | const start = Date.now();
615 | while (Date.now() - start < timeout) {
616 | const ele = $single(selector);
617 | if (ele) {
618 | return ele;
619 | }
620 |
621 | await nextFrame();
622 | }
623 |
624 | throw new Error("Timeout");
625 | }
626 |
627 | async function $singleAsyncClick(select, timeout = 1000) {
628 | const ele = await $singleAsync(select, timeout);
629 | ele?.click();
630 |
631 | return ele;
632 | }
633 |
634 | /*
635 | 类似 jQuery 的元素查找函数
636 |
637 | 适用于不会改变页面结构、或不影响用户操作体验的场景
638 | 使用自定义 Timer 以固定间隔查询元素, 性能开销较小, 但查找速度相对较慢
639 |
640 | 与 singleAsync 不同的是, 该函数通过节流方式降低性能消耗,
641 | 更适合异步检查某些静态区域元素是否已加载完成等情况
642 | */
643 | function $singleTimerAsync(selector, interval = 100, timeout = 1000) {
644 | return promise(async (resolve, reject) => {
645 | const start = Date.now();
646 | const timer = new Timer(() => {
647 | const ele = $single(selector);
648 | if (ele) {
649 | resolve(ele);
650 | timer.stop();
651 | return;
652 | }
653 | if (Date.now() - start >= timeout) {
654 | reject(new Error("Timeout"));
655 | timer.stop();
656 | return;
657 | }
658 | }, interval);
659 | timer.start(true);
660 | });
661 | }
662 |
663 | // 用于查找无法单纯使用 CSS 选择器的复杂元素
664 | async function $selectSingleAsync(selector, filter, timeout = 1000) {
665 | const start = Date.now();
666 | while (Date.now() - start < timeout) {
667 | const eles = $all(selector);
668 | if (eles.length) {
669 | let selected = Array.from(eles).filter(filter);
670 | if (selected.length) {
671 | return selected[0];
672 | }
673 | }
674 |
675 | await nextFrame();
676 | }
677 |
678 | throw new Error("Timeout");
679 | }
680 |
681 | function $all(arg1, arg2) {
682 | if (arguments.length == 2) {
683 | return $all2(arg1, arg2);
684 | }
685 | return $all1(arg1);
686 | }
687 | function $all1(selector) {
688 | return document.querySelectorAll(selector);
689 | }
690 | function $all2(dom, selector) {
691 | return dom.querySelectorAll(selector);
692 | }
693 |
694 | function html() {
695 | return document.documentElement;
696 | }
697 |
698 | // 初始化设置
699 | function initSettings() {
700 | log("初始化设置");
701 |
702 | settings.light_time = GM_getValue("light_time", settings.light_time);
703 | settings.dark_time = GM_getValue("dark_time", settings.dark_time);
704 |
705 | refreshMenuCommand();
706 | }
707 |
708 | // 获取根域名
709 | function getRootDomain(domain) {
710 | for (const suffix of domain_suffixes) {
711 | if (!domain.endsWith(suffix)) {
712 | continue;
713 | }
714 |
715 | const index = domain.lastIndexOf(".", suffix.length);
716 | return domain.substring(index + 1);
717 | }
718 | }
719 |
720 | // 检查当前时间是否需要切换主题
721 | async function checkAndChangeTheme() {
722 | log("开始检查主题");
723 |
724 | const light_minutes = timeToMinutes(settings.light_time);
725 | const dark_minutes = timeToMinutes(settings.dark_time);
726 |
727 | let now = nowMinutes();
728 |
729 | const current_theme = site_setting.check();
730 | log(`当前主题:${current_theme}`);
731 |
732 | if (DEBUG && DEBUG_FORCE_TOGGLE) {
733 | debug("强制切换主题");
734 | if (
735 | now >= light_minutes &&
736 | now < dark_minutes &&
737 | current_theme === "light"
738 | ) {
739 | now = dark_minutes;
740 | debug("将当前时间设置为黑夜时间");
741 | } else if (
742 | (now >= dark_minutes || now < light_minutes) &&
743 | current_theme === "dark"
744 | ) {
745 | now = light_minutes;
746 | debug("将当前时间设置为明亮时间");
747 | }
748 | }
749 |
750 | if (now >= light_minutes && now < dark_minutes) {
751 | if (current_theme === "light") {
752 | log("当前时间为明亮主题时间, 无需切换");
753 | return;
754 | }
755 | if (site_setting.toggle) {
756 | log("切换到明亮主题 - toggle");
757 | await site_setting.toggle();
758 | log("切换完成");
759 | return;
760 | }
761 | if (site_setting.toLight) {
762 | log("切换到明亮主题 - toLight");
763 | await site_setting.toLight();
764 | log("切换完成");
765 | return;
766 | }
767 |
768 | error("切换到明亮主题 - 未指定切换函数");
769 | } else {
770 | if (current_theme === "dark") {
771 | log("当前时间为黑夜主题时间, 无需切换");
772 | return;
773 | }
774 | if (site_setting.toggle) {
775 | log("切换到黑夜主题 - toggle");
776 | await site_setting.toggle();
777 | log("切换完成");
778 | return;
779 | }
780 | if (site_setting.toDark) {
781 | log("切换到黑夜主题 - toDark");
782 | await site_setting.toDark();
783 | log("切换完成");
784 | return;
785 | }
786 |
787 | error("切换到黑夜主题 - 未指定切换函数");
788 | }
789 | }
790 |
791 | // 刷新菜单
792 | function refreshMenuCommand() {
793 | log("刷新脚本菜单");
794 |
795 | if (settings.light_menu_id) {
796 | GM_unregisterMenuCommand(settings.light_menu_id);
797 | }
798 | if (settings.dark_menu_id) {
799 | GM_unregisterMenuCommand(settings.dark_menu_id);
800 | }
801 | if (settings.debug_toggle_id) {
802 | GM_unregisterMenuCommand(settings.debug_toggle_id);
803 | }
804 |
805 | settings.light_menu_id = GM_registerMenuCommand(
806 | `设置明亮时间 (${settings.light_time})`,
807 | () => setTimePrompt("light_time", "明亮时间")
808 | );
809 | settings.dark_menu_id = GM_registerMenuCommand(
810 | `设置黑夜时间 (${settings.dark_time})`,
811 | () => setTimePrompt("dark_time", "黑夜时间")
812 | );
813 | if (DEBUG) {
814 | settings.debug_toggle_id = GM_registerMenuCommand(
815 | `调试模式: 强制切换主题`,
816 | async () => {
817 | DEBUG_FORCE_TOGGLE = true;
818 | try {
819 | await checkAndChangeTheme();
820 | } catch (ex) {
821 | error("强制切换主题失败", ex);
822 | } finally {
823 | DEBUG_FORCE_TOGGLE = false;
824 | }
825 | }
826 | );
827 | }
828 | }
829 |
830 | // 设置时间提示框
831 | function setTimePrompt(key, label) {
832 | log(`设置${label}提示框`);
833 |
834 | const old_val = GM_getValue(key, settings[key]);
835 |
836 | log(`旧${label}:${old_val}`);
837 |
838 | const new_val = prompt(`设置${label}(格式 HH:mm):`, old_val);
839 | log(`用户输入: ${new_val}`);
840 | if (!new_val) {
841 | return;
842 | }
843 | if (!new_val || !/^([0-1][0-9]|2[0-3])[::]([0-5][0-9])$/.test(new_val)) {
844 | alert('格式不正确, 时间格式为 "08:00"');
845 | return;
846 | }
847 | const standard_new_val = new_val.replace(":", ":");
848 |
849 | log(`新${label}:${standard_new_val}`);
850 |
851 | const tmp = standard_new_val;
852 | settings[key] = standard_new_val;
853 | if (
854 | timeToMinutes(settings.light_time) > timeToMinutes(settings.dark_time)
855 | ) {
856 | log("黑夜时间不能早于明亮时间");
857 |
858 | settings[key] = tmp;
859 | alert("黑夜时间不能早于明亮时间");
860 | return;
861 | }
862 |
863 | GM_setValue(key, standard_new_val);
864 |
865 | log(`${label} 已设置为:${standard_new_val}`);
866 |
867 | alert(`${label} 已设置为:${standard_new_val}`);
868 |
869 | refreshMenuCommand();
870 | }
871 |
872 | // 将时间字符串转为分钟
873 | function timeToMinutes(time) {
874 | const [hour, minute] = time.split(":").map(Number);
875 | return hour * 60 + minute;
876 | }
877 |
878 | // 获取当前时间的分钟数
879 | function nowMinutes() {
880 | const now = new Date();
881 | return now.getHours() * 60 + now.getMinutes();
882 | }
883 |
884 | // 将函数加入下一轮事件循环
885 | function nextTick(func) {
886 | return Promise.resolve().then(() => {
887 | func?.();
888 | });
889 | }
890 |
891 | // 等待下一帧
892 | function nextFrame(func) {
893 | return new Promise((resolve) => {
894 | requestAnimationFrame((timestamp) => {
895 | func?.(timestamp);
896 | resolve(timestamp);
897 | });
898 | });
899 | }
900 |
901 | // 异步函数返回 Promise
902 | function promise(func) {
903 | return new Promise((resolve, reject) => {
904 | try {
905 | func(resolve, reject);
906 | } catch (ex) {
907 | reject(ex);
908 | }
909 | });
910 | }
911 |
912 | // 等待指定时间
913 | function waitTimeAsync(time) {
914 | return new Promise((resolve) => {
915 | setTimeout(() => {
916 | resolve();
917 | }, time);
918 | });
919 | }
920 |
921 | /*
922 | 等待某个元素达到某个状态
923 |
924 | 适用于连续操作中可能影响用户操作体验的场景, 该方式会在渲染的每一帧内检测该 DOM 元素的状态,
925 | 以缩短元素变更对用户交互的干扰时间 (如弹窗在显示帧立即点击关闭按钮)
926 |
927 | 与 waitForTimerAsync 不同的是, 本函数每一帧都会进行查询, 因此可能对性能造成一定影响
928 | 如果操作不会显著影响用户体验, 则推荐使用 waitForTimerAsync
929 | */
930 | async function waitForAsync(detector, timeout = 1000) {
931 | if (!detector) throw new Error("detector can not be null.");
932 |
933 | const start = Date.now();
934 | while (Date.now() - start < timeout) {
935 | if (detector()) {
936 | return true;
937 | }
938 |
939 | await nextFrame();
940 | }
941 |
942 | return false;
943 | }
944 |
945 | /* 等待某个元素达到某个状态
946 |
947 | 适用于不会改变页面结构、或不影响用户操作体验的场景
948 | 使用自定义 Timer 以固定间隔查询元素, 性能开销较小, 但查找速度相对较慢
949 |
950 | 与 waitForAsync 不同的是, 该函数通过节流方式降低性能消耗,
951 | 更适合异步检查某些静态区域元素是否已加载完成等情况
952 | */
953 | function waitForTimerAsync(detector, interval = 100, timeout = 1000) {
954 | if (!detector) throw new Error("detector can not be null.");
955 |
956 | return promise(async (resolve, reject) => {
957 | const start = Date.now();
958 | const timer = new Timer(() => {
959 | if (detector()) {
960 | resolve(true);
961 | timer.stop();
962 | return;
963 | }
964 | if (Date.now() - start >= timeout) {
965 | reject(new Error("Timeout"));
966 | timer.stop();
967 | return;
968 | }
969 | }, interval);
970 | timer.start(true);
971 | });
972 | }
973 |
974 | // 自建定时器
975 | class Timer {
976 | #timer = null;
977 | #func = null;
978 | delay = 0;
979 |
980 | constructor(func, delay) {
981 | this.#func = func;
982 | this.delay = delay;
983 | }
984 |
985 | start(immediate = false) {
986 | this.stop();
987 |
988 | let start_new = async () => {
989 | if (immediate) {
990 | await this.#func();
991 | }
992 |
993 | this.#timer = setTimeout(async () => {
994 | await this.#func();
995 | this.start();
996 | }, this.delay);
997 | };
998 | start_new();
999 | }
1000 |
1001 | stop() {
1002 | clearTimeout(this.#timer);
1003 | }
1004 | }
1005 | })();
1006 |
--------------------------------------------------------------------------------
/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/gqKQa8gtd0Kyk8Vv81tZKWGByC233JWIwp9iYcPORkT56fl1po5pnjNn5syc6dOZz/Iz1/dr3s9z5pk5Jv6bm7h+KoDqgIkTqCEwcQPUJFhDoIbAxAnUEJi4AepXoIZADYGJE4gJgSPAF+BFYXYngU/AsyH7CAUg4s8B84GNBSGI+DPAAmDzEAghANriDfS9wO0hJxAx9iBwvhFvhu8HbkbM1fsz6BJfAoJL/CAIfRzQJX5MCF3ioyH4AOwGrjQxbxb5Cixy2G0fcCvGhj3GuMS79vEfIH1v9Jjz/y5dADTx/wCfgScjQdDE/wt8dCTiIAgaAE38MeBBI1yyrw3hN3AgoRO2A9eshCcnfwK42+xjvQJBxj70OcEFQMRftGz+C5BcYGfanBD6iDf6DgFXLbHihG3A4y4ILgBbgEeOQWuA147/VwFvrP/FCbK4K0x8hyLtmnj53D13TCD9LwMLW23fAclLnS7QQmCDspAGYRdwJxEEifmzlgN/AiL+npJ35HLWTsy9xPuS4A5lwVAI0t92iOaCUcX7AEh7qBPEivcdTlgHvPJ435Xtu07+aHMtnxdq+/Y+fPcA6RuaEzQIq4G3CoQi4vs4wOx3GfAhIDEuB947nOCCECpeEtslYNDJm731cYDp6xIlbVpOWAG880AoKj7EAUbHWuClwwlble+tC4IMl1J6aaukNVNKzMsJ23lE2pPEvL33EAfEQlipxP4364Y3uvgYB/ggHG6urjZoDYLpJ9fb4wEnL/1PKWt5PjZ/N8c4IDWELvGuhJdM/BAHxELYBDxtnUFR8SkAyBxaYtypWNpAKC4+FQCZZ49SAmsQpIpcAlxwBKzY3nW3P91UqUEx7us8JAfYc2sQQl6PNfHyDpHltSklgC4n9IEgoXHdUdVlE58yBNpukEuRqwbXbowyVuoHud5GlbQ+m3e1p3aAWSukitRs733MGCLcjM0FQObv855QVHyuEGgfTJcTpBaQbJ+kqot1Q04HmD1p7wk/SosfwwEGgvaeYNp7v+HFnrQ2bgwHmLW194Ri4sd0gFY7FBVfAkC7diguvhQAA2Fxinp+aE4YMwcM3WuW8RVAFqwzNGl1wAwdVpatVgdkwTpDk1YHzNBhZdlqdUAWrDM06eQd8Acza/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 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | GNU GENERAL PUBLIC LICENSE
2 | Version 3, 29 June 2007
3 |
4 | Copyright (C) 2007 Free Software Foundation, Inc.
5 | Everyone is permitted to copy and distribute verbatim copies
6 | of this license document, but changing it is not allowed.
7 |
8 | Preamble
9 |
10 | The GNU General Public License is a free, copyleft license for
11 | software and other kinds of works.
12 |
13 | The licenses for most software and other practical works are designed
14 | to take away your freedom to share and change the works. By contrast,
15 | the GNU General Public License is intended to guarantee your freedom to
16 | share and change all versions of a program--to make sure it remains free
17 | software for all its users. We, the Free Software Foundation, use the
18 | GNU General Public License for most of our software; it applies also to
19 | any other work released this way by its authors. You can apply it to
20 | your programs, too.
21 |
22 | When we speak of free software, we are referring to freedom, not
23 | price. Our General Public Licenses are designed to make sure that you
24 | have the freedom to distribute copies of free software (and charge for
25 | them if you wish), that you receive source code or can get it if you
26 | want it, that you can change the software or use pieces of it in new
27 | free programs, and that you know you can do these things.
28 |
29 | To protect your rights, we need to prevent others from denying you
30 | these rights or asking you to surrender the rights. Therefore, you have
31 | certain responsibilities if you distribute copies of the software, or if
32 | you modify it: responsibilities to respect the freedom of others.
33 |
34 | For example, if you distribute copies of such a program, whether
35 | gratis or for a fee, you must pass on to the recipients the same
36 | freedoms that you received. You must make sure that they, too, receive
37 | or can get the source code. And you must show them these terms so they
38 | know their rights.
39 |
40 | Developers that use the GNU GPL protect your rights with two steps:
41 | (1) assert copyright on the software, and (2) offer you this License
42 | giving you legal permission to copy, distribute and/or modify it.
43 |
44 | For the developers' and authors' protection, the GPL clearly explains
45 | that there is no warranty for this free software. For both users' and
46 | authors' sake, the GPL requires that modified versions be marked as
47 | changed, so that their problems will not be attributed erroneously to
48 | authors of previous versions.
49 |
50 | Some devices are designed to deny users access to install or run
51 | modified versions of the software inside them, although the manufacturer
52 | can do so. This is fundamentally incompatible with the aim of
53 | protecting users' freedom to change the software. The systematic
54 | pattern of such abuse occurs in the area of products for individuals to
55 | use, which is precisely where it is most unacceptable. Therefore, we
56 | have designed this version of the GPL to prohibit the practice for those
57 | products. If such problems arise substantially in other domains, we
58 | stand ready to extend this provision to those domains in future versions
59 | of the GPL, as needed to protect the freedom of users.
60 |
61 | Finally, every program is threatened constantly by software patents.
62 | States should not allow patents to restrict development and use of
63 | software on general-purpose computers, but in those that do, we wish to
64 | avoid the special danger that patents applied to a free program could
65 | make it effectively proprietary. To prevent this, the GPL assures that
66 | patents cannot be used to render the program non-free.
67 |
68 | The precise terms and conditions for copying, distribution and
69 | modification follow.
70 |
71 | TERMS AND CONDITIONS
72 |
73 | 0. Definitions.
74 |
75 | "This License" refers to version 3 of the GNU General Public License.
76 |
77 | "Copyright" also means copyright-like laws that apply to other kinds of
78 | works, such as semiconductor masks.
79 |
80 | "The Program" refers to any copyrightable work licensed under this
81 | License. Each licensee is addressed as "you". "Licensees" and
82 | "recipients" may be individuals or organizations.
83 |
84 | To "modify" a work means to copy from or adapt all or part of the work
85 | in a fashion requiring copyright permission, other than the making of an
86 | exact copy. The resulting work is called a "modified version" of the
87 | earlier work or a work "based on" the earlier work.
88 |
89 | A "covered work" means either the unmodified Program or a work based
90 | on the Program.
91 |
92 | To "propagate" a work means to do anything with it that, without
93 | permission, would make you directly or secondarily liable for
94 | infringement under applicable copyright law, except executing it on a
95 | computer or modifying a private copy. Propagation includes copying,
96 | distribution (with or without modification), making available to the
97 | public, and in some countries other activities as well.
98 |
99 | To "convey" a work means any kind of propagation that enables other
100 | parties to make or receive copies. Mere interaction with a user through
101 | a computer network, with no transfer of a copy, is not conveying.
102 |
103 | An interactive user interface displays "Appropriate Legal Notices"
104 | to the extent that it includes a convenient and prominently visible
105 | feature that (1) displays an appropriate copyright notice, and (2)
106 | tells the user that there is no warranty for the work (except to the
107 | extent that warranties are provided), that licensees may convey the
108 | work under this License, and how to view a copy of this License. If
109 | the interface presents a list of user commands or options, such as a
110 | menu, a prominent item in the list meets this criterion.
111 |
112 | 1. Source Code.
113 |
114 | The "source code" for a work means the preferred form of the work
115 | for making modifications to it. "Object code" means any non-source
116 | form of a work.
117 |
118 | A "Standard Interface" means an interface that either is an official
119 | standard defined by a recognized standards body, or, in the case of
120 | interfaces specified for a particular programming language, one that
121 | is widely used among developers working in that language.
122 |
123 | The "System Libraries" of an executable work include anything, other
124 | than the work as a whole, that (a) is included in the normal form of
125 | packaging a Major Component, but which is not part of that Major
126 | Component, and (b) serves only to enable use of the work with that
127 | Major Component, or to implement a Standard Interface for which an
128 | implementation is available to the public in source code form. A
129 | "Major Component", in this context, means a major essential component
130 | (kernel, window system, and so on) of the specific operating system
131 | (if any) on which the executable work runs, or a compiler used to
132 | produce the work, or an object code interpreter used to run it.
133 |
134 | The "Corresponding Source" for a work in object code form means all
135 | the source code needed to generate, install, and (for an executable
136 | work) run the object code and to modify the work, including scripts to
137 | control those activities. However, it does not include the work's
138 | System Libraries, or general-purpose tools or generally available free
139 | programs which are used unmodified in performing those activities but
140 | which are not part of the work. For example, Corresponding Source
141 | includes interface definition files associated with source files for
142 | the work, and the source code for shared libraries and dynamically
143 | linked subprograms that the work is specifically designed to require,
144 | such as by intimate data communication or control flow between those
145 | subprograms and other parts of the work.
146 |
147 | The Corresponding Source need not include anything that users
148 | can regenerate automatically from other parts of the Corresponding
149 | Source.
150 |
151 | The Corresponding Source for a work in source code form is that
152 | same work.
153 |
154 | 2. Basic Permissions.
155 |
156 | All rights granted under this License are granted for the term of
157 | copyright on the Program, and are irrevocable provided the stated
158 | conditions are met. This License explicitly affirms your unlimited
159 | permission to run the unmodified Program. The output from running a
160 | covered work is covered by this License only if the output, given its
161 | content, constitutes a covered work. This License acknowledges your
162 | rights of fair use or other equivalent, as provided by copyright law.
163 |
164 | You may make, run and propagate covered works that you do not
165 | convey, without conditions so long as your license otherwise remains
166 | in force. You may convey covered works to others for the sole purpose
167 | of having them make modifications exclusively for you, or provide you
168 | with facilities for running those works, provided that you comply with
169 | the terms of this License in conveying all material for which you do
170 | not control copyright. Those thus making or running the covered works
171 | for you must do so exclusively on your behalf, under your direction
172 | and control, on terms that prohibit them from making any copies of
173 | your copyrighted material outside their relationship with you.
174 |
175 | Conveying under any other circumstances is permitted solely under
176 | the conditions stated below. Sublicensing is not allowed; section 10
177 | makes it unnecessary.
178 |
179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180 |
181 | No covered work shall be deemed part of an effective technological
182 | measure under any applicable law fulfilling obligations under article
183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or
184 | similar laws prohibiting or restricting circumvention of such
185 | measures.
186 |
187 | When you convey a covered work, you waive any legal power to forbid
188 | circumvention of technological measures to the extent such circumvention
189 | is effected by exercising rights under this License with respect to
190 | the covered work, and you disclaim any intention to limit operation or
191 | modification of the work as a means of enforcing, against the work's
192 | users, your or third parties' legal rights to forbid circumvention of
193 | technological measures.
194 |
195 | 4. Conveying Verbatim Copies.
196 |
197 | You may convey verbatim copies of the Program's source code as you
198 | receive it, in any medium, provided that you conspicuously and
199 | appropriately publish on each copy an appropriate copyright notice;
200 | keep intact all notices stating that this License and any
201 | non-permissive terms added in accord with section 7 apply to the code;
202 | keep intact all notices of the absence of any warranty; and give all
203 | recipients a copy of this License along with the Program.
204 |
205 | You may charge any price or no price for each copy that you convey,
206 | and you may offer support or warranty protection for a fee.
207 |
208 | 5. Conveying Modified Source Versions.
209 |
210 | You may convey a work based on the Program, or the modifications to
211 | produce it from the Program, in the form of source code under the
212 | terms of section 4, provided that you also meet all of these conditions:
213 |
214 | a) The work must carry prominent notices stating that you modified
215 | it, and giving a relevant date.
216 |
217 | b) The work must carry prominent notices stating that it is
218 | released under this License and any conditions added under section
219 | 7. This requirement modifies the requirement in section 4 to
220 | "keep intact all notices".
221 |
222 | c) You must license the entire work, as a whole, under this
223 | License to anyone who comes into possession of a copy. This
224 | License will therefore apply, along with any applicable section 7
225 | additional terms, to the whole of the work, and all its parts,
226 | regardless of how they are packaged. This License gives no
227 | permission to license the work in any other way, but it does not
228 | invalidate such permission if you have separately received it.
229 |
230 | d) If the work has interactive user interfaces, each must display
231 | Appropriate Legal Notices; however, if the Program has interactive
232 | interfaces that do not display Appropriate Legal Notices, your
233 | work need not make them do so.
234 |
235 | A compilation of a covered work with other separate and independent
236 | works, which are not by their nature extensions of the covered work,
237 | and which are not combined with it such as to form a larger program,
238 | in or on a volume of a storage or distribution medium, is called an
239 | "aggregate" if the compilation and its resulting copyright are not
240 | used to limit the access or legal rights of the compilation's users
241 | beyond what the individual works permit. Inclusion of a covered work
242 | in an aggregate does not cause this License to apply to the other
243 | parts of the aggregate.
244 |
245 | 6. Conveying Non-Source Forms.
246 |
247 | You may convey a covered work in object code form under the terms
248 | of sections 4 and 5, provided that you also convey the
249 | machine-readable Corresponding Source under the terms of this License,
250 | in one of these ways:
251 |
252 | a) Convey the object code in, or embodied in, a physical product
253 | (including a physical distribution medium), accompanied by the
254 | Corresponding Source fixed on a durable physical medium
255 | customarily used for software interchange.
256 |
257 | b) Convey the object code in, or embodied in, a physical product
258 | (including a physical distribution medium), accompanied by a
259 | written offer, valid for at least three years and valid for as
260 | long as you offer spare parts or customer support for that product
261 | model, to give anyone who possesses the object code either (1) a
262 | copy of the Corresponding Source for all the software in the
263 | product that is covered by this License, on a durable physical
264 | medium customarily used for software interchange, for a price no
265 | more than your reasonable cost of physically performing this
266 | conveying of source, or (2) access to copy the
267 | Corresponding Source from a network server at no charge.
268 |
269 | c) Convey individual copies of the object code with a copy of the
270 | written offer to provide the Corresponding Source. This
271 | alternative is allowed only occasionally and noncommercially, and
272 | only if you received the object code with such an offer, in accord
273 | with subsection 6b.
274 |
275 | d) Convey the object code by offering access from a designated
276 | place (gratis or for a charge), and offer equivalent access to the
277 | Corresponding Source in the same way through the same place at no
278 | further charge. You need not require recipients to copy the
279 | Corresponding Source along with the object code. If the place to
280 | copy the object code is a network server, the Corresponding Source
281 | may be on a different server (operated by you or a third party)
282 | that supports equivalent copying facilities, provided you maintain
283 | clear directions next to the object code saying where to find the
284 | Corresponding Source. Regardless of what server hosts the
285 | Corresponding Source, you remain obligated to ensure that it is
286 | available for as long as needed to satisfy these requirements.
287 |
288 | e) Convey the object code using peer-to-peer transmission, provided
289 | you inform other peers where the object code and Corresponding
290 | Source of the work are being offered to the general public at no
291 | charge under subsection 6d.
292 |
293 | A separable portion of the object code, whose source code is excluded
294 | from the Corresponding Source as a System Library, need not be
295 | included in conveying the object code work.
296 |
297 | A "User Product" is either (1) a "consumer product", which means any
298 | tangible personal property which is normally used for personal, family,
299 | or household purposes, or (2) anything designed or sold for incorporation
300 | into a dwelling. In determining whether a product is a consumer product,
301 | doubtful cases shall be resolved in favor of coverage. For a particular
302 | product received by a particular user, "normally used" refers to a
303 | typical or common use of that class of product, regardless of the status
304 | of the particular user or of the way in which the particular user
305 | actually uses, or expects or is expected to use, the product. A product
306 | is a consumer product regardless of whether the product has substantial
307 | commercial, industrial or non-consumer uses, unless such uses represent
308 | the only significant mode of use of the product.
309 |
310 | "Installation Information" for a User Product means any methods,
311 | procedures, authorization keys, or other information required to install
312 | and execute modified versions of a covered work in that User Product from
313 | a modified version of its Corresponding Source. The information must
314 | suffice to ensure that the continued functioning of the modified object
315 | code is in no case prevented or interfered with solely because
316 | modification has been made.
317 |
318 | If you convey an object code work under this section in, or with, or
319 | specifically for use in, a User Product, and the conveying occurs as
320 | part of a transaction in which the right of possession and use of the
321 | User Product is transferred to the recipient in perpetuity or for a
322 | fixed term (regardless of how the transaction is characterized), the
323 | Corresponding Source conveyed under this section must be accompanied
324 | by the Installation Information. But this requirement does not apply
325 | if neither you nor any third party retains the ability to install
326 | modified object code on the User Product (for example, the work has
327 | been installed in ROM).
328 |
329 | The requirement to provide Installation Information does not include a
330 | requirement to continue to provide support service, warranty, or updates
331 | for a work that has been modified or installed by the recipient, or for
332 | the User Product in which it has been modified or installed. Access to a
333 | network may be denied when the modification itself materially and
334 | adversely affects the operation of the network or violates the rules and
335 | protocols for communication across the network.
336 |
337 | Corresponding Source conveyed, and Installation Information provided,
338 | in accord with this section must be in a format that is publicly
339 | documented (and with an implementation available to the public in
340 | source code form), and must require no special password or key for
341 | unpacking, reading or copying.
342 |
343 | 7. Additional Terms.
344 |
345 | "Additional permissions" are terms that supplement the terms of this
346 | License by making exceptions from one or more of its conditions.
347 | Additional permissions that are applicable to the entire Program shall
348 | be treated as though they were included in this License, to the extent
349 | that they are valid under applicable law. If additional permissions
350 | apply only to part of the Program, that part may be used separately
351 | under those permissions, but the entire Program remains governed by
352 | this License without regard to the additional permissions.
353 |
354 | When you convey a copy of a covered work, you may at your option
355 | remove any additional permissions from that copy, or from any part of
356 | it. (Additional permissions may be written to require their own
357 | removal in certain cases when you modify the work.) You may place
358 | additional permissions on material, added by you to a covered work,
359 | for which you have or can give appropriate copyright permission.
360 |
361 | Notwithstanding any other provision of this License, for material you
362 | add to a covered work, you may (if authorized by the copyright holders of
363 | that material) supplement the terms of this License with terms:
364 |
365 | a) Disclaiming warranty or limiting liability differently from the
366 | terms of sections 15 and 16 of this License; or
367 |
368 | b) Requiring preservation of specified reasonable legal notices or
369 | author attributions in that material or in the Appropriate Legal
370 | Notices displayed by works containing it; or
371 |
372 | c) Prohibiting misrepresentation of the origin of that material, or
373 | requiring that modified versions of such material be marked in
374 | reasonable ways as different from the original version; or
375 |
376 | d) Limiting the use for publicity purposes of names of licensors or
377 | authors of the material; or
378 |
379 | e) Declining to grant rights under trademark law for use of some
380 | trade names, trademarks, or service marks; or
381 |
382 | f) Requiring indemnification of licensors and authors of that
383 | material by anyone who conveys the material (or modified versions of
384 | it) with contractual assumptions of liability to the recipient, for
385 | any liability that these contractual assumptions directly impose on
386 | those licensors and authors.
387 |
388 | All other non-permissive additional terms are considered "further
389 | restrictions" within the meaning of section 10. If the Program as you
390 | received it, or any part of it, contains a notice stating that it is
391 | governed by this License along with a term that is a further
392 | restriction, you may remove that term. If a license document contains
393 | a further restriction but permits relicensing or conveying under this
394 | License, you may add to a covered work material governed by the terms
395 | of that license document, provided that the further restriction does
396 | not survive such relicensing or conveying.
397 |
398 | If you add terms to a covered work in accord with this section, you
399 | must place, in the relevant source files, a statement of the
400 | additional terms that apply to those files, or a notice indicating
401 | where to find the applicable terms.
402 |
403 | Additional terms, permissive or non-permissive, may be stated in the
404 | form of a separately written license, or stated as exceptions;
405 | the above requirements apply either way.
406 |
407 | 8. Termination.
408 |
409 | You may not propagate or modify a covered work except as expressly
410 | provided under this License. Any attempt otherwise to propagate or
411 | modify it is void, and will automatically terminate your rights under
412 | this License (including any patent licenses granted under the third
413 | paragraph of section 11).
414 |
415 | However, if you cease all violation of this License, then your
416 | license from a particular copyright holder is reinstated (a)
417 | provisionally, unless and until the copyright holder explicitly and
418 | finally terminates your license, and (b) permanently, if the copyright
419 | holder fails to notify you of the violation by some reasonable means
420 | prior to 60 days after the cessation.
421 |
422 | Moreover, your license from a particular copyright holder is
423 | reinstated permanently if the copyright holder notifies you of the
424 | violation by some reasonable means, this is the first time you have
425 | received notice of violation of this License (for any work) from that
426 | copyright holder, and you cure the violation prior to 30 days after
427 | your receipt of the notice.
428 |
429 | Termination of your rights under this section does not terminate the
430 | licenses of parties who have received copies or rights from you under
431 | this License. If your rights have been terminated and not permanently
432 | reinstated, you do not qualify to receive new licenses for the same
433 | material under section 10.
434 |
435 | 9. Acceptance Not Required for Having Copies.
436 |
437 | You are not required to accept this License in order to receive or
438 | run a copy of the Program. Ancillary propagation of a covered work
439 | occurring solely as a consequence of using peer-to-peer transmission
440 | to receive a copy likewise does not require acceptance. However,
441 | nothing other than this License grants you permission to propagate or
442 | modify any covered work. These actions infringe copyright if you do
443 | not accept this License. Therefore, by modifying or propagating a
444 | covered work, you indicate your acceptance of this License to do so.
445 |
446 | 10. Automatic Licensing of Downstream Recipients.
447 |
448 | Each time you convey a covered work, the recipient automatically
449 | receives a license from the original licensors, to run, modify and
450 | propagate that work, subject to this License. You are not responsible
451 | for enforcing compliance by third parties with this License.
452 |
453 | An "entity transaction" is a transaction transferring control of an
454 | organization, or substantially all assets of one, or subdividing an
455 | organization, or merging organizations. If propagation of a covered
456 | work results from an entity transaction, each party to that
457 | transaction who receives a copy of the work also receives whatever
458 | licenses to the work the party's predecessor in interest had or could
459 | give under the previous paragraph, plus a right to possession of the
460 | Corresponding Source of the work from the predecessor in interest, if
461 | the predecessor has it or can get it with reasonable efforts.
462 |
463 | You may not impose any further restrictions on the exercise of the
464 | rights granted or affirmed under this License. For example, you may
465 | not impose a license fee, royalty, or other charge for exercise of
466 | rights granted under this License, and you may not initiate litigation
467 | (including a cross-claim or counterclaim in a lawsuit) alleging that
468 | any patent claim is infringed by making, using, selling, offering for
469 | sale, or importing the Program or any portion of it.
470 |
471 | 11. Patents.
472 |
473 | A "contributor" is a copyright holder who authorizes use under this
474 | License of the Program or a work on which the Program is based. The
475 | work thus licensed is called the contributor's "contributor version".
476 |
477 | A contributor's "essential patent claims" are all patent claims
478 | owned or controlled by the contributor, whether already acquired or
479 | hereafter acquired, that would be infringed by some manner, permitted
480 | by this License, of making, using, or selling its contributor version,
481 | but do not include claims that would be infringed only as a
482 | consequence of further modification of the contributor version. For
483 | purposes of this definition, "control" includes the right to grant
484 | patent sublicenses in a manner consistent with the requirements of
485 | this License.
486 |
487 | Each contributor grants you a non-exclusive, worldwide, royalty-free
488 | patent license under the contributor's essential patent claims, to
489 | make, use, sell, offer for sale, import and otherwise run, modify and
490 | propagate the contents of its contributor version.
491 |
492 | In the following three paragraphs, a "patent license" is any express
493 | agreement or commitment, however denominated, not to enforce a patent
494 | (such as an express permission to practice a patent or covenant not to
495 | sue for patent infringement). To "grant" such a patent license to a
496 | party means to make such an agreement or commitment not to enforce a
497 | patent against the party.
498 |
499 | If you convey a covered work, knowingly relying on a patent license,
500 | and the Corresponding Source of the work is not available for anyone
501 | to copy, free of charge and under the terms of this License, through a
502 | publicly available network server or other readily accessible means,
503 | then you must either (1) cause the Corresponding Source to be so
504 | available, or (2) arrange to deprive yourself of the benefit of the
505 | patent license for this particular work, or (3) arrange, in a manner
506 | consistent with the requirements of this License, to extend the patent
507 | license to downstream recipients. "Knowingly relying" means you have
508 | actual knowledge that, but for the patent license, your conveying the
509 | covered work in a country, or your recipient's use of the covered work
510 | in a country, would infringe one or more identifiable patents in that
511 | country that you have reason to believe are valid.
512 |
513 | If, pursuant to or in connection with a single transaction or
514 | arrangement, you convey, or propagate by procuring conveyance of, a
515 | covered work, and grant a patent license to some of the parties
516 | receiving the covered work authorizing them to use, propagate, modify
517 | or convey a specific copy of the covered work, then the patent license
518 | you grant is automatically extended to all recipients of the covered
519 | work and works based on it.
520 |
521 | A patent license is "discriminatory" if it does not include within
522 | the scope of its coverage, prohibits the exercise of, or is
523 | conditioned on the non-exercise of one or more of the rights that are
524 | specifically granted under this License. You may not convey a covered
525 | work if you are a party to an arrangement with a third party that is
526 | in the business of distributing software, under which you make payment
527 | to the third party based on the extent of your activity of conveying
528 | the work, and under which the third party grants, to any of the
529 | parties who would receive the covered work from you, a discriminatory
530 | patent license (a) in connection with copies of the covered work
531 | conveyed by you (or copies made from those copies), or (b) primarily
532 | for and in connection with specific products or compilations that
533 | contain the covered work, unless you entered into that arrangement,
534 | or that patent license was granted, prior to 28 March 2007.
535 |
536 | Nothing in this License shall be construed as excluding or limiting
537 | any implied license or other defenses to infringement that may
538 | otherwise be available to you under applicable patent law.
539 |
540 | 12. No Surrender of Others' Freedom.
541 |
542 | If conditions are imposed on you (whether by court order, agreement or
543 | otherwise) that contradict the conditions of this License, they do not
544 | excuse you from the conditions of this License. If you cannot convey a
545 | covered work so as to satisfy simultaneously your obligations under this
546 | License and any other pertinent obligations, then as a consequence you may
547 | not convey it at all. For example, if you agree to terms that obligate you
548 | to collect a royalty for further conveying from those to whom you convey
549 | the Program, the only way you could satisfy both those terms and this
550 | License would be to refrain entirely from conveying the Program.
551 |
552 | 13. Use with the GNU Affero General Public License.
553 |
554 | Notwithstanding any other provision of this License, you have
555 | permission to link or combine any covered work with a work licensed
556 | under version 3 of the GNU Affero General Public License into a single
557 | combined work, and to convey the resulting work. The terms of this
558 | License will continue to apply to the part which is the covered work,
559 | but the special requirements of the GNU Affero General Public License,
560 | section 13, concerning interaction through a network will apply to the
561 | combination as such.
562 |
563 | 14. Revised Versions of this License.
564 |
565 | The Free Software Foundation may publish revised and/or new versions of
566 | the GNU General Public License from time to time. Such new versions will
567 | be similar in spirit to the present version, but may differ in detail to
568 | address new problems or concerns.
569 |
570 | Each version is given a distinguishing version number. If the
571 | Program specifies that a certain numbered version of the GNU General
572 | Public License "or any later version" applies to it, you have the
573 | option of following the terms and conditions either of that numbered
574 | version or of any later version published by the Free Software
575 | Foundation. If the Program does not specify a version number of the
576 | GNU General Public License, you may choose any version ever published
577 | by the Free Software Foundation.
578 |
579 | If the Program specifies that a proxy can decide which future
580 | versions of the GNU General Public License can be used, that proxy's
581 | public statement of acceptance of a version permanently authorizes you
582 | to choose that version for the Program.
583 |
584 | Later license versions may give you additional or different
585 | permissions. However, no additional obligations are imposed on any
586 | author or copyright holder as a result of your choosing to follow a
587 | later version.
588 |
589 | 15. Disclaimer of Warranty.
590 |
591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599 |
600 | 16. Limitation of Liability.
601 |
602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610 | SUCH DAMAGES.
611 |
612 | 17. Interpretation of Sections 15 and 16.
613 |
614 | If the disclaimer of warranty and limitation of liability provided
615 | above cannot be given local legal effect according to their terms,
616 | reviewing courts shall apply local law that most closely approximates
617 | an absolute waiver of all civil liability in connection with the
618 | Program, unless a warranty or assumption of liability accompanies a
619 | copy of the Program in return for a fee.
620 |
621 | END OF TERMS AND CONDITIONS
622 |
623 | How to Apply These Terms to Your New Programs
624 |
625 | If you develop a new program, and you want it to be of the greatest
626 | possible use to the public, the best way to achieve this is to make it
627 | free software which everyone can redistribute and change under these terms.
628 |
629 | To do so, attach the following notices to the program. It is safest
630 | to attach them to the start of each source file to most effectively
631 | state the exclusion of warranty; and each file should have at least
632 | the "copyright" line and a pointer to where the full notice is found.
633 |
634 |
635 | Copyright (C)
636 |
637 | This program is free software: you can redistribute it and/or modify
638 | it under the terms of the GNU General Public License as published by
639 | the Free Software Foundation, either version 3 of the License, or
640 | (at your option) any later version.
641 |
642 | This program is distributed in the hope that it will be useful,
643 | but WITHOUT ANY WARRANTY; without even the implied warranty of
644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645 | GNU General Public License for more details.
646 |
647 | You should have received a copy of the GNU General Public License
648 | along with this program. If not, see .
649 |
650 | Also add information on how to contact you by electronic and paper mail.
651 |
652 | If the program does terminal interaction, make it output a short
653 | notice like this when it starts in an interactive mode:
654 |
655 | Copyright (C)
656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657 | This is free software, and you are welcome to redistribute it
658 | under certain conditions; type `show c' for details.
659 |
660 | The hypothetical commands `show w' and `show c' should show the appropriate
661 | parts of the General Public License. Of course, your program's commands
662 | might be different; for a GUI interface, you would use an "about box".
663 |
664 | You should also get your employer (if you work as a programmer) or school,
665 | if any, to sign a "copyright disclaimer" for the program, if necessary.
666 | For more information on this, and how to apply and follow the GNU GPL, see
667 | .
668 |
669 | The GNU General Public License does not permit incorporating your program
670 | into proprietary programs. If your program is a subroutine library, you
671 | may consider it more useful to permit linking proprietary applications with
672 | the library. If this is what you want to do, use the GNU Lesser General
673 | Public License instead of this License. But first, please read
674 | .
675 |
--------------------------------------------------------------------------------
/AnnoyancesInterception.user.js:
--------------------------------------------------------------------------------
1 | // ==UserScript==
2 | // @name 骚扰拦截
3 | // @version 1.5.4
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 | // @match *://pan.quark.cn/s/*
75 | // @icon data:image/png;base64,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
76 | // @run-at document-body
77 | // @grant none
78 | // @license GPL-3.0
79 | // ==/UserScript==
80 |
81 | (function () {
82 | "use strict";
83 |
84 | /**
85 | * 规则列表
86 | * @type {name/url/items}
87 | */
88 | const websites = [
89 | {
90 | name: "CSDN",
91 | url: "csdn.net",
92 | items: [
93 | //下载弹窗
94 | ".weixin-shadowbox",
95 | //悬浮按钮:打开:狐猴浏览器中的bug
96 | ".feed-Sign-weixin",
97 | //悬浮按钮:APP内打开+登录/打开注册(主页)
98 | ".feed-Sign-span",
99 | //PC端:弹窗:学生认证
100 | "#csdn-highschool-window",
101 | //PC端:登录弹窗(顶部)
102 | "#csdn-toolbar-profile-nologin",
103 | //PC端:登录弹窗(底部)
104 | ".passport-login-tip-container",
105 | ],
106 | fun: function () {
107 | /**
108 | * PC端:屏蔽登录弹窗
109 | * @param {list} mutationsList The mutations list
110 | */
111 | let removeLoginNotice = function (mutationsList) {
112 | for (let mutation of mutationsList) {
113 | for (let node of mutation.addedNodes) {
114 | if (document.querySelector(".passport-login-container")) {
115 | //有登陆弹窗时:模拟点击关闭按钮
116 | let button = node.querySelector("img");
117 | if (button) {
118 | if (LoginFlag == true) {
119 | button.click();
120 | } else {
121 | LoginFlag = true;
122 | }
123 | return;
124 | }
125 | }
126 | }
127 | }
128 | };
129 |
130 | let loginBtn = document.querySelector(".toolbar-btn-login>.toolbar-btn-loginfun");
131 | //未登录:
132 | if (loginBtn) {
133 | //添加事件,不拦截
134 | loginBtn.addEventListener("click", function () {
135 | LoginFlag = false;
136 | });
137 | //执行监听
138 | let observer = new MutationObserver(removeLoginNotice);
139 | observer.observe(document, { childList: true, subtree: true });
140 | }
141 | //移动版登录弹窗
142 | if (document.querySelector(".toolbarBack")) {
143 | addStyle(".passport-login-container {display: none !important}");
144 | }
145 | },
146 | },
147 | {
148 | name: "简书",
149 | url: "jianshu.com",
150 | items: [
151 | //下载弹窗
152 | ".download-app-guidance",
153 | //悬浮按钮:打开App,看更多相似好文
154 | ".call-app-btn",
155 | //悬浮按钮:打开App,看更多好文(首页)
156 | ".index_call-app-btn",
157 | //PC端:透明遮挡
158 | "._23ISFX-mask",
159 | //PC端:登录弹窗
160 | "._23ISFX-wrap",
161 | ],
162 | overflow: true,
163 | },
164 | {
165 | name: "掘金",
166 | url: "juejin.cn",
167 | items: [
168 | //悬浮按钮:APP内打开
169 | ".open-button",
170 | //下载弹窗
171 | ".app-open-drawer",
172 | //PC端:下方拓展弹窗(主页)
173 | ".recommend-box",
174 | //PC端:登录弹窗(右上角)
175 | ".login-popover",
176 | //PC端:登录弹窗(右下角)
177 | ".bottom-login-guide",
178 | ],
179 | overflow: true,
180 | },
181 | {
182 | name: "知乎发现页",
183 | url: "www.zhihu.com/explore",
184 | items: [
185 | //PC端:登录按钮(发现页)
186 | ".ExploreHomePage-specialsLogin",
187 | ],
188 | fun: function () {
189 | //发现页:热点和问题高度保持一致;
190 | if (location.href.includes("www.zhihu.com/explore")) {
191 | addStyle(".ExploreHomePage-square > div:nth-child(3){margin: 0px}");
192 | }
193 | },
194 | },
195 | {
196 | name: "知乎",
197 | url: "zhihu.com",
198 | items: [
199 | //悬浮按钮:是否在知乎app内阅读全文
200 | ".MobileModal-wrapper",
201 | //悬浮按钮:打开知乎(主页),打开
202 | ".OpenInAppButton",
203 | ],
204 | overflow: true,
205 | fun: function () {
206 | //PC端拦截登录弹窗
207 | if (!/Mobile|Android|iPhone/i.test(navigator.userAgent)) {
208 | window.addEventListener("DOMContentLoaded", function () {
209 | let loginBtn = document.querySelector(".css-1rwz7is");
210 | //检验是否登录
211 | if (loginBtn) {
212 | //执行监听
213 | let observer = new MutationObserver(removeLoginNotice);
214 | observer.observe(document, { childList: true, subtree: true });
215 |
216 | onload = function () {
217 | loginBtn.addEventListener("click", function () {
218 | LoginFlag = false;
219 | });
220 | };
221 | }
222 | });
223 | /**
224 | * 删除登录弹窗
225 | *
226 | * @param {MutationRecord[]} mutationsList The mutations list
227 | * @param {MutationObserver} observer The observer
228 | */
229 | function removeLoginNotice(mutationsList) {
230 | for (let mutation of mutationsList) {
231 | for (let node of mutation.addedNodes) {
232 | //有登陆弹窗1时:模拟点击关闭按钮
233 | if (node.querySelector(".signFlowModal")) {
234 | let button = node.querySelector(".Button.Modal-closeButton.Button--plain");
235 | if (button) {
236 | if (LoginFlag == true) {
237 | button.click();
238 | } else {
239 | LoginFlag = true;
240 | }
241 | //此处删除return,进行持续监听,规避反制
242 | }
243 | }
244 | //拦截登录弹窗2
245 | if (getXpath('//button[text()="立即登录/注册"]', node)) {
246 | getXpath('//button[text()="立即登录/注册"]', node).parentElement.parentElement.remove();
247 | }
248 | }
249 | }
250 | }
251 | }
252 | },
253 | },
254 | {
255 | name: "百度",
256 | url: "baidu.com",
257 | items: [
258 | //悬浮按钮:打开百度
259 | "#J-invoke-baiduApp-float",
260 | ],
261 | },
262 | {
263 | name: "百度贴吧",
264 | url: "tieba.baidu.com",
265 | items: [
266 | //悬浮按钮:打开百度贴吧
267 | ".nav-bar-bottom",
268 | ],
269 | },
270 | {
271 | name: "百度文库1",
272 | url: "/wk.baidu.com/view/",
273 | items: [
274 | //悬浮按钮(上方):百度文库
275 | ".wk-student-defense",
276 | ],
277 | },
278 | {
279 | name: "百度文库2",
280 | url: "tanbi.baidu.com/h5apptopic/browse/",
281 | items: [
282 | //悬浮按钮(上方):百度文库
283 | ".wk-student-limit-jump",
284 | ".bartop",
285 | //悬浮按钮(下方):下载App,继续阅读
286 | ".wk-bottom-btn",
287 | ],
288 | },
289 | {
290 | name: "百家号",
291 | url: "baijiahao.baidu.com/s",
292 | items: [
293 | //悬浮按钮:百度APP内打开
294 | "#bdrainrwDragButton",
295 | ],
296 | },
297 | {
298 | name: "百度资讯+百度首页",
299 | url: "mbd.baidu.com/newspage/data",
300 | items: [
301 | //悬浮按钮:百度APP内打开
302 | "#bdrainrwDragButton",
303 | //悬浮按钮:百度APP内播放
304 | ".drag-bottom",
305 | ],
306 | },
307 | {
308 | name: "腾讯新闻1",
309 | url: "view.inews.qq.com/",
310 | items: [
311 | //固定按钮:打开
312 | ".slider-top-bar_sliderWrapper__1Nize",
313 | //悬浮按钮:打开腾讯新闻,看更多热点资讯
314 | ".bottom-bar_buttonWrap__NXBe-",
315 | ],
316 | },
317 | {
318 | name: "腾讯新闻2",
319 | url: "xw.qq.com/",
320 | items: [
321 | //固定按钮:打开(首页)
322 | "#opeApp",
323 | ],
324 | },
325 | {
326 | name: "腾讯视频",
327 | url: "m.v.qq.com",
328 | items: [
329 | //下载弹窗
330 | ".at-app-banner",
331 | //打开APP查看高清内容
332 | ".open_app_bottom",
333 | ],
334 | },
335 | {
336 | name: "优酷视频",
337 | url: "youku.com",
338 | items: [
339 | //下载弹窗
340 | ".callEnd_box",
341 | //悬浮按钮(主页):打开优酷APP更流畅
342 | ".callEnd_fixed_box",
343 | //悬浮按钮:打开优酷APP更流畅
344 | ".undefined",
345 | //悬浮按钮:红包
346 | ".Corner-container",
347 | ],
348 | },
349 | {
350 | name: "爱奇艺",
351 | url: "iqiyi.com/",
352 | items: [
353 | //下载弹窗
354 | ".m-iqyGuide-layer",
355 | //打开爱奇艺APP,看精彩视频
356 | "[class^=ChannelHomeBanner]",
357 | //PC端:登录提示上侧
358 | ".pl__1",
359 | ],
360 | },
361 | {
362 | name: "好看视频",
363 | url: "haokan.baidu.com/",
364 | items: [
365 | //悬浮按钮:打开好看app(中间)
366 | ".open-app-top",
367 | //固定文字:打开APP(多)
368 | ".top-video-card-img-app",
369 | //固定按钮:下载APP(视频播放时)
370 | ".video-player-download-tips",
371 | //固定按钮:打开(底部)
372 | ".open-app-bottom",
373 | //固定按钮:打开(底部:个别)
374 | ".NewOpenApp",
375 | //PC端固定按钮:下载APP(视频暂停时)
376 | ".player-lefttip-inner",
377 | //PC端登录提示:登录提示
378 | "#passport-login-pop",
379 | //PC端登录提示:朦胧背板
380 | ".pop-mask",
381 | //PC端登录提示:悬浮提示
382 | ".page-top-rightinfo-popover",
383 | ],
384 | },
385 | {
386 | name: "m1905电影网",
387 | url: "1905.com/",
388 | items: [
389 | //悬浮弹窗:打开app
390 | "#popupModule",
391 | //悬浮按钮:
392 | ".open-link",
393 | ],
394 | },
395 | {
396 | name: "百度搜索",
397 | url: "baidu.com",
398 | items: [
399 | //搜索结果:小程序
400 | "[srcid=xcx_multi]",
401 | //搜索结果:百度手机助手
402 | "[srcid=app_mobile_simple]",
403 | //搜索结果:百度手机助手:安全下载
404 | "[srcid=app_mobile_simple_safety]",
405 | //搜索结果:百度应用搜索(IOS)
406 | "[srcid=app_mobile_ios]",
407 | ],
408 | },
409 | {
410 | name: "哔哩哔哩",
411 | url: "bilibili.com",
412 | items: [
413 | //悬浮按钮:打开app,看你感兴趣的内容(主页)
414 | ".m-open-app.fixed-openapp",
415 | //悬浮按钮:打开app(UP主页)
416 | ".m-space-float-openapp",
417 | //悬浮按钮:打开app,看高清内容(视频全屏)
418 | ".mplayer-widescreen-callapp",
419 | //悬浮按钮:bilibili内打开(底部)
420 | ".m-float-openapp",
421 | //悬浮弹窗:bilibili内打开
422 | ".openapp-dialog",
423 | //固定按钮:播放时下载
424 | ".mplayer-widescreen-callapp",
425 | //PC端:登录提示(右下角)
426 | ".lt-row",
427 | //PC端:登录提示(右上角)
428 | ".login-panel-popover:has(.login-tip-content)",
429 | //PC端:登录提示(播放器)
430 | ".bpx-player-toast-wrap",
431 | //PC端:登录提示(右上角)
432 | "div:has(.unlogin-popover-avatar)",
433 | //PC端:滑动提示(正下方:首次)
434 | ".trial-feed-wrap",
435 | ],
436 | fun: function () {
437 | let add;
438 | function mutationCallback(record, observer) {
439 | //已确定登录:停止监听
440 | let login = document.querySelector(".header-entry-mini");
441 | if (login) {
442 | observer.disconnect();
443 | }
444 | //已确定未登录:执行函数
445 | let loginBtn = document.querySelector(".header-login-entry");
446 | if (loginBtn) {
447 | if (!add) {
448 | console.log("脚本注入成功");
449 | //添加事件:不拦截
450 | loginBtn.addEventListener("click", function () {
451 | LoginFlag = false;
452 | });
453 | add = true;
454 | }
455 | for (let arr of record) {
456 | for (let node of arr.addedNodes) {
457 | let button;
458 | try {
459 | button = node.querySelector(".bili-mini-close-icon");
460 | } catch (error) {
461 | /* empty */
462 | }
463 | if (button) {
464 | //有登陆弹窗时:模拟点击关闭按钮
465 | if (LoginFlag == true) {
466 | console.log(LoginFlag);
467 | console.log("自动拦截");
468 | button.click();
469 |
470 | console.log("恢复播放");
471 | let video = document.querySelector(".bpx-player-video-wrap video");
472 | video.play();
473 | } else {
474 | console.log(LoginFlag);
475 | console.log("手动拦截");
476 | LoginFlag = true;
477 | }
478 | return;
479 | }
480 | }
481 | }
482 | }
483 | }
484 | let observer = new MutationObserver(mutationCallback);
485 | observer.observe(document, { childList: true, subtree: true });
486 | },
487 | },
488 | {
489 | name: "B站笔记",
490 | url: "bilibili.com/opus/",
491 | items: [
492 | //PC端:登录提示
493 | "div:has(.unlogin-popover-avatar)",
494 | ],
495 | },
496 | {
497 | name: "西瓜视频",
498 | url: "ixigua.com",
499 | items: [
500 | //打开弹窗:打开
501 | ".landing_guide",
502 | //PC端:登录提示
503 | ".loginBenefitNotification",
504 | //悬浮按钮:打开西瓜视频,看全网超清视频
505 | ".xigua-download",
506 | ],
507 | },
508 | {
509 | name: "抖音电脑版",
510 | url: "www.douyin.com",
511 | items: [
512 | //PC端:下载电脑客户端
513 | "#douyin-web-download-guide-container",
514 | //PC端:右下角登录提示(画质)
515 | ".vW4dJNzI",
516 | //PC端:登陆后查看评论
517 | "#related-video-card-login-guide",
518 | //PC端:底部登录提示
519 | ".HDhMLx9a",
520 | ],
521 | fun: function () {
522 | //登陆后查看评论模糊
523 | addStyle("._61cgy6j3{filter: none !important}");
524 | //拦截登录弹窗
525 | onload = function () {
526 | //增加点击事件
527 | let inter = setInterval(() => {
528 | let loginBtn = getXpath('//div[text()="登录"] | //p[text()="登录"]', document).parentElement;
529 | if (loginBtn) {
530 | loginBtn.addEventListener("click", function () {
531 | LoginFlag = false;
532 | });
533 | clearInterval(inter);
534 | }
535 | }, 1000);
536 | };
537 |
538 | /**
539 | * Removes a login notice.
540 | *
541 | * @param {MutationRecord[]} mutationsList The mutations list
542 | * @param {MutationObserver} observer The observer
543 | */
544 | let removeLoginNotice = function (mutationsList) {
545 | for (let mutation of mutationsList) {
546 | for (let node of mutation.addedNodes) {
547 | if (node.nodeType == Node.ELEMENT_NODE) {
548 | const closeBtn = document.querySelector(".DKE9HSAk");
549 | //关闭登录弹窗
550 | if (closeBtn) {
551 | if (LoginFlag == true) {
552 | closeBtn.click();
553 | }
554 | }
555 | return;
556 | }
557 | }
558 | }
559 | };
560 | //执行监听
561 | let observer = new MutationObserver(removeLoginNotice);
562 | observer.observe(document, { childList: true, subtree: true });
563 | },
564 | },
565 | {
566 | name: "丁香园",
567 | url: "3g.dxy.cn",
568 | items: [
569 | //悬浮按钮:APP内打开
570 | "[class^=fixedBtn]",
571 | //悬浮按钮:App内打开(主页)
572 | ".wrap",
573 | ],
574 | },
575 | {
576 | name: "健康界",
577 | url: "www.cn-healthcare.com/",
578 | items: [
579 | //悬浮按钮:打开(底部滚动)
580 | "footer",
581 | ],
582 | },
583 | {
584 | name: "微博",
585 | url: "m.weibo.cn",
586 | items: [
587 | //悬浮按钮:在微博内打开(百度热议)
588 | ".app-btn-box",
589 | //悬浮按钮:登录/注册
590 | ".login-btn",
591 | //小程序
592 | ".wrap",
593 | ],
594 | },
595 | {
596 | name: "新浪新闻",
597 | url: "sina.cn/",
598 | items: [
599 | //悬浮按钮:打开APP
600 | ".callApp_fl_btn",
601 | ],
602 | },
603 | {
604 | name: "新浪财经",
605 | url: "sina.cn/",
606 | items: [
607 | //悬浮弹窗:立即更新(主页:首次访问)
608 | "#SFA_newVersion_pop",
609 | //悬浮按钮:打开App中查看(主页:底部)
610 | ".m-client-call2",
611 | //固定按钮:立即登录(主页:资讯)
612 | ".login-box",
613 | //悬浮按钮:立即查看(资讯:底部,首次访问)
614 | ".wap-msg-bar-wap",
615 | //悬浮按钮:去APP听语音播报(资讯:中间)
616 | ".broadcast",
617 | //悬浮按钮:打开APP(资讯:顶部,有bug)
618 | ".m-sentiment-blk",
619 | //悬浮按钮:打开APP(资讯:底部)
620 | ".m-guss-caijing",
621 | //固定按钮:立即体验(资讯:底部)
622 | "#norm_qrcode_link_auto",
623 | //悬浮按钮:打开APP(子栏1:底部)
624 | "#subPage_bottom_callup_btn",
625 | //悬浮按钮:打开APP(子栏2:底部)
626 | "#__callup_bottom_new",
627 | //悬浮按钮:打开APP(子栏2:顶部,有bug)
628 | ".js-app-header",
629 | //悬浮按钮:新版本抢先体验(底部)
630 | "#SNP_bottom_bar",
631 | ],
632 | fun: function () {
633 | //修复上述规则产生的bug
634 | let inter = setInterval(() => {
635 | let item = document.querySelector(".compatibility-mode");
636 | if (item.style.marginTop == "0px") {
637 | clearInterval(inter);
638 | } else {
639 | item.style.marginTop = "0px";
640 | }
641 | }, 1000);
642 | },
643 | },
644 | {
645 | name: "东方财富网",
646 | url: "wap.eastmoney.com/",
647 | items: [
648 | //悬浮按钮:打开APP(顶部)
649 | ".fixed_top",
650 | //固定按钮:下载(主页:顶部)
651 | "#IndexDT",
652 | //悬浮按钮:打开下载(主页:顶部)
653 | ".emwapas_xldt_fixed",
654 | //悬浮按钮:打开APP(主页:底部)
655 | ".open-inapp",
656 | ],
657 | },
658 | {
659 | name: "东方财富网:股吧",
660 | url: "mguba.eastmoney.com/",
661 | items: [
662 | //悬浮弹窗:打开APP
663 | "#appbox",
664 | //悬浮按钮:东方财富APP内打开(底部)
665 | "#open_app",
666 | ],
667 | },
668 | {
669 | name: "电子发烧友",
670 | url: "m.elecfans.com",
671 | items: [
672 | //悬浮按钮:主页右侧
673 | ".hm_quick",
674 | //悬浮按钮:登陆/注册
675 | ".login-reg-fixed",
676 | //悬浮按钮:上方打开app
677 | ".open_app",
678 | ],
679 | },
680 | {
681 | name: "人民网",
682 | url: "app.people.cn",
683 | items: [
684 | //悬浮按钮:打开(底部)
685 | ".app-bot-wrap",
686 | ],
687 | },
688 | {
689 | name: "新京报",
690 | url: "m.bjnews.com.cn/detail/",
691 | items: [
692 | //悬浮按钮:立即打开(顶部)
693 | ".xjb-top",
694 | ],
695 | },
696 | {
697 | name: "观察者网",
698 | url: "guancha.cn",
699 | items: [
700 | //固定按钮:点击下载(顶部)
701 | ".g_header44",
702 | //悬浮按钮:APP专享(底部)
703 | ".g_swiper_container",
704 | ],
705 | },
706 | {
707 | name: "澎湃新闻",
708 | url: "m.thepaper.cn/newsDetail_forward",
709 | items: [
710 | //悬浮按钮:新闻滚条(底部)
711 | "[class^=index_footer_banner]",
712 | "[.index_footer_banner__Mcr_R]",
713 | ],
714 | },
715 | {
716 | name: "凤凰新闻",
717 | url: "ifeng.com",
718 | items: [
719 | //悬浮按钮:立即打开(主页)
720 | "[class^=index_fixSlide_]",
721 | //悬浮按钮:滚动新闻(新闻底部)
722 | "[class^=index_bottom_box_]",
723 | //悬浮按钮:立即打开(财经底部)
724 | "[class^=index_bottomSlide_]",
725 | //悬浮按钮:滚动新闻(卫视底部)
726 | "[class^=index_fixBottom_]",
727 | ],
728 | },
729 | {
730 | name: "网易新闻",
731 | url: "3g.163.com",
732 | items: [
733 | //固定按钮:App内打开(底部)
734 | ".backflow-floating",
735 | ],
736 | },
737 | {
738 | name: "网易新闻",
739 | url: "m.163.com",
740 | items: [
741 | //固定按钮:App内打开(底部)
742 | ".backflow-floating",
743 | ],
744 | },
745 | {
746 | name: "搜狐新闻",
747 | url: "m.sohu.com/a/",
748 | items: [
749 | //悬浮按钮:打开APP
750 | "#CallAppContainer",
751 | ".CallAppContainer",
752 | ],
753 | },
754 | {
755 | name: "今日头条:移动端",
756 | url: "m.toutiao.com/",
757 | items: [
758 | //悬浮按钮:App内打开(底部)
759 | ".m-bottom-container",
760 | //悬浮按钮:去首页(文章)
761 | ".m-index-tag",
762 | ],
763 | },
764 | {
765 | name: "今日头条:PC端",
766 | url: "www.toutiao.com/",
767 | items: [
768 | //悬浮弹窗:添加今日头条到电脑桌面
769 | ".add-panel",
770 | //悬浮弹窗:扫码下载今日头条
771 | "download-panel",
772 | ],
773 | },
774 | {
775 | name: "东方资讯",
776 | url: "mini.eastday.com/nsa/",
777 | items: [
778 | //PC端:悬浮弹窗:添加到桌面
779 | "#dftt-message-wrapper",
780 | ],
781 | },
782 | {
783 | name: "虎嗅",
784 | url: "m.huxiu.com",
785 | items: [
786 | //悬浮按钮:go!(主页)
787 | ".guide-wrap",
788 | //悬浮按钮:打开(顶部)
789 | ".js-top-fixed",
790 | //悬浮按钮:打开(底部)
791 | ".bottom-open-app-btn",
792 | ],
793 | },
794 | {
795 | name: "虎扑",
796 | url: "m.hupu.com",
797 | items: [
798 | //悬浮按钮:App内打开
799 | ".open-hupu",
800 | ],
801 | },
802 | {
803 | name: "豆瓣",
804 | url: "m.douban.com",
805 | items: [
806 | //固定按钮:用App打开(电影详情页)
807 | ".subject-banner",
808 | //悬浮按钮:豆瓣APP内打开
809 | ".talion-nav-footer",
810 | ],
811 | },
812 | {
813 | name: "太平洋电脑",
814 | url: "g.pconline.com.cn",
815 | items: [
816 | //悬浮按钮:打开app(底部)
817 | ".btnForAppOpenImg",
818 | //悬浮按钮:打开知科技App
819 | ".btnForAppOpenA",
820 | //固定按钮:立即打开(底部)
821 | ".WakeUptop",
822 | //悬浮按钮:打开(底部)
823 | ".page-float-box",
824 | ],
825 | },
826 | {
827 | name: "中关村在线",
828 | url: "m.zol.com.cn",
829 | items: [
830 | //悬浮按钮:打开APP
831 | ".cover-back_s",
832 | //悬浮按钮:APP内打开
833 | "#bottom-fixed-wrapper > span",
834 | ],
835 | },
836 | {
837 | name: "中关村在线2(报价+论坛)",
838 | url: "wap.zol.com.cn",
839 | items: [
840 | //悬浮按钮:打开APP
841 | ".cover-back_s",
842 | //悬浮按钮:APP内打开
843 | "#bottom-fixed-wrapper > span",
844 | ],
845 | },
846 | {
847 | name: "汽车之家PC版",
848 | url: "www.autohome.com.cn",
849 | items: [
850 | //悬浮按钮:登录提示(PC端)
851 | "#loginGuide",
852 | ],
853 | },
854 | {
855 | name: "汽车之家移动版",
856 | url: "m.autohome.com.cn",
857 | items: [
858 | //悬浮按钮: App内打开
859 | "#float_new_button",
860 | ],
861 | },
862 | {
863 | name: "太平洋汽车",
864 | url: "m.pcauto.com.cn/",
865 | items: [
866 | //悬浮弹窗: App内打开
867 | "#home-bottom-half-dialog",
868 | //悬浮按钮: 轮播评论
869 | "#dmListOuter",
870 | ],
871 | },
872 | {
873 | //www.taptap.com
874 | name: "taptap",
875 | url: "www.taptap.cn",
876 | items: [
877 | //悬浮按钮:打开taptap
878 | ".open-app-global-float",
879 | ],
880 | },
881 | {
882 | //m.taptap.com
883 | name: "taptap",
884 | url: "m.taptap.cn",
885 | items: [
886 | //悬浮按钮:打开taptap查看更多精彩内容
887 | ".app-download__wrapper",
888 | //苹果端:悬浮按钮:添加到桌面
889 | ".show-add-to-screen",
890 | //苹果端:固定按钮:添加到桌面
891 | ".add-to-screen-wrap",
892 | ],
893 | },
894 | {
895 | //https://m.ithome.com/
896 | name: "it之家",
897 | url: "m.ithome.com",
898 | items: [
899 | //固定按钮(底部):立即打开
900 | ".open-app-banner",
901 | ],
902 | },
903 | {
904 | name: "360docPC版",
905 | url: "www.360doc.com/content/",
906 | items: [
907 | //登录弹窗
908 | "iframe",
909 | //登录弹窗:朦胧模板
910 | "iframe~div",
911 | ],
912 | },
913 | {
914 | name: "开源中国",
915 | url: "www.oschina.net",
916 | items: [
917 | //悬浮按钮(底部):立即打开
918 | ".app-download-banner-box",
919 | ],
920 | },
921 | {
922 | name: "segmentfault思否",
923 | url: "segmentfault.com/q",
924 | items: [
925 | //登录弹窗
926 | ".modal-dialog-centered",
927 | ],
928 | },
929 | {
930 | name: "阿里云开发者社区",
931 | url: "developer.aliyun.com/article/",
932 | items: [
933 | //阿里云App内打开
934 | ".app-fixed-btn",
935 | ],
936 | },
937 | {
938 | name: "华为云开发者社区",
939 | url: "huaweicloud.csdn.net/",
940 | items: [
941 | //加入社区
942 | ".user-desc-fix",
943 | ],
944 | },
945 | {
946 | //https://m.36kr.com/p/1964588951470856
947 | name: "36氪",
948 | url: "m.36kr.com/p/",
949 | items: [
950 | //悬浮按钮(顶部):打开
951 | ".article-top-swiper-goapp",
952 | ],
953 | },
954 | {
955 | name: "雪球",
956 | url: "xueqiu.com/",
957 | items: [
958 | //悬浮按钮:加群学习(主页)
959 | ".FloatDownloadButton_mobile_xiaoxue-button_1jZ",
960 | //悬浮按钮:加群学习(文章)
961 | ".index_xiaoxue-button_1Av",
962 | //悬浮按钮:登录提示
963 | ".widget__download-app",
964 | ],
965 | fun: function () {
966 | //悬浮按钮:打开app(话题)
967 | document.onreadystatechange = function () {
968 | if (document.readyState === "complete") {
969 | document.querySelector("[class^=FloatDownloadButton_mobile_openapp__fix_]").remove();
970 | }
971 | };
972 |
973 | /**
974 | * Removes a login notice.
975 | *
976 | * @param {MutationRecord[]} mutationsList The mutations list
977 | * @param {MutationObserver} observer The observer
978 | */
979 | let removeLoginNotice = function (mutationsList) {
980 | for (let mutation of mutationsList) {
981 | for (let node of mutation.addedNodes) {
982 | let closeBtn = document.querySelector(".modal__login .close");
983 | //关闭登录弹窗
984 | if (LoginFlag == true) {
985 | closeBtn.click();
986 | } else {
987 | LoginFlag == true;
988 | }
989 | return;
990 | }
991 | }
992 | };
993 | //拦截登录弹窗
994 | document.addEventListener("DOMContentLoaded", function () {
995 | let loginBtn = document.querySelector(".loginBtn");
996 | //检验是否登录
997 | if (loginBtn.textContent === "登录") {
998 | //增加点击事件
999 | loginBtn.addEventListener("click", function () {
1000 | LoginFlag = false;
1001 | //未知bug:导致第一次点击无法生效,所以这里再点击一次
1002 | loginBtn.click();
1003 | });
1004 | }
1005 | //执行监听
1006 | let observer = new MutationObserver(removeLoginNotice);
1007 | observer.observe(document, { childList: true, subtree: true });
1008 | });
1009 | },
1010 | },
1011 | {
1012 | name: "天眼查",
1013 | url: "m.tianyancha.com/",
1014 | items: [
1015 | //悬浮按钮:打开app(主页)
1016 | ".swiper-container",
1017 | //悬浮按钮:下载APP(企业)
1018 | "#banner_mobile_v2",
1019 | ],
1020 | },
1021 | {
1022 | name: "站酷移动版",
1023 | url: "m.zcool.com.cn/",
1024 | items: [
1025 | //悬浮按钮:打开app(主页)
1026 | ".bottom-App",
1027 | //悬浮按钮:打开app
1028 | "[class^=wapHeader_footer-button]",
1029 | ],
1030 | },
1031 | {
1032 | name: "站酷PC版",
1033 | url: "www.zcool.com.cn/",
1034 | items: [
1035 | //登录按钮
1036 | ".sideUnlogin",
1037 | //登录弹窗
1038 | ".ReactModal__Overlay--after-open:not(.ReactModal__Overlay_content-page)",
1039 | ],
1040 | fun: function () {
1041 | //登录弹窗导致的页面无法滑动
1042 | addStyle("html,body {overscroll-behavior: unset !important;overflow: unset !important;}");
1043 | },
1044 | },
1045 | {
1046 | name: "小红书",
1047 | url: "www.xiaohongshu.com",
1048 | items: [
1049 | //App内打开(视频)
1050 | ".bottom-button-box",
1051 | //App内打开(笔记)
1052 | ".bottom-bar",
1053 | ],
1054 | fun: function () {
1055 | loginObserver(".login-btn", ".icon-btn-wrapper");
1056 | },
1057 | },
1058 | {
1059 | name: "喜马拉雅",
1060 | url: "m.ximalaya.com/",
1061 | items: [
1062 | //悬浮按钮:打开APP,完整收听1
1063 | ".album-btn-container",
1064 | //悬浮按钮:打开APP,完整收听2
1065 | ".btn-open",
1066 | //打开APP2
1067 | ".downloadButton",
1068 | ],
1069 | },
1070 | {
1071 | //https://wap.cnki.net/touch/web/Journal/Article/WLAQ202302061.html
1072 | name: "中国知网",
1073 | url: "wap.cnki.net/",
1074 | items: [
1075 | //App内打开
1076 | ".Appopen",
1077 | //滚动新闻
1078 | "#fix-bottom",
1079 | ],
1080 | },
1081 | {
1082 | name: "zfrontier",
1083 | url: "www.zfrontier.com",
1084 | items: [
1085 | //App内打开
1086 | ".app-opener",
1087 | ],
1088 | },
1089 | {
1090 | name: "必应搜索",
1091 | url: "bing.com",
1092 | items: [
1093 | //必应中打开(Chrome中专属)
1094 | ".bnp_rich_div_visible",
1095 | ],
1096 | },
1097 | {
1098 | name: "w3cschool",
1099 | url: "www.w3cschool.cn/",
1100 | items: [],
1101 | fun: function () {
1102 | //复制文件时的弹窗
1103 | onload = function () {
1104 | let mo = new MutationObserver(function (mutations) {
1105 | for (let mutation of mutations) {
1106 | for (let node of mutation.addedNodes) {
1107 | if (node.nodeName == "DIV" && node.className == "") {
1108 | node.style.display = "none";
1109 | }
1110 | }
1111 | }
1112 | });
1113 | mo.observe(document, { childList: true, subtree: true });
1114 | };
1115 | },
1116 | },
1117 | {
1118 | name: "什么值得买",
1119 | url: "m.smzdm.com/",
1120 | items: [
1121 | //app内打开
1122 | ".footer-banner-wrap",
1123 | //国内好价:qpp内打开
1124 | ".wrapper",
1125 | ".foot-banner",
1126 | ],
1127 | },
1128 | {
1129 | name: "夸克网盘",
1130 | url: "pan.quark.cn/s/",
1131 | items: [],
1132 | fun: function () {
1133 | loginObserver(".ant-btn.btn.login.ant-btn-primary", ".ant-modal-close");
1134 | },
1135 | },
1136 | ];
1137 |
1138 | /**
1139 | * 主体部分
1140 | */
1141 | for (let website of websites) {
1142 | if (location.href.indexOf(website.url) != -1) {
1143 | //隐藏/拦截骚扰元素
1144 | if (website.items) {
1145 | for (let item of website.items) {
1146 | addStyle(item + "{display: none !important}");
1147 | }
1148 | }
1149 | //修复移动版页面不允许滑动
1150 | if (website.overflow) {
1151 | addStyle("body{overflow: auto !important}");
1152 | }
1153 | //执行额外方案
1154 | if (website.fun) {
1155 | website.fun();
1156 | }
1157 | }
1158 | }
1159 |
1160 | //默认监听
1161 | let LoginFlag = true;
1162 | //默认添加
1163 | let ClickFlag = true;
1164 |
1165 | /**
1166 | * 通过内容(xpath)获取节点
1167 | *
1168 | * @param {string} xpath 内容
1169 | * @param {Node} parent 父元素
1170 | * @return {Node} 元素
1171 | */
1172 | function getXpath(xpath, parent) {
1173 | let xpathResult = document.evaluate(xpath, parent || document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null);
1174 | return xpathResult.singleNodeValue;
1175 | }
1176 |
1177 | /**
1178 | * 向head标签内添加样式
1179 | *
1180 | * @param {string} text CSS样式
1181 | */
1182 | function addStyle(text) {
1183 | let css = document.createElement("style");
1184 | css.innerText += text;
1185 | document.head.append(css);
1186 | }
1187 |
1188 | /**
1189 | * 登录弹窗只弹出一次时的处理方案
1190 | *
1191 | * @param {string} unLoginBtn The un login button class
1192 | * @param {string} closeBtn The close button class
1193 | */
1194 | function loginObserver(unLoginBtn, closeBtn) {
1195 | let mo = new MutationObserver(function (mutations) {
1196 | let unloginBtn = document.querySelector(unLoginBtn);
1197 | if (unloginBtn) {
1198 | for (let mutation of mutations) {
1199 | for (let node of mutation.addedNodes) {
1200 | let button = node.querySelector(closeBtn);
1201 | if (button) {
1202 | console.log("关闭成功");
1203 | button.click();
1204 | mo.disconnect();
1205 | }
1206 | }
1207 | }
1208 | }
1209 | });
1210 | mo.observe(document, { childList: true, subtree: true });
1211 | }
1212 | })();
1213 |
--------------------------------------------------------------------------------