Участник:WindEwriX/tineye.js

// from Tineye gadget for Commons and ukwiki
//<nowiki>
$(function () {
'use strict';
if (mw.config.get('wgNamespaceNumber') !== 6 || mw.config.get('wgAction') !== "view" || !document.getElementById('file'))
	return;

var img = document.getElementById('file').getElementsByTagName('img');
if (!img || !img.length)
	return; // No preview image, e.g. for large PNGs

img = img[0];
var imgURL = img.parentNode.href;
if (!imgURL)
	return; // This occurs with thumbs of videos/sounds for instance

if (img.width <= 300)
	imgURL = img.src; // Image smaller than 300px width
else { // Get thumb url
	if (imgURL.indexOf("/commons/")==-1) 
		var n = imgURL.indexOf("/ru/") + 4;
	else
		n = imgURL.indexOf("/commons/") + 9;
	imgURL = imgURL.substr(0, n) + "thumb/" + imgURL.substr(n);
	n = imgURL.lastIndexOf('/') + 1;
	imgURL += "/300px-" + imgURL.substring(n);
	if (!imgURL.slice(-3).indexOf("svg"))
		imgURL += ".png";
}

mw.util.addPortletLink('p-cactions', 'https://tineye.com/search?url=' + encodeURIComponent(imgURL) + '&sort=size&order=desc', 'TinEye', 'ca-tineye', null).children[0].target = '_blank';
});
// </nowiki>

 

Prefix: a b c d e f g h i j k l m n o p q r s t u v w x y z 0 1 2 3 4 5 6 7 8 9

Portal di Ensiklopedia Dunia