|
1 | 1 | // ==UserScript== |
2 | 2 | // @name 全球主机交流论坛增强 |
3 | | -// @version 1.0.8 |
| 3 | +// @version 1.0.9 |
4 | 4 | // @author X.I.U |
5 | | -// @description 自动无缝翻页、自动显示帖子内隐藏回复、回到顶部(右键点击两侧空白处) |
| 5 | +// @description 自动无缝翻页、自动显示帖子内隐藏回复、自动屏蔽阅读权限 255 的帖子、回到顶部(右键点击两侧空白处) |
6 | 6 | // @match *://hostloc.com/* |
7 | 7 | // @icon https://www.hostloc.com/favicon.ico |
8 | 8 | // @grant GM_xmlhttpRequest |
|
21 | 21 | var menu_ALL = [ |
22 | 22 | ['menu_thread_pageLoading', '帖子内自动翻页', '帖子内自动翻页', true], |
23 | 23 | ['menu_showhide', '自动显示隐藏回复', '自动显示隐藏回复', true], |
| 24 | + ['menu_delate255', '自动屏蔽阅读权限 255 的帖子', '自动屏蔽阅读权限 255 的帖子', true], |
24 | 25 | ['menu_backToTop', '回到顶部(右键点击两侧空白处)', '回到顶部', true] |
25 | 26 | ], menu_ID = []; |
26 | 27 | for (let i=0;i<menu_ALL.length;i++){ // 如果读取到的值为 null 就写入默认值 |
|
124 | 125 | }else if (patt_forum.test(location.pathname) || location.search.indexOf('mod=forumdisplay') > -1){ |
125 | 126 | // 各板块帖子列表 |
126 | 127 | curSite = DBSite.forum; |
| 128 | + if (menu_value('menu_delate255')) delate255(); // 屏蔽阅读权限 255 的帖子 |
127 | 129 | }else if (patt_guide.test(location.search)){ |
128 | 130 | // 导读帖子列表 |
129 | 131 | curSite = DBSite.guide; |
|
143 | 145 | windowScroll(function (direction, e) { |
144 | 146 | if (direction === "down") { // 下滑才准备翻页 |
145 | 147 | let scrollTop = document.documentElement.scrollTop || window.pageYOffset || document.body.scrollTop; |
146 | | - let scrollDelta = 766; |
147 | | - if (document.documentElement.scrollHeight <= document.documentElement.clientHeight + scrollTop + scrollDelta) { |
| 148 | + if (document.documentElement.scrollHeight <= document.documentElement.clientHeight + scrollTop + 999) { |
148 | 149 | if (curSite.SiteTypeID === SiteType.FORUM) { // 如果是各版块帖子列表则直接点下一页就行了 |
149 | 150 | let autopbn = document.querySelector('#autopbn'); |
150 | | - if (autopbn && autopbn.innerText == "下一页 »"){ // 如果已经在加载中了,就忽略 |
| 151 | + if (autopbn && autopbn.innerText === "下一页 »"){ // 如果已经在加载中了,就忽略 |
151 | 152 | autopbn.click(); |
| 153 | + if (menu_value('menu_delate255')) { |
| 154 | + let timer = setInterval(function(){ |
| 155 | + if (document.querySelector('#autopbn').innerText === "下一页 »") { |
| 156 | + delate255(); |
| 157 | + clearInterval(timer); |
| 158 | + } |
| 159 | + }, 10); |
| 160 | + } |
152 | 161 | } |
153 | 162 | }else{ |
154 | 163 | ShowPager.loadMorePage(); |
|
190 | 199 | } |
191 | 200 |
|
192 | 201 |
|
| 202 | + // 屏蔽阅读权限 255 的帖子 |
| 203 | + function delate255() { |
| 204 | + if (patt_forum.test(location.pathname) || location.search.indexOf('mod=forumdisplay') > -1){ |
| 205 | + let tbody = document.querySelectorAll('tbody[id^="normalthread_"] .common .xw1'); |
| 206 | + Array.from(tbody).forEach(function (_this) { |
| 207 | + if (_this.innerText === '255') { |
| 208 | + _this.parentNode.parentNode.parentNode.remove(); |
| 209 | + } |
| 210 | + }) |
| 211 | + } |
| 212 | + } |
| 213 | + |
| 214 | + |
193 | 215 | // 滚动条事件 |
194 | 216 | function windowScroll(fn1) { |
195 | 217 | var beforeScrollTop = document.documentElement.scrollTop, |
|
0 commit comments