Created
April 10, 2017 19:17
-
-
Save elwinschmitz/82a738c9b651dbd31f52534c4b0b5e81 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
(function(){ | |
var anchors = document.body.querySelectorAll('[id], [name]'); | |
Array.prototype.forEach.call(anchors, function (element) { | |
var link = document.createElement('a'); | |
var hash = '#' + element.id || element.name; | |
link.href = hash; | |
link.innerText = hash; | |
link.style.cssText = 'background:hotpink !important; color:#fff !important;'; | |
element.insertBefore(link, element.firstChild); | |
}); | |
}()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment