User:Interiot/Tool2

From Wikipedia, the free encyclopedia

Contents

[edit] Instructions on using Interiot's back-up edit counter

This tool does not work with Internet Explorer.

  1. Open your user javascript file (most often monobook.js).
  2. Edit the page and copy-and-paste the code below.
  3. Go to User:Interiot/Tool2/code.js.
  4. Press the "control" and "F5" buttons on your keyboard at the same time (the page will now refresh).
  5. Enter your username into the box and choose "submit".
  6. Your edit count should appear!

[edit] The code

//Interiot's javascript edit counter
if (document.title.indexOf('User:Interiot/Tool2/code.js') != -1) {
  document.write('<script type="text/javascript" src="' 
    + 'http://en.wikipedia.org/w/index.php?title=User:Interiot/Tool2/code.js' 
    + '&action=raw&ctype=text/javascript&dontcountme=s"></script>'); }

[edit] Count link

An additional option is to add a "count" link top menu option for user pages. Clicking on the link automatically inputs the user name into the script. Adapted from the KateLink function:

function KateLink()
  {
    // use the "edit this page" tab to get user name
    var user = document.getElementById('ca-edit').getElementsByTagName('a')[0].href;
    // cut everything up to "title=" from the start and everything past "&action=edit" from the end
    user = user.substring(user.indexOf('title=') + 6, user.lastIndexOf('&action=edit'));
    user = user.substring(user.indexOf(':') + 1);
  
    var li = document.createElement( 'li' );
    li.id = 'pt-kate';
  
    var a = document.createElement( 'a' );
    a.appendChild( document.createTextNode( 'count' ) ); // eh, the css makes the text lowercase
    a.href = 'http://en.wikipedia.org/wiki/User:Interiot/Tool2/code.js?username=' + user;

    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 );
    }
  }

//add this if to Main() or load function
  if (document.title.indexOf("User") != -1)
    KateLink(); //count menu option on user pages

[edit] Troubleshooting

  • The back-up edit counter doesn't seem to currently work with Internet Explorer, although it should be fixed soon. In the meantime, you can get Firefox or ask someone else to check for you.
  • If all you see is a bunch of code, make sure you followed the directions carefully.
  • If you try to count the edits of a user with a lot of edits (4000 or more), your browser might freeze and/or display warnings about the script taking too long. This is because the script, instead of relying on the Toolserver, harvests the data directly from your contribs, which can take a really long time.
  • If you're still experiencing problems, please let User:Interiot know.