Potato Mouse Productions main banner

De-link 2.0 Bookmarklet

Saving you from TVTropes since 2009.

I am an avid user of TVTropes.org, but it has the unfortunate effect of being littered with links taking you to an ever increasing number of fascinating pages. This can waste a large amount of time when you have otherwise important things to be doing.

Enter the De-link bookmarklet. I took a few scripts, tweaked and rewrote them to fit my specific needs, and created a bookmarklet which serves to kill any and all links on a page.

For those who don't know much about bookmarklets, simply grab the following link, and drag it onto your browser's bookmark toolbar, or right click and choose to save the link as a bookmark. Click it while on any page and it should eliminate the links. Above and below are numerous links you can try it out on.

De-link 2.0

It works by identifying and eliminating the necessary HTML tags in the source code of the page needed to make links.

Here is the complete code source, in more readable code, for those interested.

// Version 2.0
// Includes multiple redunancies to eliminate most <a> attributes
// Generated with: http://userjs.up.seesaa.net/js/bookmarklet.html
var input = document.getElementsByTagName("a");

var count = input.length;

for(var i =0; i < count; i ){

document.getElementsByTagName("a")[i].removeAttribute("href");

}

for(var i =0; i < count; i ){

document.getElementsByTagName("a")[i].removeAttribute("style");

}

for(var i =0; i < count; i ){

document.getElementsByTagName("a")[i].removeAttribute("class");

}

for(var i =0; i < count; i ){

document.getElementsByTagName("a")[i].removeAttribute("title");

}
// end script

And, for the sake of completeness, De-link 1.0. The code source for which is:

// Version 1.0
var input = document.getElementsByTagName("a");

var count = input.length;

for(var i =0; i < count; i++){

document.getElementsByTagName("a")[i].removeAttribute("href");

}
// end script

I unfortunately don't remember what compiler I used to make a bookmarklet version for that version.

I am also aware that there are likely far better ways to achieve what I have done with these crude scripts, but as I haven't been able to find a method of achieving this and my own javascript skills are rather rusty, this is all I can offer. I am completely open to any tips or tricks that would improve and refine my code, and of course would offer acknowledgment.

© 2008 by Potato Mouse Productions