|
1 | 1 | // ==UserScript== |
2 | 2 | // @name V2EX 增强 |
3 | | -// @version 1.0.3 |
| 3 | +// @version 1.0.4 |
4 | 4 | // @author X.I.U |
5 | | -// @description 自动签到、自动无缝翻页、回到顶部(右键点击两侧空白处) |
| 5 | +// @description 自动签到、自动无缝翻页、回到顶部(右键点击两侧空白处)、标签页伪装为 Github(摸鱼) |
6 | 6 | // @match *://v2ex.com/* |
7 | 7 | // @match *://*.v2ex.com/* |
8 | 8 | // @icon https://www.v2ex.com/static/favicon.ico |
|
23 | 23 | ['menu_autoClockIn', '自动签到', '自动签到', true], |
24 | 24 | ['menu_pageLoading', '自动无缝翻页', '自动无缝翻页', true], |
25 | 25 | ['menu_pageLoading_reply', '帖子内自动翻页', '帖子内自动翻页', false], |
26 | | - ['menu_backToTop', '回到顶部(右键点击两侧空白处)', '回到顶部', true] |
| 26 | + ['menu_backToTop', '回到顶部(右键点击两侧空白处)', '回到顶部', true], |
| 27 | + ['menu_fish', '标签页伪装为 Github(摸鱼)', '标签页伪装为 Github', false] |
27 | 28 | ], menu_ID = []; |
28 | 29 | for (let i=0;i<menu_ALL.length;i++){ // 如果读取到的值为 null 就写入默认值 |
29 | 30 | if (GM_getValue(menu_ALL[i][0]) == null){GM_setValue(menu_ALL[i][0], menu_ALL[i][3])}; |
|
160 | 161 | } |
161 | 162 |
|
162 | 163 | curSite.pageUrl = ""; // 下一页URL |
| 164 | + if(menu_value('menu_fish'))fish() // 标签页伪装为 Github(摸鱼) |
163 | 165 | if(menu_value('menu_autoClockIn'))setTimeout(qianDao, 1000) // 自动签到(后台),延迟 1 秒执行是为了兼容 [V2ex Plus] 扩展 |
164 | 166 | if(menu_value('menu_pageLoading'))pageLoading(); // 自动翻页(无缝) |
165 | 167 | if(menu_value('menu_backToTop'))backToTop(); // 回到顶部(右键点击空白处) |
|
204 | 206 | } |
205 | 207 |
|
206 | 208 |
|
| 209 | + // 标签页伪装为 Github(摸鱼) |
| 210 | + function fish() { |
| 211 | + window.document.title = 'GitHub' |
| 212 | + if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { |
| 213 | + document.querySelector("link[rel*='shortcut icon']").href = 'https://github.githubassets.com/favicons/favicon-dark.png' |
| 214 | + } else { |
| 215 | + document.querySelector("link[rel*='shortcut icon']").href = 'https://github.githubassets.com/favicons/favicon.png' |
| 216 | + } |
| 217 | + } |
| 218 | + |
| 219 | + |
207 | 220 | // 自动无缝翻页 |
208 | 221 | function pageLoading() { |
209 | 222 | if (curSite.SiteTypeID > 0){ |
|
0 commit comments