Forked from jeffbr13/wikipedia-subheading-links.js
Last active
August 29, 2015 14:11
-
-
Save jtojnar/d611b8c4af076a28380c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://benjeffrey.com/greasemonkey-script-for-wikipedia-subheading-links | |
// Available under the MPL 2.0 | |
// ==UserScript== | |
// @key value | |
// @name Wikipedia Subheading Links | |
// @namespace com.benjeffrey.wikipedia-subheading-links | |
// @description Add links to subheadings on Wikipedia pages. | |
// @include http://*.wikipedia.org/* | |
// @include https://*.wikipedia.org/* | |
// ==/UserScript== | |
contentsItems = document.getElementById('toc').getElementsByTagName('li'); | |
for (var i = 0; i < contentsItems.length; i++) { | |
subheadingHash = contentsItems[i].getElementsByTagName('a')[0].hash.slice(1); | |
subheading = document.getElementById(subheadingHash); | |
subheading.innerHTML += ' <a href="#' + subheadingHash + '" style="color:#a3a3a2;">#</a>'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment