User:Kanegasi/editcounter

__NONEWSECTIONLINK__

Description
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 common JavaScript page at common.js or your vector skin page at vector.js or other skin page if you want this to only show up on one skin. All you need to run the script is what is below. The script will run based upon who is logged in at your computer, not where the script is at. This script should work on all MediaWiki installations using version 1.16 and above. Go to the "Special:Version" page on your site to see your site's version.

''Note: Copying the entire script to your own space is not required, even if you aren't on the Minecraft Wiki. The top line starting with  , the second line starting with   , and the   line should not be changed either. Only edit what is after the equal signs, or remove every  line if you like. If you want to make your own changes to how the script runs, as I did using the original author's version, then you can copy the script and do what you want with it, as long as what I have at the top of the script is not removed.''

// Counts all your edits and saves them to a page ( http://www.minecraftwiki.net/wiki/User_talk:Kanegasi/editcounter.js ) if (mw.config.get('wgTitle') === mw.config.get('wgUserName') && mw.config.get('wgNamespaceNumber') === 2) { var pageName = 'edit count'; var summaryLink = 'User_talk:Kanegasi/editcounter.js'; var transcludeAll = true; var tableHeaders = true; var mainDivAttrib = ''; var mainTableAttrib = ''; var topRowAttrib = ''; var bottomRowAttrib = ''; mw.loader.load('http://www.minecraftwiki.net/index.php?title=User:Kanegasi/editcounter.js&action=raw&ctype=text/javascript'); }

The lines in the middle contain variables to modify how the script acts, like table format and where the table is saved. A final note is that these vars are not active until you run the script again. When finding the right options, it is highly suggested to edit the page where the table is at, using the Show preview button. Once a desired format is achieved, copy the appropriate settings into the appropriate variable and test the script to see if it will make that table each time. Please do not edit your common.js page for each var change and run the script.
 * — 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  with the name of the page you want to create between the single quotes on the first line.
 * — this is what is linked in the edit summary. The current setting goes to this documentation page, but if you are not on the Minecraft Wiki, the summary link to this page won't work. The default setting is what you have  set at. You can have this link to any page on your wiki and even use an Interwiki link.
 * — this sets one of two transclude options.
 * — transcludes only the total edit count and date last counted. Both of these values come out as plain text when you put  on any other page, ignoring the rest of the table. Using the selective transclusion function, you can transclude just the total count or the date using the section names count and date.
 * — transcludes the whole table normally when using the mentioned code. Ignores the section names if you try to use them.
 * — this is for the namespace row. Setting to  sets up that row like table headers using the !! wikitable code. Setting this to   treats that row like normal cells.
 * — these values allow you to customize the look and behavior of the table, such as styles, classes, etc. which are all optional.
 * — this is the main container, where overall stuff like  should be.
 * — this one is for the whole table, such as cellpadding, cellspacing, class="wikitable", margins, etc.
 * — this is for the top row with the namespace labels.
 * — this is for the bottom row with the contribution numbers.
 * — this is the only required line from the code above and should not be altered unless you want your own version of the script. This loads the script for use.

It is recommended to run the script no more than once a week (as long as once a month if you have a lot of edits). Running this script often, or several people running it often, can be a possible wiki server burden.

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 v#" where the # indicates the current script version. Just click the button and the script will execute. While it is working, the button should change to "Processing..." (sometimes it won't, this is normal), and when it is done it will either say "Success!" or "Error!". From there you can go look at the table in your userspace, or load/refresh the page you have it transcluded into.

If you believe the most recent version of the script was not loaded, follow the directions at the top of your common.js page while on your user page. This will force your browser to reload the page from the Internet.

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.

Bugs
Let me know on my talk page if there are any problems, and I'll attempt to resolve them.

Count discrepancy
The discrepancy between the total edit count 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 and page protections are present on your contribution list, but don't increment your running total. Currently, the script will subtract log events such as moves, protections, deletions and anything else not an edit from the namespace counts, and page moves are probably the biggest difference. File uploads and overwrites are the only log events counted. There is a slight oddity where deleted files are also counted.

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. I plan on eventually researching every single log event available and finding out whether or not it increments the total in order to get a more accurate count for later script versions.