User:PerfektesChaos/js/resultListSort

JavaScript gadget to sort page lists on special pages.

On pages like “Whatlinkshere” several hundred results may occur in any order dropped from database query. Name spaces are mixed randomly, no one gets a survey.

Usage

 * If your project has registered this as a gadget, just activate on your Preferences page.
 * Otherwise include the following lines into your common.js or skin dependant like vector.js:
 * If you are blocking scripts from sites other than your local Wiki you might need to put www.mediawiki.org on the whitelist.
 * The gadget works also with non-WMF sites using MediaWiki 1.18 or higher.
 * The script may be loaded by anonymous users, e.g. via greasemonkey.

Effects
By default there is just a link added to the content actions of portlet. If sorting is needed it may be requested manually.

However, some types of special pages may be configured by user to perform sorting automatically, if machine is fast enough and response time acceptable to the user.

Standard collation is by namespace and page title.

Some pages get a second and even more action links: Sort by URL, and Watchlist and Recentchanges may be sorted by user or summary, Newpages also by size.

Other pages may be added if meaningful use has been found. Some 20 maintenance page lists are available right now.

For  and   it is offered to convert the three column table into a list. With long page names (perhaps caused by subpage path) they may be confusing to read.

The server provides unordered lists. These are always turned into numbered lists, since a larger number of pages sharing the same property can be derived easily.

Note that the information is gained by screengrabbing. If some details in formatting change, extraction of sortkey might fail. Please notify me.

Quick interactive configuration
Options can be set interactively on Special:Gadgets page, if the script has been loaded before.

They are the same as described in next section: These requests are stored together with user preferences on Wiki server and will be in effect on all browsers. They are overriding settings from the following section.
 * Automatic sorting for specified special pages
 * Insertion of portlet-link: always, never, on particular pages only
 * Ignore case on sorting
 * Keep page together with talk page

Javascript application object
Insert the following statement into your standard user script like common.js (best before mw.loader.load, if any):

Example: Note: Customization may be ignored if not put into a standard user script, since other scripts are loaded later and resultListSort has no knowledge about, won’t wait for them.

Other languages
This gadget is prepared for multilingual support.
 * If you like a version in your own language, please forward translations to me:
 * This documentation page.
 * The  mapping on top of source code.
 * Further ISO 639 language codes your translation might support.


 * German