So Stackoverflow Documentation has added Contributor Breakdown. For any given topic (and example) people can display who contributed in which way. That page is only available if you know the link though. And it's not linked publicly in any way. Since I like these hidden pages, but I keep forgetting the correct URLs to use, I wrote a short userscript to insert these links where relevant:// ==UserScript==// @name         Documentation contributor links// @namespace    http://github.com/Vogel612/mini-se-userscripts/documentation-contributor-breakdown// @version      0.1// @description  Add links to the contributor breakdown for topics and examples on stackoverflow documentation.// @author       Vogel612// @include      /https?:\/\/stackoverflow\.com\/documentation\/.*// @grant        none// @run-at       document-end// ==/UserScript==(function() {    // these are in here for debugging purposes    document.addLinks = addLinks;    document.addContributorLink = addContributorLink;})();// because the page is modified on SE side after loading. 2 secs should be enough to waitsetTimeout(addLinks, 2000);function addLinks() {    'use strict';    let topicLink = document.querySelectorAll(a.doc-topic-link)[0];    let topicMenuContainer = document.querySelector(div.docs-menu.topic-menu);    addContributorLink(topic, topicLink.href.split('/')[5], topicMenuContainer);    let exampleLinks = document.querySelectorAll(.example-link a.doc-example-link);    let exampleMenus = document.querySelectorAll(.example-link div.example-menu.docs-menu);    for (var i = 0; i < exampleLinks.length; i++) {        let currentLink = exampleLinks[i];        let currentMenuContainer = exampleMenus[i];        addContributorLink(example, currentLink.href.split('/')[7], currentMenuContainer);    }}function addContributorLink(section, linkId, menu) {    'use strict';    let href = `/documentation/contributors/${section}/${linkId}`;    let elem = document.createElement(A);    elem.href = href;    elem.innerHTML = CB;    elem.title = Contributor Breakdown;    menu.insertBefore(elem, menu.children[0]);}Note that the documentation pages are modified by StackOverflow after loading and that removes the link, if I add it before the page is completely built. That's why I run addLinks() with a 2 second delay.Any and all aspects are up for critique, as always :)
Showing links to Contributor Breakdown on Stackoverflow Docs
javascript;stackexchange;userscript
No need for timeout, just attach in a place that doesn't get overwritten: after the title.Since the extracted link id number is always the last, we can process all links in one go, extracting section name from a link's class name via doc-(\w+)-link to make the pattern self-evident.Instead of magic split indexes I suggest using a simple \d regexp to extract all digits.Building DOM elements by individual properties is unreadable, it's a thing from '00s, I suggest using the equally fast (or faster) and much more readable insertAdjacentHTML.The entire code boils down to:for (let link of document.querySelectorAll(a.doc-topic-link, a.doc-example-link)) {    let section = link.className.match(/doc-(\w+)-link/).pop();    let lastNumber = new URL(link.href).pathname.match(/(\d+)/g).pop();    link.insertAdjacentHTML('afterend', `        <a href=/documentation/contributors/${section}/${lastNumber}           title=Contributor Breakdown>CB</a>    `);}