User:Andy/counterLink.js

//  // //  //  //  As Kate's and Interiot's edit counters are now seldom updated, I have updated the script on //  Wikipedia:Edit counters to include a variable that allows you to specify which edit counter // you wish to use: Kate, Interiot, Essjay or Interiot's Tool2. // // Please note that the Tool2 counter is not yet IE-compatible, so if you choose Tool2 and // then click on the edit counter link with IE, a message will appear which will allow you to //  download Mozilla Firefox, which the Tool2 counter will work with. --Andrew // //  // //  Indicate where you would like "Kate" to appear: //   pt-userpage, pt-mytalk, pt-preferences, //   pt-watchlist, pt-mycontris, pt-logout // gsKateInsertBefore = 'pt-mycontris'; // leave blank to append after "logout"

function KateLink { // Modified by Andrew Havis (User:Andrewh) 18/7/2006 to use User:Interiot's Tool2 counter var user = document.getElementById( 'pt-userpage' ).firstChild.firstChild.data;

// Use which counter? Valid choices are "Tool2" or "Essjay" (recommended), "Kate" (slow) or "Interiot" (slow) var useCounter = 'Essjay';

var li = document.createElement( 'li' ); li.id = 'pt-kate';

var a = document.createElement( 'a' ); a.appendChild( document.createTextNode( 'My Edit Counter' ) ); // eh, the css makes the text lowercase a.href = 'javascript:alert("This link does not currently work. Please see Wikipedia's edit counters page to access edit counters.");' return false; switch (useCounter) { case 'Kate': a.href = 'http://tools.wikimedia.de/~kate/cgi-bin/count_edits?dbname=enwiki&user=' + user; break; case 'Interiot': a.href = 'http://tools.wikimedia.de/~interiot/cgi-bin/count_edits?dbname=enwiki&user=' + user; break; case 'Essjay': a.href = 'http://tools.wikimedia.de/~essjay/edit_count/Count.php?username=' + user; break; case 'Tool2': // Tool2 edit counter doesn't currently work in IE       var isIE = document.all; if (!isIE) { a.href = 'http://en.wikipedia.org/wiki/User:Interiot/Tool2/code.js?username=' + user; } // End if       else { a.href = 'javascript:if (confirm("This edit counter currently does not work in Internet Explorer, but will work in Mozilla Firefox. Do you wish to download Firefox?")) {document.location.href="http://www.mozilla.com/firefox/";}'; } // End else break; default: a.href = 'javascript:alert("Invalid edit counter defined! Change the useCounter option in your monobook.js to correct this.");' break; } // End switch

li.appendChild( a );

if ( ! gsKateInsertBefore ) // append to end (right) of list { document.getElementById( 'pt-logout' ).parentNode.appendChild( li ); } else { var before = document.getElementById( gsKateInsertBefore ); before.appendChild( li, before ); } }  if ( window.addEventListener ) window.addEventListener( 'load', KateLink, false ); else if ( window.attachEvent     ) window.attachEvent   ( 'onload', KateLink );

//