MediaWiki:Gadget-twinkleblock.js: Perbedaan revisi

2.375 bita ditambahkan ,  1 tahun yang lalu
Repo at d9666d4: Update Twinkle from upstream
k (terjemahkan)
(Repo at d9666d4: Update Twinkle from upstream)
 
/*
****************************************
*** twinkleblock.js: Block module
****************************************
* Mode of invocation: Tab ("Block")
* Active on: any page with relevant user name (userspace, contribs, etc.)
* Config directives in: [soon to be TwinkleConfig]
*/
 
Twinkle.block = function twinkleblock() {
 
Twinkle.block.fetchUserInfo(function() {
// clean up preset data  (defaults, etc.), done exactly once, must be before Twinkle.block.callback.change_action is called
Twinkle.block.transformBlockPresets();
 
value: Twinkle.block.field_block_options.reason
});
 
field_block_options.append({
type: 'div',
name: 'filerlog_label',
label: 'See also:',
style: 'display:inline-block;font-style:normal !important',
tooltip: 'Insert a "see also" message to indicate whether the filter log or deleted contributions played a role in the decision to block.'
});
field_block_options.append({
type: 'checkbox',
name: 'filter_see_also',
event: Twinkle.block.callback.toggle_see_alsos,
style: 'display:inline-block; margin-right:5px',
list: [
{
label: 'Filter log',
checked: false,
value: 'filter log'
}
]
} );
field_block_options.append({
type: 'checkbox',
name: 'deleted_see_also',
event: Twinkle.block.callback.toggle_see_alsos,
style: 'display:inline-block',
list: [
{
label: 'Deleted contribs',
checked: false,
value: 'deleted contribs'
}
]
} );
 
if (Twinkle.block.currentBlockInfo) {
name: 'article',
display: 'none',
label: 'ArtikelHalaman yang berkaitan',
value: '',
tooltip: 'Suatu artikelhalaman dapat ditautkan dengan pemberitahuan, yang mungkin yang menjadi sasaran perusakan. Kosongkan jika tidak ada.'
} );
if (!$form.find('[name=actiontype][value=block]').is(':checked')) {
label: 'Jangan masukkan jangka waktu pemblokiran dalam templat',
checked: Twinkle.block.field_template_options.blank_duration,
tooltip: 'Jangka waktu pemblokiran tidak dimasukkan ke dalam templat, jadi hanya menginformasikan \"Anda sudah diblokir dari penyuntingan sementara ini selama...\"'
}
]
* autoblock: <autoblock any IP addresses used (for registered users only)>
* disabletalk: <disable user from editing their own talk page while blocked>
* expiry: <string - expiry timestamp, can include relative times like "5 months", "2 weeks" etc, use "infinity" for indefinite>
* forAnonOnly: <show block option in the interface only if the relevant user is an IP>
* forRegisteredOnly: <show block option in the interface only if the relevant user is registered>
nocreate: true,
nonstandard: true,
hardblock: true,
reason: '{{blocked proxy}}',
sig: null
},
'CheckUser block' : {
expiry: '1 week',
forAnonOnly: true,
nocreate: true,
nonstandard: true,
reason: '{{CheckUser block}}',
},
'checkuserblock-account' : {
autoblock: true,
expiry: 'infinity',
forRegisteredOnly: true,
nocreate: true,
nonstandard: true,
reason: '{{checkuserblock-account}}',
},
'checkuserblock-wide' : {
forAnonOnly: true,
nocreate: true,
nonstandard: true,
reason: '{{checkuserblock-wide}}',
},
'oversightblock' : {
autoblock: true,
expiry: 'infinity',
nocreate: true,
nonstandard: true,
reason: '{{OversightBlock}}',
reason: '{{school block}}',
sig: '~~~~'
},
'spamblacklistblock' : {
forAnonOnly: true,
expiry: '1 month',
disabletalk: true,
nocreate: true,
reason: '{{spamblacklistblock}} <!-- editor only attempts to add blacklisted links, see [[Special:Log/spamblacklist]] -->'
},
// Placeholder for when we add support for rangeblocks
reason: 'Membuat ancaman hukum',
summary: 'Anda diblokir karena mencoba membuat ancaman hukum'
},
'uw-memorialblock': {
forRegisteredOnly: true,
expiry: 'infinity',
reason: 'Nama pengguna terkesan sebagai penghormatan kepada seseorang (pemblokiran lunak)',
summary: 'Anda diblokir karena nama pengguna Anda dianggap digunakan untuk menghormati seseorang'
},
'uw-myblock': {
reason: 'Nama pengguna mirip dengan pengguna lain (pemblokiran lunak)',
summary: 'Anda diblokir karena nama pengguna Anda sangat mirip dengan pengguna lain'
},
'uw-ucblock' : {
autoblock: true,
expiry: '31 hours',
nocreate: true,
pageParam: true,
reason: 'Persistent addition of [[WP:INTREF|unsourced content]]',
summary: 'You have been blocked from editing for persistent addition of [[WP:INTREF|unsourced content]]'
},
'uw-uhblock' : {
reason: 'Akun vandalisme semata-mata',
summary: 'Anda diblokir selamanya karena semata-mata melakukan [[WP:VANDAL|vandalisme]]'
},
'zombie proxy' : {
expiry: '1 month',
forAnonOnly: true,
nocreate: true,
nonstandard: true,
reason: '{{zombie proxy}}',
sig: null
}
};
settings.sig = settings.sig !== undefined ? settings.sig : 'yes';
// despite this it's preferred that you use 'infinity' as the value for expiry
settings.indefinite = settings.indefinite || settings.expiry === 'infinity' || settings.expiry === 'infinite' || settings.expiry === 'indefinite' || settings.expiry === 'never';
 
