Bookmarklet to modify links on a page

In: Uncategorized

5 Jan 2010

I recently needed to modify hundreds of links on a wiki page based on a dynamic value, so I created a simple bookmarklet (ModWikiLinks).

I searched for a tool to properly format/shrink it and found: the bookmarklet crunchinator.

var user = prompt('Enter your username');
var links = document.querySelectorAll('a[href*=localhost]');
for (i in links) {
 if (typeof links[i].href !== "undefined") {
  links[i].href = links[i].href.replace(/http:\/\/[^\/]+/,'http://trus_global.'+user+'.webdev.gspt.net');
  links[i].target = '_blank';
 }
}

About this blog

This portifolio represents a brief sampling of my work. More thorough demonstrations and walk-thrus of my latest and greatest work are available via remote virtual session on DimDim, a free flash based web conferencing tool.

Also note that I recently joined StackOverflow where you will find me asking and answering many web development questions.