میڈیا وکی:Gadget-rcPatrol.js
یاددہانی: محفوظ کرݨ دے بعد انہاں تبدیلیاں کوں ݙیکھݨ کیتے تہاکوں آپݨے براؤزر دا کیشی (cache) صاف کرݨاں ہوسی۔
- فائرفاکس/ سفاری: ڄݙݨ Reload تے کلک کرو تاں Shift دبا تے رکھو، یا Ctrl-F5 یا Ctrl-R دباؤ (Mac تے R-⌘)
- گوگل کروم: Ctrl-Shift-R دباؤ (Mac تے Shift-R-⌘)
- انٹرنیٹ ایکسپلورر: ڄݙݨ Refresh تے کلک کرو تاں Ctrl یا Ctrl-F5 دباؤ
- اوپیرا: Ctrl-F5 دباؤ۔
/* Allows to mark pages as patrolled from the Recentchanges or Watchlist page.
*
* Written by [[User:Yonidebest]]
*/
if ($.inArray(mw.config.get('wgCanonicalSpecialPageName'), ["Recentchanges", "Watchlist", "Recentchangeslinked"]) + 1) {
mw.loader.load('mediawiki.api');
$(function() {
function patrol(rcid, checkbox) {
var api = new mw.Api();
function tokenReceived(data) {
var token = data.query.recentchanges[0].patroltoken;
api.post(
{action: 'patrol', rcid: rcid, token: token},
function(data, textStatus, jqXHR) {
if (data && data.patrol) {
mw.util.jsMessage('زیر ترمیم صفحہ ' + data.patrol.title + ' کی مراجعت کی جاچکی ہے');
$(checkbox).remove();
}
else {
var desc = (data && data.error && data.error.info) || '';
mw.util.jsMessage('<span style="color:red">خطا ' + desc + '</span>');
}
},
function(jqXHR, textStatus, errorThrown) {
mw.util.jsMessage(jqXHR + '<br/>' + textStatus + '<br/>' + errorThrown);
}
);
}
api.get({list: 'recentchanges', rctoken: 'patrol', rclimit: 1}, tokenReceived);
}
function addCheckbox(elem, abbr) {
var a = elem.find('a[href*="rcid="]');
if (!a.length)
return;
var matches = a.attr('href').match(/rcid=(\d+)/);
if (matches) {
var rcid = matches[1];
abbr.before($('<input>', {'type': 'checkbox'}).change(function() {patrol(rcid, this);}));
abbr.remove();
}
}
// collect tds in "enhanced" rc list
$('td.mw-enhanced-rc').each(function() {
var td = $(this);
var abbr = td.find('abbr.unpatrolled');
var sib = td.siblings();
if (sib.find('.mw-collapsible-toggle').length)
return;
addCheckbox(sib, abbr);
});
$('li.mw-line-odd, li.mw-line-even').each(function() {
addCheckbox($(this), $(this).find('abbr.unpatrolled'));
});
}); // document.ready
} // in recentchanges page.