Jump to content

User:WhitePhosphorus/js/PagePatroller.js: Difference between revisions

no edit summary
mNo edit summary
No edit summary
Line 2:
* Showing patroller on the bottom of the page.
*
* @version 0.01 (2017-05-0506)
* @author [[User:WhitePhosphorus]]
*/
 
(function($, mw) {
wgUVS = function(a, b) {
return a;
};
 
'use strict';
Line 26 ⟶ 22:
data: {
action: 'query',
titles: mw.config.get('wgPageName'),
prop: 'revisions',
rvprop: 'timestamp',
rvlimit: 1,
rvdir: 'newer',
list: 'logevents',
letype: 'patrol',
Line 32 ⟶ 33:
}
}).done(function (data) {
var user, ts, cts, action, html = '';
if (data.query && data.query.logevents && data.query.logevents.length) {
var log = data.query.logevents[0];
Line 39 ⟶ 40:
action = log.action;
var date = new Date(ts);
if (data.query.pages) {
for (var id in data.query.pages) {
var page = data.query.pages[id];
if (page && page.revisions && page.revisions.length) {
cts = page.revisions[0].timestamp;
break;
}
}
}
ts = date.getUTCFullYear() + '年' + (date.getUTCMonth()+1) + '月' +
date.getUTCDate() + '日 (' + weekdays[date.getDay()] + ') ' +
Line 51 ⟶ 61:
'<a href="' + p.replace('$1', 'Special:BlockUser/' + user) + '">' +
'封禁' + '</a>' + ')';
if (actioncts ===&& 'patrol'new Date(cts) > ts) {
html = '';
} else if (action === 'patrol') {
html = wgUVS('本页面于', '本頁面於') + ts + '由' + user + '巡查。';
} else if (action === 'autopatrol') {
Cookies help us deliver our services. By using our services, you agree to our use of cookies.