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

אין תקציר עריכה
מ 317 גרסאות של הדף wikipedia:he:מדיה_ויקי:Gadget-WLM.js יובאו
 
(47 גרסאות ביניים של משתמש אחר אחד אינן מוצגות)
שורה 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()
שורה 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')
})
.click(function() {
$('#newrevs')
.remove();
})
})
.addClass('blueedit'));
.addClass('blueedit WLM-newrevs'));
})
.done(function(data) {
var ans = data.query.watchlist;
newmap = {};
newmap = {};
var notif = 0;
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 {
var curnotif = ans[key].notificationtimestamp;
newmap[id] = {
newmap[id] = {
title: ans[key].title,
title: ans[key].title,
שורה 558: שורה 577:
notify: curnotif
notify: curnotif
};
};
if (notif === 0 && curnotif !== '')
notif = curnotif;
else if (notif !== '' and curnotif !== '' && notif > curnotif)
notif = curnotif;
}
}
});
});
whatsnewrec(newmap, Object.keys(newmap), notif);
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);
});
});
});
}
}
שורה 579: שורה 619:
}));
}));
keys.shift();
keys.shift();
whatsnewrec(newmap, keys);
whatsnewrec(newmap, keys, notif);
} else if (goldlength > 0) {
} else if (goldlength > 0) {
$('#newrevs')
$('#newrevs')
שורה 589: שורה 629:
.clone(true, true)[0]));
.clone(true, true)[0]));
keys.shift();
keys.shift();
whatsnewrec(newmap, keys);
whatsnewrec(newmap, keys, notif);
} else {
} else {
api.get({
var data3min = newmap[data].oldid;
action: 'query',
Object.keys(notif)
format: 'json',
.map(function(key) {
list: 'watchlist',
if (newmap[data].title == notif[key].title)
indexpageids: 1,
data3min = Math.min(data3min, notif[key].old_revid);
wldir: 'newer',
});
wllimit: 500,
$('#newrevs')
wlprop: 'title|ids|notificationtimestamp',
.append($('<span>', {
wlshow: 'unread',
text: ',' + langmark + ' '
wltype: 'edit|new',
})
wlstart: newmap[data].notificationtimestamp,
.prepend($('<a>', {
wlallrev: 1,
text: newmap[data].title,
errorformat: 'wikitext'
href: 'https://he.wikipedia.org/w/index.php?title=' +
})
newmap[data].title +
.done(function(data1) {
'&redirect=no&diff=cur&oldid=' + data3min,
var data1min = Infinity;
target: '_blank'
var ans = data1.query.watchlist;
Object.keys(ans)
.map(function(key) {
if (newmap[data].title == ans[key].title)
data1min = Math.min(data1min, ans[key].old_revid);
});
$('#newrevs')
.append($('<span>', {
text: ',' + langmark + ' '
})
})
.prepend($('<a>', {
.click(function() {
text: newmap[data].title,
$(this)
href: 'https://he.wikipedia.org/w/index.php?title=' +
.parent()
newmap[data].title +
.remove();
'&redirect=no&diff=cur&oldid=' +
$('.yellowedit')
Math.min(newmap[data].oldid, data1min) +
.hide();
'&notif=' + notif,
$('body')
target: '_blank'
.trigger('script-88-pretend-clicked');
})
})));
.click(function() {
$(this)
.parent()
.remove();
$('.yellowedit')
.hide();
$('body')
.trigger('script-88-pretend-clicked');
})));
keys.shift();
keys.shift();
whatsnewrec(newmap, keys);
whatsnewrec(newmap, keys, notif);
});
}
}
} else {
} else {
שורה 669: שורה 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])
שורה 710: שורה 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)
שורה 755: שורה 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'));
שורה 771: שורה 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'));
שורה 783: שורה 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();
});
});
}
}
שורה 829: שורה 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'),
שורה 849: שורה 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);