Utente:Sanjilops/monobook.js: differenze tra le versioni

nessun oggetto della modifica
Nessun oggetto della modifica
Nessun oggetto della modifica
Riga 190:
if (!a_images.length) return;
var img, tmp;
var thumbs = new Array();
var names = new Array();
for (var i = 0; i < a_images.length; i++) {
img = a_images[i].getElementsByTagName('img')[0];
if (/\.gif$/i.test(img.src) && /\/images\/thumb\//.test(img.src) && /\bgif\b/i.test(img.alt != undefined)) {
if (!/\bgif\b/ithumbs.testpush(img.alt)) continue;
tmp = img.src.split('/');
imgnames.src = push("httpFile://images.wikia.com/nonciclopedia/images/" + tmp[tmp.length - 1].replace(/\d+px-/, ''));
}
}
if (!thumbs.length) return;
names = names.join('|');
var httpRequest = createRequest();
var id = setTimeout(function() { httpRequest.abort();}, 30000);
var param = encodeURIComponent("format=xml&action=query&prop=imageinfo&iiprop=url&titles=" + names);
httpRequest.onreadystatechange = function () { Receive(httpRequest, id, thumbs); return; }
httpRequest.open('POST', wgServer + wgScriptPath + "/api.php", true);
httpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
httpRequest.setRequestHeader('Content-Length', param.length);
httpRequest.send(param);
return;
function Receive(o, id, list) {
if (o.readyState != 4) return;
clearTimeout(id);
if (o.status != 200) return;
var xml = o.responseXML;
if (xml == null) return;
if (xml.normalize) xml.normalize();
var ii = xml.getElementsByTagName('ii');
for (var i = 0; i < ii.length; i++) {
/* NB: Si dà per scontato che l'ordine delle immagini nella risposta sia lo stesso della query */
list[i].src = ii[i].getAttribute('url');
}
return;
}
}
0

contributi