User:SD0001/StubSorter



StubSorter is a script intended to make stub sorting easier. It provides a simple HotCat-like search field to search for and add templates from Category:Stub message templates. It also allows you to remove existing stub templates.

When navigating to an article from the sorting backlog category CAT:STUBS, the script interface is opened automatically. Also to save you another click, stub is automatically removed when you add another stub template and save.

The keyboard shortcut or  (on Mac ) can be used for saving.

Installation
If you have the script-installer gadget, just click on the "Install" button in the infobox.

Otherwise, place the following line in your common.js or skin.js page:

Search modes
StubSorter searches for templates in Category:Stub message templates. Note that all search results from a prefix search will not also appear in an intitle search, as one may expect. This is because the intitle search is looking for whole-word matches, whereas prefix search is happy to match partial-word matches. For example an intitle search for "" will not find "" whereas a prefix search will. An intitle search for "" on the other hand, will find "" whereas a prefix search obviously wouldn't.
 * prefix matches: Search results from the search  within the category.
 * intitle matches: Search results from the search  within the category.

When you search, both prefix matches and intitle matches are retrieved. By default the prefix matches are shown at the top. You can change this using the dropdown menu.
 * List prefix matches first (prefix): lists prefix matches before the initle matches
 * List intitle matches first (intitle): lists intitle matches before the prefix matches
 * Use strict character-match search (regex): Strictly match the sequence of characters in the template name. This will find all the prefix matches and intitle matches, plus some more. Done internally by querying the search results for . Any regex special characters are escaped.

The default mode is the first one. You may customize the default by adding to your common.js page: replacing with,  or.

Freeze button
The "Freeze" button freezes the search results in place so that any more changing of the search query doesn't change the available options. Rather, the existing options are searched. This can be handy in situations where you want to do a search to filter the list of available templates, and then do another search to find the template from the filtered list.

As a bonus, freezing the menu will silently add extra results to the dropdown for the current search query, upto 500 prefix matches and 500 intitle matches. Otherwise, only upto 100 prefix and intitle matches each are shown.

Watchlisting
By default, the pages you stub-sort will not be added to your watchlist. To customise this, add the following line, just below the above one in your common.js:

The value can be:
 * "watch" - add the page to watchlist
 * "nochange" - (DEFAULT) watchlist status of the page is not changed - if the page is watched, it will remain watched, if unwatched, it will remain unwatched.
 * "preferences" - watchlisting will depend on your site preference given at Special:Preferences.
 * "unwatch" - explicitly unwatch the page, even if it was watched earlier (not recommended).

Minor edit
By default edits are marked as minor. To disable this, add

Menu placement
The "Stub sort" menu option is available in the "More" dropdown menu (the p-cactions menu). You may change its location to any of the other portlet menus per Help:Customizing toolbars.

Troubleshooting
This could happen occasionally due to delays in getting responses to API calls. If you are experiencing issues persistently, drop me a line with the following information:
 * Are suggestions being loaded too slowly?
 * Your browser and operating system.
 * Your internet speed, measured through a service like fast.com or speedtest.net or both.

This is because the stub template is not there in Category:Stub message templates, most probably because the template is malformed.
 * Unable to see a particular stub template?