MediaWiki:Gadget-CatWatch.js: differenze tra le versioni

Contenuto cancellato Contenuto aggiunto
correzioni da parte di Rotpunkt
+ultime modifiche raggruppate, bugfix
Riga 55:
})
.fail(function (jqXHR, textStatus, errorThrown) {
if (mw.util.getParamValue('debug'))
alert('[Gadget-CatWatch] Errore nel leggere ' +
alert('[Gadget-CatWatch] Errore userConfignel +leggere ': ' + errorThrown);
// aggiornauserConfig + l'array: ' + errorThrown);
});
}
Line 118 ⟶ 119:
function parseWatchlistDOM() {
var ret = {};
// ogni giorno è un <ul class='special'h4>
$('ul.specialh4').each(function () {
//var ladate data= è nell'<h4> precedente l'ul$(this).specialtext();
var date = $(this).prev().text();
ret[date] = [];
// la pagina di ogni giorno è un <li> in un <ul class='special'>
$(this).next('ul.special').find('li').each(function () {
ret[date].push({
time: $(this).find('span.mw-changeslist-date').text(),
Riga 130:
});
});
// retrocompatibilità con il vecchio CatWatch: con la vista raggruppata
// visualizzava le pagine del CatWatch al fondo del giorno
if (ret[date].length == 0)
ret[date].push({
time: '23:59',
el: $(this).next('div').find('table:last-child()')
});
});
return ret;
Line 136 ⟶ 143:
// Aggiunge una pagina ad OsservatiSpeciali, se quel giorno è visualizzato
function watchlistAdd(watchlist, page, category) {
var ts, el, daypages, prepended = parseTimestamp(page.timestamp)false;
if (watchlist[ts.date]) {
ts = parseTimestamp(page.timestamp);
$.each(watchlist[ts.date], function(i, entry) {
daypages = if (watchlist[ts.time >= entry.time) {date];
if (daypages) {
var el = createWatchlistEl(page.title, ts.time, category);
// per tutte le pagine di quel giorno cerca quella col time antecedente entry.el.before(el);
$.each(watchlist[ts.date]daypages, function(iidx, entry) {
// aggiorna l'array
if watchlist[(ts.date].splice(i,time 0,> { time: tsentry.time,) el: el });{
return falseentry.el.before(el);
daypages.splice(targetIdx, 0, { time: ts.time, el: el });
prepended = true;
return false;
}
});
if (!prepended) {
daypages[daypages.length - 1].el.after(el);
daypages.push({ time: ts.time, el: el });
}
}
}