Wikipedia - Linkify headers

An userscript helping you get the url linking to specified section

< Feedback on Wikipedia - Linkify headers

Question/comment

I've updated it for the latest Wikipedia redesign.

// ==UserScript==// @name        Wikipedia - Linkify headers// @version     0.2.0// @namespace   eight04.blogspot.com// @description An userscript helping you get the url linking to specified section// @include     https://*wikipedia.org/*// @grant		GM_addStyle// @compatible  firefox// @compatible  chrome// @compatible  opera// ==/UserScript=="use strict";const headings = document.querySelectorAll("#mw-content-text div.mw-heading > :first-child[id]");for (const heading of headings) {const link = document.createElement("a");link.innerHTML = "🔗";link.href = "#" + heading.id;link.className = "mw-headline-link";heading.after(link);}GM_addStyle(".mw-headline-link { font-size: 70%; margin-left: .2em; display:none; } .mw-heading:hover .mw-headline-link { display:inline; }");

https://gist.github.com/teohhanhui/f2486cd3ec7e392ab2691851f5041607

Post reply

Sign in to post a reply.