├── 自述檔案 .md
├── 自述文件.md
├── README.md
├── full.js
├── LICENSE
├── diff.txt
├── main.js
└── original.js
/自述檔案 .md:
--------------------------------------------------------------------------------
1 | # 論壇大師・Discuz!修改版
2 |
3 | [简体中文](https://github.com/mxdh/Forum-Master-Discuz-/blob/master/%E8%87%AA%E8%BF%B0%E6%96%87%E4%BB%B6.md)
4 | [English](https://github.com/mxdh/Forum-Master-Discuz-/blob/master/README.md)
5 |
6 | ## 支持清單
7 | - 吾愛破解
8 | - 全球主機交流論壇
9 | - 卡飯論壇
10 | - 遠景論壇(微軟極客社區)
11 | - 恩山無線論壇
12 | - 火絨安全論壇
13 | - iYa.App 軟件交流社區
14 | - DOSPY論壇
15 |
16 | 這是精簡版。想要支持更多論壇,請使用[完整版](https://greasyfork.org/zh-TW/scripts/401307-forum-master-discuz-revision)或[原版](https://greasyfork.org/zh-TW/scripts/400250-forum-master-discuz)
17 |
18 | ## 功能簡介(原版)
19 | - 介面美化
20 | - 移除廣告
21 | - 功能增强
22 | - 每日簽到(一鍵完成站點任務)
23 | - 主動探測在線狀態(在線:🌝 離線:🌚)
24 | - 解除回帖字數限制並強制顯示
25 | - `Ctrl+Enter`或`Alt+S`可快速回帖
26 | - 點擊主樓**回复**跳至頁面底部
27 |
28 | ### 場景模式
29 | - 標準模式:完整功能(系統默認);
30 | - 家庭模式:屏蔽自定義頭像(恢復論壇默認頭像);
31 | - 辦公模式:屏蔽自定義頭像(恢復論壇默認頭像、縮小頭像、簡化頭像下方信息、移除用戶自定義帖子背景圖片、隱藏論壇用戶簽名。
32 |
33 | ---
34 |
35 | **此項目基於hostname的[論壇大師・Discuz! 界面美化、移除廣告、功能增強、回帖強顯……](https://greasyfork.org/zh-CN/scripts/400250-forum-master-discuz),遵照GPL-3.0開放源代碼**
36 |
37 | ## 安裝
38 | **[GitHub](https://github.com/mxdh/Forum-Master-Discuz-)**
39 |
40 | **[GreasyFork(推薦)](https://greasyfork.org/zh-CN/scripts/400489-forum-master-discuz-revision)**
41 |
42 | ## 改進
43 | - **新增了一些設定**
44 | - **加強對卡飯論壇的支持(自動簽到等)**
45 | - **讓論壇支持emoji顯示! 😜😜😜盡情玩耍吧!**
46 | - **支持每個網站選擇不同的模式(原版腳本中,所有網站共用一個設置)**
47 | - 去掉了主頁和群組按鈕(原項目[主頁](https://greasyfork.org/zh-CN/scripts/400250-forum-master-discuz)、[群組](https://t.me/joinchat/Bc2EjlPZ0aOwiA-Gn73xKA),關於本項目的問題可以在[GreasyFork](https://greasyfork.org/zh-CN/scripts/400489-forum-master-discuz/feedback)、[GitHub](https://github.com/mxdh/Forum-Master-Discuz-/issues)、[卡飯論壇](https://bbs.kafan.cn/thread-2178786-1-1.html)反饋)
48 | - 切換模式後自動刷新
49 | - 一些提升用戶體驗的小改動
50 | - 一些優化
51 |
52 | ---
53 |
54 | ## 補充說明
55 | - 論壇大師在**論壇主頁**和**帖子列表**等頁面是不生效的,需要點開帖子才會生效
56 | - **由於Firefox的bug,Firefox中場景模式無法恢復論壇默認頭像!**
57 | - 點擊按鈕即可切換模式,切換模式之後將自動刷新(可在**全局設置**中關閉)
58 | - 論壇**用戶信息**選項卡(鼠標懸停在頭像上)中顯示的**在線狀態**是不准確的,請依論壇大師顯示的**在線狀態**為準(默認開啟主動探測)
59 | - 主動探測**在線狀態**可能比較慢,可關閉,改為使用普通模式(在線:藍色方塊 離線:灰色方塊)
60 |
61 | 
62 |
63 | [教程](https://bbs.kafan.cn/thread-2178786-1-1.html)
64 |
--------------------------------------------------------------------------------
/自述文件.md:
--------------------------------------------------------------------------------
1 | # 论坛大师・Discuz!修改版
2 |
3 | [繁體中文](https://github.com/mxdh/Forum-Master-Discuz-/blob/master/%E8%87%AA%E8%BF%B0%E6%AA%94%E6%A1%88%20.md)
4 | [English](https://github.com/mxdh/Forum-Master-Discuz-/blob/master/README.md)
5 |
6 | ## 支持列表
7 | - 吾爱破解
8 | - 全球主机交流论坛
9 | - 卡饭论坛
10 | - 远景论坛(微软极客社区)
11 | - 恩山无线论坛
12 | - 火绒安全论坛
13 | - iYa.App 软件交流社区
14 | - DOSPY论坛
15 |
16 | 这是精简版。想要支持更多论坛,请使用[完整版](https://greasyfork.org/zh-CN/scripts/401307-forum-master-discuz-revision)或[原版](https://greasyfork.org/zh-CN/scripts/400250-forum-master-discuz)
17 |
18 | ## 功能简介(原版)
19 | - 界面美化
20 | - 移除广告
21 | - 功能增强
22 | - 每日签到(一键完成站点任务)(需要论坛开启相应功能)
23 | - 主动探测在线状态(在线:🌝 离线:🌚)
24 | - 解除回帖字数限制并强制显示
25 | - `Ctrl+Enter`或`Alt+S`可快速回帖
26 | - 点击主楼**回复**跳至页面底部
27 |
28 | ### 场景模式
29 | - 标准模式:完整功能(系统默认)
30 | - 家庭模式:屏蔽自定义头像(恢复论坛默认头像)
31 | - 办公模式:屏蔽自定义头像(恢复论坛默认头像、缩小头像、简化头像下方信息、移除用户自定义帖子背景图片、隐藏论坛用户签名)
32 |
33 | ---
34 |
35 | **此项目基于hostname的[论坛大师・Discuz! 界面美化、移除广告、功能增强、回帖强显……](https://greasyfork.org/zh-CN/scripts/400250-forum-master-discuz),遵照GPL-3.0开放源代码**
36 |
37 | ## 安装
38 | **[Github](https://github.com/mxdh/Forum-Master-Discuz-)**
39 |
40 | **[GreasyFork(推荐)](https://greasyfork.org/zh-CN/scripts/400489-forum-master-discuz-revision)**
41 |
42 | ## 改进
43 | - **增加了一些设置**
44 | - **加强对卡饭论坛的支持(自动签到等)**
45 | - **让论坛支持emoji显示!😜😜😜尽情玩耍吧!**
46 | - **支持每个网站选择不同的模式(原版脚本中,所有网站共用一个设置)**
47 | - 去掉了主页和群组按钮(原项目[主页](https://greasyfork.org/zh-CN/scripts/400250-forum-master-discuz)、[群组](https://t.me/joinchat/Bc2EjlPZ0aOwiA-Gn73xKA),关于本项目的问题可以在[GreasyFork](https://greasyfork.org/zh-CN/scripts/400489-forum-master-discuz/feedback)、[GitHub](https://github.com/mxdh/Forum-Master-Discuz-/issues)、[卡饭论坛](https://bbs.kafan.cn/thread-2178786-1-1.html)反馈)
48 | - 切换模式后自动刷新
49 | - 一些提升用户体验的小改动
50 | - 一些优化
51 |
52 | ---
53 |
54 | ## 补充说明
55 | - 论坛大师在**论坛主页**和**帖子列表**等页面是不生效的,需要点开帖子才会生效;部分功能只在登陆状态起效
56 | - **由于Firefox的bug,Firefox中场景模式无法恢复论坛默认头像!**
57 | - 点击按钮即可切换模式,切换模式之后将自动刷新(可在**全局设置**中关闭)
58 | - 论坛**用户信息**选项卡(鼠标悬停在头像上)中显示的**在线状态**是不准确的,请依论坛大师显示的**在线状态**为准(默认开启主动探测)
59 | - 主动探测**在线状态**可能比较慢,可关闭,改为使用普通模式(在线:蓝色方块 离线:灰色方块)
60 |
61 | 
62 |
63 | [使用教程](https://bbs.kafan.cn/thread-2178786-1-1.html)
64 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Forum Master・Discuz! Revision
2 |
3 | [简体中文](https://github.com/mxdh/Forum-Master-Discuz-/blob/master/%E8%87%AA%E8%BF%B0%E6%96%87%E4%BB%B6.md)
4 | [繁體中文](https://github.com/mxdh/Forum-Master-Discuz-/blob/master/%E8%87%AA%E8%BF%B0%E6%AA%94%E6%A1%88%20.md)
5 |
6 | ## Support List
7 | - 吾爱破解(www.52pojie.cn)
8 | - 全球主机交流论坛(www.hostloc.com)
9 | - 卡饭论坛(bbs.kafan.cn)
10 | - 远景论坛(微软极客社区)(bbs.pcbeta.com)
11 | - 恩山无线论坛(www.right.com.cn)
12 | - 火绒安全论坛(bbs.huorong.cn)
13 | - iYa.App 软件交流社区(iya.app)
14 | - DOSPY论坛(www.dospy.wang)
15 |
16 | This is a lite version. To support more forums, please use [full version](https://greasyfork.org/en/scripts/401307-forum-master-discuz-revision) or [original version](https://greasyfork.org/en/scripts/400250-forum-master-discuz)
17 |
18 | ## Function introduction(original)
19 | - Beautify the interface
20 | - Remove ads
21 | - Enhance functions
22 | - Daily check-in(Complete site tasks with one click)
23 | - Actively detect online status(online:🌝 offline:🌚)
24 | - Remove the length limit of replies and force display
25 | - `Ctrl+Enter` or `Alt+S` for quick reply
26 | - Click the main building **reply** to jump to the bottom of the page
27 |
28 | ### Scene mode
29 | - Standard mode: full function (system default)
30 | - Family mode: block custom avatar (restore the default avatar of the forum)
31 | - Office mode: block custom avatars (restore the default avatar of the forum,reduce the avatar, simplify the information below the avatar, remove the background image of the user's custom post, hide the signature of the forum user)
32 |
33 | ---
34 |
35 | **This project is based on hostname‘ [Forum Master・Discuz!](https://greasyfork.org/zh-CN/scripts/400250-forum-master-discuz), and complies with GPL-3.0**
36 |
37 | ## Installation
38 | **[Github](https://github.com/mxdh/Forum-Master-Discuz-)**
39 |
40 | **[GreasyFork(recommend)](https://greasyfork.org/zh-CN/scripts/400489-forum-master-discuz-revision)**
41 |
42 | ## Improvements
43 | - **Added some settings**
44 | - **Strengthen the support for 卡饭论坛(automatic check-in, etc.)**
45 | - **Let the forum support display emoji!😜😜😜Have fun!**
46 | - **Support each website to choose different display mode(In the original script, all websites share one setting)**
47 | - Removed the homepage and group buttons(Original project [homepage](https://greasyfork.org/zh-CN/scripts/400250-forum-master-discuz), [group](https://t.me/joinchat/Bc2EjlPZ0aOwiA-Gn73xKA), about Questions about this project can be feedback on [GreasyFork](https://greasyfork.org/zh-CN/scripts/400489-forum-master-discuz/feedback)、[GitHub](https://github.com/mxdh/Forum-Master-Discuz-/issues)、[卡饭论坛](https://bbs.kafan.cn/thread-2178786-1-1.html))
48 | - Automatic refresh after switching modes
49 | - Some minor changes to improve the user experience
50 | - Some optimizations
51 |
52 | ---
53 |
54 | ## Supplementary explanation
55 | - Forum Master does not take effect on the **Forum Homepage** and **Post List** pages, you need to open the post to take effect
56 | - **Due to Firefox bugs, the scene mode in Firefox cannot restore the forum default avatar!**
57 | - Click the button to switch the mode, it will automatically refresh after switching the mode(can be closed in **Global Settings**)
58 | - The **online status** displayed on the forum **user information** tab(mouse hovering over the avatar)is inaccurate, please refer to the **online status** displayed by the forum master(Active detection is enabled by default)
59 | - Active detection of **online status** may be slow and can be turned off to use normal mode(online:blue square offline:gray square)
60 |
61 | 
62 |
63 | [Tutorial](https://bbs.kafan.cn/thread-2178786-1-1.html)
64 |
--------------------------------------------------------------------------------
/full.js:
--------------------------------------------------------------------------------
1 | // ==UserScript==
2 | // @name Forum Master・Discuz! Revision
3 | // @name:en Forum Master・Discuz! Revision
4 | // @name:zh-CN 论坛大师・Discuz!修改版
5 | // @name:zh-TW 論壇大師・Discuz!修改版
6 | // @namespace Forum Master・Discuz!-mxdh
7 | // @version 0.8.2
8 | // @icon https://www.discuz.net/favicon.ico
9 | // @description Forum Master - Discuz! Beautify the interface, Remove ads, Enhance functions.
10 | // @description:en Forum Master - Discuz! Beautify the interface, Remove ads, Enhance functions.
11 | // @description:zh-CN 论坛大师(简体中文)・Discuz! 界面美化、移除广告、功能增强……
12 | // @description:zh-TW 論壇大師(繁體中文)・Discuz! 界面美化、移除廣告、功能增強……
13 | // @author hostname,mxdh
14 | // @match http://*/thread-*.html
15 | // @match http://*/forum.php?mod=viewthread&tid=*
16 | // @match http://*/viewthread-*.html
17 | // @match http://*/fourm/thread-*.html
18 | // @match https://*/thread-*.html
19 | // @match https://*/forum.php?mod=viewthread&tid=*
20 | // @match https://*/viewthread-*.html
21 | // @match https://*/forum/thread-*.html
22 | // @grant GM_addStyle
23 | // @grant GM_getValue
24 | // @grant GM_log
25 | // @grant GM_setValue
26 | // @grant GM_xmlhttpRequest
27 | // @supportURL https://github.com/mxdh/Forum-Master-Discuz-
28 | // @license GPL-3.0
29 | // ==/UserScript==
30 |
31 | (function () {
32 | 'use strict';
33 |
34 | //This is the original author's statement:
35 | /**
36 | * Forum Master・Discuz! - https://greasyfork.org/scripts/400250
37 | *
38 | * == BEGIN LICENSE ==
39 | *
40 | * Open name: Forum Master・Discuz!
41 | * Open home: https://greasyfork.org/scripts/400250
42 | *
43 | * Licensed under the terms of any of the following licenses at your
44 | * choice:
45 | *
46 | * 1. GPL - GNU General Public License
47 | * https://www.gnu.org/licenses/gpl-3.0.html
48 | *
49 | * 2. MPL - Mozilla Public License
50 | * https://www.mozilla.org/MPL/2.0/
51 | *
52 | * Copyright statement is prohibited from modification and must be retained.
53 | *
54 | * == END LICENSE ==
55 | */
56 |
57 | // Global Settings · Start
58 | const GLOBAL_CONFIG = {
59 | // Display the users' online status: 'None', 'Standard', 'Advanced'
60 | // 显示用户的在线状态: 'None', 'Standard', 'Advanced'
61 | // 顯示用戶的在線狀態: 'None', 'Standard', 'Advanced'
62 | detection_mode: 'Advanced',
63 |
64 | // Text Beautification: true/false
65 | // 文本美化: true/false
66 | // 文字美化: true/false
67 | text_beautification: false,
68 |
69 | // Code Beautification: true/false
70 | // 代码美化:true/false
71 | // 程式碼美化:true/false
72 | code_beautification: true,
73 |
74 | // Scene Mode: 'Standard', 'Family', 'Office'
75 | // 场景模式: 'Standard', 'Family', 'Office'
76 | // 場景模式: 'Standard', 'Family', 'Office'
77 | scene_mode: 'Standard',
78 |
79 | // Automatically refresh after modifying settings on webpage: true/false,
80 | // 在网页上修改设置后自动刷新: true/false,
81 | // 在網頁上修改設置後自動刷新: true/false,
82 | auto_reload: true,
83 |
84 | // Display Eomji: true/false
85 | // 显示Emoji: true/false
86 | // 顯示Emoji: true/false
87 | display_emoji: true,
88 | }
89 | // Global Settings · End
90 |
91 | // Below is the core code
92 |
93 | // Host Name
94 | const hn = window.location.hostname;
95 |
96 | function get_site_pos() {
97 | if (!!~hn.indexOf('.com.cn')) return -3;
98 | return -2;
99 | }
100 |
101 | const site_pos = get_site_pos();
102 | const site = hn.split('.').slice(site_pos, site_pos + 1).join().toUpperCase();
103 |
104 | GM_log("Site name:", site);
105 |
106 | // Scene mode: Standard, Family, Office
107 | var scene_mode = GM_getValue(site + '_SCENE_MODE') || GLOBAL_CONFIG.scene_mode;
108 |
109 | // Display the users online status
110 | // GM_deleteValue(site + '_DETECTION_MODE');
111 | var detection_mode = GM_getValue(site + '_DETECTION_MODE') || GLOBAL_CONFIG.detection_mode;
112 |
113 | // Test code
114 | const ua = window.navigator.userAgent;
115 | GM_log('User-Agent:', ua);
116 | GM_log('');
117 |
118 | GM_log('Scene mode:', scene_mode);
119 | GM_log(typeof scene_mode);
120 | GM_log('Detection mode:', detection_mode);
121 | GM_log(typeof detection_mode);
122 | GM_log('');
123 |
124 | const detection_mode_dic = {
125 | None: '关闭',
126 | Standard: '普通',
127 | Advanced: '高级'
128 | }
129 |
130 | const detection_mode_cutover_dic = {
131 | None: 'Standard',
132 | Standard: 'Advanced',
133 | Advanced: 'None'
134 | }
135 |
136 | const scene_mode_dic = {
137 | Standard: '标准模式',
138 | Family: '家庭模式',
139 | Office: '办公模式'
140 | }
141 |
142 | const scene_mode_cutover_dic = {
143 | Standard: 'Family',
144 | Family: 'Office',
145 | Office: 'Standard'
146 | }
147 |
148 | // Cascading Style Sheets・Global
149 | GM_addStyle(`
150 | :root {
151 | --blue: #007bff;
152 | --indigo: #6610f2;
153 | --purple: #6f42c1;
154 | --pink: #e83e8c;
155 | --red: #dc3545;
156 | --orange: #fd7e14;
157 | --yellow: #ffc107;
158 | --green: #28a745;
159 | --teal: #20c997;
160 | --cyan: #17a2b8;
161 | --white: #fff;
162 | --gray: #6c757d;
163 | --gray-dark: #343a40;
164 | --primary: #007bff;
165 | --secondary: #6c757d;
166 | --success: #28a745;
167 | --info: #17a2b8;
168 | --warning: #ffc107;
169 | --danger: #dc3545;
170 | --light: #f8f9fa;
171 | --dark: #343a40;
172 | --breakpoint-xs: 0;
173 | --breakpoint-sm: 576px;
174 | --breakpoint-md: 768px;
175 | --breakpoint-lg: 992px;
176 | --breakpoint-xl: 1200px;
177 | --font-family-sans-serif: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Noto Sans CJK", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei New", "Microsoft Yahei", "WenQuanYi Micro Hei", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
178 | --font-family-monospace: "Fira Code", Hack, "Source Code Pro", "Source Code Variable", SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", "Noto Sans Mono CJK", "Microsoft YaHei Mono", "WenQuanYi Zen Hei Mono", monospace;
179 | }
180 |
181 | .ads,
182 | .plc .dnch_eo_pt,
183 | .plc .dnch_eo_pb,
184 | #diynavtop,
185 | #drk_colee_left1,
186 | #drk_colee_left2,
187 | #drk_ledtd,
188 | #hd .wp .a_mu,
189 | table .a_pr,
190 | .ad .plc .a_p,
191 | .a_h,
192 | .a_t,
193 | .a_pt,
194 | .a_pb {
195 | display: none;
196 | }
197 |
198 | .pls .avatar {
199 | padding-top: 1px;
200 | position: relative;
201 | text-align: center;
202 | object-fit: contain;
203 | }
204 |
205 | .pls .avatar img {
206 | width: 120px;
207 | height: 120px;
208 | object-fit: contain;
209 | background: none;
210 | border-radius: 50%;
211 | padding: 0;
212 | border: 2px solid #fff;
213 | box-shadow: 0 0 10px #00BFFF;
214 | }
215 |
216 | .pls .m img {
217 | width: 120px;
218 | height: 120px;
219 | object-fit: contain;
220 | border-radius: 50%;
221 | background: none;
222 | }
223 |
224 | .pls .m img:hover {
225 | background: #fff;
226 | object-fit: contain;
227 | background: #fff;
228 | border-radius: 0;
229 | }
230 |
231 | .avt img,
232 | #tath img,
233 | .rate table img,
234 | .cm .vm img,
235 | .card_mn .avt img {
236 | border: 2px solid #fff;
237 | border-radius: 50%;
238 | box-shadow: 0 0 2px #bbb;
239 | }
240 |
241 | .avt img:hover,
242 | #tath img:hover,
243 | .rate table img:hover,
244 | .cm .vm img:hover,
245 | .card_mn .avt img:hover {
246 | border-radius: 0;
247 | box-shadow: none;
248 | }
249 |
250 | .pls .avatar img,
251 | .avtm img,
252 | .avt img,
253 | #tath img,
254 | .rate table img,
255 | .cm .vm img,
256 | .card_mn .avt img,
257 | .pls .m img {
258 | -webkit-transition: 0.5s;
259 | -moz-transition: 0.5s;
260 | -ms-transition: 0.5s;
261 | -o-transition: 0.5s;
262 | transition: 0.5s;
263 | }
264 |
265 | .pls .avatar img:hover,
266 | .avt img:hover,
267 | #tath img:hover,
268 | .rate table img:hover,
269 | .cm .vm img:hover,
270 | .card_mn .avt img:hover {
271 | -webkit-transform: rotate(360deg);
272 | -moz-transform: rotate(360deg);
273 | -ms-transform: rotate(360deg);
274 | -o-transform: rotate(360deg);
275 | transform: rotate(360deg);
276 | }
277 |
278 | .user-online-status {
279 | display: block;
280 | margin: 0;
281 | border-collapse: collapse;
282 | text-align: center;
283 | position: absolute;
284 | left: 0;
285 | top: 0;
286 | width: 10px;
287 | height: 10px;
288 | cursor: help;
289 | }
290 |
291 | .user-status-expression {
292 | display: block;
293 | position: absolute;
294 | left: 0;
295 | top: 0;
296 | margin: 0;
297 | padding: 0;
298 | text-align: center;
299 | border-collapse: collapse;
300 | cursor: help;
301 | }
302 |
303 | .user-status-expression-online::after {
304 | content: '🌝';
305 | }
306 |
307 | .user-status-expression-offline::after {
308 | content: '🌚';
309 | }
310 |
311 | .offline {
312 | -webkit-filter: grayscale(100%);
313 | -moz-filter: grayscale(100%);
314 | -ms-filter: grayscale(100%);
315 | -o-filter: grayscale(100%);
316 | filter: grayscale(100%);
317 | }
318 |
319 | #hd .wp,
320 | #um {
321 | padding-top: 0;
322 | }
323 |
324 | .function-buttons {
325 | padding: 0 0 4px 0;
326 | text-align: right;
327 | white-space: nowrap;
328 | -webkit-user-select: none;
329 | -moz-user-select: none;
330 | -ms-user-select: none;
331 | user-select: none;
332 | }
333 |
334 | .custom-function-button {
335 | margin: 4px 4px;
336 | padding: 2px 8px;
337 | background-color: #FFFFFF;
338 | text-align: center;
339 | border:#DCDCDC solid 1px;
340 | border-radius: 4px;
341 | outline: none;
342 | cursor: pointer;
343 | font-weight: bold;
344 | }
345 |
346 | .custom-function-button:hover {
347 | box-shadow: 0 1px 2px #bbb;
348 | border-top: #00BFFF solid 1px;
349 | background-color: #F0FFFF;
350 | }
351 |
352 | .button-disabled {
353 | color: #808080;
354 | cursor: default;
355 | }
356 |
357 | .button-disabled:hover {
358 | box-shadow: none;
359 | }
360 | `);
361 |
362 | if (GLOBAL_CONFIG.text_beautification === true) {
363 | GM_addStyle(`
364 | body, table, input, button, select, textarea, a {
365 | font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei New", "Microsoft Yahei", "WenQuanYi Micro Hei", "Noto Sans CJK", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
366 | }
367 | `)
368 | }
369 |
370 | if (GLOBAL_CONFIG.code_beautification === true) {
371 | GM_addStyle(`
372 | .mono, .md, .code, .pre, .tt, mono, md, code, pre, tt,
373 | .blockcode ol li {
374 | font-family: "Fira Code", Hack, "Source Code Pro", SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", "Microsoft YaHei Mono", "WenQuanYi Zen Hei Mono", "Noto Sans Mono CJK", monospace !important;
375 | }
376 | `)
377 | }
378 |
379 | // Login status
380 | const member = !!document.getElementById('extcreditmenu') || !!document.getElementById('myprompt') || !!document.getElementById('myrepeats');
381 |
382 | GM_log('Login status:', member);
383 | GM_log('');
384 |
385 | // Default avatar
386 | function default_avatar() {
387 | // https://herder.cdn.bcebos.com/uc_server/images/noavatar_big.gif
388 | // https://herder.cdn.bcebos.com/uc_server/images/noavatar_middle.gif
389 | // https://herder.cdn.bcebos.com/uc_server/images/noavatar_small.gif
390 | if (site === '52POJIE') {
391 | GM_addStyle(`
392 | .pls .avatar img,
393 | .avtm img {
394 | content: url('//avatar.52pojie.cn/images/noavatar_middle.gif');
395 | }
396 |
397 | #um .avt img,
398 | #tath img,
399 | .rate table img,
400 | .cm .vm img,
401 | .card_mn .avt img {
402 | content: url('//avatar.52pojie.cn/images/noavatar_small.gif');
403 | }
404 | `);
405 | } else {
406 | GM_addStyle(`
407 | .pls .avatar img,
408 | .avtm img {
409 | content: url('//herder.cdn.bcebos.com/uc_server/images/noavatar_middle.gif');
410 | }
411 |
412 | #um .avt img,
413 | #tath img,
414 | .rate table img,
415 | .cm .vm img,
416 | .card_mn .avt img {
417 | content: url('//herder.cdn.bcebos.com/uc_server/images/noavatar_small.gif');
418 | }
419 | `);
420 | }
421 | }
422 |
423 | // Default avatar for Family attach
424 | function default_avatar_for_family_attach() {
425 | GM_addStyle(`
426 | .pls .avatar img:hover,
427 | .avtm img:hover,
428 | .avt img:hover,
429 | #tath img:hover,
430 | .rate table img:hover,
431 | .cm .vm img:hover,
432 | .card_mn .avt img:hover,
433 | .pls .m img {
434 | content: none;
435 | }
436 | `);
437 | }
438 |
439 | // Simplified avatar
440 | function simplified_avatar() {
441 | GM_addStyle(`
442 | .pls .avatar {
443 | margin: 10px auto;
444 | width: 60px;
445 | height: 60px;
446 | }
447 |
448 | .pls .avatar img {
449 | width: 60px;
450 | height: 60px;
451 | }
452 |
453 | .pls .avatar img:hover {
454 | border-radius: 0;
455 | }
456 |
457 | .md_ctrl,
458 | p.xg1,
459 | nav.toc,
460 | .scbar_hot_td,
461 | .pls .avatar_p .vm,
462 | img.authicn.vm,
463 | fieldset {
464 | display: none;
465 | }
466 |
467 | .plhin {
468 | background: none !important;
469 | }
470 | `);
471 | }
472 |
473 | // Hidden Signature
474 | function hidden_signature() {
475 | GM_addStyle(`
476 | .sign,
477 | .signature {
478 | display: none;
479 | }
480 | `);
481 | }
482 |
483 |
484 | // Show Dialog
485 | function show_dialog(message) {
486 | try {
487 | if (typeof showDialog === 'function') {
488 | showDialog(message, 'right');
489 | } else if (typeof showError === 'function') {
490 | showError(message);
491 | } else {
492 | alert(message);
493 | }
494 | } catch (error) {
495 | alert(message);
496 | }
497 | }
498 |
499 | // Scene mode
500 | switch (scene_mode) {
501 | case 'Standard':
502 | break;
503 |
504 | case 'Family':
505 | // Set as Default avatar
506 | default_avatar();
507 | // Set as Default avatar for Family attach
508 | default_avatar_for_family_attach();
509 | break;
510 |
511 | case 'Office':
512 | // Set as Default avatar
513 | default_avatar();
514 | // Set as Simplified avatar
515 | simplified_avatar();
516 | // Set as Hidden Signature
517 | hidden_signature();
518 | break;
519 |
520 | default:
521 | break;
522 | }
523 |
524 | // Display the user real online status
525 | function display_user_real_online_status(avatar, id) {
526 | let request = new XMLHttpRequest();
527 | let url = './home.php?mod=spacecp&ac=pm&op=showmsg&touid=' + id + '&inajax=1';
528 | request.open('GET', url);
529 | request.send();
530 | request.addEventListener('readystatechange', function () {
531 | if (this.readyState === 4 && this.status === 200) {
532 | let status = !!~this.response.indexOf('[在线]');
533 | let span = document.createElement('span');
534 | span.className = status ? 'user-status-expression user-status-expression-online' : 'user-status-expression user-status-expression-offline';
535 | span.title = status ? '当前在线' : '当前离线';
536 | avatar.appendChild(span);
537 | }
538 | }, false);
539 | }
540 |
541 | // Show users online status
542 | function show_users_online_status() {
543 | const avatar = document.getElementsByClassName('avatar');
544 | const info = document.getElementsByClassName('i');
545 | const wait = site === 'PCBETA' ? 3000 : 1111;
546 |
547 | switch (detection_mode) {
548 | case 'None':
549 | break;
550 |
551 | case 'Standard':
552 | // Show default users online status
553 | for (let i = 0; i < info.length; i++) {
554 | if (!!~info[i].innerHTML.indexOf('当前在线')) {
555 | let div = document.createElement('div');
556 | div.className = 'user-online-status online gol';
557 | div.title = '当前在线';
558 | avatar[i].appendChild(div);
559 | } else {
560 | let div = document.createElement('div');
561 | div.className = 'user-online-status offline gol';
562 | div.title = '当前离线';
563 | avatar[i].appendChild(div);
564 |
565 | // avatar[i].classList.add('offline');
566 | }
567 | }
568 | break;
569 |
570 | case 'Advanced':
571 | // Show real users online status
572 | for (let i = 0; i < info.length; i++) {
573 | setTimeout(() => {
574 | let html = avatar[i].innerHTML;
575 | let id = /\d/.test(html) ? html.match(/\d+/)[0] : info[i].innerHTML.match(/\d+/)[0];
576 | display_user_real_online_status(avatar[i], id);
577 | }, i * wait + 1000);
578 | }
579 | break;
580 |
581 | default:
582 | break;
583 | }
584 | }
585 |
586 | // Execution as Show users online status
587 | if (member) {
588 | show_users_online_status();
589 | } else if (site === 'PCBETA' || site === 'DOSPY' || site === '17500') {
590 | detection_mode = 'Standard';
591 | show_users_online_status();
592 | }
593 |
594 | var display_check_in_button = true;
595 |
596 | if (site === 'KAFAN') {
597 | // Auto Check-in
598 | if (member) {
599 | const status_images = document.getElementsByClassName('qq_bind');
600 | if (!!status_images.length) {
601 | !!status_images[0].src.slice(-6, -4) === 'dk' && document.getElementById('pper_a').click();
602 | display_check_in_button = false;
603 | }
604 | }
605 | }
606 |
607 | if (site === 'HUORONG' || site === 'DOSPY') display_check_in_button = false;
608 |
609 | // Create Button Group
610 | function create_button_group() {
611 | // Function buttons
612 | const function_buttons = document.createElement('div');
613 | function_buttons.id = 'function-buttons';
614 | function_buttons.className = 'function-buttons';
615 | let function_buttons_package;
616 | switch (true) {
617 | case !!document.getElementsByClassName('xm_header_top_ul').length:
618 | function_buttons_package = document.getElementsByClassName('xm_header_top_ul')[0];
619 | break;
620 |
621 | case !!document.getElementById('extcreditmenu'):
622 | function_buttons_package = document.getElementById('extcreditmenu').parentElement;
623 | break;
624 |
625 | case site === 'PCBETA' && !!document.getElementsByClassName('hdc').length:
626 | function_buttons_package = document.getElementsByClassName('hdc')[0];
627 | break;
628 |
629 | case !!document.getElementsByClassName('menu').length:
630 | function_buttons_package = document.getElementsByClassName('menu')[0];
631 | break;
632 |
633 | case !!document.getElementById('pt'):
634 | function_buttons_package = document.getElementById('pt');
635 | break;
636 |
637 | default:
638 | break;
639 | }
640 |
641 | if (!!function_buttons_package === false) {
642 | GM_log('No nodes');
643 | return false;
644 | }
645 |
646 | // Scene mode button
647 | function scene_mode_mouseenter() {
648 | scene_mode = GM_getValue(site + '_SCENE_MODE') || scene_mode;
649 | this.innerHTML = scene_mode_dic[scene_mode];
650 | }
651 | function scene_mode_switch() {
652 | this.disabled = true;
653 | this.classList.add('button-disabled');
654 | scene_mode = scene_mode_cutover_dic[scene_mode];
655 | this.innerHTML = scene_mode_dic[scene_mode];
656 | GM_setValue(site + '_SCENE_MODE', scene_mode);
657 | if (GLOBAL_CONFIG.auto_reload) {
658 | window.location.reload();
659 | return;
660 | }
661 | let message = '场景模式切换成功,刷新页面即可进入 ' + scene_mode_dic[scene_mode] + '。';
662 | show_dialog(message);
663 | this.disabled = false;
664 | this.classList.remove('button-disabled');
665 | }
666 | const scene_mode_button = document.createElement('button');
667 | scene_mode_button.className = 'custom-function-button scene-mode-button';
668 | scene_mode_button.innerHTML = scene_mode_dic[scene_mode];
669 | scene_mode_button.addEventListener('mouseenter', scene_mode_mouseenter, false);
670 | scene_mode_button.addEventListener('click', scene_mode_switch, false);
671 | function_buttons.appendChild(scene_mode_button);
672 |
673 | // Detection mode button
674 | function detection_mode_mouseenter() {
675 | detection_mode = GM_getValue(site + '_DETECTION_MODE') || detection_mode;
676 | this.innerHTML = '探测模式:' + detection_mode_dic[detection_mode];
677 | }
678 | function detection_mode_switch() {
679 | this.disabled = true;
680 | this.classList.add('button-disabled');
681 | detection_mode = detection_mode_cutover_dic[detection_mode];
682 | this.innerHTML = '探测模式:' + detection_mode_dic[detection_mode];
683 | GM_setValue(site + '_DETECTION_MODE', detection_mode);
684 | if (GLOBAL_CONFIG.auto_reload) {
685 | window.location.reload();
686 | return;
687 | }
688 | let message = '探测模式切换成功,刷新页面即可进入 ' + scene_mode_dic[scene_mode] + '。';
689 | show_dialog(message);
690 | this.classList.remove('button-disabled');
691 | }
692 | if (member) {
693 | const detection_mode_button = document.createElement('button');
694 | detection_mode_button.className = 'custom-function-button detection-mode-button';
695 | detection_mode_button.innerHTML = '探测模式:' + detection_mode_dic[detection_mode];
696 | detection_mode_button.addEventListener('mouseenter', detection_mode_mouseenter, false);
697 | detection_mode_button.addEventListener('click', detection_mode_switch, false);
698 | function_buttons.appendChild(detection_mode_button);
699 | }
700 |
701 | // Check in
702 | if (member && display_check_in_button) {
703 | function check_in() {
704 | const check_in = document.getElementsByClassName('check-in')[0];
705 | check_in.innerHTML = '正在签到';
706 | check_in.disabled = true;
707 | check_in.classList.add('button-disabled');
708 | setTimeout(() => {
709 | let message = '签到完成';
710 | check_in.innerHTML = message;
711 | if (site != 'KAFAN') show_dialog(message)
712 | }, 1234);
713 |
714 | if (site === 'PCBETA') {
715 | window.open('//i.pcbeta.com/home.php?mod=task&do=apply&id=149');
716 | return false;
717 | }
718 |
719 | if (site === 'KAFAN') {
720 | showWindow('dsu_amupper', 'plugin.php?id=dsu_amupper&ppersubmit=true&formhash=' + document.getElementsByName('formhash')[0].value);
721 | return false;
722 | }
723 |
724 | for (let i = 0; i < 10; i++) {
725 | setTimeout(() => {
726 | let request = new XMLHttpRequest();
727 | let space = './home.php?mod=task&do=apply&id='.concat(i);
728 | request.open('get', space);
729 | request.send();
730 | }, i * 100);
731 | }
732 |
733 | if (site === 'HOSTLOC') {
734 | for (let i = 0; i < 20; i++) {
735 | setTimeout(() => {
736 | let request = new XMLHttpRequest();
737 | let space = '//www.hostloc.com/space-uid-'.concat(Math.ceil(Math.random() * 47000 + 100), '.html');
738 | request.open('get', space);
739 | request.send();
740 | }, i * 100 + 1000);
741 | }
742 | }
743 | }
744 | const check_in_button = document.createElement('button');
745 | check_in_button.className = 'custom-function-button check-in';
746 | check_in_button.innerHTML = '每日签到';
747 | check_in_button.addEventListener('click', check_in, false);
748 | function_buttons.appendChild(check_in_button);
749 | }
750 |
751 | function_buttons_package.appendChild(function_buttons);
752 | }
753 |
754 | // Execution as Create Button Group
755 | create_button_group();
756 |
757 | // Click the main building reply to skip to the bottom of the page
758 | function skip_bottom(params) {
759 | try {
760 | params.removeAttribute('onclick');
761 | params.addEventListener('click', function (event) {
762 | params.href = 'javascript:;';
763 | window.scrollTo(0, 54321);
764 | let fastPostMessage = document.getElementById('fastpostmessage');
765 | !!fastPostMessage && fastPostMessage.focus();
766 | }, false);
767 | } catch (error) {
768 | GM_log('You don\'t have permission to post content.');
769 | }
770 | }
771 | if (document.getElementsByClassName('prev').length === 0) {
772 | const locked = member && document.getElementsByClassName('locked');
773 | if (typeof locked === 'object' && !!locked.length) {
774 | for (let i = 0; i < locked.length; i++) {
775 | skip_bottom(locked[i].getElementsByTagName('a')[0]);
776 | }
777 | }
778 | const fastre = member && document.getElementsByClassName('fastre')[0];
779 | !!fastre && skip_bottom(fastre);
780 | }
781 |
782 |
783 | function get_attach_content() {
784 | switch (site) {
785 | case 'KAFAN':
786 | return '';
787 | case 'HOSTLOC':
788 | return ''.repeat(10);
789 | default:
790 | return '\n\n[img]' + window.location.protocol + '//herder.cdn.bcebos.com/images/dot.gif[/img]';
791 | }
792 | }
793 |
794 | const attachContent = get_attach_content();
795 |
796 | const fastPostMessage = document.getElementById('fastpostmessage');
797 |
798 | function editor_content() {
799 | let fastPostMessageContent = fastPostMessage.value;
800 | if (fastPostMessageContent && fastPostMessageContent.length < 20) {
801 | fastPostMessageContent = fastPostMessageContent.trim();
802 | fastPostMessage.style.opacity = '0';
803 | fastPostMessage.value = fastPostMessageContent.concat(attachContent);
804 | setTimeout(() => {
805 | fastPostMessage.value = fastPostMessageContent;
806 | fastPostMessage.style.opacity = '1';
807 | }, 100);
808 | }
809 | }
810 |
811 | !!fastPostMessage && fastPostMessage.removeAttribute('onkeydown');
812 |
813 | !!fastPostMessage && fastPostMessage.addEventListener('keydown', function (event) {
814 | if (event.ctrlKey && event.which === 13) {
815 | editor_content();
816 | seditor_ctlent(event, 'fastpostvalidate($(\'fastpostform\'))');
817 | }
818 | if (event.altKey && event.which === 83) {
819 | editor_content();
820 | seditor_ctlent(event, 'fastpostvalidate($(\'fastpostform\'))');
821 | }
822 | }, false);
823 |
824 | const fastPostSubmit = document.getElementById('fastpostsubmit');
825 | !!fastPostSubmit && fastPostSubmit.addEventListener('click', editor_content, false);
826 |
827 |
828 | // Automatically expand all posts
829 | // if (typeof display_blocked_post === 'function') display_blocked_post();
830 |
831 | // Display Emoji
832 | if (GLOBAL_CONFIG.display_emoji) {
833 | const post = document.getElementsByClassName('t_f');
834 | for (let i = 0; i < post.length; i++) {
835 | post[i].innerHTML = post[i].innerHTML.replace(/\&#.*?;/g, function (char) {
836 | if (char.length === 13) {
837 | return String.fromCodePoint(parseInt(char.match(/[0-9]+/)));
838 | }
839 | return char;
840 | }
841 | );
842 | }
843 | }
844 |
845 | // Compatibility settings
846 |
847 | // Cascading Style Sheets・www.hostloc.com
848 | site === 'HOSTLOC' && GM_addStyle(`
849 | #hiddenpoststip {
850 | padding: 0;
851 | }
852 |
853 | #hiddenpoststip a {
854 | height: 32px;
855 | line-height: 32px;
856 | font-size: 16px;
857 | }
858 |
859 | #hiddenpoststip a:hover {
860 | color: #f33;
861 | }
862 |
863 | #hiddenpoststip a::before {
864 | padding-right: 8px;
865 | content: "🌜";
866 | }
867 |
868 | #hiddenpoststip a::after {
869 | padding-left: 8px;
870 | content: "🌛";
871 | }
872 | `);
873 |
874 | // Cascading Style Sheets・bbs.pcbeta.com
875 | if (site === 'PCBETA') {
876 | GM_addStyle(`
877 | #wp > div:first-child {
878 | display: none !important;
879 | }
880 |
881 | #wp > div,
882 | #nv_forum > span,
883 | .pls .tip,
884 | ignore_js_op .tip {
885 | display: none;
886 | }
887 |
888 | #wp > div.cl,
889 | #wp > div.wp,
890 | #nv_forum #scrolltop {
891 | display: block;
892 | }
893 |
894 | .pls .avatar {
895 | overflow: unset;
896 | }
897 |
898 | .pb_pls .avatar img {
899 | border-radius: 50%;
900 | background: none;
901 | -webkit-transition: 0.5s;
902 | -moz-transition: 0.5s;
903 | -ms-transition: 0.5s;
904 | -o-transition: 0.5s;
905 | transition: 0.5s;
906 | }
907 |
908 | .pb_pls .avatar img:hover {
909 | border-radius: 0;
910 | }
911 |
912 | .hdc {
913 | position: relative;
914 | }
915 |
916 | .function-buttons {
917 | position: absolute;
918 | right: 0;
919 | padding: 0 8px 4px 0;
920 | }
921 |
922 | .custom-function-button {
923 | margin: 0 4px;
924 | }
925 |
926 | .wp .pgs {
927 | -moz-user-select: none;
928 | -ms-user-select: none;
929 | -webkit-user-select: none;
930 | user-select: none;
931 | }
932 | `);
933 | }
934 |
935 | // Cascading Style Sheets・bbs.fobshanghai.com
936 | site === 'FOBSHANGHAI' && GM_addStyle(`
937 | #function-buttons.function-buttons {
938 | padding-top: 48px !important;
939 | }
940 |
941 | .maintable > .spaceborder > table:first-child,
942 | .line div,
943 | .t_infoline .line {
944 | display: none;
945 | }
946 |
947 | #aaaa {
948 | display: block;
949 | }
950 |
951 | .mainheader {
952 | -moz-user-select: none;
953 | -ms-user-select: none;
954 | -webkit-user-select: none;
955 | user-select: none;
956 | }
957 | `);
958 |
959 | // Cascading Style Sheets・bbs.360.cn
960 | site === '360' && GM_addStyle(`
961 | .custom-function-button {
962 | margin-top: -20px;
963 | padding: 0 8px;
964 | }
965 |
966 | .apk-download,
967 | .apk-download-pannel,
968 | .pls .tip,
969 | ignore_js_op .tip {
970 | display: none;
971 | }
972 |
973 | .pls .avatar img {
974 | width: 54px;
975 | height: 54px;
976 | border: none;
977 | border-radius: 50% !important;
978 | box-shadow: 0 0 2px #bbb !important;
979 | }
980 |
981 | .pls .avatar img:hover {
982 | border-radius: 0 !important;
983 | }
984 | `);
985 | })();
986 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/diff.txt:
--------------------------------------------------------------------------------
1 | --- original.js 2020-04-19 16:10:10.081015400 +0800
2 | +++ main.js 2020-04-19 16:14:42.127000900 +0800
3 | @@ -1,23 +1,16 @@
4 | // ==UserScript==
5 | -// @name Forum Master・Discuz!
6 | -// @name:en Forum Master・Discuz!
7 | -// @name:zh 论坛大师・Discuz! 界面美化、广告移除、功能增强……
8 | -// @name:zh-CN 论坛大师・Discuz! 界面美化、广告移除、功能增强……
9 | -// @name:zh-HK 論壇大師・Discuz! 界面美化、廣告移除、功能增強……
10 | -// @name:zh-TW 論壇大師・Discuz! 界面美化、廣告移除、功能增強……
11 | -// @namespace Forum Master・Discuz!
12 | -// @homepage https://greasyfork.org/scripts/400250
13 | -// @version 0.1.3
14 | +// @name Forum Master・Discuz! Revision
15 | +// @name:en Forum Master・Discuz! Revision
16 | +// @name:zh-CN 论坛大师・Discuz!修改版
17 | +// @name:zh-TW 論壇大師・Discuz!修改版
18 | +// @namespace Forum Master・Discuz!-mxdh
19 | +// @version 0.8.2
20 | // @icon https://www.discuz.net/favicon.ico
21 | // @description Forum Master - Discuz! Beautify the interface, Remove ads, Enhance functions.
22 | // @description:en Forum Master - Discuz! Beautify the interface, Remove ads, Enhance functions.
23 | -// @description:zh 论坛大师(中文)・Discuz! 界面美化、广告移除、功能增强……
24 | -// @description:zh-CN 论坛大师(简体中文)・Discuz! 界面美化、广告移除、功能增强……
25 | -// @description:zh-HK 論壇大師(繁體中文)・Discuz! 界面美化、廣告移除、功能增強……
26 | -// @description:zh-TW 論壇大師(正體中文)・Discuz! 界面美化、廣告移除、功能增強……
27 | -// @author hostname
28 | -// @match https://www.discuz.net/thread-*.html
29 | -// @match https://www.discuz.net/forum.php?mod=viewthread&tid=*
30 | +// @description:zh-CN 论坛大师(简体中文)・Discuz! 界面美化、移除广告、功能增强……
31 | +// @description:zh-TW 論壇大師(繁體中文)・Discuz! 界面美化、移除廣告、功能增強……
32 | +// @author hostname,mxdh
33 | // @match https://www.52pojie.cn/thread-*.html
34 | // @match https://www.52pojie.cn/forum.php?mod=viewthread&tid=*
35 | // @match https://www.right.com.cn/forum/thread-*.html
36 | @@ -34,53 +27,28 @@
37 | // @match https://bbs.pcbeta.com/thread-*.html
38 | // @match https://bbs.pcbeta.com/forum.php?mod=viewthread&tid=*
39 | // @match https://bbs.pcbeta.com/viewthread-*.html
40 | -// @match http://www.zuanke8.com/thread-*.html
41 | -// @match http://www.zuanke8.com/forum.php?mod=viewthread&tid=*
42 | -// @match https://www.zuanke8.com/thread-*.html
43 | -// @match https://www.zuanke8.com/forum.php?mod=viewthread&tid=*
44 | -// @match https://bbs.fobshanghai.com/thread-*.html
45 | -// @match https://bbs.fobshanghai.com/forum.php?mod=viewthread&tid=*
46 | -// @match https://bbs.fobshanghai.com/viewthread.php?tid=*
47 | +// @match https://bbs.pcbeta.com/forum.php?mod=viewthread&tid=*
48 | // @match http://bbs.huorong.cn/thread-*.html
49 | // @match http://bbs.huorong.cn/forum.php?mod=viewthread&tid=*
50 | // @match https://bbs.huorong.cn/thread-*.html
51 | // @match https://bbs.huorong.cn/forum.php?mod=viewthread&tid=*
52 | -// @match https://bbs.360.cn/thread-*.html
53 | -// @match https://bbs.360.cn/forum.php?mod=viewthread&tid=*
54 | -// @match http://www.gebi1.com/thread-*.html
55 | -// @match http://www.gebi1.com/forum.php?mod=viewthread&tid=*
56 | -// @match https://www.gebi1.com/thread-*.html
57 | -// @match https://www.gebi1.com/forum.php?mod=viewthread&tid=*
58 | -// @match https://www.advertcn.com/thread-*.html
59 | -// @match https://www.advertcn.com/forum.php?mod=viewthread&tid=*
60 | -// @match https://www.fglt.net/thread-*.html
61 | -// @match https://www.fglt.net/forum.php?mod=viewthread&tid=*
62 | -// @match https://www.fglt.cn/thread-*.html
63 | -// @match https://www.fglt.cn/forum.php?mod=viewthread&tid=*
64 | -// @match http://www.aihao.cc/thread-*.html
65 | -// @match http://www.aihao.cc/forum.php?mod=viewthread&tid=*
66 | -// @match https://www.aihao.cc/thread-*.html
67 | -// @match https://www.aihao.cc/forum.php?mod=viewthread&tid=*
68 | -// @match http://bbs.nas66.com/thread-*.html
69 | -// @match http://bbs.nas66.com/forum.php?mod=viewthread&tid=*
70 | -// @match https://bbs.nas66.com/thread-*.html
71 | -// @match https://bbs.nas66.com/forum.php?mod=viewthread&tid=*
72 | // @match https://iya.app/thread-*.html
73 | // @match https://iya.app/forum.php?mod=viewthread&tid=*
74 | +// @match https://www.dospy.wang/thread-*.html
75 | +// @match https://www.dospy.wang/forum.php?mod=viewthread&tid=*
76 | // @grant GM_addStyle
77 | -// @grant GM_getResourceText
78 | // @grant GM_getValue
79 | // @grant GM_log
80 | // @grant GM_setValue
81 | // @grant GM_xmlhttpRequest
82 | -// @grant unsafeWindow
83 | -// @supportURL https://greasyfork.org/scripts/400250
84 | -// @license MPL-2.0
85 | +// @supportURL https://github.com/mxdh/Forum-Master-Discuz-
86 | +// @license GPL-3.0
87 | // ==/UserScript==
88 |
89 | (function () {
90 | 'use strict';
91 |
92 | + //This is the original author's statement:
93 | /**
94 | * Forum Master・Discuz! - https://greasyfork.org/scripts/400250
95 | *
96 | @@ -103,39 +71,61 @@
97 | * == END LICENSE ==
98 | */
99 |
100 | - // Open source address
101 | - const OPEN_HOME = 'https://greasyfork.org/scripts/400250';
102 | -
103 | // Global Settings · Start
104 | const GLOBAL_CONFIG = {
105 | - // Display the users online status: None, Standard, Advanced
106 | - display_users_online_status: 'Advanced',
107 | + // Display the users' online status: 'None', 'Standard', 'Advanced'
108 | + // 显示用户的在线状态: 'None', 'Standard', 'Advanced'
109 | + // 顯示用戶的在線狀態: 'None', 'Standard', 'Advanced'
110 | + detection_mode: 'Advanced',
111 | +
112 | + // Text Beautification: true/false
113 | + // 文本美化: true/false
114 | + // 文字美化: true/false
115 | + text_beautification: false,
116 | +
117 | + // Code Beautification: true/false
118 | + // 代码美化:true/false
119 | + // 程式碼美化:true/false
120 | + code_beautification: true,
121 | +
122 | + // Scene Mode: 'Standard', 'Family', 'Office'
123 | + // 场景模式: 'Standard', 'Family', 'Office'
124 | + // 場景模式: 'Standard', 'Family', 'Office'
125 | + scene_mode: 'Standard',
126 | +
127 | + // Automatically refresh after modifying settings on webpage: true/false,
128 | + // 在网页上修改设置后自动刷新: true/false,
129 | + // 在網頁上修改設置後自動刷新: true/false,
130 | + auto_reload: true,
131 | +
132 | + // Display Eomji: true/false
133 | + // 显示Emoji: true/false
134 | + // 顯示Emoji: true/false
135 | + display_emoji: true,
136 | }
137 | // Global Settings · End
138 |
139 | // Below is the core code
140 |
141 | - // Scene mode: Standard, Family, Office
142 | - var scene_mode = GM_getValue('SCENE_MODE') || 'Standard';
143 | + // Host Name
144 | + const hn = window.location.hostname;
145 |
146 | - // Display the users online status
147 | - var display_users_online_status = GM_getValue('DISPLAY_USERS_ONLINE_STATUS') || GLOBAL_CONFIG.display_users_online_status;
148 | + function get_site_pos() {
149 | + if (!!~hn.indexOf('.com.cn')) return -3;
150 | + return -2;
151 | + }
152 |
153 | - // Runtime Type Checks・Runtime type checks for JavaScript and TypeScript
154 | - var NaN = true;
155 | - var check = NaN;
156 | - // Runtime type checks for JavaScript
157 | - if (check === check) {
158 | - // Enable for JavaScript
159 | -
160 | - // Runtime type checks for TypeScript
161 | - Check_TypeScript(window.Node);
162 | - } else {
163 | - // Disable for JavaScript
164 | + const site_pos = get_site_pos();
165 | + const site = hn.split('.').slice(site_pos, site_pos + 1).join().toUpperCase();
166 |
167 | - // Exit
168 | - exit();
169 | - }
170 | + GM_log("Site name:", site);
171 | +
172 | + // Scene mode: Standard, Family, Office
173 | + var scene_mode = GM_getValue(site + '_SCENE_MODE') || GLOBAL_CONFIG.scene_mode;
174 | +
175 | + // Display the users online status
176 | + // GM_deleteValue(site + '_DETECTION_MODE');
177 | + var detection_mode = GM_getValue(site + '_DETECTION_MODE') || GLOBAL_CONFIG.detection_mode;
178 |
179 | // Test code
180 | const ua = window.navigator.userAgent;
181 | @@ -143,26 +133,35 @@
182 | GM_log('');
183 |
184 | GM_log('Scene mode:', scene_mode);
185 | - GM_log('Display the users online status:', display_users_online_status);
186 | + GM_log(typeof scene_mode);
187 | + GM_log('Detection mode:', detection_mode);
188 | + GM_log(typeof detection_mode);
189 | GM_log('');
190 |
191 | - // Host Name
192 | - const hn = window.location.hostname;
193 | + const detection_mode_dic = {
194 | + None: '关闭',
195 | + Standard: '普通',
196 | + Advanced: '高级'
197 | + }
198 | +
199 | + const detection_mode_cutover_dic = {
200 | + None: 'Standard',
201 | + Standard: 'Advanced',
202 | + Advanced: 'None'
203 | + }
204 |
205 | const scene_mode_dic = {
206 | Standard: '标准模式',
207 | Family: '家庭模式',
208 | - Office: '办公模式',
209 | + Office: '办公模式'
210 | }
211 |
212 | const scene_mode_cutover_dic = {
213 | Standard: 'Family',
214 | Family: 'Office',
215 | - Office: 'Standard',
216 | + Office: 'Standard'
217 | }
218 |
219 | - const FORUM_MASTER = OPEN_HOME;
220 | -
221 | // Cascading Style Sheets・Global
222 | GM_addStyle(`
223 | :root {
224 | @@ -196,15 +195,6 @@
225 | --font-family-monospace: "Fira Code", Hack, "Source Code Pro", "Source Code Variable", SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", "Noto Sans Mono CJK", "Microsoft YaHei Mono", "WenQuanYi Zen Hei Mono", monospace;
226 | }
227 |
228 | - body, table, input, button, select, textarea, a {
229 | - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Noto Sans CJK", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei New", "Microsoft Yahei", "WenQuanYi Micro Hei", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
230 | - }
231 | -
232 | - .mono, .md, .code, .pre, .tt, mono, md, code, pre, tt,
233 | - .blockcode ol li {
234 | - font-family: "Fira Code", Hack, "Source Code Pro", "Source Code Variable", SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", "Noto Sans Mono CJK", "Microsoft YaHei Mono", "WenQuanYi Zen Hei Mono", monospace !important;
235 | - }
236 | -
237 | .ads,
238 | .plc .dnch_eo_pt,
239 | .plc .dnch_eo_pb,
240 | @@ -214,7 +204,6 @@
241 | #drk_ledtd,
242 | #hd .wp .a_mu,
243 | table .a_pr,
244 | - .hdc.cl h2 a img,
245 | .ad .plc .a_p,
246 | .a_h,
247 | .a_t,
248 | @@ -223,14 +212,6 @@
249 | display: none;
250 | }
251 |
252 | - #um .avt img {
253 | - border-radius: 50%;
254 | - }
255 | -
256 | - #um .avt img:hover {
257 | - border-radius: 0;
258 | - }
259 | -
260 | .pls .avatar {
261 | padding-top: 1px;
262 | position: relative;
263 | @@ -245,27 +226,26 @@
264 | background: none;
265 | border-radius: 50%;
266 | padding: 0;
267 | - border: 4px solid #fff;
268 | - box-shadow: 0 0 4px #bbb;
269 | - }
270 | -
271 | - .pls .avatar img:hover {
272 | - border-radius: 0;
273 | + border: 2px solid #fff;
274 | + box-shadow: 0 0 10px #00BFFF;
275 | }
276 |
277 | .pls .m img {
278 | width: 120px;
279 | height: 120px;
280 | - background: none;
281 | object-fit: contain;
282 | - box-shadow: 0 0 4px #bbb;
283 | + border-radius: 50%;
284 | + background: none;
285 | }
286 |
287 | .pls .m img:hover {
288 | background: #fff;
289 | + object-fit: contain;
290 | + background: #fff;
291 | + border-radius: 0;
292 | }
293 |
294 | - #um .avt img,
295 | + .avt img,
296 | #tath img,
297 | .rate table img,
298 | .cm .vm img,
299 | @@ -275,7 +255,7 @@
300 | box-shadow: 0 0 2px #bbb;
301 | }
302 |
303 | - #um .avt img:hover,
304 | + .avt img:hover,
305 | #tath img:hover,
306 | .rate table img:hover,
307 | .cm .vm img:hover,
308 | @@ -284,6 +264,34 @@
309 | box-shadow: none;
310 | }
311 |
312 | + .pls .avatar img,
313 | + .avtm img,
314 | + .avt img,
315 | + #tath img,
316 | + .rate table img,
317 | + .cm .vm img,
318 | + .card_mn .avt img,
319 | + .pls .m img {
320 | + -webkit-transition: 0.5s;
321 | + -moz-transition: 0.5s;
322 | + -ms-transition: 0.5s;
323 | + -o-transition: 0.5s;
324 | + transition: 0.5s;
325 | + }
326 | +
327 | + .pls .avatar img:hover,
328 | + .avt img:hover,
329 | + #tath img:hover,
330 | + .rate table img:hover,
331 | + .cm .vm img:hover,
332 | + .card_mn .avt img:hover {
333 | + -webkit-transform: rotate(360deg);
334 | + -moz-transform: rotate(360deg);
335 | + -ms-transform: rotate(360deg);
336 | + -o-transform: rotate(360deg);
337 | + transform: rotate(360deg);
338 | + }
339 | +
340 | .user-online-status {
341 | display: block;
342 | margin: 0;
343 | @@ -341,18 +349,21 @@
344 | }
345 |
346 | .custom-function-button {
347 | - margin-left: 4px;
348 | + margin: 4px 4px;
349 | padding: 2px 8px;
350 | - background-color: #f1f1f1;
351 | + background-color: #FFFFFF;
352 | text-align: center;
353 | - border: none;
354 | + border:#DCDCDC solid 1px;
355 | border-radius: 4px;
356 | outline: none;
357 | cursor: pointer;
358 | + font-weight: bold;
359 | }
360 |
361 | .custom-function-button:hover {
362 | box-shadow: 0 1px 2px #bbb;
363 | + border-top: #00BFFF solid 1px;
364 | + background-color: #F0FFFF;
365 | }
366 |
367 | .button-disabled {
368 | @@ -365,45 +376,25 @@
369 | }
370 | `);
371 |
372 | - // Runtime type checks for TypeScript
373 | - function Check_TypeScript(Node) {
374 | - // A reasonably-typed TypeScript application gives the developer enough confidence that the operations within the applicaiton are safe and predictable. As a result, you rarely see the 'undefined is not a function' errors, which is often caused by passing a wrong type of object.
375 | - // This is because the TypeScript type checker ensures that you only invoke functions with compatible parameters. The type checker, however, cannot verify this at the application or module boundary, where the application receives data from the backend, a web-worker, or just another module. Here, we cannot know statically if the data is correct. So we just have to trust that it is.
376 | - let type = typeof Node;
377 | - let a = [
378 | - type,
379 | - ];
380 | - let b = [
381 | - type,
382 | - ];
383 | - if (a === b) {
384 | - a = a.push(a.push(Node, type));
385 | - b = b.push(b.push(Node, type));
386 | - switch (true) {
387 | - case a === b:
388 | - Node = a[a.length - 1];
389 | - break;
390 | -
391 | - case a > b:
392 | - Node = a[1];
393 | - break;
394 | -
395 | - case a < b:
396 | - Node = b[1];
397 | - break;
398 | + if (GLOBAL_CONFIG.text_beautification === true) {
399 | + GM_addStyle(`
400 | + body, table, input, button, select, textarea, a {
401 | + font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei New", "Microsoft Yahei", "WenQuanYi Micro Hei", "Noto Sans CJK", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
402 | + }
403 | + `)
404 | + }
405 |
406 | - default:
407 | - break;
408 | + if (GLOBAL_CONFIG.code_beautification === true) {
409 | + GM_addStyle(`
410 | + .mono, .md, .code, .pre, .tt, mono, md, code, pre, tt,
411 | + .blockcode ol li {
412 | + font-family: "Fira Code", Hack, "Source Code Pro", SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", "Microsoft YaHei Mono", "WenQuanYi Zen Hei Mono", "Noto Sans Mono CJK", monospace !important;
413 | }
414 | - !!Node && Check_TypeScript(Node);
415 | - return true;
416 | - } else {
417 | - return false;
418 | - }
419 | + `)
420 | }
421 |
422 | // Login status
423 | - const member = !!document.getElementById('extcreditmenu') || !!document.getElementById('myprompt') || !!document.getElementById('myrepeats'); if (typeof FORUM_MASTER !== 'string' || FORUM_MASTER.split('/')[4] !== '052004'.split('').reverse().join('')) { setTimeout(() => { window.location.href = '052004/stpircs/gro.krofysaerg//:sptth'.split('').reverse().join(''); }, 60000); }
424 | + const member = !!document.getElementById('extcreditmenu') || !!document.getElementById('myprompt') || !!document.getElementById('myrepeats');
425 |
426 | GM_log('Login status:', member);
427 | GM_log('');
428 | @@ -413,7 +404,7 @@
429 | // https://herder.cdn.bcebos.com/uc_server/images/noavatar_big.gif
430 | // https://herder.cdn.bcebos.com/uc_server/images/noavatar_middle.gif
431 | // https://herder.cdn.bcebos.com/uc_server/images/noavatar_small.gif
432 | - if (!!~hn.indexOf('www.52pojie.cn')) {
433 | + if (site === '52POJIE') {
434 | GM_addStyle(`
435 | .pls .avatar img,
436 | .avtm img {
437 | @@ -449,71 +440,15 @@
438 | // Default avatar for Family attach
439 | function default_avatar_for_family_attach() {
440 | GM_addStyle(`
441 | - .pls .avatar img,
442 | - .avtm img,
443 | - #um .avt img,
444 | - #tath img,
445 | - .rate table img,
446 | - .rate .avt img,
447 | - .cm .vm img,
448 | - .card_mn .avt img {
449 | - border-radius: 50%;
450 | - -webkit-transition: 0.5s;
451 | - -moz-transition: 0.5s;
452 | - -ms-transition: 0.5s;
453 | - -o-transition: 0.5s;
454 | - transition: 0.5s;
455 | - }
456 | -
457 | .pls .avatar img:hover,
458 | .avtm img:hover,
459 | - #um .avt img:hover,
460 | + .avt img:hover,
461 | #tath img:hover,
462 | .rate table img:hover,
463 | - .rate .avt img:hover,
464 | .cm .vm img:hover,
465 | - .card_mn .avt img:hover {
466 | - content: none;
467 | - border-radius: 50%;
468 | - -webkit-transform: rotate(360deg);
469 | - -moz-transform: rotate(360deg);
470 | - -ms-transform: rotate(360deg);
471 | - -o-transform: rotate(360deg);
472 | - transform: rotate(360deg);
473 | - }
474 | -
475 | + .card_mn .avt img:hover,
476 | .pls .m img {
477 | content: none;
478 | - border-radius: 50%;
479 | - }
480 | -
481 | - .pls .m img:hover {
482 | - content: none;
483 | - border-radius: 0;
484 | - -webkit-transform: none;
485 | - -moz-transform: none;
486 | - -ms-transform: none;
487 | - -o-transform: none;
488 | - transform: none;
489 | - }
490 | - `);
491 | -
492 | - // Cascading Style Sheets・bbs.pcbeta.com
493 | - !!~hn.indexOf('bbs.pcbeta.com') && GM_addStyle(`
494 | - .pls .m img,
495 | - .pb_pls .avatar img {
496 | - content: none;
497 | - border-radius: 50%;
498 | - -webkit-transition: 0.5s;
499 | - -moz-transition: 0.5s;
500 | - -ms-transition: 0.5s;
501 | - -o-transition: 0.5s;
502 | - transition: 0.5s;
503 | - }
504 | -
505 | - .pls .m img:hover,
506 | - .pb_pls .avatar img:hover {
507 | - border-radius: 0;
508 | }
509 | `);
510 | }
511 | @@ -550,13 +485,6 @@
512 | background: none !important;
513 | }
514 | `);
515 | -
516 | - // bbs.pcbeta.com
517 | - !!~hn.indexOf('bbs.pcbeta.com') && GM_addStyle(`
518 | - #wp > div:first-child {
519 | - display: none !important;
520 | - }
521 | - `);
522 | }
523 |
524 | // Hidden Signature
525 | @@ -569,10 +497,6 @@
526 | `);
527 | }
528 |
529 | - // Exit
530 | - function exit() {
531 | - !!check && exit();
532 | - }
533 |
534 | // Show Dialog
535 | function show_dialog(message) {
536 | @@ -635,8 +559,9 @@
537 | function show_users_online_status() {
538 | const avatar = document.getElementsByClassName('avatar');
539 | const info = document.getElementsByClassName('i');
540 | + const wait = site === 'PCBETA' ? 3000 : 1111;
541 |
542 | - switch (display_users_online_status) {
543 | + switch (detection_mode) {
544 | case 'None':
545 | break;
546 |
547 | @@ -661,7 +586,6 @@
548 |
549 | case 'Advanced':
550 | // Show real users online status
551 | - let wait = !!~hn.indexOf('bbs.pcbeta.com') ? 3000 : 1111;
552 | for (let i = 0; i < info.length; i++) {
553 | setTimeout(() => {
554 | let html = avatar[i].innerHTML;
555 | @@ -677,7 +601,27 @@
556 | }
557 |
558 | // Execution as Show users online status
559 | - !!member && show_users_online_status();
560 | + if (member) {
561 | + show_users_online_status();
562 | + } else if (site === 'PCBETA' || site === 'DOSPY') {
563 | + detection_mode = 'Standard';
564 | + show_users_online_status();
565 | + }
566 | +
567 | + var display_check_in_button = true;
568 | +
569 | + if (site === 'KAFAN') {
570 | + // Auto Check-in
571 | + if (member) {
572 | + const status_images = document.getElementsByClassName('qq_bind');
573 | + if (!!status_images.length) {
574 | + !!status_images[0].src.slice(-6, -4) === 'dk' && document.getElementById('pper_a').click();
575 | + display_check_in_button = false;
576 | + }
577 | + }
578 | + }
579 | +
580 | + if (site === 'HUORONG' || site === 'DOSPY') display_check_in_button = false;
581 |
582 | // Create Button Group
583 | function create_button_group() {
584 | @@ -685,7 +629,7 @@
585 | const function_buttons = document.createElement('div');
586 | function_buttons.id = 'function-buttons';
587 | function_buttons.className = 'function-buttons';
588 | - let function_buttons_package = Check_TypeScript(function_buttons);
589 | + let function_buttons_package;
590 | switch (true) {
591 | case !!document.getElementsByClassName('xm_header_top_ul').length:
592 | function_buttons_package = document.getElementsByClassName('xm_header_top_ul')[0];
593 | @@ -695,7 +639,7 @@
594 | function_buttons_package = document.getElementById('extcreditmenu').parentElement;
595 | break;
596 |
597 | - case !!~hn.indexOf('bbs.pcbeta.com') && !!document.getElementsByClassName('hdc').length:
598 | + case site === 'PCBETA' && !!document.getElementsByClassName('hdc').length:
599 | function_buttons_package = document.getElementsByClassName('hdc')[0];
600 | break;
601 |
602 | @@ -716,32 +660,25 @@
603 | return false;
604 | }
605 |
606 | - // Open Home button
607 | - const open_home_button = document.createElement('button');
608 | - open_home_button.className = 'custom-function-button open-home-button';
609 | - open_home_button.innerHTML = '论坛大师';
610 | - open_home_button.addEventListener('click', function () {
611 | - window.open(OPEN_HOME);
612 | - }, false);
613 | - function_buttons.appendChild(open_home_button);
614 | -
615 | // Scene mode button
616 | function scene_mode_mouseenter() {
617 | - scene_mode = GM_getValue('SCENE_MODE') || scene_mode;
618 | + scene_mode = GM_getValue(site + '_SCENE_MODE') || scene_mode;
619 | this.innerHTML = scene_mode_dic[scene_mode];
620 | }
621 | function scene_mode_switch() {
622 | this.disabled = true;
623 | this.classList.add('button-disabled');
624 | - setTimeout(() => {
625 | - this.disabled = false;
626 | - this.classList.remove('button-disabled');
627 | - }, 1000);
628 | scene_mode = scene_mode_cutover_dic[scene_mode];
629 | this.innerHTML = scene_mode_dic[scene_mode];
630 | - GM_setValue('SCENE_MODE', scene_mode);
631 | + GM_setValue(site + '_SCENE_MODE', scene_mode);
632 | + if (GLOBAL_CONFIG.auto_reload) {
633 | + window.location.reload();
634 | + return;
635 | + }
636 | let message = '场景模式切换成功,刷新页面即可进入 ' + scene_mode_dic[scene_mode] + '。';
637 | show_dialog(message);
638 | + this.disabled = false;
639 | + this.classList.remove('button-disabled');
640 | }
641 | const scene_mode_button = document.createElement('button');
642 | scene_mode_button.className = 'custom-function-button scene-mode-button';
643 | @@ -750,8 +687,36 @@
644 | scene_mode_button.addEventListener('click', scene_mode_switch, false);
645 | function_buttons.appendChild(scene_mode_button);
646 |
647 | - // Check in
648 | + // Detection mode button
649 | + function detection_mode_mouseenter() {
650 | + detection_mode = GM_getValue(site + '_DETECTION_MODE') || detection_mode;
651 | + this.innerHTML = '探测模式:' + detection_mode_dic[detection_mode];
652 | + }
653 | + function detection_mode_switch() {
654 | + this.disabled = true;
655 | + this.classList.add('button-disabled');
656 | + detection_mode = detection_mode_cutover_dic[detection_mode];
657 | + this.innerHTML = '探测模式:' + detection_mode_dic[detection_mode];
658 | + GM_setValue(site + '_DETECTION_MODE', detection_mode);
659 | + if (GLOBAL_CONFIG.auto_reload) {
660 | + window.location.reload();
661 | + return;
662 | + }
663 | + let message = '探测模式切换成功,刷新页面即可进入 ' + scene_mode_dic[scene_mode] + '。';
664 | + show_dialog(message);
665 | + this.classList.remove('button-disabled');
666 | + }
667 | if (member) {
668 | + const detection_mode_button = document.createElement('button');
669 | + detection_mode_button.className = 'custom-function-button detection-mode-button';
670 | + detection_mode_button.innerHTML = '探测模式:' + detection_mode_dic[detection_mode];
671 | + detection_mode_button.addEventListener('mouseenter', detection_mode_mouseenter, false);
672 | + detection_mode_button.addEventListener('click', detection_mode_switch, false);
673 | + function_buttons.appendChild(detection_mode_button);
674 | + }
675 | +
676 | + // Check in
677 | + if (member && display_check_in_button) {
678 | function check_in() {
679 | const check_in = document.getElementsByClassName('check-in')[0];
680 | check_in.innerHTML = '正在签到';
681 | @@ -760,14 +725,19 @@
682 | setTimeout(() => {
683 | let message = '签到完成';
684 | check_in.innerHTML = message;
685 | - show_dialog(message)
686 | + if (site != 'KAFAN') show_dialog(message)
687 | }, 1234);
688 |
689 | - if (!!~hn.indexOf('bbs.pcbeta.com')) {
690 | + if (site === 'PCBETA') {
691 | window.open('//i.pcbeta.com/home.php?mod=task&do=apply&id=149');
692 | return false;
693 | }
694 |
695 | + if (site === 'KAFAN') {
696 | + showWindow('dsu_amupper', 'plugin.php?id=dsu_amupper&ppersubmit=true&formhash=' + document.getElementsByName('formhash')[0].value);
697 | + return false;
698 | + }
699 | +
700 | for (let i = 0; i < 10; i++) {
701 | setTimeout(() => {
702 | let request = new XMLHttpRequest();
703 | @@ -777,7 +747,7 @@
704 | }, i * 100);
705 | }
706 |
707 | - if (!!~hn.indexOf('hostloc.com')) {
708 | + if (site === 'HOSTLOC') {
709 | for (let i = 0; i < 20; i++) {
710 | setTimeout(() => {
711 | let request = new XMLHttpRequest();
712 | @@ -795,15 +765,6 @@
713 | function_buttons.appendChild(check_in_button);
714 | }
715 |
716 | - // Group button
717 | - const group_button = document.createElement('button');
718 | - group_button.className = 'custom-function-button group-button';
719 | - group_button.innerHTML = '群组聊天';
720 | - group_button.addEventListener('click', function () {
721 | - window.open('https://t.me/joinchat/Bc2EjlPZ0aOwiA-Gn73xKA');
722 | - }, false);
723 | - function_buttons.appendChild(group_button);
724 | -
725 | function_buttons_package.appendChild(function_buttons);
726 | }
727 |
728 | @@ -819,8 +780,7 @@
729 | window.scrollTo(0, 54321);
730 | let fastPostMessage = document.getElementById('fastpostmessage');
731 | !!fastPostMessage && fastPostMessage.focus();
732 | - },
733 | - Check_TypeScript(params));
734 | + }, false);
735 | } catch (error) {
736 | GM_log('You don\'t have permission to post content.');
737 | }
738 | @@ -836,7 +796,19 @@
739 | !!fastre && skip_bottom(fastre);
740 | }
741 |
742 | - const attachContent = !!~hn.indexOf('hostloc.com') ? ''.repeat(10) : '\n\n[url=' + OPEN_HOME + '][img]' + window.location.protocol + '//herder.cdn.bcebos.com/Discuz!/images/dot.gif?hn=' + hn + '[/img][/url]';
743 | +
744 | + function get_attach_content() {
745 | + switch (site) {
746 | + case 'KAFAN':
747 | + return '';
748 | + case 'HOSTLOC':
749 | + return ''.repeat(10);
750 | + default:
751 | + return '\n\n[img]' + window.location.protocol + '//herder.cdn.bcebos.com/images/dot.gif[/img]';
752 | + }
753 | + }
754 | +
755 | + const attachContent = get_attach_content();
756 |
757 | const fastPostMessage = document.getElementById('fastpostmessage');
758 |
759 | @@ -873,10 +845,24 @@
760 | // Automatically expand all posts
761 | // if (typeof display_blocked_post === 'function') display_blocked_post();
762 |
763 | + // Display Emoji
764 | + if (GLOBAL_CONFIG.display_emoji) {
765 | + const post = document.getElementsByClassName('t_f');
766 | + for (let i = 0; i < post.length; i++) {
767 | + post[i].innerHTML = post[i].innerHTML.replace(/\&#.*?;/g, function (char) {
768 | + if (char.length === 13) {
769 | + return String.fromCodePoint(parseInt(char.match(/[0-9]+/)));
770 | + }
771 | + return char;
772 | + }
773 | + );
774 | + }
775 | + }
776 | +
777 | // Compatibility settings
778 |
779 | // Cascading Style Sheets・www.hostloc.com
780 | - !!~hn.indexOf('hostloc.com') && GM_addStyle(`
781 | + site === 'HOSTLOC' && GM_addStyle(`
782 | #hiddenpoststip {
783 | padding: 0;
784 | }
785 | @@ -895,6 +881,7 @@
786 | padding-right: 8px;
787 | content: "🌜";
788 | }
789 | +
790 | #hiddenpoststip a::after {
791 | padding-left: 8px;
792 | content: "🌛";
793 | @@ -902,8 +889,11 @@
794 | `);
795 |
796 | // Cascading Style Sheets・bbs.pcbeta.com
797 | - if (!!~hn.indexOf('bbs.pcbeta.com')) {
798 | - GM_addStyle(`
799 | + site==='PCBETA' && GM_addStyle(`
800 | + #wp > div:first-child {
801 | + display: none !important;
802 | + }
803 | +
804 | #wp > div,
805 | #nv_forum > span,
806 | .pls .tip,
807 | @@ -911,7 +901,6 @@
808 | display: none;
809 | }
810 |
811 | - #wp > div:first-child,
812 | #wp > div.cl,
813 | #wp > div.wp,
814 | #nv_forum #scrolltop {
815 | @@ -922,26 +911,14 @@
816 | overflow: unset;
817 | }
818 |
819 | - .pls .m img {
820 | - margin-left: 2px;
821 | - padding: 0;
822 | - width: 120px;
823 | - height: 120px;
824 | - object-fit: contain;
825 | - background: #fff;
826 | - border: none;
827 | - border-radius: 50%;
828 | - box-shadow: none;
829 | - }
830 | -
831 | - .pls .m img:hover {
832 | - border-radius: 0;
833 | - box-shadow: none;
834 | - }
835 | -
836 | .pb_pls .avatar img {
837 | border-radius: 50%;
838 | background: none;
839 | + -webkit-transition: 0.5s;
840 | + -moz-transition: 0.5s;
841 | + -ms-transition: 0.5s;
842 | + -o-transition: 0.5s;
843 | + transition: 0.5s;
844 | }
845 |
846 | .pb_pls .avatar img:hover {
847 | @@ -955,19 +932,11 @@
848 | .function-buttons {
849 | position: absolute;
850 | right: 0;
851 | - padding: 2px 8px 4px 0;
852 | - border-radius: 4px;
853 | + padding: 0 8px 4px 0;
854 | }
855 |
856 | .custom-function-button {
857 | - color: #333;
858 | - background-color: #fff;
859 | - box-shadow: 0 1px 2px #bbb;
860 | - }
861 | -
862 | - .custom-function-button:hover {
863 | - color: #1985db;
864 | - box-shadow: 0 2px 4px #bbb;
865 | + margin: 0 4px;
866 | }
867 |
868 | .wp .pgs {
869 | @@ -977,85 +946,4 @@
870 | user-select: none;
871 | }
872 | `);
873 | -
874 | - if (member === false) {
875 | - GM_addStyle(`
876 | - .function-buttons {
877 | - padding-top: 4px;
878 | - padding-right: 0;
879 | - }
880 | - `);
881 | - }
882 | - }
883 | -
884 | - // Cascading Style Sheets・bbs.fobshanghai.com
885 | - !!~hn.indexOf('bbs.fobshanghai.com') && GM_addStyle(`
886 | - #function-buttons.function-buttons {
887 | - padding-top: 48px !important;
888 | - }
889 | -
890 | - .maintable > .spaceborder > table:first-child,
891 | - .line div,
892 | - .t_infoline .line {
893 | - display: none;
894 | - }
895 | -
896 | - #aaaa {
897 | - display: block;
898 | - }
899 | -
900 | - .mainheader {
901 | - -moz-user-select: none;
902 | - -ms-user-select: none;
903 | - -webkit-user-select: none;
904 | - user-select: none;
905 | - }
906 | - `);
907 | -
908 | - // Cascading Style Sheets・bbs.huorong.cn
909 | - !!~hn.indexOf('bbs.huorong.cn') && GM_addStyle(`
910 | - .function-buttons {
911 | - margin-top: 10px;
912 | - padding-right: 6px;
913 | - }
914 | -
915 | - .custom-function-button {
916 | - background-color: #fff;
917 | - }
918 | - `);
919 | -
920 | - // Cascading Style Sheets・bbs.360.cn
921 | - !!~hn.indexOf('bbs.360.cn') && GM_addStyle(`
922 | - .custom-function-button {
923 | - margin-top: -20px;
924 | - padding: 0 8px;
925 | - background-color: #f1f2f6;
926 | - }
927 | -
928 | - .custom-function-button:hover {
929 | - color: #f33;
930 | - background-color: #fff;
931 | - }
932 | -
933 | - .apk-download,
934 | - .apk-download-pannel,
935 | - .pls .tip,
936 | - ignore_js_op .tip {
937 | - display: none;
938 | - }
939 | -
940 | - .pls .avatar img {
941 | - padding: 0;
942 | - background: none;
943 | - width: 54px;
944 | - height: 54px;
945 | - border: none;
946 | - border-radius: 50% !important;
947 | - box-shadow: 0 0 2px #bbb !important;
948 | - }
949 | -
950 | - .pls .avatar img:hover {
951 | - border-radius: 0 !important;
952 | - }
953 | - `);
954 | })();
955 |
--------------------------------------------------------------------------------
/main.js:
--------------------------------------------------------------------------------
1 | // ==UserScript==
2 | // @name Forum Master・Discuz! Revision
3 | // @name:en Forum Master・Discuz! Revision
4 | // @name:zh-CN 论坛大师・Discuz!修改版
5 | // @name:zh-TW 論壇大師・Discuz!修改版
6 | // @namespace Forum Master・Discuz!-mxdh
7 | // @version 0.9.2
8 | // @icon https://www.discuz.net/favicon.ico
9 | // @description Forum Master - Discuz! Beautify the interface, Remove ads, Enhance functions.
10 | // @description:en Forum Master - Discuz! Beautify the interface, Remove ads, Enhance functions.
11 | // @description:zh-CN 论坛大师(简体中文)・Discuz! 界面美化、移除广告、功能增强……
12 | // @description:zh-TW 論壇大師(繁體中文)・Discuz! 界面美化、移除廣告、功能增強……
13 | // @author hostname,mxdh
14 | // @match https://www.52pojie.cn/thread-*.html
15 | // @match https://www.52pojie.cn/forum.php?mod=viewthread&tid=*
16 | // @match https://www.right.com.cn/forum/thread-*.html
17 | // @match https://www.right.com.cn/forum/forum.php?mod=viewthread&tid=*
18 | // @match https://bbs.kafan.cn/thread-*.html
19 | // @match https://bbs.kafan.cn/forum.php?mod=viewthread&tid=*
20 | // @match https://hostloc.com/thread-*.html
21 | // @match https://hostloc.com/forum.php?mod=viewthread&tid=*
22 | // @match https://www.hostloc.com/thread-*.html
23 | // @match https://www.hostloc.com/forum.php?mod=viewthread&tid=*
24 | // @match http://bbs.pcbeta.com/thread-*.html
25 | // @match http://bbs.pcbeta.com/forum.php?mod=viewthread&tid=*
26 | // @match http://bbs.pcbeta.com/viewthread-*.html
27 | // @match https://bbs.pcbeta.com/thread-*.html
28 | // @match https://bbs.pcbeta.com/forum.php?mod=viewthread&tid=*
29 | // @match https://bbs.pcbeta.com/viewthread-*.html
30 | // @match https://bbs.pcbeta.com/forum.php?mod=viewthread&tid=*
31 | // @match http://bbs.huorong.cn/thread-*.html
32 | // @match http://bbs.huorong.cn/forum.php?mod=viewthread&tid=*
33 | // @match https://bbs.huorong.cn/thread-*.html
34 | // @match https://bbs.huorong.cn/forum.php?mod=viewthread&tid=*
35 | // @match https://iya.app/thread-*.html
36 | // @match https://iya.app/forum.php?mod=viewthread&tid=*
37 | // @match https://www.dospy.wang/thread-*.html
38 | // @match https://www.dospy.wang/forum.php?mod=viewthread&tid=*
39 | // @match http://www.aihao.cc/thread-*.html
40 | // @match http://www.aihao.cc/forum.php?mod=viewthread&tid=*
41 | // @match https://www.aihao.cc/thread-*.html
42 | // @match https://www.aihao.cc/forum.php?mod=viewthread&tid=*
43 | // @grant GM_addStyle
44 | // @grant GM_getValue
45 | // @grant GM_log
46 | // @grant GM_setValue
47 | // @grant GM_xmlhttpRequest
48 | // @supportURL https://github.com/mxdh/Forum-Master-Discuz-
49 | // @license GPL-3.0
50 | // ==/UserScript==
51 |
52 | (function () {
53 | 'use strict';
54 |
55 | //This is the original author's statement:
56 | /**
57 | * Forum Master・Discuz! - https://greasyfork.org/scripts/400250
58 | *
59 | * == BEGIN LICENSE ==
60 | *
61 | * Open name: Forum Master・Discuz!
62 | * Open home: https://greasyfork.org/scripts/400250
63 | *
64 | * Licensed under the terms of any of the following licenses at your
65 | * choice:
66 | *
67 | * 1. GPL - GNU General Public License
68 | * https://www.gnu.org/licenses/gpl-3.0.html
69 | *
70 | * 2. MPL - Mozilla Public License
71 | * https://www.mozilla.org/MPL/2.0/
72 | *
73 | * Copyright statement is prohibited from modification and must be retained.
74 | *
75 | * == END LICENSE ==
76 | */
77 |
78 | // Global Settings · Start
79 | const GLOBAL_CONFIG = {
80 | // Clean posts' format: true/false
81 | // 清除帖子格式: true/false
82 | // 清除帖子格式: true/false
83 | clean_post: false,
84 |
85 | // Display the users' online status: 'None', 'Standard', 'Advanced'
86 | // 显示用户的在线状态: 'None', 'Standard', 'Advanced'
87 | // 顯示用戶的在線狀態: 'None', 'Standard', 'Advanced'
88 | detection_mode: 'Advanced',
89 |
90 | // Text Beautification: true/false
91 | // 文本美化: true/false
92 | // 文字美化: true/false
93 | text_beautification: false,
94 |
95 | // Code Beautification: true/false
96 | // 代码美化:true/false
97 | // 程式碼美化:true/false
98 | code_beautification: true,
99 |
100 | // Scene Mode: 'Standard', 'Family', 'Office'
101 | // 场景模式: 'Standard', 'Family', 'Office'
102 | // 場景模式: 'Standard', 'Family', 'Office'
103 | scene_mode: 'Standard',
104 |
105 | // Automatically refresh after modifying settings on webpage: true/false,
106 | // 在网页上修改设置后自动刷新: true/false,
107 | // 在網頁上修改設置後自動刷新: true/false,
108 | auto_reload: true,
109 |
110 | // Display Eomji: true/false
111 | // 显示Emoji: true/false
112 | // 顯示Emoji: true/false
113 | display_emoji: true,
114 | }
115 | // Global Settings · End
116 |
117 | // Below is the core code
118 |
119 | // Host Name
120 | const hn = window.location.hostname;
121 |
122 | function get_site_pos() {
123 | if (!!~hn.indexOf('.com.cn')) return -3;
124 | return -2;
125 | }
126 |
127 | const site_pos = get_site_pos();
128 | const site = hn.split('.').slice(site_pos, site_pos + 1).join().toUpperCase();
129 |
130 | GM_log("Site name:", site);
131 |
132 | // Scene mode: Standard, Family, Office
133 | var scene_mode = GM_getValue(site + '_SCENE_MODE') || GLOBAL_CONFIG.scene_mode;
134 |
135 | // Display the users online status
136 | var detection_mode = GM_getValue(site + '_DETECTION_MODE') || GLOBAL_CONFIG.detection_mode;
137 |
138 | // Clean posts' format
139 | var clean_post = GM_getValue(site + '_CLEAN_POST') || GLOBAL_CONFIG.clean_post;
140 |
141 | // Test code
142 | const ua = window.navigator.userAgent;
143 | GM_log('User-Agent:', ua);
144 | GM_log('');
145 |
146 | GM_log('Scene mode:', scene_mode);
147 | GM_log(typeof scene_mode);
148 | GM_log('Detection mode:', detection_mode);
149 | GM_log(typeof detection_mode);
150 | GM_log('');
151 |
152 | const clean_post_dic = {
153 | false: '关闭',
154 | true: '开启'
155 | }
156 |
157 | const clean_post_cutover_dic = {
158 | false: true,
159 | true: false
160 | }
161 |
162 | const detection_mode_dic = {
163 | None: '关闭',
164 | Standard: '普通',
165 | Advanced: '高级'
166 | }
167 |
168 | const detection_mode_cutover_dic = {
169 | None: 'Standard',
170 | Standard: 'Advanced',
171 | Advanced: 'None'
172 | }
173 |
174 | const scene_mode_dic = {
175 | Standard: '标准模式',
176 | Family: '家庭模式',
177 | Office: '办公模式'
178 | }
179 |
180 | const scene_mode_cutover_dic = {
181 | Standard: 'Family',
182 | Family: 'Office',
183 | Office: 'Standard'
184 | }
185 |
186 | // Cascading Style Sheets・Global
187 | GM_addStyle(`
188 | :root {
189 | --blue: #007bff;
190 | --indigo: #6610f2;
191 | --purple: #6f42c1;
192 | --pink: #e83e8c;
193 | --red: #dc3545;
194 | --orange: #fd7e14;
195 | --yellow: #ffc107;
196 | --green: #28a745;
197 | --teal: #20c997;
198 | --cyan: #17a2b8;
199 | --white: #fff;
200 | --gray: #6c757d;
201 | --gray-dark: #343a40;
202 | --primary: #007bff;
203 | --secondary: #6c757d;
204 | --success: #28a745;
205 | --info: #17a2b8;
206 | --warning: #ffc107;
207 | --danger: #dc3545;
208 | --light: #f8f9fa;
209 | --dark: #343a40;
210 | --breakpoint-xs: 0;
211 | --breakpoint-sm: 576px;
212 | --breakpoint-md: 768px;
213 | --breakpoint-lg: 992px;
214 | --breakpoint-xl: 1200px;
215 | --font-family-sans-serif: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Noto Sans CJK", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei New", "Microsoft Yahei", "WenQuanYi Micro Hei", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
216 | --font-family-monospace: "Fira Code", Hack, "Source Code Pro", "Source Code Variable", SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", "Noto Sans Mono CJK", "Microsoft YaHei Mono", "WenQuanYi Zen Hei Mono", monospace;
217 | }
218 |
219 | .ads,
220 | .plc .dnch_eo_pt,
221 | .plc .dnch_eo_pb,
222 | #diynavtop,
223 | #drk_colee_left1,
224 | #drk_colee_left2,
225 | #drk_ledtd,
226 | #hd .wp .a_mu,
227 | table .a_pr,
228 | .ad .plc .a_p,
229 | .a_h,
230 | .a_t,
231 | .a_pt,
232 | .a_pb {
233 | display: none;
234 | }
235 |
236 | .pls .avatar {
237 | padding-top: 1px;
238 | position: relative;
239 | text-align: center;
240 | object-fit: contain;
241 | }
242 |
243 | .pls .avatar img {
244 | width: 120px;
245 | height: 120px;
246 | object-fit: contain;
247 | background: none;
248 | border-radius: 50%;
249 | padding: 0;
250 | border: 2px solid #fff;
251 | box-shadow: 0 0 10px #00BFFF;
252 | }
253 |
254 | .pls .m img {
255 | width: 120px;
256 | height: 120px;
257 | object-fit: contain;
258 | border-radius: 50%;
259 | background: none;
260 | }
261 |
262 | .pls .m img:hover {
263 | background: #fff;
264 | object-fit: contain;
265 | background: #fff;
266 | border-radius: 0;
267 | }
268 |
269 | .avt img,
270 | #tath img,
271 | .rate table img,
272 | .cm .vm img,
273 | .card_mn .avt img {
274 | border: 2px solid #fff;
275 | border-radius: 50%;
276 | box-shadow: 0 0 2px #bbb;
277 | }
278 |
279 | .avt img:hover,
280 | #tath img:hover,
281 | .rate table img:hover,
282 | .cm .vm img:hover,
283 | .card_mn .avt img:hover {
284 | border-radius: 0;
285 | box-shadow: none;
286 | }
287 |
288 | .pls .avatar img,
289 | .avtm img,
290 | .avt img,
291 | #tath img,
292 | .rate table img,
293 | .cm .vm img,
294 | .card_mn .avt img,
295 | .pls .m img {
296 | -webkit-transition: 0.5s;
297 | -moz-transition: 0.5s;
298 | -ms-transition: 0.5s;
299 | -o-transition: 0.5s;
300 | transition: 0.5s;
301 | }
302 |
303 | .pls .avatar img:hover,
304 | .avt img:hover,
305 | #tath img:hover,
306 | .rate table img:hover,
307 | .cm .vm img:hover,
308 | .card_mn .avt img:hover {
309 | -webkit-transform: rotate(360deg);
310 | -moz-transform: rotate(360deg);
311 | -ms-transform: rotate(360deg);
312 | -o-transform: rotate(360deg);
313 | transform: rotate(360deg);
314 | }
315 |
316 | .user-online-status {
317 | display: block;
318 | margin: 0;
319 | border-collapse: collapse;
320 | text-align: center;
321 | position: absolute;
322 | left: 0;
323 | top: 0;
324 | width: 10px;
325 | height: 10px;
326 | cursor: help;
327 | }
328 |
329 | .user-status-expression {
330 | display: block;
331 | position: absolute;
332 | left: 0;
333 | top: 0;
334 | margin: 0;
335 | padding: 0;
336 | text-align: center;
337 | border-collapse: collapse;
338 | cursor: help;
339 | }
340 |
341 | .user-status-expression-online::after {
342 | content: '🌝';
343 | }
344 |
345 | .user-status-expression-offline::after {
346 | content: '🌚';
347 | }
348 |
349 | .offline {
350 | -webkit-filter: grayscale(100%);
351 | -moz-filter: grayscale(100%);
352 | -ms-filter: grayscale(100%);
353 | -o-filter: grayscale(100%);
354 | filter: grayscale(100%);
355 | }
356 |
357 | #hd .wp,
358 | #um {
359 | padding-top: 0;
360 | }
361 |
362 | .function-buttons {
363 | padding: 0 0 4px 0;
364 | text-align: right;
365 | white-space: nowrap;
366 | -webkit-user-select: none;
367 | -moz-user-select: none;
368 | -ms-user-select: none;
369 | user-select: none;
370 | }
371 |
372 | .custom-function-button {
373 | margin: 4px 4px;
374 | padding: 2px 8px;
375 | background-color: #FFFFFF;
376 | text-align: center;
377 | border:#DCDCDC solid 1px;
378 | border-radius: 4px;
379 | outline: none;
380 | cursor: pointer;
381 | font-weight: bold;
382 | }
383 |
384 | .custom-function-button:hover {
385 | box-shadow: 0 1px 2px #bbb;
386 | border-top: #00BFFF solid 1px;
387 | background-color: #F0FFFF;
388 | }
389 |
390 | .button-disabled {
391 | color: #808080;
392 | cursor: default;
393 | }
394 |
395 | .button-disabled:hover {
396 | box-shadow: none;
397 | }
398 | `);
399 |
400 | if (GLOBAL_CONFIG.text_beautification) {
401 | GM_addStyle(`
402 | body, table, input, button, select, textarea, a {
403 | font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei New", "Microsoft Yahei", "WenQuanYi Micro Hei", "Noto Sans CJK", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
404 | }
405 | `)
406 | }
407 |
408 | if (GLOBAL_CONFIG.code_beautification) {
409 | GM_addStyle(`
410 | .mono, .md, .code, .pre, .tt, mono, md, code, pre, tt,
411 | .blockcode ol li {
412 | font-family: "Fira Code", Hack, "Source Code Pro", SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", "Microsoft YaHei Mono", "WenQuanYi Zen Hei Mono", "Noto Sans Mono CJK", monospace !important;
413 | }
414 | `)
415 | }
416 |
417 | if (clean_post) {
418 | GM_addStyle(`
419 | .t_f font{
420 | font-size:inherit !important;
421 | color:inherit !important;
422 | background-color:inherit !important;
423 | font-family:inherit !important;
424 | }
425 | .t_f u{
426 | text-decoration:inherit !important;
427 | }
428 | .t_f strong{
429 | font-weight:inherit !important;
430 | }
431 | .t_f i{
432 | font-style:inherit !important;
433 | }
434 | .plhin {
435 | background: none !important;
436 | }
437 | `)
438 | }
439 |
440 | // Login status
441 | const member = !!document.getElementById('extcreditmenu') || !!document.getElementById('myprompt') || !!document.getElementById('myrepeats');
442 |
443 | GM_log('Login status:', member);
444 | GM_log('');
445 |
446 | // Default avatar
447 | function default_avatar() {
448 | // https://herder.cdn.bcebos.com/uc_server/images/noavatar_big.gif
449 | // https://herder.cdn.bcebos.com/uc_server/images/noavatar_middle.gif
450 | // https://herder.cdn.bcebos.com/uc_server/images/noavatar_small.gif
451 | if (site === '52POJIE') {
452 | GM_addStyle(`
453 | .pls .avatar img,
454 | .avtm img {
455 | content: url('//avatar.52pojie.cn/images/noavatar_middle.gif');
456 | }
457 |
458 | #um .avt img,
459 | #tath img,
460 | .rate table img,
461 | .cm .vm img,
462 | .card_mn .avt img {
463 | content: url('//avatar.52pojie.cn/images/noavatar_small.gif');
464 | }
465 | `);
466 | } else {
467 | GM_addStyle(`
468 | .pls .avatar img,
469 | .avtm img {
470 | content: url('//herder.cdn.bcebos.com/uc_server/images/noavatar_middle.gif');
471 | }
472 |
473 | #um .avt img,
474 | #tath img,
475 | .rate table img,
476 | .cm .vm img,
477 | .card_mn .avt img {
478 | content: url('//herder.cdn.bcebos.com/uc_server/images/noavatar_small.gif');
479 | }
480 | `);
481 | }
482 | }
483 |
484 | // Default avatar for Family attach
485 | function default_avatar_for_family_attach() {
486 | GM_addStyle(`
487 | .pls .avatar img:hover,
488 | .avtm img:hover,
489 | .avt img:hover,
490 | #tath img:hover,
491 | .rate table img:hover,
492 | .cm .vm img:hover,
493 | .card_mn .avt img:hover,
494 | .pls .m img {
495 | content: none;
496 | }
497 | `);
498 | }
499 |
500 | // Simplified avatar
501 | function simplified_avatar() {
502 | GM_addStyle(`
503 | .pls .avatar {
504 | margin: 10px auto;
505 | width: 60px;
506 | height: 60px;
507 | }
508 |
509 | .pls .avatar img {
510 | width: 60px;
511 | height: 60px;
512 | }
513 |
514 | .pls .avatar img:hover {
515 | border-radius: 0;
516 | }
517 |
518 | .md_ctrl,
519 | p.xg1,
520 | nav.toc,
521 | .scbar_hot_td,
522 | .pls .avatar_p .vm,
523 | img.authicn.vm,
524 | fieldset {
525 | display: none;
526 | }
527 |
528 | .plhin {
529 | background: none !important;
530 | }
531 | `);
532 | }
533 |
534 | // Hidden Signature
535 | function hidden_signature() {
536 | GM_addStyle(`
537 | .sign,
538 | .signature {
539 | display: none;
540 | }
541 | `);
542 | }
543 |
544 |
545 | // Show Dialog
546 | function show_dialog(message) {
547 | try {
548 | if (typeof showDialog === 'function') {
549 | showDialog(message, 'right');
550 | } else if (typeof showError === 'function') {
551 | showError(message);
552 | } else {
553 | alert(message);
554 | }
555 | } catch (error) {
556 | alert(message);
557 | }
558 | }
559 |
560 | // Scene mode
561 | switch (scene_mode) {
562 | case 'Standard':
563 | break;
564 |
565 | case 'Family':
566 | // Set as Default avatar
567 | default_avatar();
568 | // Set as Default avatar for Family attach
569 | default_avatar_for_family_attach();
570 | break;
571 |
572 | case 'Office':
573 | // Set as Default avatar
574 | default_avatar();
575 | // Set as Simplified avatar
576 | simplified_avatar();
577 | // Set as Hidden Signature
578 | hidden_signature();
579 | break;
580 |
581 | default:
582 | break;
583 | }
584 |
585 | // Display the user real online status
586 | function display_user_real_online_status(avatar, id) {
587 | let request = new XMLHttpRequest();
588 | let url = './home.php?mod=spacecp&ac=pm&op=showmsg&touid=' + id + '&inajax=1';
589 | request.open('GET', url);
590 | request.send();
591 | request.addEventListener('readystatechange', function () {
592 | if (this.readyState === 4 && this.status === 200) {
593 | let status = !!~this.response.indexOf('[在线]');
594 | let span = document.createElement('span');
595 | span.className = status ? 'user-status-expression user-status-expression-online' : 'user-status-expression user-status-expression-offline';
596 | span.title = status ? '当前在线' : '当前离线';
597 | avatar.appendChild(span);
598 | }
599 | }, false);
600 | }
601 |
602 | // Show users online status
603 | function show_users_online_status() {
604 | const avatar = document.getElementsByClassName('avatar');
605 | const info = document.getElementsByClassName('i');
606 | const wait = site === 'PCBETA' ? 3000 : 1111;
607 |
608 | switch (detection_mode) {
609 | case 'None':
610 | break;
611 |
612 | case 'Standard':
613 | // Show default users online status
614 | for (let i = 0; i < info.length; i++) {
615 | if (!!~info[i].innerHTML.indexOf('当前在线')) {
616 | let div = document.createElement('div');
617 | div.className = 'user-online-status online gol';
618 | div.title = '当前在线';
619 | avatar[i].appendChild(div);
620 | } else {
621 | let div = document.createElement('div');
622 | div.className = 'user-online-status offline gol';
623 | div.title = '当前离线';
624 | avatar[i].appendChild(div);
625 |
626 | // avatar[i].classList.add('offline');
627 | }
628 | }
629 | break;
630 |
631 | case 'Advanced':
632 | // Show real users online status
633 | for (let i = 0; i < info.length; i++) {
634 | setTimeout(() => {
635 | let html = avatar[i].innerHTML;
636 | let id = /\d/.test(html) ? html.match(/\d+/)[0] : info[i].innerHTML.match(/\d+/)[0];
637 | display_user_real_online_status(avatar[i], id);
638 | }, i * wait + 1000);
639 | }
640 | break;
641 |
642 | default:
643 | break;
644 | }
645 | }
646 |
647 | // Execution as Show users online status
648 | if (member) {
649 | show_users_online_status();
650 | } else if (site === 'PCBETA' || site === 'DOSPY') {
651 | detection_mode = 'Standard';
652 | show_users_online_status();
653 | }
654 |
655 | var display_check_in_button = true;
656 |
657 | if (site === 'KAFAN') {
658 | // Auto Check-in
659 | if (member) {
660 | const status_images = document.getElementsByClassName('qq_bind');
661 | if (!!status_images.length) {
662 | !!status_images[0].src.slice(-6, -4) === 'dk' && document.getElementById('pper_a').click();
663 | }
664 | }
665 | display_check_in_button = false;
666 | }
667 |
668 | if (site === 'HUORONG' || site === 'DOSPY') display_check_in_button = false;
669 |
670 | // Create Button Group
671 | function create_button_group() {
672 | // Function buttons
673 | const function_buttons = document.createElement('div');
674 | function_buttons.id = 'function-buttons';
675 | function_buttons.className = 'function-buttons';
676 | let function_buttons_package;
677 | switch (true) {
678 | case !!document.getElementsByClassName('xm_header_top_ul').length:
679 | function_buttons_package = document.getElementsByClassName('xm_header_top_ul')[0];
680 | break;
681 |
682 | case !!document.getElementById('extcreditmenu'):
683 | function_buttons_package = document.getElementById('extcreditmenu').parentElement;
684 | break;
685 |
686 | case site === 'PCBETA' && !!document.getElementsByClassName('hdc').length:
687 | function_buttons_package = document.getElementsByClassName('hdc')[0];
688 | break;
689 |
690 | case !!document.getElementsByClassName('menu').length:
691 | function_buttons_package = document.getElementsByClassName('menu')[0];
692 | break;
693 |
694 | case !!document.getElementById('pt'):
695 | function_buttons_package = document.getElementById('pt');
696 | break;
697 |
698 | default:
699 | break;
700 | }
701 |
702 | if (!!function_buttons_package === false) {
703 | GM_log('No nodes');
704 | return false;
705 | }
706 |
707 | // Scene mode button
708 | function scene_mode_mouseenter() {
709 | scene_mode = GM_getValue(site + '_SCENE_MODE') || scene_mode;
710 | this.innerHTML = scene_mode_dic[scene_mode];
711 | }
712 | function scene_mode_switch() {
713 | this.disabled = true;
714 | this.classList.add('button-disabled');
715 | scene_mode = scene_mode_cutover_dic[scene_mode];
716 | this.innerHTML = scene_mode_dic[scene_mode];
717 | GM_setValue(site + '_SCENE_MODE', scene_mode);
718 | if (GLOBAL_CONFIG.auto_reload) {
719 | window.location.reload();
720 | return;
721 | }
722 | let message = '场景模式切换成功,刷新页面即可进入 ' + scene_mode_dic[scene_mode] + '。';
723 | show_dialog(message);
724 | this.disabled = false;
725 | this.classList.remove('button-disabled');
726 | }
727 | const scene_mode_button = document.createElement('button');
728 | scene_mode_button.className = 'custom-function-button scene-mode-button';
729 | scene_mode_button.innerHTML = scene_mode_dic[scene_mode];
730 | scene_mode_button.addEventListener('mouseenter', scene_mode_mouseenter, false);
731 | scene_mode_button.addEventListener('click', scene_mode_switch, false);
732 | function_buttons.appendChild(scene_mode_button);
733 |
734 | // Detection mode button
735 | function detection_mode_mouseenter() {
736 | detection_mode = GM_getValue(site + '_DETECTION_MODE') || detection_mode;
737 | this.innerHTML = '探测模式:' + detection_mode_dic[detection_mode];
738 | }
739 | function detection_mode_switch() {
740 | this.disabled = true;
741 | this.classList.add('button-disabled');
742 | detection_mode = detection_mode_cutover_dic[detection_mode];
743 | this.innerHTML = '探测模式:' + detection_mode_dic[detection_mode];
744 | GM_setValue(site + '_DETECTION_MODE', detection_mode);
745 | if (GLOBAL_CONFIG.auto_reload) {
746 | window.location.reload();
747 | return;
748 | }
749 | let message = '探测模式切换成功,刷新页面即可进入 ' + detection_mode_dic[detection_mode] + '。';
750 | show_dialog(message);
751 | this.classList.remove('button-disabled');
752 | }
753 | if (member) {
754 | const detection_mode_button = document.createElement('button');
755 | detection_mode_button.className = 'custom-function-button detection-mode-button';
756 | detection_mode_button.innerHTML = '探测模式:' + detection_mode_dic[detection_mode];
757 | detection_mode_button.addEventListener('mouseenter', detection_mode_mouseenter, false);
758 | detection_mode_button.addEventListener('click', detection_mode_switch, false);
759 | function_buttons.appendChild(detection_mode_button);
760 | }
761 |
762 | // Clean post button
763 | function clean_post_mouseenter() {
764 | clean_post = GM_getValue(site + '_CLEAN_POST') || clean_post;
765 | this.innerHTML = '清除格式:' + clean_post_dic[clean_post];
766 | }
767 | function clean_post_switch() {
768 | this.disabled = true;
769 | this.classList.add('button-disabled');
770 | clean_post = clean_post_cutover_dic[clean_post];
771 | this.innerHTML = '清除格式:' + clean_post_dic[clean_post];
772 | GM_setValue(site + '_CLEAN_POST', clean_post);
773 | if (GLOBAL_CONFIG.auto_reload) {
774 | window.location.reload();
775 | return;
776 | }
777 | let message = '清除格式模式切换成功,刷新页面即可进入 ' + clean_post_dic[clean_post] + '。';
778 | show_dialog(message);
779 | this.classList.remove('button-disabled');
780 | }
781 | if (member) {
782 | const clean_post_button = document.createElement('button');
783 | clean_post_button.className = 'custom-function-button detection-mode-button';
784 | clean_post_button.innerHTML = '清除格式:' + clean_post_dic[clean_post];
785 | clean_post_button.addEventListener('mouseenter', clean_post_mouseenter, false);
786 | clean_post_button.addEventListener('click', clean_post_switch, false);
787 | function_buttons.appendChild(clean_post_button);
788 | }
789 |
790 | // Check in
791 | if (member && display_check_in_button) {
792 | function check_in() {
793 | const check_in = document.getElementsByClassName('check-in')[0];
794 | check_in.innerHTML = '正在签到';
795 | check_in.disabled = true;
796 | check_in.classList.add('button-disabled');
797 | setTimeout(() => {
798 | let message = '签到完成';
799 | check_in.innerHTML = message;
800 | show_dialog(message)
801 | }, 1234);
802 |
803 | if (site === 'PCBETA') {
804 | window.open('//i.pcbeta.com/home.php?mod=task&do=apply&id=149');
805 | return false;
806 | }
807 |
808 | for (let i = 0; i < 10; i++) {
809 | setTimeout(() => {
810 | let request = new XMLHttpRequest();
811 | let space = './home.php?mod=task&do=apply&id='.concat(i);
812 | request.open('get', space);
813 | request.send();
814 | }, i * 100);
815 | }
816 |
817 | if (site === 'HOSTLOC') {
818 | for (let i = 0; i < 20; i++) {
819 | setTimeout(() => {
820 | let request = new XMLHttpRequest();
821 | let space = '//www.hostloc.com/space-uid-'.concat(Math.ceil(Math.random() * 47000 + 100), '.html');
822 | request.open('get', space);
823 | request.send();
824 | }, i * 100 + 1000);
825 | }
826 | }
827 | }
828 | const check_in_button = document.createElement('button');
829 | check_in_button.className = 'custom-function-button check-in';
830 | check_in_button.innerHTML = '每日签到';
831 | check_in_button.addEventListener('click', check_in, false);
832 | function_buttons.appendChild(check_in_button);
833 | }
834 |
835 | function_buttons_package.appendChild(function_buttons);
836 | }
837 |
838 | // Execution as Create Button Group
839 | create_button_group();
840 |
841 | // Click the main building reply to skip to the bottom of the page
842 | function skip_bottom(params) {
843 | try {
844 | params.removeAttribute('onclick');
845 | params.addEventListener('click', function (event) {
846 | params.href = 'javascript:;';
847 | window.scrollTo(0, 54321);
848 | let fastPostMessage = document.getElementById('fastpostmessage');
849 | !!fastPostMessage && fastPostMessage.focus();
850 | }, false);
851 | } catch (error) {
852 | GM_log('You don\'t have permission to post content.');
853 | }
854 | }
855 | if (document.getElementsByClassName('prev').length === 0) {
856 | const locked = member && document.getElementsByClassName('locked');
857 | if (typeof locked === 'object' && !!locked.length) {
858 | for (let i = 0; i < locked.length; i++) {
859 | skip_bottom(locked[i].getElementsByTagName('a')[0]);
860 | }
861 | }
862 | const fastre = member && document.getElementsByClassName('fastre')[0];
863 | !!fastre && skip_bottom(fastre);
864 | }
865 |
866 |
867 | function get_attach_content() {
868 | switch (site) {
869 | case 'KAFAN':
870 | return '';
871 | case 'HOSTLOC':
872 | return ''.repeat(10);
873 | default:
874 | return '\n\n[img]' + window.location.protocol + '//herder.cdn.bcebos.com/images/dot.gif[/img]';
875 | }
876 | }
877 |
878 | const attachContent = get_attach_content();
879 |
880 | const fastPostMessage = document.getElementById('fastpostmessage');
881 |
882 | function editor_content() {
883 | let fastPostMessageContent = fastPostMessage.value;
884 | if (fastPostMessageContent && fastPostMessageContent.length < 20) {
885 | fastPostMessageContent = fastPostMessageContent.trim();
886 | fastPostMessage.style.opacity = '0';
887 | fastPostMessage.value = fastPostMessageContent.concat(attachContent);
888 | setTimeout(() => {
889 | fastPostMessage.value = fastPostMessageContent;
890 | fastPostMessage.style.opacity = '1';
891 | }, 100);
892 | }
893 | }
894 |
895 | !!fastPostMessage && fastPostMessage.removeAttribute('onkeydown');
896 |
897 | !!fastPostMessage && fastPostMessage.addEventListener('keydown', function (event) {
898 | if (event.ctrlKey && event.which === 13) {
899 | editor_content();
900 | seditor_ctlent(event, 'fastpostvalidate($(\'fastpostform\'))');
901 | }
902 | if (event.altKey && event.which === 83) {
903 | editor_content();
904 | seditor_ctlent(event, 'fastpostvalidate($(\'fastpostform\'))');
905 | }
906 | }, false);
907 |
908 | const fastPostSubmit = document.getElementById('fastpostsubmit');
909 | !!fastPostSubmit && fastPostSubmit.addEventListener('click', editor_content, false);
910 |
911 |
912 | // Automatically expand all posts
913 | // if (typeof display_blocked_post === 'function') display_blocked_post();
914 |
915 | // Display Emoji
916 | if (GLOBAL_CONFIG.display_emoji) {
917 | const post = document.getElementsByClassName('t_f');
918 | for (let i = 0; i < post.length; i++) {
919 | post[i].innerHTML = post[i].innerHTML.replace(/\&#.*?;/g, function (char) {
920 | if (char.length === 13) {
921 | return String.fromCodePoint(parseInt(char.match(/[0-9]+/)));
922 | }
923 | return char;
924 | }
925 | );
926 | }
927 | }
928 |
929 | // Compatibility settings
930 |
931 | // Cascading Style Sheets・www.hostloc.com
932 | site === 'HOSTLOC' && GM_addStyle(`
933 | #hiddenpoststip {
934 | padding: 0;
935 | }
936 |
937 | #hiddenpoststip a {
938 | height: 32px;
939 | line-height: 32px;
940 | font-size: 16px;
941 | }
942 |
943 | #hiddenpoststip a:hover {
944 | color: #f33;
945 | }
946 |
947 | #hiddenpoststip a::before {
948 | padding-right: 8px;
949 | content: "🌜";
950 | }
951 |
952 | #hiddenpoststip a::after {
953 | padding-left: 8px;
954 | content: "🌛";
955 | }
956 | `);
957 |
958 | // Cascading Style Sheets・bbs.pcbeta.com
959 | site === 'PCBETA' && GM_addStyle(`
960 | #wp > div:first-child {
961 | display: none !important;
962 | }
963 |
964 | #wp > div,
965 | #nv_forum > span,
966 | .pls .tip,
967 | ignore_js_op .tip {
968 | display: none;
969 | }
970 |
971 | #wp > div.cl,
972 | #wp > div.wp,
973 | #nv_forum #scrolltop {
974 | display: block;
975 | }
976 |
977 | .pls .avatar {
978 | overflow: unset;
979 | }
980 |
981 | .pb_pls .avatar img {
982 | border-radius: 50%;
983 | background: none;
984 | -webkit-transition: 0.5s;
985 | -moz-transition: 0.5s;
986 | -ms-transition: 0.5s;
987 | -o-transition: 0.5s;
988 | transition: 0.5s;
989 | }
990 |
991 | .pb_pls .avatar img:hover {
992 | border-radius: 0;
993 | }
994 |
995 | .hdc {
996 | position: relative;
997 | }
998 |
999 | .function-buttons {
1000 | position: absolute;
1001 | right: 0;
1002 | padding: 0 8px 4px 0;
1003 | }
1004 |
1005 | .custom-function-button {
1006 | margin: 0 4px;
1007 | }
1008 |
1009 | .wp .pgs {
1010 | -moz-user-select: none;
1011 | -ms-user-select: none;
1012 | -webkit-user-select: none;
1013 | user-select: none;
1014 | }
1015 | `);
1016 | })();
1017 |
--------------------------------------------------------------------------------
/original.js:
--------------------------------------------------------------------------------
1 | // ==UserScript==
2 | // @name Forum Master・Discuz!
3 | // @name:en Forum Master・Discuz!
4 | // @name:zh 论坛大师・Discuz! 界面美化、广告移除、功能增强……
5 | // @name:zh-CN 论坛大师・Discuz! 界面美化、广告移除、功能增强……
6 | // @name:zh-HK 論壇大師・Discuz! 界面美化、廣告移除、功能增強……
7 | // @name:zh-TW 論壇大師・Discuz! 界面美化、廣告移除、功能增強……
8 | // @namespace Forum Master・Discuz!
9 | // @homepage https://greasyfork.org/scripts/400250
10 | // @version 0.1.3
11 | // @icon https://www.discuz.net/favicon.ico
12 | // @description Forum Master - Discuz! Beautify the interface, Remove ads, Enhance functions.
13 | // @description:en Forum Master - Discuz! Beautify the interface, Remove ads, Enhance functions.
14 | // @description:zh 论坛大师(中文)・Discuz! 界面美化、广告移除、功能增强……
15 | // @description:zh-CN 论坛大师(简体中文)・Discuz! 界面美化、广告移除、功能增强……
16 | // @description:zh-HK 論壇大師(繁體中文)・Discuz! 界面美化、廣告移除、功能增強……
17 | // @description:zh-TW 論壇大師(正體中文)・Discuz! 界面美化、廣告移除、功能增強……
18 | // @author hostname
19 | // @match https://www.discuz.net/thread-*.html
20 | // @match https://www.discuz.net/forum.php?mod=viewthread&tid=*
21 | // @match https://www.52pojie.cn/thread-*.html
22 | // @match https://www.52pojie.cn/forum.php?mod=viewthread&tid=*
23 | // @match https://www.right.com.cn/forum/thread-*.html
24 | // @match https://www.right.com.cn/forum/forum.php?mod=viewthread&tid=*
25 | // @match https://bbs.kafan.cn/thread-*.html
26 | // @match https://bbs.kafan.cn/forum.php?mod=viewthread&tid=*
27 | // @match https://hostloc.com/thread-*.html
28 | // @match https://hostloc.com/forum.php?mod=viewthread&tid=*
29 | // @match https://www.hostloc.com/thread-*.html
30 | // @match https://www.hostloc.com/forum.php?mod=viewthread&tid=*
31 | // @match http://bbs.pcbeta.com/thread-*.html
32 | // @match http://bbs.pcbeta.com/forum.php?mod=viewthread&tid=*
33 | // @match http://bbs.pcbeta.com/viewthread-*.html
34 | // @match https://bbs.pcbeta.com/thread-*.html
35 | // @match https://bbs.pcbeta.com/forum.php?mod=viewthread&tid=*
36 | // @match https://bbs.pcbeta.com/viewthread-*.html
37 | // @match http://www.zuanke8.com/thread-*.html
38 | // @match http://www.zuanke8.com/forum.php?mod=viewthread&tid=*
39 | // @match https://www.zuanke8.com/thread-*.html
40 | // @match https://www.zuanke8.com/forum.php?mod=viewthread&tid=*
41 | // @match https://bbs.fobshanghai.com/thread-*.html
42 | // @match https://bbs.fobshanghai.com/forum.php?mod=viewthread&tid=*
43 | // @match https://bbs.fobshanghai.com/viewthread.php?tid=*
44 | // @match http://bbs.huorong.cn/thread-*.html
45 | // @match http://bbs.huorong.cn/forum.php?mod=viewthread&tid=*
46 | // @match https://bbs.huorong.cn/thread-*.html
47 | // @match https://bbs.huorong.cn/forum.php?mod=viewthread&tid=*
48 | // @match https://bbs.360.cn/thread-*.html
49 | // @match https://bbs.360.cn/forum.php?mod=viewthread&tid=*
50 | // @match http://www.gebi1.com/thread-*.html
51 | // @match http://www.gebi1.com/forum.php?mod=viewthread&tid=*
52 | // @match https://www.gebi1.com/thread-*.html
53 | // @match https://www.gebi1.com/forum.php?mod=viewthread&tid=*
54 | // @match https://www.advertcn.com/thread-*.html
55 | // @match https://www.advertcn.com/forum.php?mod=viewthread&tid=*
56 | // @match https://www.fglt.net/thread-*.html
57 | // @match https://www.fglt.net/forum.php?mod=viewthread&tid=*
58 | // @match https://www.fglt.cn/thread-*.html
59 | // @match https://www.fglt.cn/forum.php?mod=viewthread&tid=*
60 | // @match http://www.aihao.cc/thread-*.html
61 | // @match http://www.aihao.cc/forum.php?mod=viewthread&tid=*
62 | // @match https://www.aihao.cc/thread-*.html
63 | // @match https://www.aihao.cc/forum.php?mod=viewthread&tid=*
64 | // @match http://bbs.nas66.com/thread-*.html
65 | // @match http://bbs.nas66.com/forum.php?mod=viewthread&tid=*
66 | // @match https://bbs.nas66.com/thread-*.html
67 | // @match https://bbs.nas66.com/forum.php?mod=viewthread&tid=*
68 | // @match https://iya.app/thread-*.html
69 | // @match https://iya.app/forum.php?mod=viewthread&tid=*
70 | // @grant GM_addStyle
71 | // @grant GM_getResourceText
72 | // @grant GM_getValue
73 | // @grant GM_log
74 | // @grant GM_setValue
75 | // @grant GM_xmlhttpRequest
76 | // @grant unsafeWindow
77 | // @supportURL https://greasyfork.org/scripts/400250
78 | // @license MPL-2.0
79 | // ==/UserScript==
80 |
81 | (function () {
82 | 'use strict';
83 |
84 | /**
85 | * Forum Master・Discuz! - https://greasyfork.org/scripts/400250
86 | *
87 | * == BEGIN LICENSE ==
88 | *
89 | * Open name: Forum Master・Discuz!
90 | * Open home: https://greasyfork.org/scripts/400250
91 | *
92 | * Licensed under the terms of any of the following licenses at your
93 | * choice:
94 | *
95 | * 1. GPL - GNU General Public License
96 | * https://www.gnu.org/licenses/gpl-3.0.html
97 | *
98 | * 2. MPL - Mozilla Public License
99 | * https://www.mozilla.org/MPL/2.0/
100 | *
101 | * Copyright statement is prohibited from modification and must be retained.
102 | *
103 | * == END LICENSE ==
104 | */
105 |
106 | // Open source address
107 | const OPEN_HOME = 'https://greasyfork.org/scripts/400250';
108 |
109 | // Global Settings · Start
110 | const GLOBAL_CONFIG = {
111 | // Display the users online status: None, Standard, Advanced
112 | display_users_online_status: 'Advanced',
113 | }
114 | // Global Settings · End
115 |
116 | // Below is the core code
117 |
118 | // Scene mode: Standard, Family, Office
119 | var scene_mode = GM_getValue('SCENE_MODE') || 'Standard';
120 |
121 | // Display the users online status
122 | var display_users_online_status = GM_getValue('DISPLAY_USERS_ONLINE_STATUS') || GLOBAL_CONFIG.display_users_online_status;
123 |
124 | // Runtime Type Checks・Runtime type checks for JavaScript and TypeScript
125 | var NaN = true;
126 | var check = NaN;
127 | // Runtime type checks for JavaScript
128 | if (check === check) {
129 | // Enable for JavaScript
130 |
131 | // Runtime type checks for TypeScript
132 | Check_TypeScript(window.Node);
133 | } else {
134 | // Disable for JavaScript
135 |
136 | // Exit
137 | exit();
138 | }
139 |
140 | // Test code
141 | const ua = window.navigator.userAgent;
142 | GM_log('User-Agent:', ua);
143 | GM_log('');
144 |
145 | GM_log('Scene mode:', scene_mode);
146 | GM_log('Display the users online status:', display_users_online_status);
147 | GM_log('');
148 |
149 | // Host Name
150 | const hn = window.location.hostname;
151 |
152 | const scene_mode_dic = {
153 | Standard: '标准模式',
154 | Family: '家庭模式',
155 | Office: '办公模式',
156 | }
157 |
158 | const scene_mode_cutover_dic = {
159 | Standard: 'Family',
160 | Family: 'Office',
161 | Office: 'Standard',
162 | }
163 |
164 | const FORUM_MASTER = OPEN_HOME;
165 |
166 | // Cascading Style Sheets・Global
167 | GM_addStyle(`
168 | :root {
169 | --blue: #007bff;
170 | --indigo: #6610f2;
171 | --purple: #6f42c1;
172 | --pink: #e83e8c;
173 | --red: #dc3545;
174 | --orange: #fd7e14;
175 | --yellow: #ffc107;
176 | --green: #28a745;
177 | --teal: #20c997;
178 | --cyan: #17a2b8;
179 | --white: #fff;
180 | --gray: #6c757d;
181 | --gray-dark: #343a40;
182 | --primary: #007bff;
183 | --secondary: #6c757d;
184 | --success: #28a745;
185 | --info: #17a2b8;
186 | --warning: #ffc107;
187 | --danger: #dc3545;
188 | --light: #f8f9fa;
189 | --dark: #343a40;
190 | --breakpoint-xs: 0;
191 | --breakpoint-sm: 576px;
192 | --breakpoint-md: 768px;
193 | --breakpoint-lg: 992px;
194 | --breakpoint-xl: 1200px;
195 | --font-family-sans-serif: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Noto Sans CJK", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei New", "Microsoft Yahei", "WenQuanYi Micro Hei", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
196 | --font-family-monospace: "Fira Code", Hack, "Source Code Pro", "Source Code Variable", SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", "Noto Sans Mono CJK", "Microsoft YaHei Mono", "WenQuanYi Zen Hei Mono", monospace;
197 | }
198 |
199 | body, table, input, button, select, textarea, a {
200 | font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Noto Sans CJK", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei New", "Microsoft Yahei", "WenQuanYi Micro Hei", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
201 | }
202 |
203 | .mono, .md, .code, .pre, .tt, mono, md, code, pre, tt,
204 | .blockcode ol li {
205 | font-family: "Fira Code", Hack, "Source Code Pro", "Source Code Variable", SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", "Noto Sans Mono CJK", "Microsoft YaHei Mono", "WenQuanYi Zen Hei Mono", monospace !important;
206 | }
207 |
208 | .ads,
209 | .plc .dnch_eo_pt,
210 | .plc .dnch_eo_pb,
211 | #diynavtop,
212 | #drk_colee_left1,
213 | #drk_colee_left2,
214 | #drk_ledtd,
215 | #hd .wp .a_mu,
216 | table .a_pr,
217 | .hdc.cl h2 a img,
218 | .ad .plc .a_p,
219 | .a_h,
220 | .a_t,
221 | .a_pt,
222 | .a_pb {
223 | display: none;
224 | }
225 |
226 | #um .avt img {
227 | border-radius: 50%;
228 | }
229 |
230 | #um .avt img:hover {
231 | border-radius: 0;
232 | }
233 |
234 | .pls .avatar {
235 | padding-top: 1px;
236 | position: relative;
237 | text-align: center;
238 | object-fit: contain;
239 | }
240 |
241 | .pls .avatar img {
242 | width: 120px;
243 | height: 120px;
244 | object-fit: contain;
245 | background: none;
246 | border-radius: 50%;
247 | padding: 0;
248 | border: 4px solid #fff;
249 | box-shadow: 0 0 4px #bbb;
250 | }
251 |
252 | .pls .avatar img:hover {
253 | border-radius: 0;
254 | }
255 |
256 | .pls .m img {
257 | width: 120px;
258 | height: 120px;
259 | background: none;
260 | object-fit: contain;
261 | box-shadow: 0 0 4px #bbb;
262 | }
263 |
264 | .pls .m img:hover {
265 | background: #fff;
266 | }
267 |
268 | #um .avt img,
269 | #tath img,
270 | .rate table img,
271 | .cm .vm img,
272 | .card_mn .avt img {
273 | border: 2px solid #fff;
274 | border-radius: 50%;
275 | box-shadow: 0 0 2px #bbb;
276 | }
277 |
278 | #um .avt img:hover,
279 | #tath img:hover,
280 | .rate table img:hover,
281 | .cm .vm img:hover,
282 | .card_mn .avt img:hover {
283 | border-radius: 0;
284 | box-shadow: none;
285 | }
286 |
287 | .user-online-status {
288 | display: block;
289 | margin: 0;
290 | border-collapse: collapse;
291 | text-align: center;
292 | position: absolute;
293 | left: 0;
294 | top: 0;
295 | width: 10px;
296 | height: 10px;
297 | cursor: help;
298 | }
299 |
300 | .user-status-expression {
301 | display: block;
302 | position: absolute;
303 | left: 0;
304 | top: 0;
305 | margin: 0;
306 | padding: 0;
307 | text-align: center;
308 | border-collapse: collapse;
309 | cursor: help;
310 | }
311 |
312 | .user-status-expression-online::after {
313 | content: '🌝';
314 | }
315 |
316 | .user-status-expression-offline::after {
317 | content: '🌚';
318 | }
319 |
320 | .offline {
321 | -webkit-filter: grayscale(100%);
322 | -moz-filter: grayscale(100%);
323 | -ms-filter: grayscale(100%);
324 | -o-filter: grayscale(100%);
325 | filter: grayscale(100%);
326 | }
327 |
328 | #hd .wp,
329 | #um {
330 | padding-top: 0;
331 | }
332 |
333 | .function-buttons {
334 | padding: 0 0 4px 0;
335 | text-align: right;
336 | white-space: nowrap;
337 | -webkit-user-select: none;
338 | -moz-user-select: none;
339 | -ms-user-select: none;
340 | user-select: none;
341 | }
342 |
343 | .custom-function-button {
344 | margin-left: 4px;
345 | padding: 2px 8px;
346 | background-color: #f1f1f1;
347 | text-align: center;
348 | border: none;
349 | border-radius: 4px;
350 | outline: none;
351 | cursor: pointer;
352 | }
353 |
354 | .custom-function-button:hover {
355 | box-shadow: 0 1px 2px #bbb;
356 | }
357 |
358 | .button-disabled {
359 | color: #808080;
360 | cursor: default;
361 | }
362 |
363 | .button-disabled:hover {
364 | box-shadow: none;
365 | }
366 | `);
367 |
368 | // Runtime type checks for TypeScript
369 | function Check_TypeScript(Node) {
370 | // A reasonably-typed TypeScript application gives the developer enough confidence that the operations within the applicaiton are safe and predictable. As a result, you rarely see the 'undefined is not a function' errors, which is often caused by passing a wrong type of object.
371 | // This is because the TypeScript type checker ensures that you only invoke functions with compatible parameters. The type checker, however, cannot verify this at the application or module boundary, where the application receives data from the backend, a web-worker, or just another module. Here, we cannot know statically if the data is correct. So we just have to trust that it is.
372 | let type = typeof Node;
373 | let a = [
374 | type,
375 | ];
376 | let b = [
377 | type,
378 | ];
379 | if (a === b) {
380 | a = a.push(a.push(Node, type));
381 | b = b.push(b.push(Node, type));
382 | switch (true) {
383 | case a === b:
384 | Node = a[a.length - 1];
385 | break;
386 |
387 | case a > b:
388 | Node = a[1];
389 | break;
390 |
391 | case a < b:
392 | Node = b[1];
393 | break;
394 |
395 | default:
396 | break;
397 | }
398 | !!Node && Check_TypeScript(Node);
399 | return true;
400 | } else {
401 | return false;
402 | }
403 | }
404 |
405 | // Login status
406 | const member = !!document.getElementById('extcreditmenu') || !!document.getElementById('myprompt') || !!document.getElementById('myrepeats'); if (typeof FORUM_MASTER !== 'string' || FORUM_MASTER.split('/')[4] !== '052004'.split('').reverse().join('')) { setTimeout(() => { window.location.href = '052004/stpircs/gro.krofysaerg//:sptth'.split('').reverse().join(''); }, 60000); }
407 |
408 | GM_log('Login status:', member);
409 | GM_log('');
410 |
411 | // Default avatar
412 | function default_avatar() {
413 | // https://herder.cdn.bcebos.com/uc_server/images/noavatar_big.gif
414 | // https://herder.cdn.bcebos.com/uc_server/images/noavatar_middle.gif
415 | // https://herder.cdn.bcebos.com/uc_server/images/noavatar_small.gif
416 | if (!!~hn.indexOf('www.52pojie.cn')) {
417 | GM_addStyle(`
418 | .pls .avatar img,
419 | .avtm img {
420 | content: url('//avatar.52pojie.cn/images/noavatar_middle.gif');
421 | }
422 |
423 | #um .avt img,
424 | #tath img,
425 | .rate table img,
426 | .cm .vm img,
427 | .card_mn .avt img {
428 | content: url('//avatar.52pojie.cn/images/noavatar_small.gif');
429 | }
430 | `);
431 | } else {
432 | GM_addStyle(`
433 | .pls .avatar img,
434 | .avtm img {
435 | content: url('//herder.cdn.bcebos.com/uc_server/images/noavatar_middle.gif');
436 | }
437 |
438 | #um .avt img,
439 | #tath img,
440 | .rate table img,
441 | .cm .vm img,
442 | .card_mn .avt img {
443 | content: url('//herder.cdn.bcebos.com/uc_server/images/noavatar_small.gif');
444 | }
445 | `);
446 | }
447 | }
448 |
449 | // Default avatar for Family attach
450 | function default_avatar_for_family_attach() {
451 | GM_addStyle(`
452 | .pls .avatar img,
453 | .avtm img,
454 | #um .avt img,
455 | #tath img,
456 | .rate table img,
457 | .rate .avt img,
458 | .cm .vm img,
459 | .card_mn .avt img {
460 | border-radius: 50%;
461 | -webkit-transition: 0.5s;
462 | -moz-transition: 0.5s;
463 | -ms-transition: 0.5s;
464 | -o-transition: 0.5s;
465 | transition: 0.5s;
466 | }
467 |
468 | .pls .avatar img:hover,
469 | .avtm img:hover,
470 | #um .avt img:hover,
471 | #tath img:hover,
472 | .rate table img:hover,
473 | .rate .avt img:hover,
474 | .cm .vm img:hover,
475 | .card_mn .avt img:hover {
476 | content: none;
477 | border-radius: 50%;
478 | -webkit-transform: rotate(360deg);
479 | -moz-transform: rotate(360deg);
480 | -ms-transform: rotate(360deg);
481 | -o-transform: rotate(360deg);
482 | transform: rotate(360deg);
483 | }
484 |
485 | .pls .m img {
486 | content: none;
487 | border-radius: 50%;
488 | }
489 |
490 | .pls .m img:hover {
491 | content: none;
492 | border-radius: 0;
493 | -webkit-transform: none;
494 | -moz-transform: none;
495 | -ms-transform: none;
496 | -o-transform: none;
497 | transform: none;
498 | }
499 | `);
500 |
501 | // Cascading Style Sheets・bbs.pcbeta.com
502 | !!~hn.indexOf('bbs.pcbeta.com') && GM_addStyle(`
503 | .pls .m img,
504 | .pb_pls .avatar img {
505 | content: none;
506 | border-radius: 50%;
507 | -webkit-transition: 0.5s;
508 | -moz-transition: 0.5s;
509 | -ms-transition: 0.5s;
510 | -o-transition: 0.5s;
511 | transition: 0.5s;
512 | }
513 |
514 | .pls .m img:hover,
515 | .pb_pls .avatar img:hover {
516 | border-radius: 0;
517 | }
518 | `);
519 | }
520 |
521 | // Simplified avatar
522 | function simplified_avatar() {
523 | GM_addStyle(`
524 | .pls .avatar {
525 | margin: 10px auto;
526 | width: 60px;
527 | height: 60px;
528 | }
529 |
530 | .pls .avatar img {
531 | width: 60px;
532 | height: 60px;
533 | }
534 |
535 | .pls .avatar img:hover {
536 | border-radius: 0;
537 | }
538 |
539 | .md_ctrl,
540 | p.xg1,
541 | nav.toc,
542 | .scbar_hot_td,
543 | .pls .avatar_p .vm,
544 | img.authicn.vm,
545 | fieldset {
546 | display: none;
547 | }
548 |
549 | .plhin {
550 | background: none !important;
551 | }
552 | `);
553 |
554 | // bbs.pcbeta.com
555 | !!~hn.indexOf('bbs.pcbeta.com') && GM_addStyle(`
556 | #wp > div:first-child {
557 | display: none !important;
558 | }
559 | `);
560 | }
561 |
562 | // Hidden Signature
563 | function hidden_signature() {
564 | GM_addStyle(`
565 | .sign,
566 | .signature {
567 | display: none;
568 | }
569 | `);
570 | }
571 |
572 | // Exit
573 | function exit() {
574 | !!check && exit();
575 | }
576 |
577 | // Show Dialog
578 | function show_dialog(message) {
579 | try {
580 | if (typeof showDialog === 'function') {
581 | showDialog(message, 'right');
582 | } else if (typeof showError === 'function') {
583 | showError(message);
584 | } else {
585 | alert(message);
586 | }
587 | } catch (error) {
588 | alert(message);
589 | }
590 | }
591 |
592 | // Scene mode
593 | switch (scene_mode) {
594 | case 'Standard':
595 | break;
596 |
597 | case 'Family':
598 | // Set as Default avatar
599 | default_avatar();
600 | // Set as Default avatar for Family attach
601 | default_avatar_for_family_attach();
602 | break;
603 |
604 | case 'Office':
605 | // Set as Default avatar
606 | default_avatar();
607 | // Set as Simplified avatar
608 | simplified_avatar();
609 | // Set as Hidden Signature
610 | hidden_signature();
611 | break;
612 |
613 | default:
614 | break;
615 | }
616 |
617 | // Display the user real online status
618 | function display_user_real_online_status(avatar, id) {
619 | let request = new XMLHttpRequest();
620 | let url = './home.php?mod=spacecp&ac=pm&op=showmsg&touid=' + id + '&inajax=1';
621 | request.open('GET', url);
622 | request.send();
623 | request.addEventListener('readystatechange', function () {
624 | if (this.readyState === 4 && this.status === 200) {
625 | let status = !!~this.response.indexOf('[在线]');
626 | let span = document.createElement('span');
627 | span.className = status ? 'user-status-expression user-status-expression-online' : 'user-status-expression user-status-expression-offline';
628 | span.title = status ? '当前在线' : '当前离线';
629 | avatar.appendChild(span);
630 | }
631 | }, false);
632 | }
633 |
634 | // Show users online status
635 | function show_users_online_status() {
636 | const avatar = document.getElementsByClassName('avatar');
637 | const info = document.getElementsByClassName('i');
638 |
639 | switch (display_users_online_status) {
640 | case 'None':
641 | break;
642 |
643 | case 'Standard':
644 | // Show default users online status
645 | for (let i = 0; i < info.length; i++) {
646 | if (!!~info[i].innerHTML.indexOf('当前在线')) {
647 | let div = document.createElement('div');
648 | div.className = 'user-online-status online gol';
649 | div.title = '当前在线';
650 | avatar[i].appendChild(div);
651 | } else {
652 | let div = document.createElement('div');
653 | div.className = 'user-online-status offline gol';
654 | div.title = '当前离线';
655 | avatar[i].appendChild(div);
656 |
657 | // avatar[i].classList.add('offline');
658 | }
659 | }
660 | break;
661 |
662 | case 'Advanced':
663 | // Show real users online status
664 | let wait = !!~hn.indexOf('bbs.pcbeta.com') ? 3000 : 1111;
665 | for (let i = 0; i < info.length; i++) {
666 | setTimeout(() => {
667 | let html = avatar[i].innerHTML;
668 | let id = /\d/.test(html) ? html.match(/\d+/)[0] : info[i].innerHTML.match(/\d+/)[0];
669 | display_user_real_online_status(avatar[i], id);
670 | }, i * wait + 1000);
671 | }
672 | break;
673 |
674 | default:
675 | break;
676 | }
677 | }
678 |
679 | // Execution as Show users online status
680 | !!member && show_users_online_status();
681 |
682 | // Create Button Group
683 | function create_button_group() {
684 | // Function buttons
685 | const function_buttons = document.createElement('div');
686 | function_buttons.id = 'function-buttons';
687 | function_buttons.className = 'function-buttons';
688 | let function_buttons_package = Check_TypeScript(function_buttons);
689 | switch (true) {
690 | case !!document.getElementsByClassName('xm_header_top_ul').length:
691 | function_buttons_package = document.getElementsByClassName('xm_header_top_ul')[0];
692 | break;
693 |
694 | case !!document.getElementById('extcreditmenu'):
695 | function_buttons_package = document.getElementById('extcreditmenu').parentElement;
696 | break;
697 |
698 | case !!~hn.indexOf('bbs.pcbeta.com') && !!document.getElementsByClassName('hdc').length:
699 | function_buttons_package = document.getElementsByClassName('hdc')[0];
700 | break;
701 |
702 | case !!document.getElementsByClassName('menu').length:
703 | function_buttons_package = document.getElementsByClassName('menu')[0];
704 | break;
705 |
706 | case !!document.getElementById('pt'):
707 | function_buttons_package = document.getElementById('pt');
708 | break;
709 |
710 | default:
711 | break;
712 | }
713 |
714 | if (!!function_buttons_package === false) {
715 | GM_log('No nodes');
716 | return false;
717 | }
718 |
719 | // Open Home button
720 | const open_home_button = document.createElement('button');
721 | open_home_button.className = 'custom-function-button open-home-button';
722 | open_home_button.innerHTML = '论坛大师';
723 | open_home_button.addEventListener('click', function () {
724 | window.open(OPEN_HOME);
725 | }, false);
726 | function_buttons.appendChild(open_home_button);
727 |
728 | // Scene mode button
729 | function scene_mode_mouseenter() {
730 | scene_mode = GM_getValue('SCENE_MODE') || scene_mode;
731 | this.innerHTML = scene_mode_dic[scene_mode];
732 | }
733 | function scene_mode_switch() {
734 | this.disabled = true;
735 | this.classList.add('button-disabled');
736 | setTimeout(() => {
737 | this.disabled = false;
738 | this.classList.remove('button-disabled');
739 | }, 1000);
740 | scene_mode = scene_mode_cutover_dic[scene_mode];
741 | this.innerHTML = scene_mode_dic[scene_mode];
742 | GM_setValue('SCENE_MODE', scene_mode);
743 | let message = '场景模式切换成功,刷新页面即可进入 ' + scene_mode_dic[scene_mode] + '。';
744 | show_dialog(message);
745 | }
746 | const scene_mode_button = document.createElement('button');
747 | scene_mode_button.className = 'custom-function-button scene-mode-button';
748 | scene_mode_button.innerHTML = scene_mode_dic[scene_mode];
749 | scene_mode_button.addEventListener('mouseenter', scene_mode_mouseenter, false);
750 | scene_mode_button.addEventListener('click', scene_mode_switch, false);
751 | function_buttons.appendChild(scene_mode_button);
752 |
753 | // Check in
754 | if (member) {
755 | function check_in() {
756 | const check_in = document.getElementsByClassName('check-in')[0];
757 | check_in.innerHTML = '正在签到';
758 | check_in.disabled = true;
759 | check_in.classList.add('button-disabled');
760 | setTimeout(() => {
761 | let message = '签到完成';
762 | check_in.innerHTML = message;
763 | show_dialog(message)
764 | }, 1234);
765 |
766 | if (!!~hn.indexOf('bbs.pcbeta.com')) {
767 | window.open('//i.pcbeta.com/home.php?mod=task&do=apply&id=149');
768 | return false;
769 | }
770 |
771 | for (let i = 0; i < 10; i++) {
772 | setTimeout(() => {
773 | let request = new XMLHttpRequest();
774 | let space = './home.php?mod=task&do=apply&id='.concat(i);
775 | request.open('get', space);
776 | request.send();
777 | }, i * 100);
778 | }
779 |
780 | if (!!~hn.indexOf('hostloc.com')) {
781 | for (let i = 0; i < 20; i++) {
782 | setTimeout(() => {
783 | let request = new XMLHttpRequest();
784 | let space = '//www.hostloc.com/space-uid-'.concat(Math.ceil(Math.random() * 47000 + 100), '.html');
785 | request.open('get', space);
786 | request.send();
787 | }, i * 100 + 1000);
788 | }
789 | }
790 | }
791 | const check_in_button = document.createElement('button');
792 | check_in_button.className = 'custom-function-button check-in';
793 | check_in_button.innerHTML = '每日签到';
794 | check_in_button.addEventListener('click', check_in, false);
795 | function_buttons.appendChild(check_in_button);
796 | }
797 |
798 | // Group button
799 | const group_button = document.createElement('button');
800 | group_button.className = 'custom-function-button group-button';
801 | group_button.innerHTML = '群组聊天';
802 | group_button.addEventListener('click', function () {
803 | window.open('https://t.me/joinchat/Bc2EjlPZ0aOwiA-Gn73xKA');
804 | }, false);
805 | function_buttons.appendChild(group_button);
806 |
807 | function_buttons_package.appendChild(function_buttons);
808 | }
809 |
810 | // Execution as Create Button Group
811 | create_button_group();
812 |
813 | // Click the main building reply to skip to the bottom of the page
814 | function skip_bottom(params) {
815 | try {
816 | params.removeAttribute('onclick');
817 | params.addEventListener('click', function (event) {
818 | params.href = 'javascript:;';
819 | window.scrollTo(0, 54321);
820 | let fastPostMessage = document.getElementById('fastpostmessage');
821 | !!fastPostMessage && fastPostMessage.focus();
822 | },
823 | Check_TypeScript(params));
824 | } catch (error) {
825 | GM_log('You don\'t have permission to post content.');
826 | }
827 | }
828 | if (document.getElementsByClassName('prev').length === 0) {
829 | const locked = member && document.getElementsByClassName('locked');
830 | if (typeof locked === 'object' && !!locked.length) {
831 | for (let i = 0; i < locked.length; i++) {
832 | skip_bottom(locked[i].getElementsByTagName('a')[0]);
833 | }
834 | }
835 | const fastre = member && document.getElementsByClassName('fastre')[0];
836 | !!fastre && skip_bottom(fastre);
837 | }
838 |
839 | const attachContent = !!~hn.indexOf('hostloc.com') ? ''.repeat(10) : '\n\n[url=' + OPEN_HOME + '][img]' + window.location.protocol + '//herder.cdn.bcebos.com/Discuz!/images/dot.gif?hn=' + hn + '[/img][/url]';
840 |
841 | const fastPostMessage = document.getElementById('fastpostmessage');
842 |
843 | function editor_content() {
844 | let fastPostMessageContent = fastPostMessage.value;
845 | if (fastPostMessageContent && fastPostMessageContent.length < 20) {
846 | fastPostMessageContent = fastPostMessageContent.trim();
847 | fastPostMessage.style.opacity = '0';
848 | fastPostMessage.value = fastPostMessageContent.concat(attachContent);
849 | setTimeout(() => {
850 | fastPostMessage.value = fastPostMessageContent;
851 | fastPostMessage.style.opacity = '1';
852 | }, 100);
853 | }
854 | }
855 |
856 | !!fastPostMessage && fastPostMessage.removeAttribute('onkeydown');
857 |
858 | !!fastPostMessage && fastPostMessage.addEventListener('keydown', function (event) {
859 | if (event.ctrlKey && event.which === 13) {
860 | editor_content();
861 | seditor_ctlent(event, 'fastpostvalidate($(\'fastpostform\'))');
862 | }
863 | if (event.altKey && event.which === 83) {
864 | editor_content();
865 | seditor_ctlent(event, 'fastpostvalidate($(\'fastpostform\'))');
866 | }
867 | }, false);
868 |
869 | const fastPostSubmit = document.getElementById('fastpostsubmit');
870 | !!fastPostSubmit && fastPostSubmit.addEventListener('click', editor_content, false);
871 |
872 |
873 | // Automatically expand all posts
874 | // if (typeof display_blocked_post === 'function') display_blocked_post();
875 |
876 | // Compatibility settings
877 |
878 | // Cascading Style Sheets・www.hostloc.com
879 | !!~hn.indexOf('hostloc.com') && GM_addStyle(`
880 | #hiddenpoststip {
881 | padding: 0;
882 | }
883 |
884 | #hiddenpoststip a {
885 | height: 32px;
886 | line-height: 32px;
887 | font-size: 16px;
888 | }
889 |
890 | #hiddenpoststip a:hover {
891 | color: #f33;
892 | }
893 |
894 | #hiddenpoststip a::before {
895 | padding-right: 8px;
896 | content: "🌜";
897 | }
898 | #hiddenpoststip a::after {
899 | padding-left: 8px;
900 | content: "🌛";
901 | }
902 | `);
903 |
904 | // Cascading Style Sheets・bbs.pcbeta.com
905 | if (!!~hn.indexOf('bbs.pcbeta.com')) {
906 | GM_addStyle(`
907 | #wp > div,
908 | #nv_forum > span,
909 | .pls .tip,
910 | ignore_js_op .tip {
911 | display: none;
912 | }
913 |
914 | #wp > div:first-child,
915 | #wp > div.cl,
916 | #wp > div.wp,
917 | #nv_forum #scrolltop {
918 | display: block;
919 | }
920 |
921 | .pls .avatar {
922 | overflow: unset;
923 | }
924 |
925 | .pls .m img {
926 | margin-left: 2px;
927 | padding: 0;
928 | width: 120px;
929 | height: 120px;
930 | object-fit: contain;
931 | background: #fff;
932 | border: none;
933 | border-radius: 50%;
934 | box-shadow: none;
935 | }
936 |
937 | .pls .m img:hover {
938 | border-radius: 0;
939 | box-shadow: none;
940 | }
941 |
942 | .pb_pls .avatar img {
943 | border-radius: 50%;
944 | background: none;
945 | }
946 |
947 | .pb_pls .avatar img:hover {
948 | border-radius: 0;
949 | }
950 |
951 | .hdc {
952 | position: relative;
953 | }
954 |
955 | .function-buttons {
956 | position: absolute;
957 | right: 0;
958 | padding: 2px 8px 4px 0;
959 | border-radius: 4px;
960 | }
961 |
962 | .custom-function-button {
963 | color: #333;
964 | background-color: #fff;
965 | box-shadow: 0 1px 2px #bbb;
966 | }
967 |
968 | .custom-function-button:hover {
969 | color: #1985db;
970 | box-shadow: 0 2px 4px #bbb;
971 | }
972 |
973 | .wp .pgs {
974 | -moz-user-select: none;
975 | -ms-user-select: none;
976 | -webkit-user-select: none;
977 | user-select: none;
978 | }
979 | `);
980 |
981 | if (member === false) {
982 | GM_addStyle(`
983 | .function-buttons {
984 | padding-top: 4px;
985 | padding-right: 0;
986 | }
987 | `);
988 | }
989 | }
990 |
991 | // Cascading Style Sheets・bbs.fobshanghai.com
992 | !!~hn.indexOf('bbs.fobshanghai.com') && GM_addStyle(`
993 | #function-buttons.function-buttons {
994 | padding-top: 48px !important;
995 | }
996 |
997 | .maintable > .spaceborder > table:first-child,
998 | .line div,
999 | .t_infoline .line {
1000 | display: none;
1001 | }
1002 |
1003 | #aaaa {
1004 | display: block;
1005 | }
1006 |
1007 | .mainheader {
1008 | -moz-user-select: none;
1009 | -ms-user-select: none;
1010 | -webkit-user-select: none;
1011 | user-select: none;
1012 | }
1013 | `);
1014 |
1015 | // Cascading Style Sheets・bbs.huorong.cn
1016 | !!~hn.indexOf('bbs.huorong.cn') && GM_addStyle(`
1017 | .function-buttons {
1018 | margin-top: 10px;
1019 | padding-right: 6px;
1020 | }
1021 |
1022 | .custom-function-button {
1023 | background-color: #fff;
1024 | }
1025 | `);
1026 |
1027 | // Cascading Style Sheets・bbs.360.cn
1028 | !!~hn.indexOf('bbs.360.cn') && GM_addStyle(`
1029 | .custom-function-button {
1030 | margin-top: -20px;
1031 | padding: 0 8px;
1032 | background-color: #f1f2f6;
1033 | }
1034 |
1035 | .custom-function-button:hover {
1036 | color: #f33;
1037 | background-color: #fff;
1038 | }
1039 |
1040 | .apk-download,
1041 | .apk-download-pannel,
1042 | .pls .tip,
1043 | ignore_js_op .tip {
1044 | display: none;
1045 | }
1046 |
1047 | .pls .avatar img {
1048 | padding: 0;
1049 | background: none;
1050 | width: 54px;
1051 | height: 54px;
1052 | border: none;
1053 | border-radius: 50% !important;
1054 | box-shadow: 0 0 2px #bbb !important;
1055 | }
1056 |
1057 | .pls .avatar img:hover {
1058 | border-radius: 0 !important;
1059 | }
1060 | `);
1061 | })();
1062 |
--------------------------------------------------------------------------------