Skip to content

Commit 6887870

Browse files
committed
新增 支持 /thread-XXX-X-X.html 这类帖子自动回复。优化 帖子不含有隐藏内容时,将不会定位至底部(隐藏内容)。
1 parent 17b0573 commit 6887870

1 file changed

Lines changed: 22 additions & 7 deletions

File tree

Zhiyoo-Enhanced.user.js

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// ==UserScript==
22
// @name 智友邦论坛增强
3-
// @version 1.0.3
3+
// @version 1.0.4
44
// @author X.I.U
55
// @description 自动签到、自动回复、自动无缝翻页、自动清理置顶帖子等
66
// @icon http://bbs.zhiyoo.net/favicon.ico
@@ -36,6 +36,7 @@
3636
FORUMDISPLAY: DBSite.forumdisplay.SiteTypeID // 各板块帖子列表
3737
};
3838

39+
var patt_thread = /\/thread-\d+-\d+\-\d+.html/; // 匹配 /thread-XXX-X-X.html 帖子正则表达式
3940

4041
if (location.pathname === '/plugin.php'){
4142
switch(getQueryVariable("id"))
@@ -47,15 +48,13 @@
4748
attachmentBack(); // 立即返回帖子
4849
break;
4950
}
50-
/*if (location.href === 'http://bbs.zhiyoo.net/plugin.php?id=dsu_paulsign:sign'){
51-
qiandao(); // 自动签到
52-
}*/
5351
}
5452
else if(location.pathname === '/forum.php'){
5553
switch(getQueryVariable("mod"))
5654
{
5755
case 'viewthread': // 浏览帖子内容
58-
autoReply(); // 自动回复,回复过就定位到底部(隐藏内容区域)
56+
showHide(); // 先看看是否有隐藏内容,如果已显示则定位到隐藏内容区域,如果没有隐藏内容,则啥都不干
57+
autoReply(); // 自动回复(有隐藏内容才会回复),回复过就定位到底部(隐藏内容区域)
5958
break;
6059
case 'forumdisplay': // 浏览帖子列表
6160
curSite = DBSite.forumdisplay;
@@ -65,6 +64,11 @@
6564
break;
6665
}
6766
}
67+
else if (patt_thread.test(location.pathname)){ // 对于 /thread-XXX-X-X.html 这种帖子页面也和上面一样
68+
showHide();
69+
autoReply();
70+
}
71+
6872

6973
// 自动翻页
7074
function pageLoading() {
@@ -95,12 +99,23 @@
9599

96100
// 自动回复
97101
function autoReply(){
102+
// 存在隐藏内容,自动回复
98103
if (document.getElementsByClassName("locked").length > 0){
99104
document.querySelector('#saya_fastreply_div div').click();
100105
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);
101118
}
102-
setTimeout(`window.scrollTo(0,99999999)`, 1000);
103-
//setTimeout(`location.hash='#footer'`, 1000);
104119
}
105120

106121

0 commit comments

Comments
 (0)