MediaWiki talk:Gadget-imagelinks.js

Doesn't work for all links
This gadget seems not to be working in all cases. A link like File:Roger Willemsen signature.svg isn't redirected to commons. --Patrick87 (talk) 14:19, 29 April 2013 (UTC)


 * I investigated the issue and sadly this is a limitation of the script (see here). --Patrick87 (talk) 17:30, 29 April 2013 (UTC)

Fix paths
Whenever this gadget is included multiple times (as in d:MediaWiki:Common.js and m:User:Ricordisamoa/global.js) all file links result in "//commons.wikimedia.org//commons.wikimedia.org/wiki/File:...". The issue would be solved by replacing  and   in   only at the string beginning. Thanks in advance, -- Ricordi  samoa  05:41, 31 August 2013 (UTC)
 * Sorry, I'm not really sure what you mean. Can you post working code somewhere and then I can copy it over? Thanks, Legoktm (talk) 21:49, 1 September 2013 (UTC)
 * Replace these two lines:

localBasePath = mw.util.wikiGetlink( mw.config.get( 'wgFormattedNamespaces' )['6'] + ':' ), localBaseScript = mw.util.wikiScript + '?title=' + mw.util.wikiUrlencode( mw.config.get( 'wgFormattedNamespaces' )['6'] + ':' ), With these two lines: localBasePath = new RegExp('^' + mw.util.wikiGetlink( mw.config.get( 'wgFormattedNamespaces' )['6'] + ':' ).replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&")), localBaseScript = new RegExp('^' + (mw.util.wikiScript + '?title=' + mw.util.wikiUrlencode( mw.config.get( 'wgFormattedNamespaces' )['6'] + ':' )).replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&")), Jackmcbarn (talk) 00:59, 4 September 2013 (UTC)
 * ✅ &mdash; Martin (MSGJ · talk) 09:53, 4 September 2013 (UTC)
 * or Could you please delete User:Ricordisamoa/imagelinks.js? I created it as sandbox, but it's unuseful now. Thanks, --  Ricordi  samoa  23:13, 7 September 2013 (UTC)
 * ✅ by --  Ricordi  samoa  22:23, 13 September 2013 (UTC)

$.escapeRE is not a function
I'm using this gadget externally by importing it into global.js. When I do so using Chrome 54, I get an error on Wikimedia pages: index.php?title=MediaWiki:Gadget-imagelinks.js&action=raw&ctype=text/javascript:21 Uncaught TypeError: $.escapeRE is not a function James Martindale (talk) 06:17, 21 November 2016 (UTC)

Prepare for T314318
Please copy this upstream change, https://www.mediawiki.org/w/index.php?title=Snippets%2FDirect_imagelinks_to_Commons&type=revision&diff=5451422&oldid=3976429

For more information, see Parsoid/Parser_Unification/Media_structure/FAQ

Thanks, Arlolra (talk) 20:45, 24 November 2022 (UTC)
 * ✅ — xaosflux  Talk 00:43, 25 February 2023 (UTC)