User:Freederick/monobook.js

// User:Lupin/popups.js

//importScript('User:Lupin/popups.js'); var popScript    = '//en.wikipedia.org/w/index.php?action=raw&ctype=text/javascript&title=MediaWiki:Gadget-popups.js'; var popStyleSheet = '//en.wikipedia.org/w/index.php?action=raw&ctype=text/css&title=MediaWiki:Gadget-navpop.css'; if ( window.localCSS ) { popStyleSheet = 'http://localhost:8080/js/navpop.css'; }

function popups_importScriptURI(url) { var s = document.createElement('script'); s.setAttribute('src',url); s.setAttribute('type','text/javascript'); document.getElementsByTagName('head')[0].appendChild(s); return s; }

function popups_importStylesheetURI(url) { return document.createStyleSheet ? document.createStyleSheet(url) : popups_appendCSS('@import "' + url + '";'); }

function popups_appendCSS(text) { var s = document.createElement('style'); s.type = 'text/css'; s.rel = 'stylesheet'; if (s.styleSheet) s.styleSheet.cssText = text //IE else s.appendChild(document.createTextNode(text + '')) //Safari sometimes borks on null document.getElementsByTagName('head')[0].appendChild(s); return s; }

popups_importStylesheetURI(popStyleSheet); popups_importScriptURI(popScript);

// This code will change ISBN links to point to the url of your choice, // instead of Special:Booksources. // // 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. Go to Book sources and copy // the URL of the site you want to use (right-click the link, then click "Copy Link // Location", "Copy Target", or similar). Put the new URL between the quotes next // to magicURL, in place of the URL now there. // // The current magicURL includes Wikimedia's Amazon Referral reference. That means if you click on // the ISBN link, go to Amazon and end up buying the book, Wikimedia will earn some small amount // of money from that sale. If you don't want to support Wikimedia in this way, but do want ISBNs // to link to Amazon, replace the current magicURL with "http://www.amazon.com/gp/search?ie=UTF8&field-isbn=MAGICNUMBER" // // Good luck, and if you have any questions, leave a comment on the discussion // page of User:Lunchboxhero/monobook.js. Thanks to Superm401 and drrngravy for their // improvements. // // (Every line that starts with "//" is a comment and can be discarded.) var magicURL = "http://www.amazon.co.uk/gp/search?ie=UTF8&field-isbn=MAGICNUMBER&tag=wikipedia08-20"; importScript('User:Lunchboxhero/externISBN.js');