User:Majr/codeLinks.js

$( function { 'use strict';

var $code = $( '.mw-code' ), interwikiTable = { '4jstudiostweet':     'https://twitter.com/4JStudios/status/$1', 'apibug':             'https://mojang.atlassian.net/browse/MCAPI-$1', 'bomuboitweet':       'https://twitter.com/BomuBoi/status/$1', 'bug':                'https://mojang.atlassian.net/browse/MC-$1', 'c418tweet':          'https://twitter.com/C418/status/$1', 'cache':              'https://www.google.com/search?q=cache:$1', 'carlmannehtweet':    'https://twitter.com/carlmanneh/status/$1', 'carnalizertweet':    'https://twitter.com/carnalizer/status/$1', 'commons':            'https://commons.wikimedia.org/wiki/$1', 'danfrisktweet':      'https://twitter.com/danfrisk/status/$1', 'de':                 'http://minecraft-de.gamepedia.com/$1', 'dinnerbonetweet':    'https://twitter.com/Dinnerbone/status/$1', 'en':                 'http://minecraft.gamepedia.com/$1', 'es':                 'http://minecraft-es.gamepedia.com/$1', 'evilsephtweet':      'https://twitter.com/EvilSeph/status/$1', 'fr':                 'http://minecraft-fr.gamepedia.com/$1', 'google':             'https://www.google.com/search?q=$1', 'hu':                 'http://minecraft-hu.gamepedia.com/$1', 'it':                 'http://minecraft-it.gamepedia.com/$1', 'ja':                 'http://minecraft-ja.gamepedia.com/$1', 'jahkobtweet':        'https://twitter.com/JahKob/status/$1', 'jbernhardssontweet': 'https://twitter.com/jbernhardsson/status/$1', 'jebtweet':           'https://twitter.com/jeb_/status/$1', 'jnkboytweet':        'https://twitter.com/jnkboy/status/$1', 'jonkagstromtweet':   'https://twitter.com/jonkagstrom/status/$1', 'junkboytweet':       'https://twitter.com/jnkboy/status/$1', 'kappischetweet':     'https://twitter.com/Kappische/status/$1', 'ko':                 'http://minecraft-ko.gamepedia.com/$1', 'krisjelbringtweet':  'https://twitter.com/KrisJelbring/status/$1', 'lydiawinterstweet':  'https://twitter.com/LydiaWinters/status/$1', 'm':                  'https://meta.wikimedia.org/wiki/$1', 'marctweet':          'https://twitter.com/Marc_IRL/status/$1', 'marcwatsontweet':    'https://twitter.com/Marc_IRL/status/$1', 'mcapibug':           'https://mojang.atlassian.net/browse/MCAPI-$1', 'mcbug':              'https://mojang.atlassian.net/browse/MC-$1', 'mcf':                'http://www.minecraftforum.net/forum/$1', 'mcfnews':            'http://www.minecraftforum.net/news/$1', 'mcftopic':           'http://www.minecraftforum.net/topic/$1', 'mcpebug':            'https://mojang.atlassian.net/browse/MCPE-$1', 'mediawikiwiki':      'https://www.mediawiki.org/wiki/$1', 'mediazilla':         'https://bugzilla.wikipedia.org/$1', 'meta':               'https://meta.wikimedia.org/wiki/$1', 'metawikipedia':      'https://meta.wikimedia.org/wiki/$1', 'minecraftchicktweet': 'https://twitter.com/MinecraftChick/status/$1', 'mollstamtweet':      'https://twitter.com/mollstam/status/$1', 'mozillawiki':        'https://wiki.mozilla.org/index.php/$1', 'mw':                 'https://www.mediawiki.org/wiki/$1', 'mwbug':              'https://bugzilla.wikimedia.org/show_bug.cgi?id=$1', 'nl':                 'http://minecraft-nl.gamepedia.com/$1', 'notchtweet':         'https://twitter.com/notch/status/$1', 'pebug':              'https://mojang.atlassian.net/browse/MCPE-$1', 'pl':                 'http://minecraft-pl.gamepedia.com/$1', 'pt-br':              'http://minecraft-br.gamepedia.com/$1', 'ru':                 'http://minecraft-ru.gamepedia.com/$1', 'thewordofnotch':     'http://notch.tumblr.com/post/$1', 'twitter':            'https://twitter.com/$1/', 'wikia':              'http://www.wikia.com/wiki/$1', 'wikimedia':          'https://wikimediafoundation.org/wiki/$1', 'wikipedia':          'https://en.wikipedia.org/wiki/$1', 'wordofnotch':        'http://notch.tumblr.com/post/$1', 'wp':                 'https://en.wikipedia.org/wiki/Wikipedia:$1', 'xlsontweet':         'https://twitter.com/xlson/status/$1', 'zetterstrandtweet':  'https://twitter.com/Zetterstrand/status/$1', 'zh':                 'http://minecraft-zh.gamepedia.com/$1' };

if ( mcw.onlyLinkComment ) { $code = $code.find( '.comment' ); }

$code.html( function( i, html ) {	return html.replace( /(?:\[\[([^\[\]#<>\|{}\n]*?)\]\]|((\w*?:)?(mailto:|MAILTO:|\/\/)[\w\-\._~@&]+\.[\w\-\._~@&]+(:\d+)?(\/[\w\-\._~\/&:]*)?(\?[\w\-\._~=&:\/;]*)?(#[\w\-\._~&:]*)?))/g, function( m, wiki, ext ) { if ( wiki ) { var parts = wiki.split( ':' ), url = '/' + wiki; parts[1] = parts.slice( 1 ).join( ':' ); if ( interwikiTable[parts[0].toLowerCase] ) { url = interwikiTable[parts[0].toLowerCase].replace( /\$1/, parts[1] ); }				return '' + mw.html.escape( wiki ) + ''; } else if ( ext ) { return '' + ext + ''; }	} ); } );

} );