MediaWiki:Gadget-twinklespeedy.js: Perbedaan antara revisi
Konten dihapus Konten ditambahkan
Repo at a491314: tracking branch 'upstream/master'; tracking branch 'upstream/master'; Use fullurl when linking to file logs on CSD log (#636); Remove Morebits.wikipedia (#600); tweak F5 tooltip to be more in line with use of db-f5 rather than di-orphaned fair use; Tweak db-xfd tooltip to be sysop-agnostic (#620); wikilink additional parameters in the CSD log if possible; Cleanup and simplify code around userList, redirects, and function calls, and add plain G8 to categories (#603); Ignore bl... |
Repo at 5c1e7e3: Update from Github |
||
Baris 1:
// <nowiki>
(function($) {
Baris 11:
* Mode of invocation: Tab ("CSD")
* Active on: Non-special, existing pages
*
* NOTE FOR DEVELOPERS:
Baris 28 ⟶ 27:
}
Twinkle.addPortletLink(
};
// This function is run when the CSD tab/header link is clicked
Twinkle.speedy.callback = function twinklespeedyCallback() {
Twinkle.speedy.initDialog(Morebits.
};
// Used by unlink feature
Twinkle.speedy.dialog = null;
// Used throughout
Twinkle.speedy.hasCSD = !!$('#delete-reason').length;
// The speedy criteria list can be in one of several modes
Baris 73 ⟶ 74:
mode === Twinkle.speedy.mode.userMultipleRadioClick ||
mode === Twinkle.speedy.mode.sysopMultipleRadioClick;
}
};
Baris 79 ⟶ 80:
Twinkle.speedy.initDialog = function twinklespeedyInitDialog(callbackfunc) {
var dialog;
Twinkle.speedy.dialog = new Morebits.simpleWindow(Twinkle.getPref('speedyWindowWidth'), Twinkle.getPref('speedyWindowHeight'));
dialog = Twinkle.speedy.dialog;
dialog.setTitle(
dialog.setScriptName(
dialog.addFooterLink(
dialog.addFooterLink(
var form = new Morebits.quickForm(
if (
form.append(
}
// enable redirects checkbox
cForm.redirects.checked = !cChecked;
// enable delete multiple
// enable deletion notification checkbox
cForm.warnusertalk.checked = !cChecked && !Twinkle.speedy.hasCSD;
// enable multiple
// enable requesting creation protection
cForm.salting.checked = false;
Twinkle.speedy.callback.modeChanged(cForm);
event.stopPropagation();
}
});
var deleteOptions = form.append(
deleteOptions.append(
if (mw.config.get('wgNamespaceNumber') % 2 === 0 && (mw.config.get('wgNamespaceNumber') !== 2 || (/\//).test(mw.config.get('wgTitle')))) { // hide option for user pages, to avoid accidentally deleting user talk page
deleteOptions.append(
type: 'checkbox',
list: [
Baris 147 ⟶ 142:
value: 'talkpage',
name: 'talkpage',
tooltip:
checked: Twinkle.getPref('deleteTalkPageOnDelete'),
event: function(event) {
event.stopPropagation();
}
}
]
}
}
deleteOptions.append(
type: 'checkbox',
list: [
{
label: 'Hapus
value: '
name: '
tooltip:
checked: Twinkle.getPref('deleteRedirectsOnDelete'),
event: function(event) {
event.stopPropagation();
}
}
]
}
deleteOptions.append(
type: 'checkbox',
list: [
{
label: '
value: '
name: '
tooltip: 'Ketika terpilih, Anda dapat memilih beberapa kriteria yang dapat dipakai ke halaman. Misalnya, U11 dan A7.',
event: function(event) {
Twinkle.speedy.callback.modeChanged(event.target.form);
event.stopPropagation();
}
}
]
}
type: 'checkbox',
list: [
{
label: '
value: '
name: '
tooltip: 'A notification template will be placed on the talk page of the creator, IF you have a notification enabled in your Twinkle preferences ' +
'for the criterion you choose AND this box is checked. The creator may be welcomed as well.',
checked: !Twinkle.speedy.hasCSD,
event: function(event) {
event.stopPropagation();
}
}
]
}
}
var tagOptions = form.append(
});
if (Morebits.userIsSysop) {
type: 'header',
label: 'Opsi terkait dengan tag'
});
}
tagOptions.append({
type: 'checkbox',
list: [
{
label: 'Hubungi pembuat halaman jika memungkinkan',
value: 'notify',
name: 'notify',
tooltip: 'Templat notifikasi akan diberikan pada halaman pembicaraan pembuat halaman, JIKA Anda mengaktifkan notifikasi di preferensi Twinkle ' +
'untuk kriteria yang Anda pilih DAN kotak ini diberi ceklis. Pembuat halaman akan disambut juga.',
checked: !Morebits.userIsSysop || !(Twinkle.speedy.hasCSD || Twinkle.getPref('deleteSysopDefaultToDelete')),
event: function(event) {
event.stopPropagation();
}
}
]
});
tagOptions.append({
type: 'checkbox',
list: [
{
label: 'Tag for creation protection (salting) as well',
value: 'salting',
name: 'salting',
tooltip: 'When selected, the speedy deletion tag will be accompanied by a {{salt}} tag requesting that the deleting administrator apply creation protection. Only select if this page has been repeatedly recreated.',
event: function(event) {
event.stopPropagation();
}
}
]
});
tagOptions.append({
type: 'checkbox',
list: [
{
label: 'Tag with multiple criteria',
value: 'multiple',
name: 'multiple',
tooltip: 'Ketika dipilih, Anda dapat memilih beberapa kriteria untuk diterapkan. Contohnya, G11 dan A7 adalah gabungan umum pada artikel.',
event: function(event) {
Twinkle.speedy.callback.modeChanged(event.target.form);
event.stopPropagation();
}
}
]
});
form.append({
type: 'div',
name: 'work_area',
label: 'Gagal menginisialisasi modul KPC. Ulangi kembali atau beritahukan pengembang Twinkle mengenai masalah ini.'
});
if (Twinkle.getPref('speedySelectionStyle') !== 'radioClick') {
form.append({ type: 'submit', className: 'tw-speedy-submit' }); // Renamed in modeChanged
}
var result = form.render();
dialog.setContent(
dialog.display();
Twinkle.speedy.callback.modeChanged(
};
Baris 295 ⟶ 304:
if (isSysopMode) {
$(
$(
$('button.tw-speedy-submit').text('Delete page');
} else {
$(
$(
$('button.tw-speedy-submit').text('Tag page');
}
var work_area = new Morebits.quickForm.element(
if (mode === Twinkle.speedy.mode.userMultipleRadioClick || mode === Twinkle.speedy.mode.sysopMultipleRadioClick) {
var evaluateType = isSysopMode ? 'evaluateSysop' : 'evaluateUser';
work_area.append(
work_area.append(
}
var radioOrCheckbox =
if (isSysopMode && !Twinkle.speedy.mode.isMultiple(mode)) {
work_area.append(
work_area.append(
}
if (namespace % 2 === 1 && namespace !== 3) {
// show db-talk on talk pages, but not user talk pages
work_area.append(
work_area.append(
}
Baris 342 ⟶ 353:
case 0: // article
case 1: // talk
work_area.append(
work_area.append(
break;
case 2: // user
case 3: // user talk
work_area.append(
work_area.append(
break;
case 6: // file
case 7: // file talk
work_area.append(
work_area.append(
if (!isSysopMode) {
work_area.append(
}
break;
Baris 363 ⟶ 374:
case 10: // template
case 11: // template talk
work_area.append(
work_area.append(
break;
case 14: // category
case 15: // category talk
work_area.append(
work_area.append(
break;
case 100: // portal
case 101: // portal talk
work_area.append(
work_area.append(
break;
Baris 383 ⟶ 394:
}
} else {
if (namespace === 2 || namespace === 3) {
work_area.append(
work_area.append(
}
work_area.append(
work_area.append(
}
Baris 394 ⟶ 405:
// custom rationale lives under general criteria when tagging
if (!isSysopMode) {
generalCriteria = Twinkle.speedy.customRationale.concat(generalCriteria);
}
work_area.append(
work_area.append(
var old_area = Morebits.quickForm.getElements(form,
form.replaceChild(work_area.render(), old_area);
// if sysop, check if CSD is already on the page and fill in custom rationale
if (isSysopMode &&
var customOption = $(
if (customOption) {
if (Twinkle.getPref('speedySelectionStyle') !== 'radioClick') {
Baris 412 ⟶ 423:
customOption.parentNode.appendChild(customOption.subgroup);
}
customOption.subgroup.querySelector('input').value = decodeURIComponent($(
}
}
Baris 488 ⟶ 499:
type: 'button',
name: 'submit',
label: isSysopMode ? 'Hapus halaman' : '
event: submitSubgroupHandler
});
Baris 497 ⟶ 508:
type: 'button',
name: 'submit', // ends up being called "csd.submit" so this is OK
label: isSysopMode ? 'Hapus halaman' : '
event: submitSubgroupHandler
}
Baris 504 ⟶ 515:
// FIXME: does this do anything?
criterion.event = openSubgroupHandler;
}
Baris 527 ⟶ 523:
Twinkle.speedy.customRationale = [
{
label: 'Alasan lain' + (Morebits.
value: 'reason',
tooltip: '{{db}} kependekan dari "dihapus karena". Sekurang-kurangnya satu kriteria harus diberikan, dan sebutkan alasannya.',
Baris 552 ⟶ 548:
label: 'B1: Redundan atau duplikat',
value: 'redundantimage',
tooltip: 'Berkas atau media tak terpakai yang merupakan sebuah salinan, dengan format yang sama dan resolusi/kualitas yang sama/lebih rendah, dari sebuah berkas atau media lain di Wikipedia. Yang tidak termasuk di dalamnya adalah duplikat berkas atau media di Wikimedia Commons, karena alasan-alasan lisensi;'
},
{
Baris 599 ⟶ 595:
}
},
/* {
label: 'F7: Fair-use media from a commercial image agency which is not the subject of sourced commentary',
value: 'badfairuse', // same as above
Baris 610 ⟶ 606:
},
hideWhenMultiple: true
}, */
{
label: 'B8: Berkas yang sama persis tersedia di Wikimedia Commons',
Baris 697 ⟶ 693:
label: 'A7: Tidak mengindikasikan kepentingan (tokoh, organisasi, isi situs)',
value: 'a7',
tooltip: 'Artikel tentang tokoh, organisasi (termasuk di dalamnya band, klub, perusahaan, dll., kecuali sekolah), atau isi situs yang tidak menunjukkan alasan mengapa subyek itu dianggap penting. Jika yang kontroversial, maka Anda dapat mengusulkan penghapusan dengan templat {{hapus}} atau membawanya ke halaman Wikipedia:Usulan penghapusan'
// hideWhenSingle: true
},
/* {
label: 'A7:
value: 'person',
tooltip: 'An article about a real person that does not assert the importance or significance of its subject. If controversial, or if there has been a previous AfD that resulted in the article being kept, the article should be nominated for AfD instead',
Baris 707 ⟶ 703:
},
{
label: 'A7:
value: 'band',
tooltip: 'Article about a band, singer, musician, or musical ensemble that does not assert the importance or significance of the subject',
Baris 713 ⟶ 709:
},
{
label: 'A7:
value: 'club',
tooltip: 'Article about a club, society or group that does not assert the importance or significance of the subject',
hideWhenMultiple: true
},
{
label: 'A7:
value: 'corp',
tooltip: 'Article about a company or organization that does not assert the importance or significance of the subject',
Baris 725 ⟶ 721:
},
{
label: 'A7:
value: 'web',
tooltip: 'Article about a web site, blog, online forum, webcomic, podcast, or similar web content that does not assert the importance or significance of its subject',
Baris 731 ⟶ 727:
},
{
label: 'A7:
value: 'animal',
tooltip: 'Article about an individual animal (e.g. pet) that does not assert the importance or significance of its subject',
Baris 737 ⟶ 733:
},
{
label: 'A7:
value: 'event',
tooltip: 'Article about an organized event (tour, function, meeting, party, etc.) that does not assert the importance or significance of its subject',
hideWhenMultiple: true
}, */
{
label: 'A9: Artikel yang tidak mengindikasikan kepentingan (rekaman musik)',
Baris 756 ⟶ 752:
label: 'Artikel serupa: '
}
}
/* {
label: 'A11: Obviously made up by creator, and no claim of significance',
value: 'madeup',
tooltip: 'An article which plainly indicates that the subject was invented/coined/discovered by the article\'s creator or someone they know personally, and does not credibly indicate why its subject is important or significant'
} */
];
Baris 793 ⟶ 789:
value: 'userreq',
tooltip: 'Yang termasuk di dalamnya: halaman dan subhalaman pengguna (tetapi tidak halaman pembicaraan pengguna) yang diminta untuk dihapus oleh penggunanya. Dalam kasus-kasus yang langka ada kemungkinan halaman tersebut perlu dipertahankan untuk kepentingan administratif.',
subgroup:
name: 'userreq_rationale',
type: 'input',
Baris 799 ⟶ 795:
tooltip: 'Halaman pembicaraan pengguna dihapus hanya dalam keadaan langka tertentu.',
size: 60
} : null
hideSubgroupWhenMultiple: true
},
Baris 825 ⟶ 821:
hideWhenMultiple: true,
hideWhenRedirect: true
}
/
{
label: 'G13: AfC draft submission or a blank draft, stale by over 6 months',
value: 'afc',
tooltip: 'Any rejected or unsubmitted AfC draft submission or a blank draft, that has not been edited in over 6 months (excluding bot edits).',
hideWhenRedirect: true
}
*/
];
Baris 845 ⟶ 843:
label: 'Penjelasan lanjut: ',
size: 60
},
hideSubgroupWhenSysop: true
},
{
Baris 870 ⟶ 869:
type: 'input',
label: 'Pilih kriteria yang berlaku: '
}
},
{
Baris 885 ⟶ 883:
value: 'nonsense',
tooltip: 'Yang tidak termasuk di dalamnya: penulisan yang buruk, terjemahan buruk, vandalisme, materi fiktif, materi berbahasa selain bahasa Indonesia, pemberitaan palsu; namun demikian, beberapa di antara yang disebutkan dapat dihapus dengan dasar vandalisme.',
hideInNamespaces: [ 2 ]
},
{
Baris 891 ⟶ 889:
value: 'test',
tooltip: 'Halaman yang dibuat untuk mencoba kode-kode wiki. Yang tidak termasuk di dalamnya: penyuntingan di halaman-halaman bernama "bak pasir" dan ruangnama pengguna.',
hideInNamespaces: [ 2 ]
},
{
Baris 914 ⟶ 912:
tooltip: 'Harus dimulai dengan awalan "Wikipedia:"',
size: 60
}
},
{
Baris 926 ⟶ 923:
label: 'Nama pengguna (jika ada): ',
tooltip: 'Jangan dimulai dengan "Pengguna:"'
}
},
{
Baris 955 ⟶ 951:
hideWhenRedirect: true
},
/
{
value: 'xfd',
tooltip: 'A deletion discussion (at AfD, FfD, RfD, TfD, CfD, or MfD) was closed as "delete", but the page wasn\'t actually deleted.',
name: 'xfd_fullvotepage', */
{
label: 'U6: Pemindahan salin-tempel',
Baris 1.012 ⟶ 1.010:
label: 'Penjelasan opsional: ',
size: 60
},
hideSubgroupWhenSysop: true
},
{
Baris 1.065 ⟶ 1.064:
]
},
}
];
Baris 1.088 ⟶ 1.086:
},
{
label: '
value: 'redirtypo',
tooltip: 'Meskipun demikian, pengalihan dari kesalahan umum pengejaan atau penamaan biasanya berguna, seperti halnya pengalihan dari istilah dalam bahasa lain.'
},
{
label: 'U6: Pengalihan ke halaman disambiguasi yang salah',
Baris 1.105 ⟶ 1.103:
},
{
label: 'U8: Pengalihan ke target tidak sah
value: 'redirnone',
tooltip: 'Ini tidak berlaku untuk halaman berguna ke sebuah proyek, dan khususnya: diskusi penghapusan yang tidak dicatat di tempat lain, halaman pengguna dan pembicaraannya, arsip halaman pembicaraan, pengalihan yang dapat diperbaiki, dan halaman berkas dan pembicaraannya yang ada di Commons.',
hideWhenMultiple: true
}
];
Baris 1.159 ⟶ 1.157:
'a10': 'a10',
'madeup': 'a11',
'rediruser': '
'redirtypo': '
'redundantimage': 'b1',
'noimage': 'b2',
Baris 1.168 ⟶ 1.166:
'unksource': 'b4',
'unfree': 'b5',
'
'norat': 'b6',
'badfairuse': 'b7',
'commons': 'b8',
'imgcopyvio': 'b9',
Baris 1.177 ⟶ 1.174:
'nopermission': 'b11',
'catempty': 'k1',
'userreq': 'h1',
'nouser': 'h2',
'gallery': 'h3',
'notwebhost': 'h5',
'policy': '
'duplicatetemplate': '
'p1': 'p1',
'emptyportal': 'p2',
Baris 1.194 ⟶ 1.189:
var code, parameters, i;
if (params.normalizeds.length > 1) {
code =
params.utparams = {};
$.each(params.normalizeds, function(index, norm) {
code +=
parameters = params.templateParams[index] || [];
for (var i in parameters) {
if (typeof parameters[i] === 'string' && !parseInt(i, 10)) { // skip numeric parameters - {{db-multiple}} doesn't understand them
code +=
}
}
$.extend(params.utparams, Twinkle.speedy.getUserTalkParameters(norm, parameters));
});
code +=
} else {
parameters = params.templateParams[0] || [];
code =
for (i in parameters) {
if (typeof parameters[i] === 'string') {
code +=
}
}
if (params.usertalk) {
code += '|help=off';
}
code += '}}';
params.utparams = Twinkle.speedy.getUserTalkParameters(params.normalizeds[0], parameters);
}
Baris 1.224 ⟶ 1.222:
parseWikitext: function(wikitext, callback) {
var query = {
action:
prop:
pst:
text: wikitext,
contentmodel:
title: mw.config.get(
};
var statusIndicator = new Morebits.status(
var api = new Morebits.wiki.api(
} else {
statusIndicator.info('selesai');
}
callback(reason);
}, statusIndicator);
api.post();
},
noteToCreator: function(pageobj) {
var params = pageobj.getCallbackParameters();
var initialContrib = pageobj.getCreator();
// disallow notifying yourself
if (initialContrib === mw.config.get('wgUserName')) {
Morebits.status.warn('Anda (' + initialContrib + ') membuat halaman ini; lewati pemberitahuan');
initialContrib = null;
// don't notify users when their user talk page is nominated/deleted
} else if (initialContrib === mw.config.get('wgTitle') && mw.config.get('wgNamespaceNumber') === 3) {
Morebits.status.warn('Memberitahu penyunting awal: pengguna ini membuat halaman pembicaraannya sendiri; lewati pemberitahuan');
initialContrib = null;
// quick hack to prevent excessive unwanted notifications, per request. Should actually be configurable on recipient page...
} else if ((initialContrib === 'Cyberbot I' || initialContrib === 'SoxBot' || initialContrib === 'Kenrick95Bot') && params.normalizeds[0] === 'f2') {
Morebits.status.warn('Memberitahu kontributor awal: halaman dibuat oleh bot; lewati pemberitahuan');
initialContrib = null;
// Check for already existing tags
} else if (Twinkle.speedy.hasCSD && params.warnUser && !confirm('The page is has a deletion-related tag, and thus the creator has likely been notified. Do you want to notify them for this deletion as well?')) {
Morebits.status.info('Notifying initial contributor', 'canceled by user; skipping notification.');
initialContrib = null;
}
if (initialContrib) {
var usertalkpage = new Morebits.wiki.page('User talk:' + initialContrib, 'Memberitahu penyunting awal (' + initialContrib + ')'),
notifytext, i, editsummary;
// special cases: "db" and "db-multiple"
if (params.normalizeds.length > 1) {
notifytext = '\n{{subst:db-' + (params.warnUser ? 'deleted' : 'notice') + '-multiple|1=' + Morebits.pageNameNorm;
var count = 2;
$.each(params.normalizeds, function(index, norm) {
notifytext += '|' + count++ + '=' + norm.toUpperCase();
});
} else if (params.normalizeds[0] === 'db') {
notifytext = '\n{{subst:db-reason-' + (params.warnUser ? 'deleted' : 'notice') + '|1=' + Morebits.pageNameNorm;
} else {
notifytext = '\n{{subst:db-csd-' + (params.warnUser ? 'deleted' : 'notice') + '-custom|1=';
if (params.values[0] === 'copypaste') {
notifytext += params.templateParams[0].sourcepage;
} else {
notifytext += Morebits.pageNameNorm;
}
notifytext += '|2=' + params.values[0];
}
for (i in params.utparams) {
if (typeof params.utparams[i] === 'string') {
notifytext += '|' + i + '=' + params.utparams[i];
}
}
notifytext += (params.welcomeuser ? '' : '|nowelcome=yes') + '}} ~~~~';
editsummary = 'Pemberitahuan: ' + (params.warnUser ? '' : ' nominasi ') + 'penghapusan cepat';
if (params.normalizeds.indexOf('g10') === -1) { // no article name in summary for G10 taggings
editsummary += ' untuk [[:' + Morebits.pageNameNorm + ']].';
} else {
editsummary += ' dari halaman serangan.';
}
usertalkpage.setAppendText(notifytext);
usertalkpage.setEditSummary(editsummary + Twinkle.getPref('summaryAd'));
usertalkpage.setCreateOption('recreate');
usertalkpage.setFollowRedirect(true);
usertalkpage.append(function onNotifySuccess() {
// add this nomination to the user's userspace log, if the user has enabled it
if (params.lognomination) {
Twinkle.speedy.callbacks.user.addToLog(params, initialContrib);
}
}, function onNotifyError() {
// if user could not be notified, log nomination without mentioning that notification was sent
if (params.lognomination) {
Twinkle.speedy.callbacks.user.addToLog(params, null);
}
});
} else if (params.lognomination) {
// log nomination even if the user notification wasn't sent
Twinkle.speedy.callbacks.user.addToLog(params, null);
}
},
sysop: {
main: function(
var reason;
if (!params.normalizeds.length && params.normalizeds[0] === 'db') {
reason = prompt('"Masukkan alasan penghapusan yang akan digunakan untuk catatan penghapusan:
Twinkle.speedy.callbacks.sysop.deletePage(
} else {
var code = Twinkle.speedy.callbacks.getTemplateCodeAndParams(params)[0];
Twinkle.speedy.callbacks.parseWikitext(code, function(reason) {
if (params.promptForSummary) {
reason = prompt(
}
Twinkle.speedy.callbacks.sysop.deletePage(
});
}
},
deletePage: function(
var thispage = new Morebits.wiki.page(
if (reason === null) {
return Morebits.status.error(
} else if (!reason || !reason.replace(/^\s*/,
return Morebits.status.error(
}
thispage.
thispage.deletePage(function() {
thispage.getStatusElement().info('done');
typeof callback === 'function' && callback();
Twinkle.speedy.callbacks.sysop.deleteTalk(params);
});
};
// look up initial contributor. If prompting user for deletion reason, just display a link.
// Otherwise open the talk page directly
if (
thispage.setCallbackParameters(
thispage.lookupCreation(function(pageobj) {
deleteMain(function() {
Twinkle.speedy.callbacks.noteToCreator(pageobj);
});
});
} else {
deleteMain();
}
},
deleteTalk: function(
// delete talk page
if (params.deleteTalkPage &&
params.normalized !== 'f8' &&
document.getElementById(
var talkpage = new Morebits.wiki.page(
talkpage.setEditSummary('[[WP:KPC#U8|U8]]: Halaman pembicaraan dari halaman yang telah dihapus
talkpage.deletePage();
// this is ugly, but because of the architecture of wiki.api, it is needed
// (otherwise success/failure messages for the previous action would be suppressed)
window.setTimeout(function() {
Twinkle.speedy.callbacks.sysop.deleteRedirects( }, 1800); } else {
Twinkle.speedy.callbacks.sysop.deleteRedirects(
}
},
deleteRedirects: function(
// delete redirects
if (params.deleteRedirects) {
Baris 1.305 ⟶ 1.397:
'titles': mw.config.get('wgPageName'),
'prop': 'redirects',
'rdlimit':
};
var wikipedia_api = new Morebits.wiki.api(
new Morebits.status(
wikipedia_api.params = params;
wikipedia_api.post();
Baris 1.315 ⟶ 1.407:
// promote Unlink tool
var $link, $bigtext;
if
$link = $('<a/>', {
'href': '#',
'text': 'Klik di sini untuk mengakses alat Unlink',
'css': { 'fontSize': '
'click': function() {
Morebits.wiki.actionCompleted.redirect = null;
Twinkle.speedy.dialog.close();
Twinkle.unlink.callback(
}
});
Baris 1.335 ⟶ 1.427:
'href': '#',
'text': 'Klik di sini untuk mengakses alat Unlink',
'css': { 'fontSize': '
'click': function() {
Morebits.wiki.actionCompleted.redirect = null;
Twinkle.speedy.dialog.close();
Twinkle.unlink.callback(
}
});
Baris 1.349 ⟶ 1.441:
}
},
var xmlDoc = apiobj.getXML();
var $snapshot = $(xmlDoc).find('redirects rd');
Baris 1.404 ⟶ 1.447:
var statusIndicator = apiobj.statelem;
if (
statusIndicator.status(
return;
}
statusIndicator.status(
var current = 0;
var onsuccess = function(
var now = parseInt(
statusIndicator.update(
apiobjInner.statelem.unlink();
if (
statusIndicator.info(
Morebits.wiki.removeCheckpoint();
}
Baris 1.439 ⟶ 1.482:
// defaults to /doc for lua modules, which may not exist
if (!pageobj.exists() && mw.config.get('wgPageContentModel') !== 'Scribunto') {
statelem.error(
return;
}
Baris 1.446 ⟶ 1.489:
var params = pageobj.getCallbackParameters();
statelem.status(
// check for existing deletion tags
var tag = /(?:\{\{\s*(db|delete|hapus|hapus:|penghapusan|db-.*?|speedy deletion-.*?)(?:\s*\||\s*\}\}))/.exec(
// This won't make use of the db-multiple template but it probably should
if
return;
}
var xfd = /\{\{((?:article for deletion|proposed deletion|prod blp|template for discussion)\/dated|[cfm]fd\b)/i.exec(
if
return;
}
Baris 1.466 ⟶ 1.509:
params.utparams = buildData[1];
// curate/patrol the page
if (Twinkle.getPref('markSpeedyPagesAsPatrolled')) {
pageobj.triage();
}
Baris 1.475 ⟶ 1.517:
// Won't work with userboxes in userspace, or any other transcluded page outside template space
if (mw.config.get('wgNamespaceNumber') === 10) { // Template:
code =
}
// Remove tags that become superfluous with this action
text = text.replace(/\{\{\s*([Uu]serspace draft)\s*(\|(?:\{\{[^{}]*\}\}|[^{}])*)?\}\}\s*/g,
if (mw.config.get('wgNamespaceNumber') === 6) {
// remove "move to Commons" tag - deletion-tagged files cannot be moved to Commons
text = text.replace(/\{\{(mtc|(copy |move )?to ?commons|move to wikimedia commons|copy to wikimedia commons)[^}]*\}\}/gi,
}
if (params.requestsalt) {
if (params.normalizeds.indexOf('g10') === -1) {
code = code + '\n{{salt}}';
} else {
code = '{{salt}}\n' + code;
}
}
Baris 1.494 ⟶ 1.544:
editsummary = editsummary.substr(0, editsummary.length - 2); // remove trailing comma
editsummary += ').';
} else if (params.normalizeds[0] ===
editsummary = 'Meminta [[WP:KPC|penghapusan cepat]] dengan alasan "' + params.templateParams[0][
} else {
editsummary =
}
// Set the correct value for |ts= parameter in {{db-g13}}
if (params.normalizeds.indexOf('u13') !== -1) {
code = code.replace('$TIMESTAMP', pageobj.getLastEditTime());
}
pageobj.setPageText(code + (params.normalizeds.indexOf('g10') !== -1 ? '' : '\n' + text)); // cause attack pages to be blanked
pageobj.setEditSummary(editsummary + Twinkle.getPref('summaryAd'));
pageobj.setWatchlist(params.watch);
if (params.scribunto) {
pageobj.setCreateOption('recreate'); // Module /doc might not exist
if (params.watch) {
// Watch module in addition to /doc subpage
var watch_query = {
action: 'watch',
titles: mw.config.get('wgPageName'),
token: mw.user.tokens.get('watchToken')
};
new Morebits.wiki.api('Adding Module to watchlist', watch_query).post();
}
}
pageobj.save(Twinkle.speedy.callbacks.user.tagComplete);
},
Baris 1.510 ⟶ 1.576:
var params = pageobj.getCallbackParameters();
// Notification to first contributor, will also log nomination to the user's userspace log
if (params.usertalk) {
var thispage = new Morebits.wiki.page(Morebits.pageNameNorm);
thispage.
thispage.lookupCreation(Twinkle.speedy.callbacks.noteToCreator);
// or, if not notifying, add this nomination to the user's userspace log without the initial contributor's name
} else if (params.lognomination) {
Twinkle.speedy.callbacks.user.addToLog(params, null);
}
Baris 1.594 ⟶ 1.592:
// for DI: params.fromDI = true, params.templatename, params.normalized (note: normalized is a string)
addToLog: function(params, initialContrib) {
var
usl.initialText =
'Ini adalah log semua nominasi [[WP:KPC|penghapusan cepat]] yang dibuat oleh pengguna ini dengan menggunakan modul KPC [[WP:TW|Twinkle]].\n\n' +
'Jika Anda tidak ingin menyimpan log ini, Anda dapat mematikannya di [[Wikipedia:Twinkle/Preferences|panel preferensi]], dan ' +
'menominasikan halaman ini untuk dihapus di bawah [[WP:KPC#H1|KPC U1]].' +
(Morebits.userIsSysop ? '\n\nLog ini tidak mencatat penghapusan cepat yang dibuat menggunakan Twinkle.' : '');
var formatParamLog = function(normalize, csdparam, input) {
if ((normalize === 'G4' && csdparam === 'xfd') ||
(normalize === 'G6' && csdparam === 'page') || (normalize === 'G6' && csdparam === 'fullvotepage') || (normalize === 'G6' && csdparam === 'sourcepage') || (normalize === 'A10' && csdparam === 'article') || (normalize === ' (normalize === 'F5' && csdparam === 'replacement')) {
input = '[[:' + input + ']]';
} else if (normalize === 'G5' && csdparam === 'user') {
Baris 1.632 ⟶ 1.613:
} else if (normalize === 'G12' && csdparam.lastIndexOf('url', 0) === 0 && input.lastIndexOf('http', 0) === 0) {
input = '[' + input + ' ' + input + ']';
} else if (normalize === 'T3' && csdparam === 'template') {
input = '[[:Template:' + input + ']]';
Baris 1.647 ⟶ 1.626:
// If a logged file is deleted but exists on commons, the wikilink will be blue, so provide a link to the log
var fileLogLink = mw.config.get('wgNamespaceNumber') === 6 ? ' ([{{fullurl:Special:Log|page=' + mw.util.wikiUrlencode
var editsummary =
var appendText
if (params.fromDI) {
appendText +=
// The params data structure when coming from DI is quite different,
// so this hardcodes the only interesting items worth logging
Baris 1.662 ⟶ 1.641:
}
});
editsummary +=
} else {
if (params.normalizeds.indexOf(
appendText +=
editsummary +=
} else {
appendText +=
editsummary +=
}
if (params.normalizeds.length > 1) {
appendText +=
$.each(params.normalizeds, function(index, norm) {
appendText +=
});
appendText = appendText.substr(0, appendText.length - 2); // remove trailing comma
appendText += ')';
} else if (params.normalizeds[0] ===
appendText +=
} else {
appendText +=
}
Baris 1.688 ⟶ 1.667:
// Treat custom rationale individually
if (params.normalizeds[0] && params.normalizeds[0] === 'db') {
extraInfo += formatParamLog('Custom', 'rationale', params.templateParams[0][
} else {
params.templateParams.forEach(function(item, index) {
var keys = Object.keys(item);
if (keys[0] !== undefined && keys[0].length > 0) {
// Second loop required since some items (G12, F9) may have multiple keys
keys.forEach(function(key, keyIndex) {
if (keys[keyIndex] === 'blanked' || keys[keyIndex] === 'ts') {
return true; // Not worth logging
}
extraInfo += formatParamLog(params.normalizeds[index].toUpperCase(), keys[keyIndex], item[key]);
});
}
Baris 1.707 ⟶ 1.685:
}
if (params.requestsalt) {
appendText += '; requested creation protection ([[WP:SALT|salting]])';
}
if (extraInfo) {
appendText += '; informasi tambahan:' + extraInfo;
}
if (
appendText +=
}
appendText +=
usl.log(appendText, editsummary + Twinkle.getPref('summaryAd'));
}
}
Baris 1.731 ⟶ 1.710:
switch (value) {
case 'reason':
if (form[
var dbrationale = form[
if (!dbrationale || !dbrationale.trim()) {
alert(
parameters = null;
return false;
}
currentParams[
}
break;
case 'userreq': // U1
if (form[
var u1rationale = form[
if (mw.config.get('wgNamespaceNumber') === 3 && !
(!u1rationale || !u1rationale.trim())) {
alert(
parameters = null;
return false;
Baris 1.756 ⟶ 1.735:
case 'repost': // G4
if (form[
var deldisc = form[
if (deldisc) {
if (!/^(?:wp|wikipedia):/i.test(deldisc)) {
alert(
parameters = null;
return false;
Baris 1.770 ⟶ 1.749:
case 'banned': // G5
if (form[
currentParams.user = form[
}
break;
case 'move': // G6
if (form[
var movepage = form[
movereason = form[
if (!movepage || !movepage.trim()) {
alert(
parameters = null;
return false;
}
if (!movereason || !movereason.trim()) {
alert(
parameters = null;
return false;
Baris 1.794 ⟶ 1.773:
break;
if (!/^(?:wp|wikipedia):/i.test(xfd)) {
case 'copypaste': // G6
if (form[
var copypaste = form[
if (!copypaste || !copypaste.trim()) {
alert(
parameters = null;
return false;
Baris 1.821 ⟶ 1.800:
case 'g6': // G6
if (form[
currentParams.rationale = form[
}
break;
case 'author': // G7
if (form[
currentParams.rationale = form[
}
break;
case 'g8': // G8
if (form[
currentParams.rationale = form[
}
break;
Baris 1.844 ⟶ 1.823:
case 'copyvio': // G12
if (form[
currentParams.url = form[
}
if (form[
currentParams.url2 = form[
}
if (form[
currentParams.url3 = form[
}
break;
case 'afc': // G13
currentParams.ts = '$TIMESTAMP'; // to be replaced by the last revision timestamp when page is saved
break;
case 'redundantimage': // F1
if (form[
var redimage = form[
if (!redimage || !redimage.trim()) {
alert(
parameters = null;
return false;
}
currentParams.filename =
}
break;
case 'badfairuse': // F7
if (form[
currentParams.rationale = form[
}
break;
case 'commons': // F8
if (form[
var filename = form[
if (filename && filename.trim() && filename !== Morebits.pageNameNorm) {
currentParams.filename = /^\s*(
}
}
Baris 1.904 ⟶ 1.866:
case 'imgcopyvio': // F9
if (form[
var f9url = form[
var f9rationale = form[
if ((!f9url || !f9url.trim()) && (!f9rationale || !f9rationale.trim())) {
alert(
parameters = null;
return false;
}
if (form[
currentParams.url = f9url;
}
if (form[
currentParams.rationale = f9rationale;
}
Baris 1.922 ⟶ 1.884:
case 'foreign': // A2
if (form[
var foreignlink = form[
if (!foreignlink || !foreignlink.trim()) {
alert(
parameters = null;
return false;
Baris 1.934 ⟶ 1.896:
case 'transwiki': // A5
if (form[
currentParams.location = form[
}
break;
case 'a10': // A10
if (form[
var duptitle = form[
if (!duptitle || !duptitle.trim()) {
alert(
parameters = null;
return false;
Baris 1.952 ⟶ 1.914:
case 'policy': // T2
if (form[
currentParams.rationale = form[
}
break;
case 'duplicatetemplate': // T3
if (form[
var t3template = form[
if (!t3template || !t3template.trim()) {
alert(
parameters = null;
return false;
}
currentParams.ts =
currentParams.template = t3template.replace(/^\s*Template:/i,
}
break;
case 'p1': // P1
if (form[
var criterion = form[
if (!criterion || !criterion.trim()) {
alert(
parameters = null;
return false;
Baris 1.990 ⟶ 1.952:
};
//
// key1/value1: for {{db-criterion-[notice|deleted]}} (via {{db-csd-[notice|deleted]-custom}})
// utparams.param: for {{db-[notice|deleted]-multiple}}
Twinkle.speedy.getUserTalkParameters = function twinklespeedyGetUserTalkParameters(normalized, parameters) {
var utparams = [];
// Special cases
if (normalized === 'db') {
utparams['2'] = parameters['1'];
} else if (normalized === 'g6') {
} else if (normalized === 'g12') {
['url', 'url2', 'url3'].forEach(function(item, idx) {
if (parameters[item]) {
idx++;
utparams['key' + idx] = item;
utparams['value' + idx] = utparams[item] = parameters[item];
});
} else {
// Handle the rest
var param;
switch (normalized) {
case 'g4':
param = 'xfd';
break;
case 'a2':
param = 'source';
break;
case 'a5':
param = 'location';
break;
case 'a10':
param = 'article';
break;
case 'f9':
param = 'url';
break;
case 'p1':
param = 'criterion';
break;
default:
break;
}
// No harm in providing a usertalk template with the others' parameters
if (param && parameters[param]) {
utparams.key1 = param;
utparams.value1 = utparams[param] = parameters[param];
}
}
return utparams;
Baris 2.015 ⟶ 2.010:
var values = (e.target.form ? e.target.form : e.target).getChecked('csd');
if (values.length === 0) {
alert(
return null;
}
Baris 2.022 ⟶ 2.017:
Twinkle.speedy.callback.evaluateSysop = function twinklespeedyCallbackEvaluateSysop(e) {
var form =
if (e.target.type ===
e.target.type ===
return;
}
var tag_only = form.tag_only;
if (
Twinkle.speedy.callback.evaluateUser(e);
return;
Baris 2.037 ⟶ 2.032:
var values = Twinkle.speedy.resolveCsdValues(e);
if (!values) {
return;
}
var templateParams = Twinkle.speedy.getParameters(form, values);
if (!templateParams) {
return;
}
var normalizeds = values.map(function(value) {
return Twinkle.speedy.normalizeHash[
});
// analyse each criterion to determine whether to watch the page, prompt for summary, or
var watchPage, promptForSummary;
normalizeds.forEach(function(norm) {
if (Twinkle.getPref(
watchPage = true;
}
if (Twinkle.getPref(
promptForSummary = true;
}
});
var warnusertalk = false;
if (form.warnusertalk.checked) {
$.each(normalizeds, function(index, norm) {
if (Twinkle.getPref('warnUserOnSpeedyDelete').indexOf(norm) !== -1) {
if (norm === 'g6' && values[index] !== 'copypaste') {
return true;
}
warnusertalk = true;
return false; // break
}
});
}
var welcomeuser = false;
if (warnusertalk) {
$.each(normalizeds, function(index, norm) {
if (Twinkle.getPref('welcomeUserOnSpeedyDeletionNotification').indexOf(norm) !== -1) {
welcomeuser = true;
return false; // break
}
});
}
var params = {
Baris 2.061 ⟶ 2.083:
deleteTalkPage: form.talkpage && form.talkpage.checked,
deleteRedirects: form.redirects.checked,
warnUser: warnusertalk,
welcomeuser: welcomeuser,
promptForSummary: promptForSummary,
templateParams:
};
Morebits.simpleWindow.setButtonsEnabled(
Morebits.status.init(
Twinkle.speedy.callbacks.sysop.main(
};
Twinkle.speedy.callback.evaluateUser = function twinklespeedyCallbackEvaluateUser(e) {
var form =
if (e.target.type ===
e.target.type ===
return;
}
Baris 2.087 ⟶ 2.107:
return;
}
var templateParams = Twinkle.speedy.getParameters(form, values);
if (!templateParams) {
return;
}
// var multiple = form.multiple.checked;
var normalizeds = [];
$.each(values, function(index, value) {
var norm = Twinkle.speedy.normalizeHash[
normalizeds.push(norm);
Baris 2.144 ⟶ 2.169:
welcomeuser: welcomeuser,
lognomination: csdlog,
requestsalt: form.salting.checked,
templateParams: templateParams
};
Morebits.simpleWindow.setButtonsEnabled(
Morebits.status.init(
Morebits.wiki.actionCompleted.redirect = mw.config.get('wgPageName');
Morebits.wiki.actionCompleted.notice =
// Modules can't be tagged, follow standard at TfD and place on /doc subpage
var wikipedia_page =
wikipedia_page.setCallbackParameters(params);
wikipedia_page.load(Twinkle.speedy.callbacks.user.main);
Baris 2.165 ⟶ 2.188:
// </nowiki>
|