User:Chruck/monobook.js

// From User:Lunchboxhero/monobook.js : //This code will change ISBN links to point to the url of your choice, //instead of Special:Book_sources. // //How to use it: // //First, you must copy this code to your user javascript page. This is //at User: /monobook.js. My username is Lunchboxhero so //my javascript page is User:Lunchboxhero/monobook.js. You must be logged //in to edit your javascript page. // //Once you have copied the code and saved the page, you need to refresh your //browser's cache. For Mozilla/Safari/Konqueror: hold down Shift while clicking //Reload (or press Ctrl-Shift-R), IE: press Ctrl-F5, Opera: press F5. // //The code should now work, as long as you are logged in. // //You can change the destination url by simply modifying the quoted url that //follows document.links[i].href= // //Good luck, and if you have any questions, leave me a comment on the discussion //page of User:Lunchboxhero/monobook.js. // This particular script searches Spartanburg County Public Libraries --Jas var req; function processReqChange { // only if req shows "loaded" if (req.readyState == 4) { // only if "OK" if (req.status == 200 {            // ...procession statements go here...             alert("...procession statements go here...");         } else {             alert("There was a problem retrieving the XML data:\n" + req.status.text);        }     } } function externISBN {     req = false;     try {         req = new XMLHttpRequest;     } catch(e) {         req = false;     }     if (req) {         alert('1');         req.onreadystatechange = processReqChange;         alert('2');         req.open("GET", "http://catalog.infodepot.org/uhtbin/cgisirsi.exe/x/0/0/49/", true);         alert('3');         req.responseText.match(/form(.*)/);         alert('4');         alert('RegExp.$1');     } else {         alert('NOPE');     }     for (var i = 0; i < document.links.length; i++) {                 var ln = document.links[i].href.match(/isbn=(.*)/);          if (ln) {             document.links[i].href=             'http://catalog.infodepot.org/uhtbin/cgisirsi.exe/KtEdNbcLeq/SPARTANBRG/285040106/123?searchdata1='+RegExp.$1;          }     } } addOnloadHook(externISBN);