修复 偶尔会无法滚动到隐藏内容的问题;优化 规范代码

This commit is contained in:
xiu2
2021-03-30 10:47:12 +08:00
parent 8e75f916b1
commit 255b6f00c0
+7 -9
View File
@@ -1,6 +1,6 @@
// ==UserScript==
// @name 智友邦论坛增强
// @version 1.1.6
// @version 1.1.7
// @author X.I.U
// @description 自动签到、自动回复、自动无缝翻页、清理置顶帖子、简化附件兑换/下载、清理帖子标题〖XXX〗【XXX】文字
// @icon http://bbs.zhiyoo.net/favicon.ico
@@ -210,9 +210,9 @@
writeReply();
// 如果使用了我的 [智友邦美化] 脚本,则定位至底部,反之定位至隐藏内容区域
if (document.getElementById("fastpostmessage").offsetParent == null){
setTimeout(`window.scrollTo(0,99999999)`, 500);
setTimeout(function(){window.scrollTo(0,99999999)}, 1000);
}else{
setTimeout(`window.scrollTo(0,document.querySelector('.showhide').offsetTop)`, 500);
setTimeout(function(){window.scrollTo(0,document.querySelector('.showhide').offsetTop)}, 1000);
}
}
}
@@ -226,9 +226,9 @@
// 随机写入回复内容
textarea.value = textarea.value + replyList[Math.floor((Math.random()*replyList.length))] + replyList[Math.floor((Math.random()*replyList.length))];
//console.log(`${textarea.value}`)
var fastpostsubmit = document.getElementById("fastpostsubmit");
let fastpostsubmit = document.getElementById("fastpostsubmit");
if (fastpostsubmit){
setTimeout(`fastpostsubmit.click()`, 200);
setTimeout(function(){fastpostsubmit.click()}, 200);
}
}
}
@@ -242,11 +242,9 @@
if (document.getElementsByClassName("showhide").length > 0){
// 如果使用了我的 [智友邦美化] 脚本,则定位至底部,反之定位至隐藏内容区域
if (document.getElementById("fastpostmessage").offsetParent == null){
setTimeout(`window.scrollTo(0,99999999)`, 500);
console.log("111")
setTimeout(function(){window.scrollTo(0,99999999)}, 1000);
}else{
setTimeout(`window.scrollTo(0,document.querySelector('.showhide').offsetTop)`, 500);
console.log("222")
setTimeout(function(){window.scrollTo(0,document.querySelector('.showhide').offsetTop)}, 1000);
}
}
}