User:Haza-w/interiot.js
From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Firefox/Mozilla/Safari: hold down Shift while clicking Reload (or press Ctrl-Shift-R), Internet Explorer: press Ctrl-F5, Opera/Konqueror: press F5.
// Add an "Interiot" link to your "personal menu" portlet. // For the Monobook skin, this is at the top-right of the browser window. // This script works in all skins and is compatible with scripts that move the // "p-personal" personal options portlet. // // Code by Haza-w based on KATE script // // Indicate the node you would like "Interiot" to appear before: // pt-userpage, pt-mytalk, pt-preferences, // pt-watchlist, pt-mycontris, pt-logout // gsInteriotInsertBefore = 'pt-logout'; // leave blank to append after "logout" // function InteriotLink() { var isIE = document.all?1:0, user = document.getElementById( 'pt-userpage' ).firstChild.firstChild.data; var li = document.createElement( 'li' ); li.id = 'pt-interiot'; var a = document.createElement( 'a' ); a.appendChild( document.createTextNode( 'Interiot' ) ); a.href = isIE?'http://tools.wikimedia.de/~interiot/cgi-bin/count_edits?dbname=enwiki_p&user=' + user : 'http://en.wikipedia.org/wiki/User:Interiot/Tool2/code.js?username=' + user; li.appendChild( a ); var li2 = document.createElement( 'li' ); li2.id = 'pt-interiot'; var a2 = document.createElement( 'a' ); a2.appendChild( document.createTextNode( 'Mathbot' ) ); a2.href = 'http://www.math.ucla.edu/~aoleg/wp/rfa/edit_summary.cgi?lang=en&user=' + user; li2.appendChild( a2 ); if ( ! gsInteriotInsertBefore ) // append to end (right) of list if not defined { document.getElementById( 'pt-logout' ).parentNode.appendChild( li ); document.getElementById( 'pt-logout' ).parentNode.appendChild( li2 ); } else { var before = document.getElementById( gsInteriotInsertBefore ); before.parentNode.insertBefore( li, before ); before.parentNode.insertBefore( li2, before ); } } if ( window.addEventListener ) window.addEventListener( 'load', InteriotLink, false ); else if ( window.attachEvent ) window.attachEvent ( 'onload', InteriotLink );