"ମିଡ଼ିଆଉଇକି:Gadget-imagelinks.js" ପୃଷ୍ଠାର ସଂସ୍କରଣଗୁଡ଼ିକ ମଧ୍ୟରେ ତଫାତ
ଦେଖଣା
Content deleted Content added
Migration: wikiGetlink → getUrl |
|||
୨୫ କ ଧାଡ଼ି: | ୨୫ କ ଧାଡ଼ି: | ||
commonsBaseScript = '//commons.wikimedia.org/w/index.php?title=File:'; |
commonsBaseScript = '//commons.wikimedia.org/w/index.php?title=File:'; |
||
$( 'a.image' ).attr( 'href', function ( i, currVal ) { |
$( 'a.image, a.mw-file-description' ).attr( 'href', function ( i, currVal ) { |
||
if ( uploadBaseRe.test( $(this).find( 'img' ).attr( 'src' ) ) ) { |
if ( uploadBaseRe.test( $(this).find( 'img' ).attr( 'src' ) ) ) { |
||
return currVal |
return currVal |
୦୨:୪୦, ୮ ମାର୍ଚ୍ଚ ୨୦୨୩ ହୋଇଥିବା ରିଭିଜନ
/* _____________________________________________________________________________
* | |
* | === WARNING: GLOBAL GADGET FILE === |
* | Changes to this page affect many users. |
* | Please discuss changes on the talk page or on [[WT:Gadget]] before editing. |
* |_____________________________________________________________________________|
*
* Direct imagelinks to Commons
* Files hosted at Commons have local image links redirected to Commons.
* Imported from version 9 as of 2012-12-08
*
* @source mediawiki.org/wiki/Snippets/Direct_imagelinks_to_Commons
* @author [[commons:User:Krinkle]]
* @version 9
*/
if ( mw.config.get( 'wgNamespaceNumber', 0 ) >= 0 ) {
$( function () {
var
uploadBaseRe = /^\/\/upload\.wikimedia\.org\/wikipedia\/commons/,
localBasePath = mw.util.getUrl( mw.config.get( 'wgFormattedNamespaces' )['6'] + ':' ),
localBaseScript = mw.util.wikiScript() + '?title=' + mw.util.wikiUrlencode( mw.config.get( 'wgFormattedNamespaces' )['6'] + ':' ),
commonsBasePath = '//commons.wikimedia.org/wiki/File:',
commonsBaseScript = '//commons.wikimedia.org/w/index.php?title=File:';
$( 'a.image, a.mw-file-description' ).attr( 'href', function ( i, currVal ) {
if ( uploadBaseRe.test( $(this).find( 'img' ).attr( 'src' ) ) ) {
return currVal
.replace( localBasePath, commonsBasePath )
.replace( localBaseScript, commonsBaseScript );
}
});
});
}