MediaWiki:Gadget-twinkleblock.js: Difference between revisions

Content deleted Content added
Repo at 5f68c5c: Add Horn of Africa DS topic; Fix typo in preview link
Repo at f050fa9: Apply; Show expiry/timestamp for last action (if not currently restricted)
Line 140:
 
Twinkle.block.hasBlockLog = !!data.query.logevents.length;
Twinkle.block.blockLog = Twinkle.block.hasBlockLog && data.query.logevents;
// Used later to check if block status changed while filling out the form
Twinkle.block.blockLogId = Twinkle.block.hasBlockLog ? data.query.logevents[0].logid : false;
Line 519 ⟶ 520:
}
return {
'action': 'query',
'format': 'json',
'list': 'allpages',
'apfrom': title.title,
'apnamespace': title.namespace,
'aplimit': '10'
};
},
Line 605 ⟶ 606:
 
if (Twinkle.block.hasBlockLog) {
var $blockloglink = $('<span>').append($('<a target="_blank" href="' + mw.util.getUrl('Special:Log', {action: 'view', page: mw.config.get('wgRelevantUserName'), type: 'block'}) + '">block log</a>)'));
if (!Twinkle.block.currentBlockInfo) {
var lastBlockAction = Twinkle.block.blockLog[0];
if (lastBlockAction.action === 'unblock') {
$blockloglink.append(' (unblocked ' + new Morebits.date(lastBlockAction.timestamp).calendar('utc') + ')');
} else { // block or reblock
$blockloglink.append(' (expired ' + new Morebits.date(lastBlockAction.params.expiry).calendar('utc') + ')');
}
}
 
Morebits.status.init($('div[name="hasblocklog"] span').last()[0]);