User talk:Najzere/edit counter.js

This script counts your contributions and breaks them down by namespace, then writes a table with the information to a page in your userspace. Obviously, the script requires that you have JavaScript enabled. If you aren't autoconfirmed yet, you should create the page in your userspace beforehand to deal with the captchas (if you don't, you'll be prompted to when the script runs).

The script can take a while to run (several minutes if your edits are in the thousands), so be patient. Also, don't run your edit counter all the time. For a simple total of all your contributions, you can use the edit count from Preferences. Abuse of this script may result in it being taken away.

You can ask on my talk page if you have any questions or suggestions, or need help setting it up.

Set up
In your skin's JavaScript page – User:Your name/BlueCloud.js by default – paste the following code:

 var editPage = 'Edit count'; var tableClass = 'collapsible collapsed'; var tableFloat = 'right'; importScript('User:Najzere/edit_counter.js');

The first three lines contain variables to modify how the table is presented.
 * 1) var editPage = 'Edit count'; — this sets the name of the page within your userspace. The default is "Edit count", which would create a page at User:Your name/Edit count. If you already have something there it will be overwritten (it overwrites the old table every time you run it), so you can move the page if you want to keep it or change Edit count in the first line to the name of the page where you want the table.
 * 2) var tableClass = 'collapsible collapsed'; — this is where you can put extra classes for the table. The table automatically uses prettytable and the script defaults to producing a collapsible table that starts out collapsed. To change the extra class, replace collapsible collapsed between the single quotes in the second line. Here are some options:
 * 3) * collapsible collapsed: The default option, this makes the table collapsible and it starts out collapsed.
 * 4) * collapsible: This makes the table collapsible, but it starts out expanded.
 * 5) * nothing: This doesn't add any extra classes, so you just get the normal table. Used like so: var tableClass = '' ;
 * 6) var tableFloat = 'right';</tt> — this makes the table float to the left, right or not at all. The table defaults to floating right. Acceptable options are: left</tt>, right</tt> or nothing (empty single quotes). To change this, replace right</tt> in the third line between the single quotes with one of those options.

Usage
When you visit your main userpage, you will see an extra link in the Toolbox (at the top right of the page in the BlueCloud skin) labeled as "Edit counts". Just click the button and the script will execute. While it is working, the button should change to "Calculating...", and when it is done it will either say "Done!" or "Error!". From there you can go look at the table in your userspace, or load/refresh the page you have it transcluded into.

Output
The table is by itself on a separate page so that you can easily transclude it wherever you want. You can do so by using  </tt>, where Table page normally defaults to Edit count unless you changed it in the JavaScript. Alternatively, you can just copy/paste the table code from the table page and use it.

Note: if you've set the table to not float, it will attempt to be as wide as it can be. This means if you want to make it smaller, you should wrap it in a  with the width set to whatever you want.

Bugs
Let me know on my talk page if there are any problems, and I'll attempt to resolved them. At this time I've only verified the script works for Firefox 3.5.7 in the Windows 7 operating system.