Description | Give Commons redirects a wedgie |
---|---|
Author(s) | User:Alexis Jazz |
Status | haven't had any complaints |
Updated | March 13, 2022 |
Skin support | all |
Source | User:Alexis Jazz/RedirectCommonsRedirects.js |
When looking at a file page that doesn't exist as a file locally but exists as a redirect on Commons, add ?redirect=no to the url to see the page as if the Commons redirect doesn't exist, showing deletion logs or a local non-file page which is otherwise inaccessible. This also acts as a workaround for Phabricator: An image redirect from a foreign shared File Repository overrides local wiki page.
Plenty of links on User:Alexis Reggae/The Real Slim ShadyCommons to test the effect.
For reference:
- You open a file page that does not exist locally but is a redirect on Commons. The target exists as a file on Commons but not locally. You are shown the Commons target file but the URL doesn't change and has become desynchronized. This script adds ?redirect=no.
- You open a local file page that is a redirect on Commons. The target exists as a file on Commons but not locally. See above.
- You open a local file page that is a redirect on Commons. The target exists locally. You are redirected to the local target. This script redirects you back.
- You open a local file page that is a local redirect. The target exists locally. You are redirected to the local target. This script redirects you back.
That last case isn't actually a Commons redirect, but there's no way to distinguish the two (well, not without making the script substantially bigger) and if you got redirected you should update the source link anyway.
This script can be loaded globally safely, it detects when you are on Commons and disables itself.
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/RedirectCommonsRedirects.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.