User:Ultraexactzz/afdsort

AFDsort is a user script for Wikipedia editors, and is intended to simplify the process of sorting debates on Articles for Deletion. The script is in two parts, for simplicity and ease of installation (and creation).

The primary script adds a "sort" button to the top of any edit page where the article being edited is an Article for Deletion. When clicked, the script prompts for a single-letter category code, found here. The script then removes any existing AfD sorting templates with nonstandard or unsorted input, and adds a template that sorts the debate per your input. The script then adds an edit summary and saves the edit.

The debate will now be added to the category that matches your input, or to the "Unsorted" category if you did not input a correct category code. The edit summary will read "Sorting per CAT:AFD using AFDsort". If you watch pages you edit by default, the page will also be added to your watchlist. As always, you are responsible for the edits made using this script.

A second function, using the "afdsort2" script, adds an "Unsort" button to the top of any edit page where the article being edited is an Article for Deletion. Clicking this button will remove the sort template from any sorted AfD, add the edit summary "Removing sort template from closed debate using AFDsort", and submit the edit. This function is intended only for use on closed debates, where the closing admin or user inadvertantly left the sort template in place, and using this function will remove the debate from all sorting categories. Again, you are responsible for the edits made using this script.

Special thanks to User:Ais523 for scripting assistance, and to User:Digitalme, whose AIV helper provided a starting point for this script.

Installation
Copy the following code onto your Monobook.js page.

"afdsort.js" adds the sort feature to the editing page, while "afdsort2.js" adds the "Unsort" function. The scripts may be used together or separately.

Compatibility
I've seen no data to suggest that this script does not work beautifully with most modern browsers. However, your mileage may vary. Please notify me at my talk page if you encounter any problems.

Known Bugs

 * Extra line bug - Corrected 19 December 2007

Source
The sort script itself (and its code) may be found here, while the Unsort script may be found here.

Last updated 21:07, 28 December 2007 (UTC)