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. If your browser tells you it's taking too long, you can allow it to continue and it will eventually finish. If it takes longer than 10–15 minutes, then you should start to worry, unless you have 40,000+ edits.

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

Set up
The following code goes in your skin's JavaScript page – "User:Your name/Skin name.js". The default on StrategyWiki is BlueCloud.js.

 var editPage = 'Edit count'; var tableClass = ''; var tableStyle = ''; importScriptURI('http://strategywiki.org/w/index.php?title=User:Najzere/edit_counter.js&action=raw&ctype=text/javascript');

The first three lines contain variables to modify how the table is presented, and are optional. The last line, however is how the script gets executed, so don't forget that one.
 * 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 that page if you want to keep it or replace Edit count with the name of the page you want to create between the single quotes on the first line.
 * 2) var tableClass = '' ; — this is where you can put extra classes for the table. By default, the table just uses the "wikitable" class. To add extra classes, put the ones you want between the single quotes in the second line. Note that the table uses colspans, so the "sortable" class won't work. Here are some options:
 * 3) * collapsible collapsed: This makes the table collapsible and it starts out collapsed.
 * 4) * collapsible: This makes the table collapsible, but it starts out expanded.
 * 5) * other: You can put any custom classes you have in your user CSS page to make the table look different. Note that custom classes will only be visible to you.
 * 6) var tableStyle =  ; — this adds any additional styles you want to your table. This is a list of styles separated by semi-colons with no double-quotes around them. For instance, you might put float:right;width:200px;text-align:center'' between the single quotes on the third line.

Usage
When you visit your main userpage, you will see an extra link in the Toolbox, right after the "User contributions" link. It will be labeled "Edit counter". 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  , where "Edit count" is the default page name, which can be changed as described above. Alternatively, you can just copy/paste the table code from the table page and use it.

Note: Unless you've set the tableStyle</tt> variable with a float or width, the table will automatically collapse to the smallest width.

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

Count discrepancy
The discrepancy between the total edit count at the top of the table and the sum of the different edit counts by namespace is not a bug. The total edit count comes from a running total the wiki keeps track of (as seen in your preferences), while the edit counts by namespace come from your contribution list. Certain events, such as page moves, page protections and uploading new versions of images are present on your contribution list, but don't increment your running total. Currently, the script will subtract page moves and page protections from the namespace counts, and page moves are probably the biggest difference. Getting a count of how many uploads were overwrites currently takes way too long, so if there is any remaining discrepancy, it likely lies there. There may be other differences, such as deleted edits not showing up in your contribution list but incrementing your running total, but they are unidentified at this point.

Missing namespaces on Wikipedia
Because the namespace numbers on Wikipedia jump from 15 up to 100–109, I would have to completely redo how I count contributions and I'm too lazy to do that right now. So for anyone with a ton of edits in the Portal or Book namespaces (and their respective talk namespaces), these edits won't be included in the by-namespace breakdown – sorry! They'll still be in your full edit count at the top of the table though.