wnas

Daily Nerd bookmarklet

javascript

I love the daily nerd, it is my first stop when I start the day. A daily list of articles I as a front end developer find interesting. But lazy as I am, I find it too much trouble to open all of those links in new pages. So I wrote a bookmarklet to do that :).

It is not wholly bulletproof, as it depends on the html structure of the daily to never change, but hey, it is easily changed…

Here it is: Open daily nerd drag this to you bookmark bar and when you are on the daily nerd, click it..

In case anyone wants to create one for a different link site, like ppk's linkbait or Roberts read category, here is the code (uncompressed).


// open the dlnrd links in a new window
var odlnrd = function(){
	// get the first article
	var a = document.getElementsByTagName('article')[0],
		// find the article in there
		b = a.getElementsByTagName('article'),
		// calculate the length of those outside the loop
		c = b.length;
	// iterate over them
	for ( var i = -1; ++i < c;){
		// open a new window for each link
		var d = b[i].getElementsByTagName('a'),
			e = d.length;
			for ( var j = -1; ++j < e; ){
				window.open(d[j].getAttribute('href'));
			}
	}
}();

Feel free to take this code and improve on it. I would like to know if you did :).

← Home