User:Menchi/monobook.js
From Wikipedia, the free encyclopedia
If a message on your talk page led you here, please be wary of who left it. The code below could contain malicious content capable of compromising your account; if your account appears to be compromised, it will be blocked. If you are unsure whether the code is safe, you can ask at the appropriate village pump.
Note: After saving, you have to bypass your browser's cache to see the changes. In Internet Explorer and Firefox, hold down the Ctrl key and click the Refresh or Reload button. Opera users have to clear their caches through Tools→Preferences, see the instructions for Opera. Konqueror and Safari users can just click the Reload button.
/* bottom tabs (duplicate tabs to bottom) */ function morelinks() { var tabs = document.getElementById('p-cactions').cloneNode(true); // don't use the same ids twice- replace the p-cactions id and prepend 'mytabs-' to the li's tabs.id = 'mytabs'; // needs this to be set from js, it ignores the css width for some reason tabs.style.width = '100%'; var listitems = tabs.getElementsByTagName('LI'); for (i=0;i<listitems.length;i++) { if(listitems[i].id) listitems[i].id = 'mytabs-' + listitems[i].id; } // drop them at the bottom of the content area document.getElementById('content').appendChild(tabs); } if (window.addEventListener) window.addEventListener("load",morelinks,false); else if (window.attachEvent) window.attachEvent("onload",morelinks); //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++) { if( document.links[i].href.match(/isbn=(.*)/) ) { document.links[i].href='http://www.amazon.com/exec/obidos/ASIN/'+RegExp.$1; } } } addOnloadHook(externISBN);