// ==UserScript== // @name alternatehistory.com: Links to Next and Previous Posts. // @namespace https://greasyfork.org/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 // @downloadURL 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