From e2340d4433fdd8b4a05af782e89dcd6285f9b9ef Mon Sep 17 00:00:00 2001 From: liuweiqing Date: Mon, 2 Sep 2024 16:16:23 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=87=AA=E5=8A=A8=E7=82=B9=E8=B5=9E?= =?UTF-8?q?=E7=89=B9=E5=AE=9A=E7=94=A8=E6=88=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index_specific_user.js | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/index_specific_user.js b/index_specific_user.js index f0d08d0b..50a3cdf0 100644 --- a/index_specific_user.js +++ b/index_specific_user.js @@ -56,8 +56,7 @@ localStorage.setItem("autoLikeEnabled", "false"); //默认关闭自动点赞 console.log("执行了初始数据更新操作"); } - let scrollInterval = null; - let checkScrollTimeout = null; + function getLatestTopic() { let lastOffset = Number(localStorage.getItem("lastOffset")) || 0; @@ -140,6 +139,8 @@ // 使用 post_id 生成 URL 并导航 window.location.href = `${BASE_URL}/t/topic/${post.topic_id}/${post.post_number}`; + } else { + console.error("未能获取到新的帖子数据。"); } } @@ -209,8 +210,10 @@ ); if (localStorage.getItem("read") === "true") { console.log("点赞开始"); - openSpecificUserPost(); likeSpecificPost(); + setTimeout(() => { + openSpecificUserPost(); + }, 1000); } }); @@ -265,14 +268,6 @@ localStorage.setItem("read", newReadState.toString()); button.textContent = newReadState ? "停止阅读" : "开始阅读"; if (!newReadState) { - if (scrollInterval !== null) { - clearInterval(scrollInterval); - scrollInterval = null; - } - if (checkScrollTimeout !== null) { - clearTimeout(checkScrollTimeout); - checkScrollTimeout = null; - } localStorage.removeItem("navigatingToNextTopic"); } else { if (BASE_URL == "https://linux.do") { @@ -301,7 +296,7 @@ saveUserButton.textContent = "保存用户ID"; saveUserButton.style.position = "fixed"; saveUserButton.style.bottom = "50px"; - saveUserButton.style.left = "150px"; + saveUserButton.style.left = "10px"; saveUserButton.style.zIndex = "1000"; saveUserButton.style.backgroundColor = "#f0f0f0"; saveUserButton.style.color = "#000";