Jump to content

User talk:Venturesum/monobook.js

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

//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:<your username>/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 . // //(Every line that starts with "//" is a comment and can be discarded.)

function externISBN() {

 for (var i = 0; i < document.links.length; i++) 
   {       
        var ln = document.links[i].href.match(/isbn=(.*)/);
        if (ln) {
          document.links[i].href='http://www.amazon.com/exec/obidos/ASIN/'+RegExp.$1;
        }
   }

}

addOnloadHook(externISBN);

Legacy JavaScript

[edit]

Hello! This script has been detected as using deprecated parameters that need to be replaced with the updated version. Examples include addOnloadHook( ... ) needs to be replaced with $( ... ) or $( function() { ... } ) (depending on use); all wgGlobalVariables need to be properly gotten with mw.config.get( 'wgGlobalVariable' ); and addPortletLink needs to be called with mw.util.addPortletLink. Please see MW:ResourceLoader/Legacy JavaScript for details. Thank you. — {{U|Technical 13}} (etc) 22:29, 19 January 2015 (UTC)[reply]