Created
October 1, 2019 13:11
-
-
Save westonwatson/d47893c5f1b05ba13954520c80fd3dca to your computer and use it in GitHub Desktop.
Hacker News OUTLINE.COM links
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
//Run this code after page load | |
window.onload = function() { | |
//target story link container(s) | |
document.querySelectorAll('.storyLink').forEach( | |
function(nodeObj, objIndex) { | |
var parentNode = nodeObj.parentNode; | |
//make a copy of the story link | |
var cloneNode = nodeObj.cloneNode(true); | |
var hrefString = nodeObj.href; | |
//create the outline.com link | |
hrefString = 'https://outline.com/' + hrefString; | |
//set href and open in new tab | |
cloneNode.href = hrefString; | |
cloneNode.target = '_blank'; | |
//leave a copy of the original link | |
nodeObj.innerHTML = ' [DIRECT LINK]'; | |
//append the outline link/copy | |
parentNode.prepend(cloneNode); | |
} | |
); | |
} |
Here's a list of Chrome/Chromium Extensions you can use to inject Javascript (and CSS) into pages...
- https://chrome.google.com/webstore/detail/user-javascript-and-css/nbhcbdghjpllgmfilhnhkllmkecfmpld (I use this one)
- https://chrome.google.com/webstore/detail/javascript-injector/djnjegpffahmfpjdlkciiecmeaebghlk
- https://chrome.google.com/webstore/detail/witchcraft-inject-js-and/hokcepcfcicnhalinladgknhaljndhpc
- https://chrome.google.com/webstore/detail/custom-javascript-for-web/poakhlngfciodnhlhhgnaaelnpjljija
- https://chrome.google.com/webstore/detail/css-js-injector/gamgadbdliolbhjdcfjjpjfjhgfnckbp
- https://chrome.google.com/webstore/detail/injector/bfdonckegflhbiamlmidciapolfccmmb
- https://chrome.google.com/webstore/detail/script-injector/fddnddnolonllcgfbenaloajnbhebmob
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm using the
User Javascript and CSS
Chrome Extension to inject this javascript into Hacker News (new.ycombinator.com).