Skip to content

Instantly share code, notes, and snippets.

@Denubis
Last active September 11, 2022 20:05
Show Gist options
  • Select an option

  • Save Denubis/36dbe49961e458bc008fe3ea1fbfe29f to your computer and use it in GitHub Desktop.

Select an option

Save Denubis/36dbe49961e458bc008fe3ea1fbfe29f to your computer and use it in GitHub Desktop.
javascript: (() => {
/*Apache2 License, Brian Ballsun-Stanton*/
const hostName = window.location.hostname;
const currentDomain = hostName.substring(hostName.lastIndexOf(".", hostName.lastIndexOf(".") - 1) + 1);
/*https://stackoverflow.com/a/19937750*/
if (currentDomain != "newsblur.com"){
const newTarget ="https://12ft.io/"+window.location.href;
window.location.href=newTarget;
} else {
Element.prototype.appendAfter = function(element) {
element.parentNode.insertBefore(this, element.nextSibling);
}, false;
/* https://stackoverflow.com/a/32135318*/
var storyTitles = document.querySelectorAll(".NB-feed-story-title");
storyTitles.forEach(story => {
const storyHref = "https://12ft.io/"+story.getAttribute('href');
console.log(storyHref);
const story12ftElement = document.createElement('span');
story12ftElement.innerHTML = '<a target="_blank" role="button" href="'+storyHref+'">[12ft Ladder]</a>';
story12ftElement.appendAfter(story)
});
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment