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

wl_from_rc: מעקב מתוך שינויים אחרונים.
 
גם הסר, למה לא.
שורה 4: שורה 4:
var span = this.span;
var span = this.span;
var textNode = span.firstChild;
var textNode = span.firstChild;
if (textNode) {
if (textNode)  
textNode. textContent = textNode. innerText = '[עוקב]';
textNode. textContent = textNode. innerText = span.following ? '[עקוב]' : '[הסר]';
span.style.color = 'green';
span.source.style.fontWeight = span.following ? 'normal' : 'bolder';
}
span.style.color = span.following ? 'blue' : 'red';
span.source.style.fontWeight = 'bolder';
span.following ^= true;
}
}


function wlinrc_watchme() {
function wlinrc_watchme() {
var ajax = sajax_init_object();
var ajax = sajax_init_object();
var target = this.target;
ajax.open('GET', 'http://he.wikipedia.org/w/api.php?action=watch' +
if (!target)
'&title=' + this.target.replace(' ', '_') +
return;
(this.following ? '&unwatch=' : ''));
target = target.replace(' ', '_');
ajax.open('GET', 'http://he.wikipedia.org/w/api.php?action=watch&title=' + target);
ajax.onreadystatechange = wlinrc_done;
ajax.onreadystatechange = wlinrc_done;
ajax.span = this;
ajax.span = this;
var textNode = this.firstChild;
this.firstChild.textContent = this.firstChild.innerText = '[נשלח...]';
if (textNode) {
this.style.color = 'orange';
textNode. textContent = textNode. innerText = '[נשלח...]';
this.style.color = 'orange';
}
ajax.send(null);
ajax.send(null);
}
}


function wlinrc_addWatchListLink(li) {
function wlinrc_addWatchListLink(li) {
var isWatched = getElementsByClassName(li, 'strong', 'mw-watched').length > 0;
if (isWatched)
return;
var anchors = li.getElementsByTagName('a');
var anchors = li.getElementsByTagName('a');
var link = '', source = null;
var link = '', source = null;
שורה 46: שורה 38:
return;
return;
var span = document.createElement(span);
var span = document.createElement(span);
span.appendChild(document.createTextNode('[עקוב]'));
span.following = getElementsByClassName(li, 'strong', 'mw-watched').length > 0;
$.extend(span.style, {cursor: 'pointer', color:'blue', 'text-decoration': 'underline'});
span.appendChild(document.createTextNode(span.following ? '[הסר]' : '[עקוב]'));
$.extend(span.style, {cursor: 'pointer', color: span.following ? 'red' : 'blue'});
$.extend(span, {onclick: wlinrc_watchme, target: link, source: source});
$.extend(span, {onclick: wlinrc_watchme, target: link, source: source});
li.appendChild(span);
li.appendChild(span);