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

Vai alla navigazione Vai alla ricerca
nessun oggetto della modifica
Nessun oggetto della modifica
Nessun oggetto della modifica
Riga 9:
FastOpen();
editcurrentid();
gif_hack();
if (document.getElementById('alert-load')) alert("alert onload presenti");
if (document.getElementById('alert-unload')) alert("alert onunload presenti");
Line 180 ⟶ 181:
}
} // <-quicksaveX()
 
 
var disable_gif_hack = false;
function gif_hack () {
if (disable_gif_hack) return false;
var a_images = getElementsByClass(document.getElementById('bodyContent'), 'image', 'a');
if (!a_images.length) return;
var gif_thumbs = new Array();
var img;
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)) gif_thumbs.push(img)
}
if (!gif_thumbs.length) return;
var ani_gif_urls;
get_urls();
var thumb_name, gif_name, tmp;
for (var I = 0; I < gif_thumbs.length; I++) {
tmp = gif_thumbs[I].src.split('/');
thumb_name = tmp[tmp.length - 1];
for (i = 0; i < ani_gif_urls.length; i++) {
tmp = ani_gif_urls[i].src.split('/');
gif_name = tmp[tmp.length - 1];
if (thumb_name == gif_name) {
gif_thumbs[I].src = "http://images.wikia.com/nonciclopedia/images/" + ani_gif_urls[i];
break;
}
}
}
return;
function get_urls() {
var cookie = getCookie("ani_gif_urls");
if (cookie == null) {
ani_gif_urls = new Array ();
Request(null);
return;
}
ani_gif_urls = cookie.split('|');
return;
}
function Request(gcmcontinue) {
var httpRequest = createRequest();
var id = setTimeout(function() { httpRequest.abort();}, 30000);
var param = "/api.php?action=query&format=xml&generator=categorymembers&gcmtitle=Category:Immagini_gif&gcmnamespace=6&gcmprop=title&gcmlimit=500&prop=imageinfo&iiprop=url";
if (gcmcontinue) param += "&gcmcontinue=" + encodeURIComponent(gcmcontinue);
httpRequest.onreadystatechange = function () { Receive(httpRequest, id, link, file); return; }
httpRequest.open('GET', wgServer + wgScriptPath + param, true);
httpRequest.send('');
return;
}
 
function Receive(o, id, link, file) {
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++) {
ani_gif_urls.push(ii[i].getAttribute('url').replace("http://images.wikia.com/nonciclopedia/images/", ''));
}
if (xml.getElementsByTagName('query-continue').length) Request(xml.getElementsByTagName('categorymembers')[0].getAttribute('gcmcontinue'));
else { // lista finita: salva cookie;
var exdate = new Date();
exdate.setDate(exdate.getDate() + 7);
document.cookie = "ani_gif_urls=" + escape(ani_gif_urls.join('|')) + ";expires=" + exdate.toUTCString());
}
return;
}
}
0

contributi

I cookie ci aiutano a fornire i nostri servizi. Utilizzando i nostri servizi, accetti il nostro utilizzo dei cookie.

Menu di navigazione