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

יותר פשוט
הכנה ל-1.18
שורה 7: שורה 7:
}
}


function wlinrc_done() {
function wlinrc_done(span) {
if (this.readyState != 4) // this is some ajax incantation - ony "4" is good.
return;
var span = this.span;
if (wgCanonicalSpecialPageName == 'Watchlist') {
if (wgCanonicalSpecialPageName == 'Watchlist') {
span.parentNode.removeChild(span);
span.parentNode.removeChild(span);
שורה 22: שורה 19:


function wlinrc_watchme() {
function wlinrc_watchme() {
var ajax = sajax_init_object();
var params = {action: 'watch', title: this.target.replace(' ', '_') , format: 'json'};
ajax.open('GET', 'http://he.wikipedia.org/w/api.php?action=watch' +
if (this.isWatched)
'&title=' + this.target.replace(' ', '_') +
params.unwatch = '';
(this.isWatched ? '&unwatch=' : ''));
if (mw && mw.user && mw.user.tokens)
ajax.onreadystatechange = wlinrc_done;
params.token = mw.user.tokens.get('watchToken');
ajax.span = this;
var span = this;
$.post(mw.util.wikiScript('api'), params, function() { wlinrc_done(span); })
wlinrc_setText(this.firstChild, '[נשלח...]');
wlinrc_setText(this.firstChild, '[נשלח...]');
this.style.color = 'orange';
this.style.color = 'orange';
ajax.send(null);
}
}