User:PerfektesChaos/js/filesMetaData

JavaScript gadget – show textual metadata on media files and description pages.

Avoid download of hundreds of thumbnail files on regular MediaWiki pages and prepare sortable filtered concise data tables.

Usage

 * If your project has registered this as a gadget, just activate on your Preferences page.
 * Otherwise include the following code into your common.js, global.js etc.:

Behaviour
After installation, Stay on this page to keep collected data and resources.
 * 1) visit Special:Blankpage/filesMetaData,
 * 2) quickly a brief response should show up,
 * 3) wait a little while, resources take a few seconds to establish OOjs (like with VisualEditor),
 * 4) make your choices from the form,
 * 5) finally use the  button.

Data origin
There are three types of sources to provide particular files.

Category
Select category mode and provide the category title by input field.

Note that categorization also works if no category description page exists.

Later you can navigate downward to specific subcategories or upward.

Media entries in category will be listed.

Special pages
Some special pages list file galleries. If API access for such pages is established their output can be analyzed.


 * Available
 * Special:Mostimages
 * Special:Uncategorizedimages
 * Special:Unusedimages


 * Currently no API
 * Special:Listfiles
 * Special:Newimages

See mw:API:Querypage on current state.

Free list and wikitext
If you select this mode, you get a text input area.

Basically a list of media identifiers is expected, each in a single line.

A pipe separated list of media identifiers is fine, too.

Media transclusion or file links in double brackets will be recognized anywhere.

Actually it should work to drop the contents of a gallery page in Commons main space into this field and the occurring media will be listed.

Leave the text input field when editing finished.

Refining
The desired output may be customized.

Columns
Select the types of information you are interested in. Each will be provided in a table column, if available. If meaningful you can sort the rows later.

Thumbnail pictures and contents of description pages are not provided immediately, but if you are interested in a particular file you may request it individually.

On file description pages information is available only if the file is local and not shared; if you work within a certain Wikipedia descriptive information on Commons is not available but media characteristics can be retrieved.

Filtering
The basic media identifiers (before the dot) may be restricted by an arbitrary string that shall be contained.

A regular expression can be used for this purpose, in common JavaScript RegExp dialect. The pattern is to be enclosed in  and an   for case-insensitivity may be appended.
 * Example:  will permit house, House, mouse anywhere but reject any other file.

The “file type extensions” may also limit the displayed entries. A space separated list can be provided.

The following groups are supported like MIME specifications:

Both conditions may be inverted.

Options
Four figures can be adapted.

They are immediately in effect even during running queries.
 * Minimum number of table rows.
 * If sufficient number of entries available the table will be expanded by this number of rows.
 * When filter conditions are in effect some additional rows might be appended since blocks of entries are retrieved until the requested number of rows has been reached, but some more results in block are consumed as well.
 * API query chunk size, for experienced users.
 * Thumbnail image size.
 * Limitiation of initial length of contents of description page.

Continuation
While further entries can be expected a button allows extension of the existing table by a block of more files.

Otherwise the general input form may be expanded again and a new run can be configured and started.

Retrieved data are collected in a cache. Subsequent calls for the same files will try to recycle known data. If action is taken based on the evaluation and during the session file properities are significantly changed, the properties might become outdated. A button to clear the gadget cache is offered.

Internationalization
Suggestions on foreign languages may be offered, as well as a translation of this page.

Codes
de:User:PerfektesChaos/js/filesMetaData