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

אין תקציר עריכה
מ 1,117 גרסאות של הדף wikipedia:he:מדיה_ויקי:Gadget-WLM-draft.js יובאו
 
(15 גרסאות ביניים של משתמש אחר אחד אינן מוצגות)
שורה 1: שורה 1:
var timestamp;
$(function() {
new mw.Api()
var timestamp, langmark;
.get({
var api = new mw.Api();
action: 'query',
api.get({
format: 'json',
action: 'query',
curtimestamp: 1
format: 'json',
})
curtimestamp: 1
.done(function(data) {
})
timestamp = data.curtimestamp;
.done(function(data) {
});
timestamp = data.curtimestamp;
});


$(function() {
function i18n(name) {
function i18n(name) {
var msg = {
var msg = {
שורה 19: שורה 19:
markCat: ['סימון קטגוריה כנקראה', 'Mark categorization as read'],
markCat: ['סימון קטגוריה כנקראה', 'Mark categorization as read'],
manymarked: ['שורות סומנו', 'lines marked'],
manymarked: ['שורות סומנו', 'lines marked'],
goldbutton: ['פתיחה וסימון של כל העריכות בדף הזה', 'Open and mark all this page revisions'],
goldbutton: ['פתיחה וסימון של כל העריכות בדף הזה',
'Open and mark all this page revisions'
],
jsonlost: ['קובץ קונפיגורציה לא אותר', 'Configuration file not found'],
jsonlost: ['קובץ קונפיגורציה לא אותר', 'Configuration file not found'],
hideAll: ['הסתרת עריכות שנקראו', 'Hide all read'],
hideAll: ['הסתרת עריכות שנקראו', 'Hide all read'],
showAll: ['הצגת עריכות שהוסתרו', 'Show all hidden'],
showAll: ['הצגת עריכות שהוסתרו', 'Show all hidden'],
whatsnew: ['מה חדש?', "What's new?"],
whatsnew: ['מה חדש?', "What's new?"],
closenew: ['סגירת רשימת החדשים', "Close the bar"],
loga: ['שימו לב: רשימת המעקב כוללת רשומת יומן שלא נקראה. הדף הוא ',
loga: ['שימו לב: רשימת המעקב כוללת רשומת יומן שלא נקראה. הדף הוא ',
'Pay attention: the watchlist includes unread log entry. Page name: '
'Pay attention: the watchlist includes unread log entry. Page name: '
שורה 29: שורה 32:
logb: [', הפעולה שנעשתה היא: ', ', log action: '],
logb: [', הפעולה שנעשתה היא: ', ', log action: '],
logc: ['(לפרטים)', '(details)'],
logc: ['(לפרטים)', '(details)'],
logd: ['אם ברצונכם לסמן אותה כנקראה, בדקו כי אין עריכות אחרות של הדף הזה שלא נקראו,' +
logd: [
' כי גם הן יסומנו. לאחר מכן לחצו ', 'If you want to mark it as read, check that there are' +
'אם ברצונכם לסמן אותה כנקראה, בדקו כי אין עריכות אחרות של הדף הזה שלא נקראו,' +
' כי גם הן יסומנו. לאחר מכן לחצו ',
'If you want to mark it as read, check that there are' +
' no other unwatched revisions of this page, because they will be marked too. Then click '
' no other unwatched revisions of this page, because they will be marked too. Then click '
],
],
שורה 42: שורה 47:
function button(msg, icon) {
function button(msg, icon) {
return $('<a>', {
return $('<a>', {
text: '\u200f',
text: langmark,
title: i18n(msg),
title: i18n(msg),
href: '#nw'
href: '#nw'
שורה 69: שורה 74:
.hide();
.hide();
var curid = /curid=([0-9]+)/.exec($(this)
var curid = /curid=([0-9]+)/.exec($(this)
.closest('table, li')
.closest('table, li')
.find('a[href*="curid"]')
.find('a[href*="curid"]')
.filter(notme)
.filter(notme)
.prop('href'))[1];
.prop('href'))[1];
var $this = $(this),
var $this = $(this),
diff = /diff=([0-9]+)/.exec($this.parent()
diff = /diff=([0-9]+)/.exec($this.parent()
שורה 98: שורה 103:
})
})
.closest('.mw-changeslist-line-watched');
.closest('.mw-changeslist-line-watched');
new mw.Api()
api.postWithToken('csrf', {
.postWithToken('csrf', {
action: 'setnotificationtimestamp',
action: 'setnotificationtimestamp',
titles: name,
titles: name,
שורה 141: שורה 145:
.click(function() {
.click(function() {
var curid = /curid=([0-9]+)/.exec($(this)
var curid = /curid=([0-9]+)/.exec($(this)
.closest('table, li')
.closest('table, li')
.find('a[href*="curid"]')
.find('a[href*="curid"]')
.filter(notme)
.filter(notme)
.prop('href'))[1];
.prop('href'))[1];
var $this = $(this),
var $this = $(this),
diffcond = $this
diffcond = $this
שורה 180: שורה 184:
})
})
.closest('.mw-changeslist-line-watched');
.closest('.mw-changeslist-line-watched');
new mw.Api()
api.postWithToken('csrf', {
.postWithToken('csrf', {
action: 'setnotificationtimestamp',
action: 'setnotificationtimestamp',
titles: name,
titles: name,
שורה 222: שורה 225:
.prop('title'),
.prop('title'),
titles = topic ? page + '|נושא:' + topic[1] : page;
titles = topic ? page + '|נושא:' + topic[1] : page;
new mw.Api()
api.postWithToken('csrf', {
.postWithToken('csrf', {
action: 'setnotificationtimestamp',
action: 'setnotificationtimestamp',
titles: titles,
titles: titles,
שורה 261: שורה 263:
.find('a.mw-changeslist-title')
.find('a.mw-changeslist-title')
.prop('title');
.prop('title');
new mw.Api()
api.postWithToken('csrf', {
.postWithToken('csrf', {
action: 'setnotificationtimestamp',
action: 'setnotificationtimestamp',
titles: page,
titles: page,
שורה 279: שורה 280:


function checklog() {
function checklog() {
new mw.Api()
api.get({
.get({
action: 'query',
action: 'query',
format: 'json',
format: 'json',
שורה 315: שורה 315:
.append($('<span>')
.append($('<span>')
.text('. ' + i18n('logd') + ' '))
.text('. ' + i18n('logd') + ' '))
.append($('<a>', {target: '_blank'})
.append($('<a>', {
target: '_blank'
})
.text(i18n('loge'))
.text(i18n('loge'))
.click(function() {
.click(function() {
new mw.Api()
api.postWithToken('csrf', {
.postWithToken('csrf', {
action: 'setnotificationtimestamp',
action: 'setnotificationtimestamp',
titles: firstname.title
titles: firstname.title
שורה 326: שורה 327:
$('#logmessage')
$('#logmessage')
.remove();
.remove();
var all = $('.mw-changeslist-line-watched a.mw-changeslist-title')
var all = $(
'.mw-changeslist-line-watched a.mw-changeslist-title')
.filter(function() {
.filter(function() {
return $(this)
return $(this)
שורה 358: שורה 360:


function goldbutton() {
function goldbutton() {
$('.mw-changeslist-line-watched')
.find('abbr.newpage')
.each(function() {
var curid = /curid=([0-9]+)/.exec($(this)
.closest('table, li')
.find('a[href*="curid"]')
.filter(notme)
.prop('href'));
if (curid !== null && curid.length > 1)
defected[curid[1]] = true;
});
$('.close-edit')
$('.close-edit')
.filter(function() {
.filter(function() {
שורה 378: שורה 391:
.each(function() {
.each(function() {
var curid = /curid=([0-9]+)/.exec($(this)
var curid = /curid=([0-9]+)/.exec($(this)
.closest('table, li')
.closest('table, li')
.find('a[href*="curid"]')
.find('a[href*="curid"]')
.filter(notme)
.filter(notme)
.prop('href'))[1];
.prop('href'))[1];
var name = $(this)
var name = $(this)
.closest('.mw-changeslist-line-watched')
.closest('.mw-changeslist-line-watched')
שורה 396: שורה 409:
.length <= 0,
.length <= 0,
min = Infinity;
min = Infinity;
checked
if (nonew) {
.find('a[href*="oldid"]')
checked
.filter(notme)
.find('a[href*="oldid"]')
.filter(function() {
.filter(notme)
return ($(this)
.filter(function() {
.text() == messages.diff || $(this)
return ($(this)
.text() == messages.last) &&
.text() == messages.diff || $(this)
($(this)
.text() == messages.last) &&
.closest('.mw-enhanced-rc-nested')
($(this)
.closest('.mw-enhanced-watched')
.closest('.mw-enhanced-rc-nested')
.length > 0 ||
.closest('.mw-enhanced-watched')
$(this)
.length > 0 ||
.closest('.mw-enhanced-rc-nested')
$(this)
.length <= 0);
.closest('.mw-enhanced-rc-nested')
})
.length <= 0);
.each(function() {
})
var old = /oldid=([0-9]+)/.exec($(this)
.each(function() {
.prop('href'));
var old = /oldid=([0-9]+)/.exec($(this)
min = old ? Math.min(min, old[1]) : min;
.prop('href'));
});
min = old ? Math.min(min, old[1]) : min;
});
}
if (min > 0 && min != Infinity && nonew) {
if (min > 0 && min != Infinity && nonew) {
$(this)
$(this)
.after($('<a>', {
.after($('<a>', {
text: '\u200f',
text: langmark,
title: i18n('goldbutton'),
title: i18n('goldbutton'),
target: '_blank',
target: '_blank',
שורה 463: שורה 478:
.click(function() {
.click(function() {
$(this)
$(this)
.closest('.mw-changeslist-line-not-watched, .mw-changeslist-line-watched')
.closest(
'.mw-changeslist-line-not-watched, .mw-changeslist-line-watched')
.hide();
.hide();
});
});
שורה 502: שורה 518:


function whatsnew() {
function whatsnew() {
$('#newrevs').remove();
$('#newrevs')
new mw.Api()
.remove();
.get({
api.get({
action: 'query',
action: 'query',
format: 'json',
format: 'json',
שורה 512: שורה 528:
wllimit: 500,
wllimit: 500,
wlprop: 'title|ids',
wlprop: 'title|ids',
wlshow: 'unread|!bot',
wlshow: 'unread',
wltype: 'edit|new',
wltype: 'edit|new',
wlstart: timestamp,
wlstart: timestamp,
שורה 521: שורה 537:
var ans = data.query.watchlist;
var ans = data.query.watchlist;
$('#hideAll')
$('#hideAll')
.after($('<div>', {id: 'newrevs', text: '['})
.after($('<div>', {
id: 'newrevs',
text: '['
})
.addClass('blueedit'));
.addClass('blueedit'));
var newmap = {};
var newmap = {};
Object.keys(ans).map(function(key) {
Object.keys(ans)
var id = ans[key].pageid;
.map(function(key) {
if (id in newmap) {
var id = ans[key].pageid;
if (ans[key].old_revid < newmap[id].oldid)
if (id in newmap) {
newmap[id].oldid = ans[key].old_revid;
if (ans[key].old_revid < newmap[id].oldid)
} else
newmap[id].oldid = ans[key].old_revid;
newmap[id] = {title: ans[key].title,
} else
oldid: ans[key].old_revid};
newmap[id] = {
});
title: ans[key].title,
Object.keys(newmap).map(function(uuu) {
oldid: ans[key].old_revid
var vvv = $('.gold-' + uuu).length;
};
if (defected[uuu])
});
$('#newrevs')
Object.keys(newmap)
.append($('<span>', {text: newmap[uuu].title + ',\u200f '}));
.map(function(data) {
else if (vvv > 0)  
var vvv = $('.gold-' + data)
$('#newrevs')
.length;
.append($('<span>', {text: newmap[uuu].title + ',\u200f ', id: 'gold-little-' + uuu})
if (defected[data])
.prepend($('.gold-' + uuu).clone(true, true)[0]));
$('#newrevs')
else
.append($('<span>', {
$('#newrevs')
text: newmap[data].title + ',' + langmark + ' '
.append($('<span>', {text: ',\u200f '})
}));
.prepend($('<a>', {text: newmap[uuu].title,
else if (vvv > 0)
href: 'https://he.wikipedia.org/w/index.php?title=' +
$('#newrevs')
newmap[uuu].title +
.append($('<span>', {
'&redirect=no&diff=cur&oldid=' + newmap[uuu].oldid,
text: newmap[data].title + ',' + langmark + ' ',
target: '_blank'
id: 'gold-little-' + data
})
.prepend($('.gold-' + data)
.clone(true, true)[0]));
else
$('#newrevs')
.append($('<span>', {
text: ',' + langmark + ' '
})
})
.click(function() {
.prepend($('<a>', {
$(this).parent().
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() {
$(this)
.parent()
.
remove();
remove();
})));
$('.yellowedit')
});
.hide();
$('body')
.trigger('script-88-pretend-clicked');
})));
});
$('#newrevs')
$('#newrevs')
.append($('<span>', {
.append($('<span>', {
text: '\u200f☺',
text: langmark,
title: 'closenew',//TODO
title: i18n('closenew'),
id: 'closenew'
id: 'closenew'
})
})
.click(function() {
.click(function() {
$('#newrevs').remove();
$('#newrevs')
})
.remove();
).append(']');
$('body')
.trigger('script-88-pretend-clicked');
})
)
.append(']');
})
})
.done(function() {
.done(function() {
$( 'body' ).trigger( 'script-88-pretend-clicked' );
$('body')
.trigger('script-88-pretend-clicked');
});
});
}
}


function hider(state) {
function hider(state) {
$('#newrevs').remove();
$('#newrevs')
.remove();
if (config.edit[state])
if (config.edit[state])
$('.mw-changeslist-line-not-watched')
$('table.mw-changeslist-line-not-watched, li.mw-changeslist-line-not-watched')
.filter(function() {
.filter(function() {
return $(this)
return $(this)
שורה 593: שורה 638:
$('#watchlist-preamble')
$('#watchlist-preamble')
.hide();
.hide();
$('input[name="mw-watchlist-reset-submit"]')
$('.WLM-mobile input[name="mw-watchlist-reset-submit"]')
.hide();
.hide();
}
}
שורה 599: שורה 644:
function unhider() {
function unhider() {
whatsnew();
whatsnew();
$('.mw-changeslist-line-watched')
$('table.mw-changeslist-line-watched, li.mw-changeslist-line-watched')
.show();
.show();
if (config.edit.show)
if (config.edit.show)
$('.mw-changeslist-line-not-watched')
$('table.mw-changeslist-line-not-watched, li.mw-changeslist-line-not-watched')
.filter(function() {
.filter(function() {
return $(this)
return $(this)
שורה 625: שורה 670:


function main() {
function main() {
$('a.mw-unwatch-link')
.each(function() {
$(this)
.prepend('\xa0\xa0\xa0')
.insertAfter($(this)
.parent()
.parent()
.children()
.children()
.last());
});
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'));
שורה 678: שורה 734:


if (mw.config.get('wgCanonicalSpecialPageName') == 'Watchlist') {
if (mw.config.get('wgCanonicalSpecialPageName') == 'Watchlist') {
var langcode = mw.user.options.get('language'),
var langcode = mw.config.get('wgUserLanguage'),
lang = langcode == 'he' ? 0 : 1,
lang = langcode == 'he' ? 0 : 1,
extendwatchlist = mw.user.options.get('extendwatchlist'),
extendwatchlist = mw.user.options.get('extendwatchlist'),
defected = {}, config, messages;
defected = {},
config, messages;
langmark = langcode == 'he' ? '\u200f' : '\u200e';
if (extendwatchlist == 1) {
if (extendwatchlist == 1) {
$('.mw-body-content')
$('.mw-body-content')
.addClass(typeof window.orientation == 'undefined' ? 'WLM-desktop' : 'WLM-mobile');
.addClass(typeof window.orientation == 'undefined' ? 'WLM-desktop' :
importStylesheet('מדיה ויקי:Gadget-WLM.css');
'WLM-mobile');
importStylesheet('משתמש:' + mw.config.get('wgUserName') + '/WLM.css');
importStylesheet('מדיה ויקי:Gadget-WLM.css');
importStylesheet('משתמש:' + mw.config.get('wgUserName') + '/WLM.css');
importStylesheet('משתמש:' + mw.config.get('wgUserName') + '/common.css');
importStylesheet('משתמש:' + mw.config.get('wgUserName') + '/common.css');
new mw.Api()
api.getMessages(['diff', 'last'], {
.getMessages(['diff', 'last'], {
amlang: langcode
amlang: langcode
})
})