Tuesday 4 October 2011

Bookmarklet to ease the pain from Warwick Uni Library's E-journal change

The University of Warwick Library no longer allow access to E-journals except after jumping through hoops to access them through the library's web catalogue. This is painful and, although I've now got a plethora of links to various journal home-pages, I still find myself cutting and pasting parts of URLs to avoid some journals' awful navigation interfaces.

But all is not lost! Here's a JavaScript bookmarklet which will open up the current page channelled through Pugwash, which appears to be the library's main server. It seems to work for me, but the "0-" prefix on the URLs looks worryingly magical and I'm not sure whether this is correct for all journals...

To use the bookmarklet on Firefox (or pretty much anywhere else), you can right-click on the link (the "here" above) and select something like "Bookmark this link". If you are (rightly) wary of trusting a random hunk of JavaScript, this is the code:

javascript:(function(){
  var str=location.href;
  if(str.substr(0,7)!="http://") {
    alert("Unrecognised protocol");
    return;
  }
  var ffs=str.substr(7).indexOf("/");
  if(ffs==-1) {
    fs=str.length-1;
  }
  else {
    ffs=ffs+7;
  }
  window.open("http://0-" + str.substr(7,ffs-7) +
              ".pugwash.lib.warwick.ac.uk/"+str.substr(ffs+1));
})()

(It has to be on one line to work, so you'll need to delete a lot of whitespace if you want to copy and paste this).

No comments: