מדיה ויקי:Gadget-watchlistMark.js: הבדלים בין גרסאות בדף
מ בדפי תרומות משתמש דף יכול להופיע כמה פעמים |
מ 12 גרסאות של הדף wikipedia:he:מדיה_ויקי:Gadget-watchlistMark.js יובאו |
||
| (4 גרסאות ביניים של 2 משתמשים אינן מוצגות) | |||
| שורה 7: | שורה 7: | ||
function readWatchList(continuation) { | function readWatchList(continuation) { | ||
var params = {action: 'query', list: 'watchlistraw', wrlimit: | var params = { action: 'query', list: 'watchlistraw', wrlimit: 'max', format: 'json', rawcontinue: 1 }; | ||
if (continuation) | if (continuation) | ||
params.wrcontinue = continuation; | params.wrcontinue = continuation; | ||
| שורה 18: | שורה 18: | ||
colorWatched(); | colorWatched(); | ||
}); | }); | ||
} | } | ||
function watchText(watch) { return (isCat ? ' ':'') + (watch ? '[עקוב]' : '[הסר]');} | function watchText(watch) { return (isCat ? ' ':'') + (watch ? '[עקוב]' : '[הסר]');} | ||
| שורה 24: | שורה 24: | ||
function colorWatched() { | function colorWatched() { | ||
var pagesList = isCat ? $('#mw-pages').find('li') : $(' | |||
var | |||
pagesList = isCat ? $('#mw-pages').find('li') : mw.util.$content.find('ul > li'), | |||
all = pagesList.each(function() { | |||
var li = $(this); | var li = $(this); | ||
var line = li.children().filter('a:last'); | var line = li.children().filter('a:last'); | ||
| שורה 35: | שורה 36: | ||
var watchLink = $('<span>', {'class': watched? 'unwatchit-link' : 'watchit-link', title: watchTitle( !watched)}) | var watchLink = $('<span>', {'class': watched? 'unwatchit-link' : 'watchit-link', title: watchTitle( !watched)}) | ||
.text(watchText(! watched)) | .text(watchText(! watched)) | ||
.click(function() {watchIt($(this), page)}) | .click(function() {watchIt($(this), page)}); | ||
li.append(watchLink); | li.append(watchLink); | ||
}); | }), | ||
showLink = $('<a>', {href: '#', text:'הצג קישוריות מעקב'}).click( | |||
function(){ | |||
mw.util.addCSS('.unwatchit-link,.watchit-link{display:inline;}'); | |||
$(this).remove(); | |||
} | |||
); | |||
if ($('#contentSub a').length) | |||
$('#contentSub a:last').after(showLink).after(' | '); | |||
else | |||
$('#contentSub').append(showLink); | |||
} | } | ||
function watchIt(span, page) { | function watchIt(span, page) { | ||
var watched = span.hasClass('unwatchit-link'); | var watched = span.hasClass('unwatchit-link'); | ||
| שורה 56: | שורה 68: | ||
}); | }); | ||
} | } | ||
mw.util.addCSS( | |||
".unwatchit-link{color:#a00; cursor: pointer; font-size: 70%;} \n" + | ".unwatchit-link{color:#a00; cursor: pointer; font-size: 70%;display:none} \n" + | ||
".watchit-link{color:#008; cursor: pointer; font-size: 70%;} \n" + | ".watchit-link{color:#008; cursor: pointer; font-size: 70%;display:none} \n" + | ||
".iswatched{font-weight: bolder;} | ".iswatched{font-weight: bolder;}" | ||
); | |||
readWatchList(); | |||
readWatchList(); | |||
}); // document ready | }); // document ready | ||