User:User-12316399/MediaWiki editcopy:Gadget-ImageForeignUseCheck

// Adapted from script By Equazcion: https://terraria.gamepedia.com/User:Equazcion

var wgNamespaceNumber = mw.config.get( 'wgNamespaceNumber' ); var wgPageName = mw.config.get( 'wgPageName' ); var wgTitle = mw.config.get( 'wgTitle' );

if (wgNamespaceNumber == 6) { $('#mw-imagepage-reupload-link').append(		$('').append( $('', {'class':'foreignLink', 'href':'#ddd', 'text':'List foreign uses'}) )	);	$('.foreignLink').click(function{		$('.interUses').remove;		$('div[id$="linkstoimage"]').append($('', {'class':'interUses'}));		var $interUses = $('.interUses');		var URLprefix = 'https://', 			URLsuffix = '.gamepedia.com/api.php?format=json&callback=?';		var msgForeignUses = 'Foreign uses',			msgImageLink = 'image page',			msgNoUses = 'No foreign uses of this image were detected.';		$interUses.append( $(' ', {'text':msgForeignUses, 'style':'margin-left:-22px;'}) );		var langs = {			"Czech":"minecraft-cs",			"French":"minecraft-fr",			"Greek":"minecraft-el",			"Italian":"minecraft-it",			"Thai":"minecraft-th",			"Turkish":"minecraft-tr",			"Ukrainian":"minecraft-uk",			"Russian":"minecraft-ru",			"Polish":"minecraft-pl",			"Portuguese":"minecraft-pt",			"Korean":"minecraft-ko",			"Chinese":"minecraft-zh",			"Ukrainian":"minecraft-uk",			"German":"minecraft-de",			"Hungarian":"minecraft-hu", "Feed The Beast":"ftb", "Aether Mod":"aether", "Mo' Creatures Mod": "mocreatures", "Feed The Beast":"ftb", };		$interUses.append( $(' ', {'text': msgNoUses, 'class':'no_foreign_uses'}) ); $.each(langs, function(key, value) {			var currentLangCode = value;			var request2 = { action:'query', list:'allimages', ailimit:'1',	aifrom:wgTitle }			$.getJSON(URLprefix + currentLangCode + URLsuffix, request2, function(response2) { $.each(response2.query.allimages, function(index, value){					if (value.name != wgTitle.replace(/ /g,'_')){						var request1 = { action:'query', list:'imageusage', iutitle:wgPageName };						$.getJSON(URLprefix + currentLangCode + URLsuffix, request1, function(response1) { var currentLangName = key; if (response1.query.imageusage.length > 0) { var urlImage = URLprefix + currentLangCode + '.gamepedia.com/' + wgPageName; $('.no_foreign_uses').remove; $interUses.append(									$(' ', {'style':'margin-left:-20px;', 'text':currentLangName}).append( $(' ', {'style':'font-size:85%;'}).append(											' (', $('', {'href':urlImage, 'text':msgImageLink}), ')'										) )								);								$.each(response1.query.imageusage, function(index, value) {									var urlUse = URLprefix + currentLangCode + '.gamepedia.com/' + value.title;									$interUses.append( $('').append(											$('', {'href': urlUse, 'text':value.title})										) );								});							}						});					}				});			});		});	setTimeout(function{$interUses[0].scrollIntoView(true)}, 1000); }); }