User:Wilfredor/commons-listfiles-editor
A row of Special:ListFiles opened for editing | |
| Description | Rename, describe and categorise files from Special:ListFiles |
|---|---|
| Author | Wilfredor |
| Status | Maintained |
| Updated | 2026-09-04 |
| Source | User:Wilfredor/commons-listfiles-editor.js |
Overview
[edit]commons-listfiles-editor turns Special:ListFiles into a place where files can be edited, instead of a list you leave in order to edit them.
Special:ListFiles shows a hundred files at once with their thumbnails, which is exactly the view in which you notice that several are still called Untitled-2.jpg, that a description is in the wrong language, or that a whole shoot never got its category. Acting on any of that meant opening each file page, editing, going back and losing your place.
What it adds
[edit]- A pencil in every row. It opens a form under that row with the file's name, its descriptions and its categories, read from the file page itself. The name is only there if you may rename files.
- One line per language in that form. A file page can describe the file in as many languages as it likes, so the form shows every one it has, the language box completes the code as it is typed, and Add a description gives the file another one.
- A tick box in every row, and a bar above the table that adds or removes one category across every ticked file, one page at a time. The boxes take a shift-click: tick one, shift-click another, and every row between them follows.
What it does not do
[edit]The Description column of that table is the upload comment, the summary typed when the file was sent. MediaWiki keeps it in the image table and nothing can edit it. The description this script writes is the one on the file page, inside {{Information}}, which is the one readers see.
How it edits
[edit]Every page edit is surgical. The description parameter and the category lines are replaced where they stand and the rest of the page is left byte for byte as it was: a file page carries assessments, structured data and templates that no script should rewrite because it was asked to fix a typo. A category that stays keeps its sort key, so a deliberate sort goes on sorting where it did.
Renaming uses action=move, so it needs the file mover right, and the form shows the name, the reason and the redirect box only to an account that holds it: offering a field whose save Commons is going to refuse is worse than not offering the field. A rename leaves a redirect behind, so everything linking to the old name keeps working, and the box that leaves the redirect out is shown to accounts that hold suppressredirect, because without that right the redirect is created whatever the box says. The extension cannot be changed: Commons refuses a rename that does, because the extension says what the file is.
Each save checks the revision it read, so an edit made by someone else while the form was open is refused instead of overwritten.
Installation
[edit]Add this line to Special:MyPage/common.js and reload with Ctrl+⇧ Shift+R:
importScript('User:Wilfredor/commons-listfiles-editor.js');