MediaWiki:Gadget-twinkleblock.js: Difference between revisions
Content deleted Content added
Amorymeltzer (talk | contribs) Repo at 712686d: Add Special:Unblock link in footer; upeblock to block options (#851); Use word boundary regex to match bot usernames; Disable CU/OS options unless user has the relevant perms |
Amorymeltzer (talk | contribs) Repo at ffe5bbed: use Morebits.date instead of native Date; Show expiry in currently blocked message; Use mw.user.tokens for the blocking token |
||
Line 4:
(function($) {
var
var menuFormattedNamespaces = $.extend({}, mw.config.get('wgFormattedNamespaces'));
menuFormattedNamespaces[0] = '(Article)';
Line 98:
Twinkle.block.fetchUserInfo = function twinkleblockFetchUserInfo(fn) {
var api = new mw.Api();
api.get({
format: 'json',
Line 531:
// returns partial: '' if the user is partially blocked
var statusStr = relevantUserName + ' is ' + (Twinkle.block.currentBlockInfo.partial === '' ? 'partially blocked' : 'blocked sitewide');
if (Twinkle.block.currentBlockInfo.expiry === 'infinity') {
var infoStr = 'Submit query to reblock with supplied options';▼
statusStr += ' (indef)';
} else if (new Morebits.date(Twinkle.block.currentBlockInfo.expiry).isValid()) {
statusStr += ' (expires ' + new Morebits.date(Twinkle.block.currentBlockInfo.expiry).calendar('utc') + ')';
if (Twinkle.block.currentBlockInfo.partial === undefined && partialBox) {
infoStr += ',
} else if (Twinkle.block.currentBlockInfo.partial === '' && !partialBox) {
infoStr += ',
}
Morebits.status.warn(statusStr, infoStr);
Line 1,435 ⟶ 1,440:
// execute block
statusElement.
▲ blockoptions.token = token;
▲ var mbApi = new Morebits.wiki.api('Executing block', blockoptions, function() {
▲ if (toWarn) {
▲ Twinkle.block.callback.issue_template(templateoptions);
▲ }
▲ });
mbApi.post();▼
});
} else if (toWarn) {
Morebits.simpleWindow.setButtonsEnabled(false);
Line 1,556:
params = pageobj.getCallbackParameters(),
messageData = params.messageData,
date = new
var dateHeaderRegex =
while ((dateHeaderRegexLast = dateHeaderRegex.exec(text)) !== null) {
dateHeaderRegexResult = dateHeaderRegexLast;
Line 1,577 ⟶ 1,575:
if (Twinkle.getPref('blankTalkpageOnIndefBlock') && params.template !== 'uw-lblock' && params.indefinite) {
Morebits.status.info('Info', 'Blanking talk page per preferences and creating a new level 2 heading for the date');
text =
} else if (!dateHeaderRegexResult || dateHeaderRegexResult.index !== lastHeaderIndex) {
Morebits.status.info('Info', 'Will create a new level 2 heading for the date, as none was found for this month');
text +=
}
|