Last active
August 29, 2015 14:14
-
-
Save linktohack/2bf96649b33f6dbbba00 to your computer and use it in GitHub Desktop.
HackerWeb (bookmarklet) redirect for HackerNews frontend
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
javascript:(function hackerWeb (len) { | |
if (window.location.href.match('https://news.ycombinator.com')) { | |
window.location.href = window.location.href.replace('https://news.ycombinator.com/item?id=', 'http://cheeaun.github.io/hackerweb/#/item/'); | |
} else { | |
var a = document.querySelectorAll('a'); | |
if (len != a.length) { | |
Array.prototype.forEach.call(a, function(e) { | |
var href = e.getAttribute('href'); | |
href && e.setAttribute('href', href.replace('https://news.ycombinator.com/item?id=', 'http://cheeaun.github.io/hackerweb/#/item/')); | |
}); | |
} | |
window.setTimeout((function (len) { | |
return function () { | |
hackerWeb(len) | |
}; | |
})(a.length), 500); | |
} | |
})(0); | |
javascript:!function t(e){if(window.location.href.match("https://news.ycombinator.com"))window.location.href=window.location.href.replace("https://news.ycombinator.com/item?id=","http://cheeaun.github.io/hackerweb/#/item/");else{var o=document.querySelectorAll("a");e!=o.length&&Array.prototype.forEach.call(o,function(t){var e=t.getAttribute("href");e&&t.setAttribute("href",e.replace("https://news.ycombinator.com/item?id=","http://cheeaun.github.io/hackerweb/#/item/"))}),window.setTimeout(function(e){return function(){t(e)}}(o.length),500)}}(0); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment