MediaWiki talk:Gadget-imagelinks.js
Doesn't work for all links
editThis 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
editThis edit request has been answered. Set the |answered= or |ans= parameter to no to reactivate your request. |
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 localBasePath
and localBaseScript
in currVal
only at the string beginning. Thanks in advance, --Ricordisamoa 05:41, 31 August 2013 (UTC)
- @Ricordisamoa: 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)
- @Legoktm: 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)
- Done — Martin (MSGJ · talk) 09:53, 4 September 2013 (UTC)
- @Legoktm: or @MSGJ: Could you please delete User:Ricordisamoa/imagelinks.js? I created it as sandbox, but it's unuseful now. Thanks, --Ricordisamoa 23:13, 7 September 2013 (UTC)
- Done — Martin (MSGJ · talk) 09:53, 4 September 2013 (UTC)
$.escapeRE is not a function
editI'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
This edit request has been answered. Set the |answered= or |ans= parameter to no to reactivate your request. |
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 mw:Parsoid/Parser_Unification/Media_structure/FAQ
Thanks, Arlolra (talk) 20:45, 24 November 2022 (UTC)