MediaWiki:Gadget-twinkleblock.js: Difference between revisions
Content deleted Content added
Amorymeltzer (talk | contribs) Repo at 540dcd6a: Slightly clearer language on form submission |
Amorymeltzer (talk | contribs) Repo at c63b1ede: Add DS topic codes for aeblock/aepblock |
||
Line 163:
partial.prop('disabled', !blockBox && !templateBox);
// Can be in preset or template field, so the old one in the template
// field will linger. No need to keep the old value around, so just
// remove it; saves trouble when hiding/evaluating
$form.find('[name=dstopic]').parent().remove();
Twinkle.block.callback.saveFieldset($('[name=field_block_options]'));
Line 336 ⟶ 341:
}
// DS selection visible in either the template field set or preset,
// joint settings saved here
var dsSelectSettings = {
type: 'select',
name: 'dstopic',
label: 'DS topic',
value: '',
tooltip: 'If selected, it will inform the template and may be added to the blocking message',
event: Twinkle.block.callback.toggle_ds_reason,
list: $.map(Twinkle.block.dsinfo, function(info, label) {
return {label: label, value: info.code};
})
};
if (templateBox) {
field_template_options = new Morebits.quickForm.element({ type: 'field', label: 'Template options', name: 'field_template_options' });
Line 346 ⟶ 364:
value: Twinkle.block.field_template_options.template
});
// Only visible for aeblock and aepblock, toggled in change_template
field_template_options.append(dsSelectSettings);
field_template_options.append({
type: 'input',
name: 'article',
label: 'Linked page',
value: '',
Line 359 ⟶ 380:
type: 'input',
name: 'area',
label: 'Area blocked from',
value: '',
Line 369 ⟶ 389:
type: 'input',
name: 'template_expiry',
label: 'Period of blocking: ',
value: '',
Line 379 ⟶ 398:
name: 'block_reason',
label: '"You have been blocked for ..." ',
tooltip: 'An optional reason, to replace the default generic reason. Only available for the generic block templates.',
value: Twinkle.block.field_template_options.block_reason
Line 429 ⟶ 447:
field_template_options.append({ type: 'div', id: 'blockpreview', label: [ $previewlink[0] ] });
field_template_options.append({ type: 'div', id: 'twinkleblock-previewbox', style: 'display: none' });
} else if (field_preset) {
// Only visible for aeblock and aepblock, toggled in change_template
field_preset.append(dsSelectSettings);
}
Line 490 ⟶ 511:
}
});
$form.find('[name=namespacerestrictions]').select2({
Line 519 ⟶ 539:
$form.find('[name=namespacerestrictions]').val(null).trigger('change');
}
if (field_template_options) {
oldfield = $form.find('fieldset[name="field_template_options"]')[0];
Line 553 ⟶ 574:
Twinkle.block.callback.update_form(e, Twinkle.block.currentBlockInfo);
}
}
};
Line 1,084 ⟶ 1,104:
reasonParam: true,
summary: 'You have been indefinitely [[WP:PB|partially blocked]] from certain areas of the encyclopedia'
}
};
// Codes and links for Discretionary Sanctions, see [[Template:Ds/topics]]
// Used for uw-ae(p)block
Twinkle.block.dsinfo = {
'': {
code: ''
},
'Abortion': {
code: 'ab',
page: 'Wikipedia:Arbitration/Requests/Case/Abortion'
},
'American politics post-1932': {
code: 'ap',
page: 'Wikipedia:Arbitration/Requests/Case/American politics 2'
},
'Ancient Egyptian race controversy': {
code: 'aerc',
page: 'Wikipedia:Requests for arbitration/Ancient Egyptian race controversy'
},
'Arab-Israeli conflict': {
code: 'a-i',
page: 'Wikipedia:Arbitration/Index/Palestine-Israel articles'
},
'Armenia, Azerbaijan, or related conflicts': {
code: 'a-a',
page: 'Wikipedia:Requests for arbitration/Armenia-Azerbaijan 2'
},
'Biographies of Living Persons (BLPs)': {
code: 'blp',
page: 'Wikipedia:Requests for arbitration/Editing of Biographies of Living Persons'
},
'Climate change': {
code: 'cc',
page: 'Wikipedia:Arbitration/Requests/Case/Climate change'
},
'Complementary and alternative medicine': {
code: 'com',
page: 'Wikipedia:Arbitration/Requests/Case/Acupuncture'
},
'Eastern Europe or the Balkans': {
code: 'e-e',
page: 'Wikipedia:Requests for arbitration/Eastern Europe'
},
'Electronic cigarettes': {
code: 'ecig',
page: 'Wikipedia:Arbitration/Requests/Case/Editor conduct in e-cigs articles'
},
'Falun Gong': {
code: 'fg',
page: 'Wikipedia:Requests for arbitration/Falun Gong'
},
'GamerGate or any gender-related dispute or controversy': {
code: 'gg',
page: 'Wikipedia:Arbitration/Requests/Case/GamerGate'
},
'Genetically modified organisms (GMO)': {
code: 'gmo',
page: 'Wikipedia:Arbitration/Requests/Case/Genetically modified organisms'
},
'Gun control': {
code: 'gc',
page: 'Wikipedia:Arbitration/Requests/Case/Gun control'
},
'India, Pakistan, and Afghanistan': {
code: 'ipa',
page: 'Wikipedia:Requests for arbitration/India-Pakistan'
},
'Infoboxes': {
code: 'cid',
page: 'Wikipedia:Arbitration/Requests/Case/Civility in infobox discussions'
},
'Landmark Worldwide': {
code: 'lw',
page: 'Wikipedia:Arbitration/Requests/Case/Landmark Worldwide'
},
'Liancourt Rocks': {
code: 'lr',
page: 'Wikipedia:Requests for arbitration/Liancourt Rocks'
},
'Manual of Style and article titles': {
code: 'mos',
page: 'Wikipedia:Arbitration/Requests/Case/Article titles and capitalisation'
},
'Muhammad': {
code: 'muh-im',
page: 'Wikipedia:Arbitration/Requests/Case/Muhammad images'
},
'Pharmaceutical drug prices (medicine)': {
code: 'med',
page: 'Wikipedia:Arbitration/Requests/Case/Medicine'
},
'Prem Rawat': {
code: 'pr',
page: 'Wikipedia:Requests for arbitration/Prem Rawat'
},
'Pseudoscience and fringe science': {
code: 'ps',
page: 'Wikipedia:Requests for arbitration/Pseudoscience'
},
'Race/ethnicity and human abilities, behaviour, and intelligence': {
code: 'r-i',
page: 'Wikipedia:Arbitration/Requests/Case/Race and intelligence'
},
'Scientology': {
code: 'sci',
page: 'Wikipedia:Requests for arbitration/Scientology'
},
'Senkaku Islands dispute': {
code: 'sen',
page: 'Wikipedia:Arbitration/Requests/Case/Senkaku Islands'
},
'September 11 attacks': {
code: '9/11',
page: 'Wikipedia:Requests for arbitration/September 11 conspiracy theories'
},
'Shakespeare authorship question': {
code: 'saq',
page: 'Wikipedia:Arbitration/Requests/Case/Shakespeare authorship question'
},
'Transcendental Meditation movement': {
code: 'tm',
page: 'Wikipedia:Arbitration/Requests/Case/Transcendental Meditation movement'
},
'The Troubles': {
code: 'tt',
page: 'Wikipedia:Requests for arbitration/The Troubles'
},
'Waldorf education': {
code: 'we',
page: 'Wikipedia:Requests for arbitration/Waldorf education'
}
};
Line 1,282 ⟶ 1,434:
} else {
this.form.reason.value = reason + '; see also ' + seeAlsoMessage;
}
};
Twinkle.block.dsReason = '';
Twinkle.block.callback.toggle_ds_reason = function twinkleblockCallbackToggleDSReason() {
var reason = this.form.reason.value.replace(
new RegExp(' ?\\(\\[\\[' + Twinkle.block.dsReason + '\\]\\]\\)'), ''
);
Twinkle.block.dsReason = Twinkle.block.dsinfo[this.options[this.selectedIndex].label].page;
if (!this.value) {
this.form.reason.value = reason;
} else {
this.form.reason.value = reason + ' ([[' + Twinkle.block.dsReason + ']])';
}
};
Line 1,354 ⟶ 1,520:
Morebits.quickForm.setElementVisibility(form.nocreate_template.parentNode, $(form).find('[name=actiontype][value=partial]').is(':checked') && !$(form).find('[name=actiontype][value=block]').is(':checked'));
} else {
// Only present if block && template
Morebits.quickForm.setElementVisibility(
form.blank_duration.parentNode,
!settings.indefinite && !settings.nonstandard
);
}
}
Morebits.quickForm.setElementVisibility(form.dstopic.parentNode, value === 'uw-aeblock' || value === 'uw-aepblock');
Morebits.quickForm.setElementVisibility(form.article.parentNode, !!settings.pageParam);
Morebits.quickForm.setElementVisibility(form.block_reason.parentNode, !!settings.reasonParam);
Line 1,379 ⟶ 1,551:
reason: form.block_reason.value,
template: form.template.value,
dstopic: form.dstopic.value,
partial: $(form).find('[name=actiontype][value=partial]').is(':checked'),
pagerestrictions: $(form.pagerestrictions).val() || [],
Line 1,405 ⟶ 1,578:
templateoptions = Twinkle.block.field_template_options;
templateoptions.disabletalk = !!(templateoptions.disabletalk || blockoptions.disabletalk);
templateoptions.hardblock = !!blockoptions.hardblock;
Line 1,571 ⟶ 1,745:
if (params.article && settings.pageParam) {
text += '|page=' + params.article;
}
if (params.dstopic) {
text += '|topic=' + params.dstopic;
}
|