ycombinator + feedjunkie + reddit bookmarklet

Costas

Administrator
Staff member
JavaScript:
javascript:(function(){ var arr = ''; if (window.location.hostname.includes("ycombinator.com")) { document.querySelectorAll('span.titleline>a').forEach(function(e) { e.setAttribute("class", "link hover-12"); arr+=("<div class='link-wrapper'>" + e.outerHTML + " <a href='#' onclick='test(event);'>c</a> </div>"); }); document.body.innerHTML = "<div class='link-cont'>" + arr + document.getElementsByClassName('morelink')[0].outerHTML; } else if (window.location.hostname.includes("feedjunkie.com")) { document.querySelectorAll('.description').forEach(function(e) { var t = e.querySelectorAll('a')[0]; t.setAttribute("class", "link hover-12"); t.text = e.firstChild.innerHTML; arr+=("<div class='link-wrapper'>" + t.outerHTML + " <a href='#' onclick='test(event);'>c</a> </div>"); }); document.body.innerHTML = "<div class='link-cont'>" + arr + document.getElementsByClassName('pagenumbers')[0].outerHTML; } else if (window.location.hostname.includes("old.reddit.com")) { document.querySelectorAll('.title a[data-event-action]').forEach(function(e) { e.setAttribute("class", "link hover-12"); arr+=("<div class='link-wrapper'>" + e.outerHTML + " <a href='#' onclick='test(event);'>c</a> </div>"); }); document.body.innerHTML = "<div class='link-cont'>" + arr + document.getElementsByClassName('next-button')[0].outerHTML; } else { window.open('https://news.ycombinator.com/newest', '_blank'); } var s = document.createElement("script"); s.innerHTML = `function replaceAll(find, replace, str) { return str.replace(new RegExp(find, 'g'), replace); } function test(e){ e.preventDefault(); var g = e.target.parentNode; var title = g.firstChild.innerHTML.replaceAll(".", ",").replaceAll("–", "-").replaceAll(": ", " - ").replaceAll("'s", "").replaceAll("’s", "").replaceAll("  ", " "); tile = title.replaceAll("[video]","").replaceAll("[pdf]",""); var url = g.firstChild.href.replaceAll("www.reddit", "old.reddit").replaceAll("twitter.com", "nitter.it"); alert(title + "\\n" + url); }`; document.head.appendChild(s); document.head.innerHTML = `<base target='_blank'> <style> @import url('https://fonts.googleapis.com/css?family=Quicksand'); a:visited { color: #336699; } body { font-family: Quicksand; margin-left: 40px; padding: 0; color: #fff; background: linear-gradient(0, #281130 50%, #030133); } h1 { position: relative; font-size: 45px; margin: 15px 0; display: inline-block; } h1:after { content: ''; position: absolute; bottom: -2px; left: 0; right: 0; height: 2px; background-color: #fff; border-radius: 5px; } .link-cont { position: relative; font-size: 24px; } .link { display: inline-block; position: relative; text-decoration: none; padding: 10px 0; color: #fff; } .link-wrapper { position: relative; display: block; padding: 20px 0; } .hover-12:before { content: ''; position: absolute; width: 100%; height: 3px; top: 0; left: 0; background-color: #ffcc00; transform: scaleX(0); transform-origin: top left; transition: transform 0.3s; } .hover-12:after { content: ''; position: absolute; width: 100%; height: 3px; bottom: 0; right: 0; background-color: #ffcc00; transform: scaleX(0); transform-origin: bottom right; transition: transform 0.3s; } .hover-12:hover:before { transform-origin: top right; transform: scaleX(1); } .hover-12:hover:after { transform-origin: bottom left; transform: scaleX(1); } </style>` })();

for https://news.ycombinator.com/newest
for http://feedjunkie.com/
for https://old.reddit.com/new/ (categories)



mgladdish - Hacker News (tampermonkey) userscript to make this site more legible
 
Top