מדיה ויקי: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.source.style.fontWeight = span.following ? 'normal' : 'bolder'; | |||
span.style.color = span.following ? 'blue' : 'red'; | |||
span | span.following ^= true; | ||
} | } | ||
function wlinrc_watchme() { | function wlinrc_watchme() { | ||
var ajax = sajax_init_object(); | var ajax = sajax_init_object(); | ||
ajax.open('GET', 'http://he.wikipedia.org/w/api.php?action=watch' + | |||
'&title=' + this.target.replace(' ', '_') + | |||
(this.following ? '&unwatch=' : '')); | |||
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; | ||
this.firstChild.textContent = this.firstChild.innerText = '[נשלח...]'; | |||
this.style.color = 'orange'; | |||
ajax.send(null); | ajax.send(null); | ||
} | } | ||
function wlinrc_addWatchListLink(li) { | function wlinrc_addWatchListLink(li) { | ||
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:' | 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); | ||