From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.

/**

 * Direct imagelinks to Commons

 *

 * @source: http://www.mediawiki.org/wiki/Snippets/Direct_imagelinks_to_Commons

 * @author: [[commons:User:Krinkle]]

 * @rev: 5

 */

if ( mw.config.get( 'wgNamespaceNumber', 0 ) >= 0 ) {

        $(document).ready( function() {

                // Must be relative without "https://secure.wikimedia.org."

                // to avoid triggering 'div#content a[href ^="https://"]' lock-icons

                var     commonsBase = mw.config.get( 'wgServer' ) === "https://secure.wikimedia.org"

                                ? '/wikipedia/commons/wiki/File:'

                                : '//commons.wikimedia.org/wiki/File:',

                        localBase = mw.util.getUrl( mw.config.get( 'wgFormattedNamespaces' )['6' + ':' ),

                        uploadBaseRe = new RegExp( '^' + $.escapeRE( '//upload.wikimedia.org/wikipedia/commons/' ) );

 

                $( 'a.image, a.mw-file-description' ).attr( 'href', function( i, currVal ) {

                        if ( uploadBaseRe.test( $(this).find( 'img' ).attr( 'src' ) ) ) {

                                return currVal.replace( localBase, commonsBase );

                        }

                });

 

        });

}
From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.

/**

 * Direct imagelinks to Commons

 *

 * @source: http://www.mediawiki.org/wiki/Snippets/Direct_imagelinks_to_Commons

 * @author: [[commons:User:Krinkle]]

 * @rev: 5

 */

if ( mw.config.get( 'wgNamespaceNumber', 0 ) >= 0 ) {

        $(document).ready( function() {

                // Must be relative without "https://secure.wikimedia.org."

                // to avoid triggering 'div#content a[href ^="https://"]' lock-icons

                var     commonsBase = mw.config.get( 'wgServer' ) === "https://secure.wikimedia.org"

                                ? '/wikipedia/commons/wiki/File:'

                                : '//commons.wikimedia.org/wiki/File:',

                        localBase = mw.util.getUrl( mw.config.get( 'wgFormattedNamespaces' )['6' + ':' ),

                        uploadBaseRe = new RegExp( '^' + $.escapeRE( '//upload.wikimedia.org/wikipedia/commons/' ) );

 

                $( 'a.image, a.mw-file-description' ).attr( 'href', function( i, currVal ) {

                        if ( uploadBaseRe.test( $(this).find( 'img' ).attr( 'src' ) ) ) {

                                return currVal.replace( localBase, commonsBase );

                        }

                });

 

        });

}

Videos

Youtube | Vimeo | Bing

Websites

Google | Yahoo | Bing

Encyclopedia

Google | Yahoo | Bing

Facebook