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

ניסוי
מ 65 גרסאות של הדף wikipedia:he:מדיה_ויקי:Gadget-rcPatrol.js יובאו
 
(6 גרסאות ביניים של 3 משתמשים אינן מוצגות)
שורה 4: שורה 4:
  */
  */


if ($.inArray(mw.config.get('wgCanonicalSpecialPageName'), ["Recentchanges", "Watchlist", "Recentchangeslinked"]) + 1) {
if ($.inArray(mw.config.get('wgCanonicalSpecialPageName'), ["Recentchanges", "Watchlist", "Recentchangeslinked", "Newpages"]) + 1) {
mw.loader.load('mediawiki.api');
mw.loader.load('mediawiki.api');
$(function() {
mw.hook( 'wikipage.content' ).add(function() {
function patrol(revid, checkbox) {
function patrol(revid, checkbox) {
var api = new mw.Api();
var api = new mw.Api();
function tokenReceived( data ) {
api.postWithToken('patrol', {action: 'patrol', revid: revid }).done( function(data, textStatus, jqXHR) {
var token = data.query.recentchanges[0].patroltoken;
if (data && data.patrol) {
api.post(
mw.notify('העריכה בדף ' + data.patrol.title + ' סומנה כבדוקה');
{action: 'patrol', revid: revid, token: token},
$(checkbox).remove();
function(data, textStatus, jqXHR) {
}
if (data && data.patrol) {
else {
mw.util.jsMessage('העריכה בדף ' + data.patrol.title + ' סומנה כבדוקה');
var desc = (data && data.error && data.error.info) || '';
$(checkbox).remove();
mw.notify(desc, {title: "אירעה שגיאה", type: "error"});
}
}
else {
})
var desc = (data && data.error && data.error.info) || '';
.fail( function(jqXHR, textStatus, errorThrown) {
mw.util.jsMessage('<span style="color:red">אירעה שגיאה ' + desc + '</span>');
mw.notify(jqXHR + '<br/>' + textStatus + '<br/>' + errorThrown);
}
});
},
function(jqXHR, textStatus, errorThrown) {
mw.util.jsMessage(jqXHR + '<br/>' + textStatus + '<br/>' + errorThrown);
}
);
}
api.get({list: 'recentchanges', rctoken: 'patrol', rclimit: 1, rctype: 'new|edit'}, tokenReceived);
}
}
      
      
שורה 55: שורה 48:
$('li.mw-line-odd, li.mw-line-even').each(function() {
$('li.mw-line-odd, li.mw-line-even').each(function() {
addCheckbox($(this), $(this).find('abbr.unpatrolled'));
addCheckbox($(this), $(this).find('abbr.unpatrolled'));
});
$('li.not-patrolled').each(function(){
var a =  $(this).find('a[href*="oldid"]')
if (!a.length)
return;
var m = a.attr('href').match(/oldid=(\d+)/);
if ( ! m )
return;
var revid = m[1];
a.before($('<input>', {'type': 'checkbox'}).change(function() {patrol(revid, this);}));
});
});
}); // document.ready
}); // document.ready
} // in recentchanges page.
} // in recentchanges page.