מדיה ויקי: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(); | ||
api.get({ | |||
action: 'query', | |||
format: 'json', | |||
}) | curtimestamp: 1 | ||
.done(function(data) { | }) | ||
.done(function(data) { | |||
}); | timestamp = data.curtimestamp; | ||
}); | |||
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: | 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') | |||
.find('a[href*="curid"]') | |||
.filter(notme) | |||
.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'); | ||
api.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') | |||
.find('a[href*="curid"]') | |||
.filter(notme) | |||
.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'); | ||
api.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; | ||
api.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'); | ||
api.postWithToken('csrf', { | |||
action: 'setnotificationtimestamp', | action: 'setnotificationtimestamp', | ||
titles: page, | titles: page, | ||
| שורה 279: | שורה 280: | ||
function checklog() { | function checklog() { | ||
api.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() { | ||
api.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') | |||
.find('a[href*="curid"]') | |||
.filter(notme) | |||
.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) { | ||
checked | |||
.find('a[href*="oldid"]') | |||
.filter(notme) | |||
.filter(function() { | |||
return ($(this) | |||
.text() == messages.diff || $(this) | |||
.text() == messages.last) && | |||
($(this) | |||
.closest('.mw-enhanced-rc-nested') | |||
.closest('.mw-enhanced-watched') | |||
.length > 0 || | |||
$(this) | |||
.closest('.mw-enhanced-rc-nested') | |||
.length <= 0); | |||
}) | |||
.each(function() { | |||
var old = /oldid=([0-9]+)/.exec($(this) | |||
.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: | 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') | ||
.remove(); | |||
api.get({ | |||
action: 'query', | action: 'query', | ||
format: 'json', | format: 'json', | ||
| שורה 512: | שורה 528: | ||
wllimit: 500, | wllimit: 500, | ||
wlprop: 'title|ids', | wlprop: 'title|ids', | ||
wlshow: 'unread | 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) | ||
.map(function(key) { | |||
var id = ans[key].pageid; | |||
if (id in newmap) { | |||
if (ans[key].old_revid < newmap[id].oldid) | |||
newmap[id].oldid = ans[key].old_revid; | |||
} else | |||
newmap[id] = { | |||
title: ans[key].title, | |||
Object.keys(newmap).map(function( | oldid: ans[key].old_revid | ||
}; | |||
}); | |||
Object.keys(newmap) | |||
.append($('<span>', {text: newmap[ | .map(function(data) { | ||
var vvv = $('.gold-' + data) | |||
.length; | |||
.append($('<span>', {text: newmap[ | if (defected[data]) | ||
.prepend($('.gold-' + | $('#newrevs') | ||
.append($('<span>', { | |||
text: newmap[data].title + ',' + langmark + ' ' | |||
.append($('<span>', {text: ', | })); | ||
else if (vvv > 0) | |||
$('#newrevs') | |||
.append($('<span>', { | |||
text: newmap[data].title + ',' + langmark + ' ', | |||
id: 'gold-little-' + data | |||
}) | |||
.prepend($('.gold-' + data) | |||
.clone(true, true)[0])); | |||
else | |||
$('#newrevs') | |||
.append($('<span>', { | |||
text: ',' + langmark + ' ' | |||
}) | }) | ||
.click(function() { | .prepend($('<a>', { | ||
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: langmark, | |||
title: i18n('closenew'), | |||
id: 'closenew' | |||
}) | |||
.click(function() { | |||
$('#newrevs') | |||
.remove(); | |||
$('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. | 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' : | ||
'WLM-mobile'); | |||
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'); | ||
api.getMessages(['diff', 'last'], { | |||
amlang: langcode | amlang: langcode | ||
}) | }) | ||