מדיה ויקי:Gadget-WLM.js: הבדלים בין גרסאות בדף

אין תקציר עריכה
מ 317 גרסאות של הדף wikipedia:he:מדיה_ויקי:Gadget-WLM.js יובאו
 
(67 גרסאות ביניים של משתמש אחר אחד אינן מוצגות)
שורה 1: שורה 1:
/* jshint maxerr: 999 */
$(function() {
$(function() {
var timestamp, langmark, newmap;
var timestamp, langmark, newmap;
שורה 35: שורה 36:
loge: ['כאן', 'here'],
loge: ['כאן', 'here'],
clear: ['ניקוי', 'clear'],
clear: ['ניקוי', 'clear'],
nointernet: ['אין תקשורת', 'No internet'],
help: ['לפרטים ראו עזרה:מנהל רשימת המעקב', '']
help: ['לפרטים ראו עזרה:מנהל רשימת המעקב', '']
};
};
שורה 75: שורה 77:
var $this = $(this),
var $this = $(this),
diff = /diff=([0-9]+)/.exec($this.parent()
diff = /diff=([0-9]+)/.exec($this.parent()
.parent()
.find('a[href*="diff"]')
.find('a[href*="diff"]')
.filter(notme)
.filter(notme)
שורה 108: שורה 111:
.append($('<span>')
.append($('<span>')
.text(' ' + all.length + ' ' + i18n('manymarked') + ' ')
.text(' ' + all.length + ' ' + i18n('manymarked') + ' ')
.addClass('nowrap')
.css({
.css({
backgroundColor: 'red'
backgroundColor: 'red'
שורה 150: שורה 154:
.length > 0,
.length > 0,
oldrev = diffcond ? 0 : /oldid=([0-9]+)/.exec($this
oldrev = diffcond ? 0 : /oldid=([0-9]+)/.exec($this
.parent()
.parent()
.parent()
.find('a[href*="oldid"]')
.find('a[href*="oldid"]')
שורה 155: שורה 160:
.prop('href'))[1],
.prop('href'))[1],
diff = diffcond ? 0 : /diff=([0-9]+)/.exec($this
diff = diffcond ? 0 : /diff=([0-9]+)/.exec($this
.parent()
.parent()
.parent()
.find('a[href*="diff"]')
.find('a[href*="diff"]')
שורה 189: שורה 195:
.append($('<span>')
.append($('<span>')
.text(' ' + all.length + ' ' + i18n('manymarked') + ' ')
.text(' ' + all.length + ' ' + i18n('manymarked') + ' ')
.addClass('nowrap')
);
);
all.removeClass('mw-changeslist-line-not-watched yellowedit')
all.removeClass('mw-changeslist-line-not-watched yellowedit')
שורה 288: שורה 295:
var firstname = data.query.watchlist;
var firstname = data.query.watchlist;
if (firstname.length > 0) {
if (firstname.length > 0) {
firstname = firstname[0];
firstname = firstname.reverse()[0];
$('#WLM-table')
$('#WLM-table')
.parent()
.parent()
שורה 305: שורה 312:
.text(i18n('logb') + firstname.logaction + ' '))
.text(i18n('logb') + firstname.logaction + ' '))
.append($('<a>', {
.append($('<a>', {
href: 'https://he.wikipedia.org//w/api.php?action=query&format=rawfm&list=watchlist&' +
href: 'https://he.wikipedia.org//w/api.php?action=query&format=rawfm&list=watchlist&' +
'indexpageids=1&wllimit=500&wlprop=title%7Cloginfo%7Ctimestamp&wlshow=unread&wltype=log',
'indexpageids=1&wllimit=500&wlprop=title%7Cloginfo%7Ctimestamp&wlshow=unread&wltype=log',
text: i18n('logc')
text: i18n('logc')
})
})
.attr({
.attr({
שורה 347: שורה 354:
.after($('<div>')
.after($('<div>')
.text(' ' + all.length + ' ' + i18n('manymarked') + ' ')
.text(' ' + all.length + ' ' + i18n('manymarked') + ' ')
.addClass('nowrap')
)
)
.addClass('yellowedit');
.addClass('yellowedit');
שורה 456: שורה 464:
.append($('<span>')
.append($('<span>')
.text(' ' + all.length + ' ' + i18n('manymarked') + ' ')
.text(' ' + all.length + ' ' + i18n('manymarked') + ' ')
.addClass('nowrap')
.css({
.css({
backgroundColor: 'red'
backgroundColor: 'red'
שורה 518: שורה 527:


function whatsnew() {
function whatsnew() {
$('#newrevs')
$('.WLM-newrevs')
.remove();
.remove();
api.get({
api.get({
שורה 534: שורה 543:
errorformat: 'wikitext'
errorformat: 'wikitext'
})
})
.done(function(data) {
.fail(function() {
var ans = data.query.watchlist;
$('#WLM-table')
$('#WLM-table')
.parent()
.parent()
.after($('<div>', {
.after($('<div>', {
id: 'newrevs',
id: 'newrevs',
text: '['
text: i18n('nointernet')
})
})
.addClass('blueedit'));
.click(function() {
$('#newrevs')
.remove();
})
.addClass('blueedit WLM-newrevs'));
})
.done(function(data) {
var ans = data.query.watchlist;
newmap = {};
newmap = {};
var notif = '';
Object.keys(ans)
Object.keys(ans)
.map(function(key) {
.map(function(key) {
var id = ans[key].pageid;
var id = ans[key].pageid;
var curnotif = ans[key].notificationtimestamp;
if (notif === '')
notif = curnotif;
else if (curnotif !== '' && notif > curnotif)
notif = curnotif;
if (id in newmap) {
if (id in newmap) {
if (ans[key].old_revid < newmap[id].oldid)
if (ans[key].old_revid < newmap[id].oldid)
newmap[id].oldid = ans[key].old_revid;
newmap[id].oldid = ans[key].old_revid;
} else
} else {
newmap[id] = {
newmap[id] = {
title: ans[key].title,
title: ans[key].title,
oldid: ans[key].old_revid,
oldid: ans[key].old_revid,
notify: ans[key].notificationtimestamp
notify: curnotif
};
};
}
});
});
whatsnewrec(newmap, Object.keys(newmap));
api.get({
action: 'query',
format: 'json',
list: 'watchlist',
indexpageids: 1,
wldir: 'newer',
wllimit: 500,
wlprop: 'title|ids|notificationtimestamp',
wlshow: 'unread',
wltype: 'edit|new',
wlstart: notif,
wlallrev: 1,
errorformat: 'wikitext'
})
.done(function(data3) {
$('.WLM-newrevs')
.remove();
$('#WLM-table')
.parent()
.after($('<div>', {
id: 'newrevs',
text: '['
})
.addClass('blueedit WLM-newrevs'));
whatsnewrec(newmap, Object.keys(newmap), data3.query.watchlist);
});
});
}
 
function whatsnewrec(newmap, keys, notif) {
if (keys.length > 0) {
var data = keys[0];
var goldlength = $('.gold-' + data)
.length;
if (defected[data]) {
$('#newrevs')
.append($('<span>', {
text: newmap[data].title + ',' + langmark + ' '
}));
keys.shift();
whatsnewrec(newmap, keys, notif);
} else if (goldlength > 0) {
$('#newrevs')
$('#newrevs')
.append($('<span>', {
.append($('<span>', {
text: langmark,
text: newmap[data].title + ',' + langmark + ' ',
title: i18n('closenew'),
id: 'gold-little-' + data
id: 'closenew'
})
})
.click(function() {
.prepend($('.gold-' + data)
$('#newrevs')
.clone(true, true)[0]));
.remove();
keys.shift();
$('body')
whatsnewrec(newmap, keys, notif);
.trigger('script-88-pretend-clicked');
} else {
})
var data3min = newmap[data].oldid;
)
Object.keys(notif)
.append(']');
.map(function(key) {
})
if (newmap[data].title == notif[key].title)
.done(function() {
data3min = Math.min(data3min, notif[key].old_revid);
$('body')
});
.trigger('script-88-pretend-clicked');
$('#newrevs')
$('#td1')
.append($('<span>', {
.append($('.mw-rcfilters-ui-liveUpdateButtonWidget'));
text: ',' + langmark + ' '
});
})
}
.prepend($('<a>', {
 
text: newmap[data].title,
function whatsnewrec(newmap, keys) {
href: 'https://he.wikipedia.org/w/index.php?title=' +
if (keys.length > 0) {
newmap[data].title +
var data = keys[0];
'&redirect=no&diff=cur&oldid=' + data3min,
var goldlength = $('.gold-' + data)
target: '_blank'
.length;
})
if (defected[data]) {
.click(function() {
$('#newrevs')
$(this)
.append($('<span>', {
.parent()
text: newmap[data].title + ',' + langmark + ' '
.remove();
}));
$('.yellowedit')
keys.shift();
.hide();
whatsnewrec(newmap, keys);
$('body')
} else if (goldlength > 0) {
.trigger('script-88-pretend-clicked');
$('#newrevs')
})));
.append($('<span>', {
keys.shift();
text: newmap[data].title + ',' + langmark + ' ',
whatsnewrec(newmap, keys, notif);
id: 'gold-little-' + data
}
})
.prepend($('.gold-' + data)
.clone(true, true)[0]));
keys.shift();
whatsnewrec(newmap, keys);
} else {
} else {
$('#newrevs')
$('#newrevs')
.append($('<span>', {
.append($('<span>', {
text: ',' + langmark + ' '
text: langmark,
})
title: i18n('closenew'),
.prepend($('<a>', {
id: 'closenew'
text: newmap[data].title,
href: 'https://he.wikipedia.org/w/index.php?title=' +
newmap[data].title +
'&redirect=no&diff=cur&oldid=' + newmap[data].oldid,
target: '_blank'
})
})
.click(function() {
.click(function() {
$(this)
$('#newrevs')
.parent()
.remove();
.remove();
$('.yellowedit')
.hide();
$('body')
$('body')
.trigger('script-88-pretend-clicked');
.trigger('script-88-pretend-clicked');
})));
})
keys.shift();
)
whatsnewrec(newmap, keys);
.append(']');
$('body')
.trigger('script-88-pretend-clicked');
$('#td1')
.append($('.mw-rcfilters-ui-liveUpdateButtonWidget'));
}
}
}
}
}


function hider(state) {
function hider(state) {
שורה 638: שורה 690:
'.mw-rcfilters-ui-filterWrapperWidget, .rcfilters-container'
'.mw-rcfilters-ui-filterWrapperWidget, .rcfilters-container'
)
)
.hide();
$('#mw-watchlist-form')
.hide();
.hide();
if (config.edit[state])
if (config.edit[state])
שורה 679: שורה 733:
'.mw-rcfilters-ui-filterWrapperWidget, .rcfilters-container'
'.mw-rcfilters-ui-filterWrapperWidget, .rcfilters-container'
)
)
.show();
$('#mw-watchlist-form')
.show();
.show();
if (config.edit.show)
if (config.edit.show)
שורה 724: שורה 780:
.append($(
.append($(
'.mw-rcfilters-ui-filterWrapperWidget-showNewChanges'));
'.mw-rcfilters-ui-filterWrapperWidget-showNewChanges'));
if ($('#td5 span.oo-ui-element-hidden').length !== 0) {
$('#td5 span.oo-ui-element-hidden .oo-ui-labelElement-label')
.html('');
$('#td5 span.oo-ui-element-hidden')
.removeClass('oo-ui-element-hidden oo-ui-labelElement');
$('.mw-rcfilters-ui-filterWrapperWidget-showNewChanges')
.css('margin-top', '0px')
.removeClass('oo-ui-buttonElement-frameless')
.addClass('oo-ui-buttonElement-framed');
}
$('#td6')
$('#td6')
.append($('.mw-rcfilters-ui-markSeenButtonWidget'));
.append($('.mw-rcfilters-ui-markSeenButtonWidget'));
שורה 740: שורה 806:
.last());
.last());
});
});
$('.mw-rcfilters-ui-changesListWrapperWidget-highlights')
$('.mw-rcfilters-ui-filterWrapperWidget-showNewChanges a')
.remove();
.attr({accessKey:'k'});
seen($('.mw-changeslist-line-watched span.mw-title'));
seen($('.mw-changeslist-line-watched span.mw-title'));
unseen($('.mw-changeslist-line-not-watched span.mw-title'));
unseen($('.mw-changeslist-line-not-watched span.mw-title'));
שורה 752: שורה 818:
.append($('.mw-rcfilters-ui-liveUpdateButtonWidget'));
.append($('.mw-rcfilters-ui-liveUpdateButtonWidget'));
hider('starthidden');
hider('starthidden');
$('.mw-rcfilters-ui-changesListWrapperWidget-highlights, .mw-rcfilters-ui-highlights')
.remove();
});
});
}
}
שורה 798: שורה 866:
}
}


mw.loader.load('ext.gadget.GlobalWatchlist');
if (mw.config.get('wgCanonicalSpecialPageName') == 'Watchlist') {
if (mw.config.get('wgCanonicalSpecialPageName') == 'Watchlist') {
var langcode = mw.config.get('wgUserLanguage'),
var langcode = mw.config.get('wgUserLanguage'),
שורה 818: שורה 887:
})
})
.then(function() {
.then(function() {
try {
config = require('./WLM.json');
} catch (err) {
config = null;
}
$.get(mw.util.wikiScript(), {
$.get(mw.util.wikiScript(), {
title: 'מדיה ויקי:Gadget-WLM.json',
title: 'משתמש:' + mw.config.get('wgUserName') + '/WLM.json',
action: 'raw'
action: 'raw'
})
})
.done(function(data) {
.done(function(data1) {
config = JSON.parse(data);
config = JSON.parse(data1);
$.get(mw.util.wikiScript(), {
title: 'משתמש:' + mw.config.get('wgUserName') + '/WLM.json',
action: 'raw'
})
.done(function(data1) {
config = JSON.parse(data1);
})
.always(function() {
if (isnewfilter) {
$('#td5')
.append($(
'.mw-rcfilters-ui-filterWrapperWidget-showNewChanges'));
mw.hook('wikipage.content')
.add(main);
} else
main();
});
})
})
.fail(function() {
.fail(function() {
console.log('ERR: ' + i18n('jsonlost'));
if (config == null)
alert('ERR: ' + i18n('jsonlost'));
})
.always(function() {
if (isnewfilter) {
$('#td5')
.append($(
'.mw-rcfilters-ui-filterWrapperWidget-showNewChanges'));
mw.hook('wikipage.content')
.add(main);
} else
main();
});
});
});
});
$('.mw-rcfilters-ui-filterWrapperWidget-showNewChanges')
.css('margin-top', '0px')
.removeClass('oo-ui-buttonElement-frameless')
.addClass('oo-ui-buttonElement-framed');
var widgetWhatsnew = new OO.ui.ButtonWidget({
var widgetWhatsnew = new OO.ui.ButtonWidget({
label: i18n('whatsnew'),
label: i18n('whatsnew'),
title: i18n('help'),
title: i18n('help'),
id: 'whatsnew'
id: 'whatsnew',
accessKey: 'o'
});
});
widgetWhatsnew.on('click', whatsnew);
widgetWhatsnew.on('click', whatsnew);
שורה 912: שורה 977:
$('#mw-watchlist-resetbutton, .mw-rcfilters-ui-markSeenButtonWidget')
$('#mw-watchlist-resetbutton, .mw-rcfilters-ui-markSeenButtonWidget')
.children()
.children()
.css({backgroundColor: "lightcoral"});
.css({
if (! isnewfilter) {
backgroundColor: "lightcoral"
});
if (!isnewfilter) {
widgetFilters = new OO.ui.ButtonWidget({
widgetFilters = new OO.ui.ButtonWidget({
label: i18n('rcfilters'),
label: i18n('rcfilters'),
שורה 922: שורה 989:
window.location.href = new mw.Uri()
window.location.href = new mw.Uri()
.extend({
.extend({
rcfilters:1,
rcfilters: 1,
liveupdate:1
liveupdate: 1
});
});
});
});