Skip to content

Commit 255b6f0

Browse files
committed
修复 偶尔会无法滚动到隐藏内容的问题;优化 规范代码
1 parent 8e75f91 commit 255b6f0

1 file changed

Lines changed: 7 additions & 9 deletions

File tree

Zhiyoo-Enhanced.user.js

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// ==UserScript==
22
// @name 智友邦论坛增强
3-
// @version 1.1.6
3+
// @version 1.1.7
44
// @author X.I.U
55
// @description 自动签到、自动回复、自动无缝翻页、清理置顶帖子、简化附件兑换/下载、清理帖子标题〖XXX〗【XXX】文字
66
// @icon http://bbs.zhiyoo.net/favicon.ico
@@ -210,9 +210,9 @@
210210
writeReply();
211211
// 如果使用了我的 [智友邦美化] 脚本,则定位至底部,反之定位至隐藏内容区域
212212
if (document.getElementById("fastpostmessage").offsetParent == null){
213-
setTimeout(`window.scrollTo(0,99999999)`, 500);
213+
setTimeout(function(){window.scrollTo(0,99999999)}, 1000);
214214
}else{
215-
setTimeout(`window.scrollTo(0,document.querySelector('.showhide').offsetTop)`, 500);
215+
setTimeout(function(){window.scrollTo(0,document.querySelector('.showhide').offsetTop)}, 1000);
216216
}
217217
}
218218
}
@@ -226,9 +226,9 @@
226226
// 随机写入回复内容
227227
textarea.value = textarea.value + replyList[Math.floor((Math.random()*replyList.length))] + replyList[Math.floor((Math.random()*replyList.length))];
228228
//console.log(`${textarea.value}`)
229-
var fastpostsubmit = document.getElementById("fastpostsubmit");
229+
let fastpostsubmit = document.getElementById("fastpostsubmit");
230230
if (fastpostsubmit){
231-
setTimeout(`fastpostsubmit.click()`, 200);
231+
setTimeout(function(){fastpostsubmit.click()}, 200);
232232
}
233233
}
234234
}
@@ -242,11 +242,9 @@
242242
if (document.getElementsByClassName("showhide").length > 0){
243243
// 如果使用了我的 [智友邦美化] 脚本,则定位至底部,反之定位至隐藏内容区域
244244
if (document.getElementById("fastpostmessage").offsetParent == null){
245-
setTimeout(`window.scrollTo(0,99999999)`, 500);
246-
console.log("111")
245+
setTimeout(function(){window.scrollTo(0,99999999)}, 1000);
247246
}else{
248-
setTimeout(`window.scrollTo(0,document.querySelector('.showhide').offsetTop)`, 500);
249-
console.log("222")
247+
setTimeout(function(){window.scrollTo(0,document.querySelector('.showhide').offsetTop)}, 1000);
250248
}
251249
}
252250
}

0 commit comments

Comments
 (0)