MediaWiki:Gadget-UncheckFileRedirect.js
Revision as of 17:34, 3 October 2022 by Jacmob (talk | contribs) (Created page with "→<nowiki> * Unchecks redirect checkbox on file pages * Because redirects in file namespace are usually unnecessary: ;(function ($, mw) { 'use strict'; var conf = mw.config.get([ 'wgCanonicalSpecialPageName', 'wgRelevantPageName' ]); $(function () { if (conf.wgCanonicalSpecialPageName === 'Movepage'){ if ((/File:/).test(conf.wgRelevantPageName)){ $('#wpLeaveRedirect > input').removeAttr('checked'); } } }); }(jQuery, mediaWiki)); /...")
Note: After publishing, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
- Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
- Opera: Press Ctrl-F5.
1 /* <nowiki>
2 * Unchecks redirect checkbox on file pages
3 * Because redirects in file namespace are usually unnecessary
4 */
5
6 ;(function ($, mw) {
7 'use strict';
8
9 var conf = mw.config.get([
10 'wgCanonicalSpecialPageName',
11 'wgRelevantPageName'
12 ]);
13
14 $(function () {
15 if (conf.wgCanonicalSpecialPageName === 'Movepage'){
16 if ((/File:/).test(conf.wgRelevantPageName)){
17 $('#wpLeaveRedirect > input').removeAttr('checked');
18 }
19 }
20 });
21 }(jQuery, mediaWiki));
22
23 // </nowiki>