User talk:Ilmari Karonen/ifdthumbnails.js

From OpenWetWare
Jump to: navigation, search

This is a user script to add thumbnails of the nominated images to Wikipedia:Files for deletion (formerly "images for deletion", hence the name) and Wikipedia:Possibly unfree files and their subpages.


To enable this script, add the following line to your monobook.js page (or the equivalent page for other skins):

<source lang="javascript"> importScript("User:Ilmari Karonen/ifdthumbnails.js"); </source>

Remember to clear your cache after saving. When you next visit FfD, it should look something like this:

File:Ifdthumbnails screenshot.png
A screenshot of the script in action.

If it doesn't, or if you get an error message, please let me know.

Usage on Commons

This script also works on the Deletion requests page on the Wikimedia Commons, although such usage is still somewhat experimental. To use this script on Commons, you need to specify the full URI of the script:

<source lang="javascript"> importScriptURI(""); </source>

Alternatively, you can copy the "importScriptFromEnwiki()" function from my monobook.js on Commons and use that.

Technical details

This script collects a list of nominated images by looking at the headings on the page, and then uses Pathoschild's AJAX framework to make a MediaWiki API query to obtain the thumbnail URLs and sizes. Then it's just a simple matter of adding the image elements below the headings.

The thumbnails are styled and floated using a small fragment of CSS included at the beginning of the script. For that purpose, the <a> tags surrounding the images are given the class name "ifd-thumbnail". The script also adds the rule "h4 { clear: right; }" to keep the floated images from extending past the next heading. You're welcome to modify or override the styles in your monobook.css — just remember to make your style rules more specific or use the "!important" keyword.

This script has been tested and confirmed to work on:

Known issues

  • The API queries will not be properly cached until bug 14402 is fixed. This wastes some bandwidth and may slow down the appearance of the thumbnails on high-latency connections.


You're welcome to leave any comments, suggestions or bug reports below. Note that I may not always look at this page very often, so if the issue is important or urgent (e.g. if the script stops working), please notify me on my talk page or by e-mail.