|
1 | 1 | // ==UserScript== |
2 | 2 | // @name 智友邦论坛增强 |
3 | | -// @version 1.1.7 |
| 3 | +// @version 1.1.8 |
4 | 4 | // @author X.I.U |
5 | | -// @description 自动签到、自动回复、自动无缝翻页、清理置顶帖子、简化附件兑换/下载、清理帖子标题〖XXX〗【XXX】文字 |
| 5 | +// @description 自动签到、自动回复、自动无缝翻页、回到顶部(右键点击两侧空白处)、清理置顶帖子、简化附件兑换/下载、清理帖子标题〖XXX〗【XXX】文字 |
6 | 6 | // @icon http://bbs.zhiyoo.net/favicon.ico |
7 | 7 | // @match *://bbs.zhiyoo.net/* |
8 | 8 | // @match *://www.zhiyoo.net/search.php* |
|
20 | 20 |
|
21 | 21 | (function() { |
22 | 22 | var menu_ALL = [ |
| 23 | + ['menu_autoReply', '自动回复', '自动回复', true], |
| 24 | + ['menu_pageLoading', '自动无缝翻页', '自动无缝翻页', true], |
| 25 | + ['menu_backToTop', '回到顶部(右键点击两侧空白处)', '回到顶部', true], |
| 26 | + ['menu_cleanTopPost', '清理置顶帖子', '清理置顶帖子', true], |
23 | 27 | ['menu_cleanPostTitle', '清理帖子标题开头〖〗【】文字', '清理帖子标题开头〖〗【】文字', true], |
24 | 28 | ['menu_qianDaoRedirectURL', '当前页面设为签到后重定向地址', '已设置当前页面为签到后重定向地址', 'http://bbs.zhiyoo.net/forum.php?mod=forumdisplay&fid=42&filter=author&orderby=dateline'] |
25 | 29 | ], menu_ID = []; |
|
166 | 170 | pageLoading(); // 自动无缝翻页 |
167 | 171 | break; |
168 | 172 | } |
| 173 | + backToTop(); // 回到顶部(右键点击两侧空白处) |
169 | 174 | }else if(location.pathname === '/search.php'){ |
170 | 175 | curSite = DBSite.search; // 搜索结果列表页(自动翻页) |
171 | 176 | pageLoading(); // 自动无缝翻页 |
|
184 | 189 | } |
185 | 190 |
|
186 | 191 |
|
187 | | - // 自动翻页 |
188 | | - function pageLoading() { |
189 | | - if (curSite.SiteTypeID > 0){ |
190 | | - windowScroll(function (direction, e) { |
191 | | - if (direction === "down") { // 下滑才准备翻页 |
192 | | - let scrollTop = document.documentElement.scrollTop || window.pageYOffset || document.body.scrollTop; |
193 | | - let scrollDelta = 666; |
194 | | - if (document.documentElement.scrollHeight <= document.documentElement.clientHeight + scrollTop + scrollDelta) { |
195 | | - ShowPager.loadMorePage(); |
196 | | - } |
197 | | - } |
198 | | - }); |
199 | | - } |
200 | | - } |
201 | | - |
202 | | - |
203 | 192 | // 自动签到 |
204 | 193 | function qiandao(){ |
205 | 194 | if (loginStatus){ |
206 | | - if(document.getElementById("yl")) |
| 195 | + if(document.getElementById('yl')) |
207 | 196 | { |
208 | | - document.querySelector('#yl').click(); |
209 | | - document.querySelector('.tr3.tac div a').click(); |
| 197 | + document.getElementById('yl').click(); |
| 198 | + document.querySelector('td.tr3.tac div a').click(); |
210 | 199 | } |
211 | 200 | setTimeout(location.href=menu_value('menu_qianDaoRedirectURL'), 2000); // 跳转到指定URL |
212 | 201 | } |
|
215 | 204 |
|
216 | 205 | // 自动回复 |
217 | 206 | function autoReply(){ |
| 207 | + if (!menu_value('menu_autoReply')) return |
218 | 208 | if (loginStatus){ |
219 | 209 | // 存在隐藏内容,自动回复 |
220 | 210 | if (document.getElementsByClassName("showhide").length == 0){ |
|
262 | 252 | } |
263 | 253 |
|
264 | 254 |
|
| 255 | + // 自动无缝翻页 |
| 256 | + function pageLoading() { |
| 257 | + if (!menu_value('menu_pageLoading')) return |
| 258 | + if (curSite.SiteTypeID > 0){ |
| 259 | + windowScroll(function (direction, e) { |
| 260 | + if (direction === "down") { // 下滑才准备翻页 |
| 261 | + let scrollTop = document.documentElement.scrollTop || window.pageYOffset || document.body.scrollTop; |
| 262 | + let scrollDelta = 666; |
| 263 | + if (document.documentElement.scrollHeight <= document.documentElement.clientHeight + scrollTop + scrollDelta) { |
| 264 | + ShowPager.loadMorePage(); |
| 265 | + } |
| 266 | + } |
| 267 | + }); |
| 268 | + } |
| 269 | + } |
| 270 | + |
| 271 | + |
| 272 | + // 回到顶部(右键点击空白处) |
| 273 | + function backToTop() { |
| 274 | + if (!menu_value('menu_backToTop')) return |
| 275 | + document.getElementById("nv_forum").oncontextmenu = function(event){ |
| 276 | + if (event.target==this) { |
| 277 | + event.preventDefault(); |
| 278 | + window.scrollTo(0,0) |
| 279 | + } |
| 280 | + } |
| 281 | + } |
| 282 | + |
| 283 | + |
| 284 | + // 清理置顶帖子 |
| 285 | + function cleanTop(){ |
| 286 | + if (!menu_value('menu_cleanTopPost')) return |
| 287 | + let showhide = document.querySelectorAll("a.showhide.y"); |
| 288 | + if (showhide.length > 0){ |
| 289 | + showhide.forEach(el=>el.click()); |
| 290 | + } |
| 291 | + } |
| 292 | + |
| 293 | + |
265 | 294 | // 兑换附件后立即返回 |
266 | 295 | function attachmentBack() { |
267 | 296 | let attachmentback = document.querySelector('#messagetext p.alert_btnleft a'); |
|
295 | 324 | } |
296 | 325 |
|
297 | 326 |
|
298 | | - // 清理置顶帖子 |
299 | | - function cleanTop(){ |
300 | | - let showhide = document.querySelectorAll("a.showhide.y"); |
301 | | - if (showhide.length > 0){ |
302 | | - showhide.forEach(el=>el.click()); |
303 | | - } |
304 | | - } |
305 | | - |
306 | | - |
307 | 327 | // 清理帖子列表中帖子标题开头的〖XXX〗【XXX】文字 |
308 | 328 | function cleanPostTitle(){ |
309 | | - if (menu_value('menu_cleanPostTitle')){ |
310 | | - let cleanposttitle = document.querySelectorAll("a.s.xst"); |
311 | | - if (cleanposttitle.length > 0){ |
312 | | - for(let num = postNum;num<cleanposttitle.length;num++){ |
313 | | - cleanposttitle[num].innerText = cleanposttitle[num].innerText.replace(patt_posttitle, ``); |
314 | | - postNum += 1; |
315 | | - } |
| 329 | + if (!menu_value('menu_cleanPostTitle')) return |
| 330 | + let cleanposttitle = document.querySelectorAll("a.s.xst"); |
| 331 | + if (cleanposttitle.length > 0){ |
| 332 | + for(let num = postNum;num<cleanposttitle.length;num++){ |
| 333 | + cleanposttitle[num].innerText = cleanposttitle[num].innerText.replace(patt_posttitle, ``); |
| 334 | + postNum += 1; |
316 | 335 | } |
317 | 336 | } |
318 | 337 | } |
|
0 commit comments