Description | Makes requesting file moves easier and automates the many steps in file moving, including automatic replacement of existing usage. |
---|---|
Author(s) | User:Alexis Jazz |
Updated | May 9, 2023 |
Skins | Vector, Minerva, Modern, Monobook, Timeless |
Source | User:Alexis Jazz/LuckyRename.js |
LuckyRename is a user script to ease requesting file moves and for file movers to streamline moving files, including automatic replacement of existing usage. With LuckyRename, even a complete idiot can move files properly. You don't even have to ponder appropriate filenames anymore: just press the Feelin' lucky button and see what happens!
The four-leaf clover is Unicode U+1F340. See the history of the test version for a changelog of sorts.
How to install
editAdd this to m:Special:MyPage/global.js to load the script globally:
mw.loader.load('//en.wikipedia.org/w/index.php?title=User:Alexis_Jazz/LuckyRename.js&action=raw&ctype=text/javascript');
To load the script on a specific Wikimedia project, add the line to Special:MyPage/common.js on the project in question instead.
How to use
editAfter installation you will get an additional tool link (somewhere near Twinkle if you have enabled that as well) and a little four-leaf clover next to the file info on file pages, for example: "(250 × 375 pixels, file size: 110 KB, MIME type: image/png) 🍀". Click either the tool link or the four-leaf cover and LuckyRename will open. There is no tool link on the mobile site, only the four-leaf cover is available there.
Request a move or move a file
edit- Enter the desired target filename or press Feelin' lucky and adjust as needed.
- (optional) Select a reason for moving the file from the drop down menu and/or enter a custom reason.
- Press either Request move to request the move or (file movers only) Move file to actually move the file and replace existing usage.
When using Feelin' lucky, if the file is used on more than one article you can press Feelin' lucky again to cycle through the filename suggestions for each article. If the background of the filename field is green, the entered name is valid. If it's red, it isn't and the reason will be visible within the field on the right side. If it's yellow it's identical to the current name.
Decline a move request
edit- (optional) Enter a reason for declining the move request.
- Press "Decline".
If you're not a file mover you'll have to press "Override" first. If you're not a file mover, please only decline clearly bogus requests and vandalism.
Illegal characters
editThe following characters will be flagged as illegal by LuckyRename:
:
,/
,\
,#
,[
,]
,{
,}
,<
,>
,|
and non-ascii characters /[\\x00-\\x1f\\x7f]/ are disallowed by MediaWiki. LuckyRename tests for /[^\x00-\xFF]/ instead of /[\\x00-\\x1f\\x7f]/./
,?
,<
,>
,\
,:
,*
,|
"
are disallowed in Windows filenames (?
,*
and"
are allowed by MediaWiki)^
is disallowed in filenames when using FAT.
as the first character indicates a hidden file on various operating systems (but not on Windows), periods are allowed when they are not the first character!
has special meaning in C shell which might cause problems for someone who downloads the files and tries to process them with a script. It's rarely appropriate anyway.
If LuckyRename flags the filename that is entered as unacceptable you can use the "Override" button to request/move the file anyway. You will be appropriately warned.
Override
editThe "Override" button disables various sanity checks and relabels the "Move file" button to "YOLO!". It will also unlock the "Decline" button if you're not a file mover. Override at your own risk. Acceptable uses of override:
- A sanity check in LuckyRename is bugged. Please report the bug so it can be fixed.
- You absolutely must use
?
,*
,"
,^
,!
in the filename or have a.
as the first character and your hands are tied. Please try to find an alternative if you can. - You are not a file mover but have identified a rename request as clearly bogus/vandalism and want to decline it.
- Generate a Feelin' lucky suggestion from an article the file isn't used on. (you can enter the article title to use when you override)
- You need to resolve redirects for a manually moved file, updating articles and other pages to link to the current name instead of the redirect. To do this: press override, then press "Resolve redirects". The edit summary will be adjusted accordingly.
Features
editEveryone
edit- Integrated list of WP:FNC criteria. Never copy-paste again!
- Automatically checks if the chosen filename is in use either locally or on Commons
- Automatically checks if the chosen filename contains illegal characters
- Doesn't change watchlist settings for any edited page
- Feelin' lucky: too drunk to come up with a better filename? Just hit the button!
File movers
edit- Automatically replaces existing usage (including file links, links to the associated talk page and updating redirects)
- Automatically removes {{Rename media}} and {{ShadowsCommons}} from the file page
- Automatically unchecks leaving a redirect when selecting WP:FNC#9 (shadows a Commons file or redirect)
- Automatically tag the redirect for speedy deletion if you don't have the
suppressredirect
right which is only available to page movers and admins. Tags {{Db-r4}} if it shadows Commons, {{Db-g6}} with reference to WP:PMRC#10 otherwise provided the file is linked from less than 20 pages. - Fully {{Bots}} compliant for usage replacement (can be useful for lists of files in user space), will not edit pages where "luckyrename" or "userscript" is denied
- {{Automatically generated}} compliant, no links or usage on automatically generated pages with that template will be replaced.
- Automatic workaround for phab:T235589
Feelin' lucky
editExamples
edit- File:Fox Sports Racing.jpg.png → File:Fox Sports Racing (television channel) logo.png
- File:800px-DKSH logo.svg.png → File:DKSH (business) logo.png
- File:CC2 REISSUE COVER.gif.png → File:Cryptic Collection Vol. 2 (2001 compilation album).png
- File:Paadhamudrafilm.jpg.JPG → File:Padamudra (1988 film).jpg
- File:TheSexFactor.jpg.png → File:The Sex Factor (reality show).png
- File:Thunderbg.jpg.gif → File:Thunder Boogie (2002 album).gif
- File:Don Keefer.jpg.png → File:Don Keefer (actor, television actor, born 1916).png
Sometimes the generated filename isn't ideal though:
- File:Nikolay Prishchepa.jpg.png → File:Nikolay Prishchepa (military personnel, born 1900).png, better to say "major general" instead of "military personnel".
- File:Prince logo.svg → File:Prince (film actor, singer, film director, singer-songwriter, screenwriter, record producer, film score composer, film producer, multi-instrumentalist, musician, dancer, guitarist, composer, actor, acting, born 1958) logo.svg, it's not wrong really.
How Feelin' lucky works
edit- Checks the title of the first article in mainspace the file is used on. If the image isn't in use in mainspace, Feelin' lucky won't work. If the first article it's used on is only loosely related to the file (e.g. a list article) the suggestion will be useless. You can activate the lucky button again to try the next article the image is used on.
- Obtains various statements from the associated Wikidata item for the article
- Checks the file page for certain templates (logo, screenshot, etc)
- ?
- Profit!
Troubleshooting
editIssue | Solution |
---|---|
LuckyRename seems to be stuck with the progress bar nearly full. | It's probably not stuck but just replacing the file name in a huge (typically bot-generated) list like User:Kotepho/reports/orphaned fairuse media5. This may take several minutes. Check "What links here" to ensure all usages have been replaced. If the list is unmaintained and not actively used for anything, you can add {{Automatically generated}} or {{bots|deny=luckyrename}} to that list so LuckyRename won't try to edit that page again, significantly speeding up the process.
|
"Feelin' lucky" is grayed out. | File is not used in article space. If you know what the file depicts you can use the "override" button and enter the article title for Feelin' lucky to use. |
My computer or internet broke in the middle of a file move. | The actual move always comes first.
|
A {{Rename media}} request that spans multiple lines isn't processed correctly or not at all. | Keep your {{Rename media}} on a single line. There's no easy fix for this. |
I get JavaScript errors. | Please report them. |
Someone using LuckyRename is editing a page I don't want them to edit. | Add (if applicable) {{Automatically generated}} or {{bots|deny=luckyrename}} to the page in question.
|
Known issues and missing features
editSee this subpage for resolved issues.
- The characters "ł" and "ę" are detected as a disallowed character, even though they aren't. (File:Kozłówka Palace in Kozłówka, Lublin Voivodeship.jpg, File:GKS Jastrzębie logo (fair use).png)