if (!Twinkle.block.isRegistered && settings.indefinite) {
{ label: 'Penyalahgunaan halaman pembicaraan pengguna selama diblokir', value: 'uw-talkrevoked' },
{ label: 'Tidak ingin mengembangkan ensiklopedia', value: 'uw-nothereblock' },
{ label: 'Isi tanpa sumber', value: 'uw-ucblock' },
{ label: 'Vandalisme', value: 'uw-vblock' },
{ label: 'Akun vandalisme semata-mata', value: 'uw-voablock' }
list: [
{ label: 'Nama pengguna bot', value: 'uw-botublock' },
{ label: 'Nama pengguna penghormatan kepada seseorang, soft block', value: 'uw-memorialblock' },
{ label: 'Nama pengguna promosi, pemblokiran rumit', value: 'uw-spamublock' },
{ label: 'Nama pengguna promosi, pemblokiran lunak', value: 'uw-softerblock' },
{ label: 'oversightblock', value: 'oversightblock' },
// { label: 'rangeblock', value: 'rangeblock' }, // placeholder for when we add support for rangeblocks
{ label: 'spamblacklistblock', value: 'spamblacklistblock' },
{ label: 'tor', value: 'tor' },
{ label: 'webhostblock', value: 'webhostblock' },
{ label: 'zombie proxy', value: 'zombie proxy' }
]
}
Morebits.quickForm.setElementVisibility(expiry.parentNode, false);
expiry.value = e.target.value;
}
};
 
Twinkle.block.seeAlsos = [];
Twinkle.block.callback.toggle_see_alsos = function twinkleblockCallbackToggleSeeAlso() {
var reason = this.form.reason.value.replace(
new RegExp('( <!--|;) ' + 'see also ' + Twinkle.block.seeAlsos.join(' and ') + '( -->)?'), ''
);
 
Twinkle.block.seeAlsos = Twinkle.block.seeAlsos.filter(function(el) {
return el !== this.value;
}.bind(this));
 
if (this.checked) Twinkle.block.seeAlsos.push(this.value);
var seeAlsoMessage = Twinkle.block.seeAlsos.join(' and ');
 
if (!Twinkle.block.seeAlsos.length) {
this.form.reason.value = reason;
} else if (reason.indexOf('{{') !== -1) {
this.form.reason.value = reason + ' <!-- see also ' + seeAlsoMessage + ' -->';
} else {
this.form.reason.value = reason + '; see also ' + seeAlsoMessage;
}
};
expiry: form.template_expiry ? form.template_expiry.value : form.expiry.value,
hardblock: Twinkle.block.isRegistered ? form.autoblock.checked : form.hardblock.checked,
indefinite: (/indef|infinityinfinit|never|\*|max/).test( form.template_expiry ? form.template_expiry.value : form.expiry.value ),
reason: form.block_reason.value,
template: form.template.value
var templateText = Twinkle.block.callback.getBlockNoticeWikitext(params);
 
form.previewer.beginRender(templateText, 'User_talk:' + mw.config.get('wgRelevantUserName')); // Force wikitext/correct username
};
 
blockoptions.anononly = blockoptions.hardblock ? undefined : true;
blockoptions.allowusertalk = blockoptions.disabletalk ? undefined : true;
 
// fix for bug with block API, see [[phab:T68646]]
if (blockoptions.expiry === 'infinity') blockoptions.expiry = 'infinite';
 
// execute block
statusElement.status('Sedang menjalankan...');
blockoptions.token = token;
var mbApi = new Morebits.wiki.api( 'Executing block', blockoptions, function(data) {
statusElement.info('Selesai');
if (toWarn) Twinkle.block.callback.issue_template(templateoptions);
}
 
params.indefinite = (/indef|infinityinfinit|never|\*|max/).test( params.expiry );
 
if ( Twinkle.getPref('blankTalkpageOnIndefBlock') && params.template !== 'uw-lblock' && params.indefinite ) {
var summary = messageData.summary;
if ( messageData.suppressArticleInSummary !== true && params.article ) {
summary += ' di [[:' + params.article + ']]';
}
summary += '.' + Twinkle.getPref('summaryAd');
 
})(jQuery);
 
 
//</nowiki>