User:CatherineMunro/monobook.js
From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Mozilla/Safari: hold down Shift while clicking Reload (or press Ctrl-Shift-R), Internet Explorer: press Ctrl-F5, Opera/Konqueror: press F5.
// Duplicates top-of-page tags at bottom of page. 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('column-content').appendChild(tabs); } if (window.addEventListener) window.addEventListener("load",morelinks,false); else if (window.attachEvent) window.attachEvent("onload",morelinks); var objPage = null; function showPage(pageName) { if (objPage) objPage.style.display = 'none'; objPage=document.getElementById(pageName); objPage.style.display = 'block' } // See [[Wikipedia:Tools/Navigation popups]] for options // Script from [[User:Lupin/popupsdev.js]] document.write('<script type="text/javascript" src="' + 'http://en.wikipedia.org/w/index.php?title=User:Lupin/popupsdev.js' + '&action=raw&ctype=text/javascript&dontcountme=s"></script>'); popupFixDabs=true; popupFixRedirs=true; popupRedirAutoClick='wpPreview'; addOnloadHook(addCountLinks); function hidePagesOutsideArticleNamespace(){ var body = document.getElementById('bodyContent'); if( !body ){ return; } if (document.getElementById('dpl_banner')) { open(document.URL, "_self"); //refresh the page return; } var lists = body.getElementsByTagName( "ul" ); for ( var j=0; j<lists.length; j++ ){ lists[j].style.listStyleType = 'decimal'; } var links = body.getElementsByTagName( "li" ); for( var i=0; i<links.length; i++ ){ var link = links[i]; if( link.innerHTML.toLowerCase().indexOf( '</a> (redirect page)' ) == -1 && ( link.innerHTML.indexOf( 'href="/wiki/Talk:' ) != -1 || link.innerHTML.indexOf( 'href="/wiki/Wikipedia:' ) != -1 || link.innerHTML.indexOf( 'href="/wiki/Wikipedia_talk:' ) != -1 || link.innerHTML.indexOf( 'href="/wiki/User:' ) != -1 || link.innerHTML.indexOf( 'href="/wiki/User_talk:' ) != -1 ) ) { links[i].style.display = 'none'; } } var banner = document.createElement("div"); banner.id = "dpl_banner"; banner.style.backgroundColor = "yellow"; banner.style.fontSize = 'larger'; banner.innerHTML = "DPL MODE ON"; body.firstChild.insertBefore(banner); } function addCountLinks(){ if (!document.URL.match('Special:Whatlinkshere')) { return; } // only add toolbox link on 'whatlinkshere' pages var target = document.getElementById('p-tb').getElementsByTagName( "ul" ); if( target.length == 0 ){ return; } //no toolbox to hook into target = target[0]; var newTool = document.createElement("li"); target.appendChild( newTool ); newTool.innerHTML = '<a href="" onclick="hidePagesOutsideArticleNamespace(); return false;">DPL mode</a>'; } // Script from [[User:Lupin/editcount.js]] document.write('<script type="text/javascript" src="' + 'http://en.wikipedia.org/w/index.php?title=User:Lupin/editcount.js' + '&action=raw&ctype=text/javascript&dontcountme=s"></script>'); popupEditCounterTool='custom'; popupEditCounterUrl='http://en.wikipedia.org/wiki/User:$1?ectarget=$1'; //This code will change ISBN links to point to the url of your choice, //instead of Special:Book_sources. // //Modify 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 . 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);