|
1 | 1 | // ==UserScript== |
2 | 2 | // @name 智友邦论坛增强 |
3 | | -// @version 1.0.3 |
| 3 | +// @version 1.0.4 |
4 | 4 | // @author X.I.U |
5 | 5 | // @description 自动签到、自动回复、自动无缝翻页、自动清理置顶帖子等 |
6 | 6 | // @icon http://bbs.zhiyoo.net/favicon.ico |
|
36 | 36 | FORUMDISPLAY: DBSite.forumdisplay.SiteTypeID // 各板块帖子列表 |
37 | 37 | }; |
38 | 38 |
|
| 39 | + var patt_thread = /\/thread-\d+-\d+\-\d+.html/; // 匹配 /thread-XXX-X-X.html 帖子正则表达式 |
39 | 40 |
|
40 | 41 | if (location.pathname === '/plugin.php'){ |
41 | 42 | switch(getQueryVariable("id")) |
|
47 | 48 | attachmentBack(); // 立即返回帖子 |
48 | 49 | break; |
49 | 50 | } |
50 | | - /*if (location.href === 'http://bbs.zhiyoo.net/plugin.php?id=dsu_paulsign:sign'){ |
51 | | - qiandao(); // 自动签到 |
52 | | - }*/ |
53 | 51 | } |
54 | 52 | else if(location.pathname === '/forum.php'){ |
55 | 53 | switch(getQueryVariable("mod")) |
56 | 54 | { |
57 | 55 | case 'viewthread': // 浏览帖子内容 |
58 | | - autoReply(); // 自动回复,回复过就定位到底部(隐藏内容区域) |
| 56 | + showHide(); // 先看看是否有隐藏内容,如果已显示则定位到隐藏内容区域,如果没有隐藏内容,则啥都不干 |
| 57 | + autoReply(); // 自动回复(有隐藏内容才会回复),回复过就定位到底部(隐藏内容区域) |
59 | 58 | break; |
60 | 59 | case 'forumdisplay': // 浏览帖子列表 |
61 | 60 | curSite = DBSite.forumdisplay; |
|
65 | 64 | break; |
66 | 65 | } |
67 | 66 | } |
| 67 | + else if (patt_thread.test(location.pathname)){ // 对于 /thread-XXX-X-X.html 这种帖子页面也和上面一样 |
| 68 | + showHide(); |
| 69 | + autoReply(); |
| 70 | + } |
| 71 | + |
68 | 72 |
|
69 | 73 | // 自动翻页 |
70 | 74 | function pageLoading() { |
|
95 | 99 |
|
96 | 100 | // 自动回复 |
97 | 101 | function autoReply(){ |
| 102 | + // 存在隐藏内容,自动回复 |
98 | 103 | if (document.getElementsByClassName("locked").length > 0){ |
99 | 104 | document.querySelector('#saya_fastreply_div div').click(); |
100 | 105 | setTimeout(`document.getElementById('fastpostsubmit').click()`, 200); |
| 106 | + setTimeout(`window.scrollTo(0,99999999)`, 1000); |
| 107 | + } |
| 108 | + } |
| 109 | + |
| 110 | + |
| 111 | + // 定位到隐藏内容区域 |
| 112 | + function showHide(){ |
| 113 | + // 如果已显示隐藏内容,则定位到隐藏内容区域 |
| 114 | + // 如果没有发现已显示隐藏内容,就不定位了 |
| 115 | + if (document.getElementsByClassName("showhide").length > 0){ |
| 116 | + setTimeout(`window.scrollTo(0,99999999)`, 1000); |
| 117 | + //setTimeout(`location.hash='#footer'`, 1000); |
101 | 118 | } |
102 | | - setTimeout(`window.scrollTo(0,99999999)`, 1000); |
103 | | - //setTimeout(`location.hash='#footer'`, 1000); |
104 | 119 | } |
105 | 120 |
|
106 | 121 |
|
|
0 commit comments