您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Add links to next and previous posts to each post.
当前为
// ==UserScript== // @name alternatehistory.com: Links to Next and Previous Posts. // @namespace https://gf.qytechs.cn/en/users/163551-vannius // @version 1.0 // @description Add links to next and previous posts to each post. // @author Vannius // @match https://www.alternatehistory.com/forum/threads/* // @grant none // ==/UserScript== (function() { // Get hash links from divTags and store in hashLinks const divTags = document.getElementsByClassName('messageBarNumber'); const hashLinks = Array.from(divTags).map((element) => element.children[0].href); // Very first post of thread's divTag.children[0].href don't have #. if (window.location.href.split('/')[6] === '') hashLinks[0] += '#' + divTags[0].parentNode.parentNode.id; for (let i = 0; i<divTags.length; i++){ // Add a link to next post if (i != divTags.length - 1){ const nextPost = document.createElement('a'); nextPost.title = "Next post"; nextPost.href = hashLinks[i + 1]; nextPost.appendChild(document.createTextNode('▼')); divTags[i].appendChild(nextPost); } // Add a link to prev post if (i !== 0){ const prevPost = document.createElement('a'); prevPost.title = "Prev post"; prevPost.href = hashLinks[i - 1]; prevPost.appendChild(document.createTextNode('▲')); divTags[i].insertBefore(prevPost, divTags[i].children[0]); } // Add a link to current post if (i === 0 || i == divTags.length - 1){ const currentPost = document.createElement('a'); currentPost.title = "Current post"; currentPost.href = hashLinks[i]; currentPost.appendChild(document.createTextNode('◆')); if (i === 0) divTags[i].insertBefore(currentPost, divTags[i].children[0]); else if (i == divTags.length - 1) divTags[i].appendChild(currentPost); } } })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址