MediaWiki:Gadget-friendlytag.js: Perbedaan antara revisi

Konten dihapus Konten ditambahkan
Repo at a491314: tracking branch 'upstream/master'; Add untag functionality (#485); fix bug when processing items with type=div; Cleanup regex, put tags under AfD notices, fix prod regex, put under salt and endorsed prod (#579); Remove globalize/India; Put new tags under salt and endorsed prod; Put tags under AfD notices, fix prod detection, tidy regex
Repo at 5c1e7e3: Update from Github
Baris 1:
// <nowiki>
 
(function($) {
Baris 11:
* Active on: Existing articles and drafts; file pages with a corresponding file
* which is local (not on Commons); all redirects
* Config directives in: FriendlyConfig
*/
 
Twinkle.tag = function friendlytag() {
// redirect tagging
if ( Morebits.wiki.isPageRedirect() ) {
Twinkle.tag.mode = 'redirect';
Twinkle.addPortletLink( Twinkle.tag.callback, "'Tag"', "'friendly-tag ramah pengguna"', "'Tag pengalihan" ');
}
// file tagging
} else if( (mw.config.get('wgNamespaceNumber') === 6 && !document.getElementById("'mw-sharedupload"') && document.getElementById("'mw-imagepage-section-filehistory"') ) {
Twinkle.tag.mode = 'file';
Twinkle.addPortletLink( Twinkle.tag.callback, "'Tag"', "'friendly-tag"', "'Beri tag pemeliharaan ke artikel" ');
}
// article/draft article tagging
} else if( ([0, 118].indexOf(mw.config.get('wgNamespaceNumber')) !== -1 && mw.config.get('wgCurRevisionId') ) {
Twinkle.tag.mode = 'article';
// Can't remove tags when not viewing current version
Baris 33 ⟶ 30:
// away from the latest diff without causing the script to reload
!mw.config.get('wgDiffNewId');
Twinkle.addPortletLink( Twinkle.tag.callback, "'Tag"', "'friendly-tag"', "'Berikan atau hapus tag pemeliharaan ke artikel" ');
}
};
Baris 40 ⟶ 37:
 
Twinkle.tag.callback = function friendlytagCallback() {
var Window = new Morebits.simpleWindow( 630, (Twinkle.tag.mode === "'article")' ? 500 : 400 );
Window.setScriptName( "'Twinkle" ');
// anyone got a good policy/guideline/info page/instructional page link??
Window.addFooterLink( "'Bantuan Twinkle"', "'WP:TW/DOC#tag" ');
 
var form = new Morebits.quickForm( Twinkle.tag.callback.evaluate );
 
form.append({
if (document.getElementsByClassName("patrollink").length) {
type: 'input',
form.append( {
typelabel: 'checkboxFilter cepat: ',
name: 'quickfilter',
list: [
size: '30px',
{
event: function twinkletagquickfilter() {
label: 'Tandai halaman ini sebagai terpatroli',
// flush the DOM of all existing underline spans
value: 'patrolPage',
$allCheckboxDivs.find('.search-hit').each(function(i, e) {
name: 'patrolPage',
var label_element = e.parentElement;
checked: Twinkle.getFriendlyPref('markTaggedPagesAsPatrolled')
// This would convert <label>Hello <span class=search-hit>wo</span>rld</label>
}
// to <label>Hello world</label>
]
label_element.innerHTML = label_element.textContent;
} );
});
}
 
if (this.value) {
switch( Twinkle.tag.mode ) {
$allCheckboxDivs.hide();
$allHeaders.hide();
var searchString = this.value;
var searchRegex = new RegExp(mw.util.escapeRegExp(searchString), 'i');
 
$allCheckboxDivs.find('label').each(function () {
var label_text = this.textContent;
var searchHit = searchRegex.exec(label_text);
if (searchHit) {
var range = document.createRange();
var textnode = this.childNodes[0];
range.selectNodeContents(textnode);
range.setStart(textnode, searchHit.index);
range.setEnd(textnode, searchHit.index + searchString.length);
var underline_span = $('<span>').addClass('search-hit').css('text-decoration', 'underline')[0];
range.surroundContents(underline_span);
this.parentElement.style.display = 'block'; // show
}
});
} else {
$allCheckboxDivs.show();
$allHeaders.show();
}
}
});
 
switch (Twinkle.tag.mode) {
case 'article':
Window.setTitle( "'Pemberian tag pemeliharaan dalam artikel" ');
 
form.append({
Baris 72 ⟶ 96:
event: Twinkle.tag.updateSortOrder,
list: [
{ type: 'option', value: 'cat', label: 'Menurut kategori', selected: Twinkle.getFriendlyPrefgetPref('tagArticleSortOrder') === 'cat' },
{ type: 'option', value: 'alpha', label: 'Menurut abjad', selected: Twinkle.getFriendlyPrefgetPref('tagArticleSortOrder') === 'alpha' }
]
});
 
 
if (! Twinkle.tag.canRemove) {
if (!Twinkle.tag.canRemove) {
var divElement = document.createElement('div');
divElement.innerHTML = 'For removal of existing tags, please open Tag menu from the current version of article';
Baris 94 ⟶ 119:
});
 
form.append( {
type: 'checkbox',
list: [
{
label: 'Kelompokkan dalam {{multiple issues}} jika dibutuhkan',
value: 'group',
name: 'group',
tooltip: 'Jika menerapkan dua templat atau lebih yang didukung oleh {{multiple issues}} dan kotak ini dicentang, semua templat yang didukung akan dikelompokkan dalam templat {{multiple issues}}.',
checked: Twinkle.getFriendlyPrefgetPref('groupByDefault')
}
]
});
 
);
form.append({
type: 'input',
label: 'Alasan',
name: 'reason',
tooltip: 'Optional reason to be appended in edit summary. Recommended when removing tags.',
size: '60px'
});
 
break;
 
case 'file':
Window.setTitle( "'Pemberian tag pemeliharaan berkas" ');
 
form.append({ type: 'header', label: 'Tag lisensi dan sumber bermasalah' });
form.append({ type: 'checkbox', name: 'fileTags', list: Twinkle.tag.file.licenseList } );
 
form.append({ type: 'header', label: 'Tag terkait dengan Commons' });
form.append({ type: 'checkbox', name: 'fileTags', list: Twinkle.tag.file.commonsList } );
 
form.append({ type: 'header', label: 'Tag perapian' } );
form.append({ type: 'checkbox', name: 'fileTags', list: Twinkle.tag.file.cleanupList } );
 
form.append({ type: 'header', label: 'Tag kualitas gambar' } );
form.append({ type: 'checkbox', name: 'fileTags', list: Twinkle.tag.file.qualityList } );
 
form.append({ type: 'header', label: 'Tag penggantian' });
form.append({ type: 'checkbox', name: 'fileTags', list: Twinkle.tag.file.replacementList } );
 
if (Twinkle.getFriendlyPrefgetPref('customFileTagList').length) {
form.append({ type: 'header', label: 'Tag kustom' });
form.append({ type: 'checkbox', name: 'fileTags', list: Twinkle.getFriendlyPrefgetPref('customFileTagList') });
}
break;
 
case 'redirect':
Window.setTitle( "'Tag pengalihan" ');
 
form.append({ type: 'header', label: 'Templat ejaan, salah ketik, gaya, dan kapitalisasi' });
form.append({ type: 'checkbox', name: 'redirectTags', list: Twinkle.tag.spellingList });
 
form.append({ type: 'header', label: 'Templat nama pengganti' });
form.append({ type: 'checkbox', name: 'redirectTags', list: Twinkle.tag.alternativeList });
 
form.append({ type: 'header', label: 'Templat administrasi dan pengalihan lain-lain' });
form.append({ type: 'checkbox', name: 'redirectTags', list: Twinkle.tag.administrativeList });
 
if (Twinkle.getFriendlyPrefgetPref('customRedirectTagList').length) {
form.append({ type: 'header', label: 'Custom tags' });
form.append({ type: 'checkbox', name: 'redirectTags', list: Twinkle.getFriendlyPrefgetPref('customRedirectTagList') });
}
break;
 
default:
alert("'Twinkle.tag: moda tak dikenal "' + Twinkle.tag.mode);
break;
}
 
if (document.getElementsByClassName('patrollink').length) {
form.append( { type:'submit' } );
form.append({
type: 'checkbox',
list: [
{
label: 'Tandai halaman ini sebagai terpatroli',
value: 'patrolPage',
name: 'patrolPage',
checked: Twinkle.getPref('markTaggedPagesAsPatrolled')
}
]
});
}
form.append({ type: 'submit', className: 'tw-tag-submit' });
 
var result = form.render();
Window.setContent( result );
Window.display();
 
// for quick filter:
if (Twinkle.tag.mode === "article") {
$allCheckboxDivs = $(result).find('[name$=Tags]').parent();
$allHeaders = $(result).find('h5');
result.quickfilter.focus(); // place cursor in the quick filter field as soon as window is opened
result.quickfilter.autocomplete = 'off'; // disable browser suggestions
result.quickfilter.addEventListener('keypress', function(e) {
if (e.keyCode === 13) { // prevent enter key from accidentally submitting the form
e.preventDefault();
return false;
}
});
 
if (Twinkle.tag.mode === 'article') {
 
Twinkle.tag.alreadyPresentTags = [];
Baris 172 ⟶ 229:
// All tags are HTML table elements that are direct children of .mw-parser-output,
// except when they are within {{multiple issues}}
$('.mw-parser-output').children().each( function parsehtml(i, e) {
 
// break out on encountering the first heading, which means we are no
// longer in the lead section
if (e.tagName === 'H2') {
return false;
}
 
// The ability to remove tags depends on the template's {{ambox}} |name=
Baris 187 ⟶ 245:
if (e.classList[0] === 'box-Multiple_issues') {
$(e).find('.ambox').each(function(idx, e) {
var tag = e.classList[0].slice(4).replace(/_/g, ' ');
Twinkle.tag.alreadyPresentTags.push(tag);
});
Baris 193 ⟶ 251:
}
 
var tag = e.classList[0].slice(4).replace(/_/g, ' ');
Twinkle.tag.alreadyPresentTags.push(tag);
}
} );
 
// {{Uncategorized}} and {{Improve categories}} are usually placed at the end
if ($("'.box-Uncategorized"').length) {
Twinkle.tag.alreadyPresentTags.push('Uncategorized');
}
if ($("'.box-Improve_categories"').length) {
Twinkle.tag.alreadyPresentTags.push('Improve categories');
}
 
}
 
// Add status text node after Submit button
var statusNode = document.createElement('small');
statusNode.id = 'tw-tag-status';
Twinkle.tag.status = {
// initial state; defined like this because these need to be available for reference
// in the click event handler
numAdded: 0,
numRemoved: 0
};
$('button.tw-tag-submit').after(statusNode);
 
// fake a change event on the sort dropdown, to initialize the tag list
var evt = document.createEvent("'Event"');
evt.initEvent("'change"', true, true);
result.sortorder.dispatchEvent(evt);
 
} else {
// Redirects and files: Add a link to each template's description page
Morebits.quickForm.getElements(result, Twinkle.tag.mode + "'Tags"').forEach(generateLinks);
}
};
 
 
// $allCheckboxDivs and $allHeaders are defined globally, rather than in the
// quickfilter event function, to avoid having to recompute them on every keydown
var $allCheckboxDivs, $allHeaders;
 
Twinkle.tag.updateSortOrder = function(e) {
var form = e.target.form;
var sortorder = e.target.value;
Twinkle.tag.checkedTags = e.target.form.getChecked("'articleTags"') || [];
if (!Twinkle.tag.checkedTags) {
Twinkle.tag.checkedTags = [];
}
 
var container = new Morebits.quickForm.element({ type: "'fragment"' });
 
// function to generate a checkbox, with appropriate subgroup if needed
var makeCheckbox = function(tag, description) {
var checkbox = { value: tag, label: "'{{"' + tag + "'}}: "' + description };
if (Twinkle.tag.checkedTags.indexOf(tag) !== -1) {
checkbox.checked = true;
}
switch (tag) {
case "'Cleanup"':
checkbox.subgroup = {
name: 'cleanup',
Baris 244 ⟶ 316:
};
break;
case "'Close paraphrasing"':
checkbox.subgroup = {
name: 'closeParaphrasing',
Baris 252 ⟶ 324:
};
break;
case "'Copy edit"':
checkbox.subgroup = {
name: 'copyEdit',
Baris 261 ⟶ 333:
};
break;
case "'Copypaste"':
checkbox.subgroup = {
name: 'copypaste',
Baris 270 ⟶ 342:
};
break;
case "'Expand language"':
checkbox.subgroup = [ {
name: 'expandLanguageLangCode',
type: 'input',
label: 'Language code: ',
tooltip: 'Language code of the language from which article is to be expanded from'
}, {
name: 'expandLanguageArticle',
type: 'input',
label: 'Name of article: ',
tooltip: 'Name of article to be expanded from, without the interwiki prefix'
},
];
break;
case "'Expert needed"':
checkbox.subgroup = [
{
Baris 306 ⟶ 378:
];
break;
case "'Globalize"':
checkbox.subgroup = {
name: 'globalizeglobalizeRegion',
type: 'selectinput',
label: 'Tidak mewakili seluruh negara atau wilayah'
list: [
{ label: "{{globalize}}: artikel mungkin tidak mewakili keseluruhan subjek yang dibahas", value: "globalize" },
/* {
label: "Subtemplat {{globalize}} mengenai wilayah",
list: [
{ label: "{{globalize/Australia}}: artikel berisi konten yang dibuat terutama dalam sudut pandang masyarakat Australia", value: "globalize/Australia" },
{ label: "{{globalize/Canada}}: artikel berisi konten yang dibuat terutama dalam sudut pandang masyarakat Kanada", value: "globalize/Canada" },
{ label: "{{globalize/China}}: artikel berisi konten yang dibuat terutama dalam sudut pandang masyarakat Tiongkok", value: "globalize/China" },
{ label: "{{globalize/Common law}}: artikel berisi konten yang dibuat terutama dalam sudut pandang hukum secara umum", value: "globalize/Common law" },
{ label: "{{globalize/Eng}}: artikel berisi konten yang dibuat terutama dalam sudut pandang pengguna bahasa Inggris", value: "globalize/Eng" },
{ label: "{{globalize/Europe}}: artikel berisi konten yang dibuat terutama dalam sudut pandang masyarakat Eropa", value: "globalize/Europe" },
{ label: "{{globalize/France}}: artikel berisi konten yang dibuat terutama dalam sudut pandang masyarakat Peranc", value: "globalize/France" },
{ label: "{{globalize/Germany}}: article deals primarily with the German viewpoint", value: "globalize/Germany" },
{ label: "{{globalize/Middle East}}: article deals primarily with the Middle Eastern viewpoint", value: "globalize/Middle East" },
{ label: "{{globalize/North America}}: article deals primarily with the North American viewpoint", value: "globalize/North America" },
{ label: "{{globalize/Northern}}: article deals primarily with the northern hemisphere viewpoint", value: "globalize/Northern" },
{ label: "{{globalize/Southern}}: article deals primarily with the southern hemisphere viewpoint", value: "globalize/Southern" },
{ label: "{{globalize/South Africa}}: article deals primarily with the South African viewpoint", value: "globalize/South Africa" },
{ label: "{{globalize/UK}}: article deals primarily with the British viewpoint", value: "globalize/UK" },
{ label: "{{globalize/UK and Canada}}: article deals primarily with the British and Canadian viewpoints", value: "globalize/UK and Canada" },
{ label: "{{globalize/US}}: article deals primarily with the USA viewpoint", value: "globalize/US" },
{ label: "{{globalize/West}}: article deals primarily with the viewpoint of Western countries", value: "globalize/West" }
]
} */
]
};
break;
case "'History merge"':
checkbox.subgroup = [
{
Baris 359 ⟶ 407:
];
break;
case "'Merge"':
case "'Merge from"':
case "'Merge to"':
var otherTagName = "'Merge"';
switch (tag) {
case 'Merge from':
{
case otherTagName "= 'Merge from":to';
otherTagName = "Merge to";
break;
case "'Merge to"':
otherTagName = "'Merge from"';
break;
// no default
}
checkbox.subgroup = [
Baris 396 ⟶ 444:
type: 'textarea',
label: 'Alasan penggabungan (akan dikirimkan ke ' +
(tag === "'Merge from"' ? 'artikel lainnya' : 'artikel ini') + ' halaman pembicaraan):',
tooltip: 'Opsional, namun sangat disarankan. Kosongkan jika tidak diinginkan. Hanya tersedia jika nama artikel tunggal diberikan.'
});
}
break;
// case "'Not English"Indonesian':
case "Not'Rough Indonesian"translation':
checkbox.subgroup = [
case "Rough translation":
{
checkbox.subgroup = [
name: 'translationLanguage',
{
nametype: 'translationLanguageinput',
typelabel: 'inputBahasa artikel (jika diketahui): ',
labeltooltip: 'BahasaBaca pedoman penerjemahan artikel (jikauntuk diketahui):informasi lebih lanjut.',
tooltip: 'Baca pedoman penerjemahan artikel untuk informasi lebih lanjut.'
}
];
// if (tag === "Not English") {
if (tag === "Not Indonesian") {
checkbox.subgroup.push({
name: 'translationNotify',
type: 'checkbox',
list: [
{
label: 'Beritahukan pembuat artikel',
checked: true,
tooltip: "Tempatkan {{uw-notenglish}} di halaman pembicaraannya."
}
]
});
}
];
if (mw.config.get('wgNamespaceNumber') === 0) {
if (tag === 'Not Indonesian') {
checkbox.subgroup.push({
checkbox.subgroup.push({
name: 'translationPostAtPNT',
typename: 'checkboxtranslationNotify',
listtype: ['checkbox',
{list: [
{
label: 'List this article at Wikipedia:Pages needing translation into English (PNT)',
checkedlabel: true'Beritahukan pembuat artikel',
}checked: true,
tooltip: 'Tempatkan {{uw-notenglish}} di halaman pembicaraannya.'
]
});
]
checkbox.subgroup.push({
});
name: 'translationComments',
}
type: 'textarea',
if (mw.config.get('wgNamespaceNumber') === 0) {
label: 'Additional comments to post at PNT',
checkbox.subgroup.push({
tooltip: 'Optional, and only relevant if "List this article ..." above is checked.'
name: 'translationPostAtPNT',
});
} type: 'checkbox',
break; list: [
{
case "Notability":
label: 'List this article at Wikipedia:Pages needing translation into English (PNT)',
checked: true
}
]
});
checkbox.subgroup.push({
name: 'translationComments',
type: 'textarea',
label: 'Additional comments to post at PNT',
tooltip: 'Optional, and only relevant if "List this article ..." above is checked.'
});
}
break;
case 'Notability':
checkbox.subgroup = {
name: 'notability',
type: 'select',
list: [
{ label: "'{{notability}}: subjek artikel mungkin tidak memenuhi kelayakan secara umum"', value: "'none"' },
{ label: "'{{notability|Academics}}: pedoman kelayakan untuk akademik"', value: "'Academics"' },
{ label: "'{{notability|BiographiesAstro}}: pedoman kelayakan untuk biografi"benda astronomi', value: "Biographies"'Astro' },
{ label: "'{{notability|BooksBiographies}}: pedoman kelayakan untuk buku"biografi', value: "Books"'Biographies' },
{ label: "'{{notability|CompaniesBooks}}: pedoman kelayakan untuk perusahaan dan organisasi"buku', value: "Companies"'Books' },
{ label: "'{{notability|EventsCompanies}}: pedoman kelayakan untuk acara/perhelatan"perusahaan dan organisasi', value: "Events"'Companies' },
{ label: "'{{notability|FilmsEvents}}: pedoman kelayakan untuk film"acara/perhelatan', value: "Films"'Events' },
{ label: "'{{notability|PlacesFilms}}: pedoman kelayakan untuk tempat/lokasi"film', value: "Places"'Films' },
{ label: "'{{notability|MusicGeographic}}: pedoman kelayakan untuk musik"fitur geografi', value: "Music"'Geographic' },
// { label: "'{{notability|NeologismsLists}}: pedoman kelayakan untuk neologisme"halaman daftar', value: "Neologisms"'Lists' },
// { label: "'{{notability|NumbersMusic}}: pedoman kelayakan untuk angka"musik', value: "Numbers"'Music' },
{ label: "'{{notability|ProductsNeologisms}}: pedoman kelayakan untuk produk dan layanan"neologisme', value: "Products"'Neologisms' },
{ label: "'{{notability|SportNumbers}}: pedoman kelayakan untuk olahraga"angka', value: "Sport"'Numbers' },
{ label: "'{{notability|TelevisionProducts}}: pedoman kelayakan untuk acaraproduk dan televisi"layanan', value: "Television"'Products' },
{ label: "'{{notability|WebSports}}: pedoman kelayakan untuk isi situs"olahraga', value: "Web"'Sports' },
{ label: '{{notability|Television}}: pedoman kelayakan untuk acara televisi', value: 'Television' },
{ label: '{{notability|Web}}: pedoman kelayakan untuk isi situs', value: 'Web' }
]
};
Baris 475 ⟶ 523:
 
var makeCheckboxesForAlreadyPresentTags = function() {
container.append({ type: "'header"', id: "'tagHeader0"', label: "'Tags already present"' });
var subdiv = container.append({ type: "'div"', id: "'tagSubdiv0"' });
var checkboxes = [];
var unCheckedTags = e.target.form.getUnchecked('alreadyPresentArticleTags') || [];
Twinkle.tag.alreadyPresentTags.forEach( function(tag) {
Twinkle.tag.alreadyPresentTags.forEach(function(tag) {
var description = Twinkle.tag.article.tags[tag];
var checkbox =
{
value: tag,
label: "'{{"' + tag + "'}}"' + ( description ? ("': "' + description) : ""''),
checked: trueunCheckedTags.indexOf(tag) === -1,
style: 'font-style: italic'
//, subgroup: { type: 'input', name: 'removeReason', label: 'Reason', tooltip: 'Enter reason for removing this tag' }
// TODO: add option for providing reason for removal
};
 
checkboxes.push(checkbox);
} );
subdiv.append({
type: "'checkbox"',
name: "'alreadyPresentArticleTags"',
list: checkboxes
});
};
 
if (sortorder === 'cat') { // categorical sort order
if (sortorder === "cat") {
// function to iterate through the tags and create a checkbox for each one
var doCategoryCheckboxes = function(subdiv, array) {
Baris 510 ⟶ 557:
});
subdiv.append({
type: "'checkbox"',
name: "'articleTags"',
list: checkboxes
});
};
 
if (Twinkle.tag.alreadyPresentTags.length > 0) {
makeCheckboxesForAlreadyPresentTags();
}
Baris 522 ⟶ 569:
// go through each category and sub-category and append lists of checkboxes
$.each(Twinkle.tag.article.tagCategories, function(title, content) {
container.append({ type: "'header"', id: "'tagHeader"' + i, label: title });
var subdiv = container.append({ type: "'div"', id: "'tagSubdiv"' + i++ });
if (Array.isArray(content)) {
doCategoryCheckboxes(subdiv, content);
} else {
$.each(content, function(subtitle, subcontent) {
subdiv.append({ type: "'div"', label: [ Morebits.htmlNode("'b"', subtitle) ] });
doCategoryCheckboxes(subdiv, subcontent);
});
}
});
} else { // alphabetical sort order
}
if (Twinkle.tag.alreadyPresentTags.length > 0) {
// alphabetical sort order
else {
if(Twinkle.tag.alreadyPresentTags.length > 0) {
makeCheckboxesForAlreadyPresentTags();
container.append({ type: "'header"', id: "'tagHeader1"', label: "'Available tags"' });
}
var checkboxes = [];
Baris 547 ⟶ 592:
});
container.append({
type: "'checkbox"',
name: "'articleTags"',
list: checkboxes
});
Baris 554 ⟶ 599:
 
// append any custom tags
if (Twinkle.getFriendlyPrefgetPref('customTagList').length) {
container.append({ type: 'header', label: 'Tag yang disesuaikan' });
container.append({ type: 'checkbox', name: 'articleTags',
list: Twinkle.getFriendlyPrefgetPref('customTagList') }.map(function(el); {
el.checked = Twinkle.tag.checkedTags.indexOf(el.value) !== -1;
return el;
})
});
}
 
var $workarea = $(e.target.form).find("div'#tagWorkArea"');
var rendered = container.render();
$workarea.empty().append(rendered);
 
// for quick filter:
$allCheckboxDivs = $workarea.find('[name$=Tags]').parent();
$allHeaders = $workarea.find('h5, .quickformDescription');
form.quickfilter.value = ''; // clear search, because the search results are not preserved over mode change
form.quickfilter.focus();
 
// style adjustments
$workarea.find("'h5"').css({ 'font-size': '110%' });
$workarea.find("'h5:not(:first-child)"').css({ 'margin-top': '1em' });
$workarea.find("'div"').filter("':has(span.quickformDescription)"').css({ 'margin-top': '0.4em' });
 
var alreadyPresentTags = Morebits.quickForm.getElements(e.target.form, "articleTags").forEach(generateLinks'alreadyPresentArticleTags');
var alreadyPresentTags = Morebits.quickForm.getElements(e.target.form, "alreadyPresentArticleTags");
if (alreadyPresentTags) {
alreadyPresentTags.forEach(generateLinks);
}
// in the unlikely case that *every* tag is already on the page
var notPresentTags = Morebits.quickForm.getElements(form, 'articleTags');
if (notPresentTags) {
notPresentTags.forEach(generateLinks);
}
 
// tally tags added/removed, update statusNode text
var statusNode = document.getElementById('tw-tag-status');
$('[name=articleTags], [name=alreadyPresentArticleTags]').click(function() {
if (this.name === 'articleTags') {
Twinkle.tag.status.numAdded += this.checked ? 1 : -1;
} else if (this.name === 'alreadyPresentArticleTags') {
Twinkle.tag.status.numRemoved += this.checked ? -1 : 1;
}
 
var firstPart = 'Adding ' + Twinkle.tag.status.numAdded + ' tag' + (Twinkle.tag.status.numAdded > 1 ? 's' : '');
var secondPart = 'Removing ' + Twinkle.tag.status.numRemoved + ' tag' + (Twinkle.tag.status.numRemoved > 1 ? 's' : '');
statusNode.textContent =
(Twinkle.tag.status.numAdded ? ' ' + firstPart : '') +
(Twinkle.tag.status.numRemoved ? (Twinkle.tag.status.numAdded ? '; ' : ' ') + secondPart : '');
});
};
 
Baris 580 ⟶ 656:
*/
var generateLinks = function(checkbox) {
var link = Morebits.htmlNode("'a"', "'>"');
link.setAttribute("'class"', "'tag-template-link"');
var tagname = checkbox.values;
link.setAttribute("'href"', mw.util.getUrl(
(tagname.indexOf("':"') === -1 ? "'Template:"' : ""'') +
(tagname.indexOf("'|"') === -1 ? tagname : tagname.slice(0, tagname.indexOf("'|"')))
));
link.setAttribute("'target"', "'_blank"');
$(checkbox).parent().append(["'\u00A0"', link]);
};
 
Baris 600 ⟶ 676:
 
Twinkle.tag.article.tags = {
"'Advert"': "'artikel ditulis seperti iklan"',
"'All plot"': "'artikel hampir semuanya ringkasan alur"',
"'Autobiography"': "'artikel adalah otobiografi yang tidak ditulis secara netral"',
"'BLP sources"': "'artikel tokoh yang masih hidup perlu referensi lebih banyak untuk diperiksa"',
"'BLP unsourced"': "'artikel tokoh yang masih hidup yang tidak punya referensi"',
"'Citation style"': "'artikel yang kutipannya tidak jelas atau tak konsisten"',
"'Cleanup"': "'artikel memerlukan perapian"',
"'Cleanup bare URLs"': "'article uses bare URLs for references, which are prone to link rot"',
"'Cleanup-PR"': "'article reads like a press release or news release"',
"'Cleanup reorganize"': "'artikel memerlukan pengubahan struktur agar sesuai dengan pedoman Wikipedia"',
"'Cleanup rewrite"': "article may need to be rewritten entirely to comply with Wikipedia's quality standards",
"'Cleanup tense"': "'article is written in an incorrect tense"',
"'Close paraphrasing"': "'artikel mengandung parafrasa yang mirip dengan sumber tidak bebas berhak cipta"',
"'COI"': "'pembuat artikel memiliki konflik kepentingan"',
"'Condense"': "'artikel mungkin punya banyak kepala bagian yang membagi-bagi isinya"',
"'Confusing"': "'artikel tidak memiliki isi yang jelas (membingungkan)"',
"'Context"': "'konteks isi artikel tidak mencukupi"',
"'Copy edit"': "'artikel butuh perbaikan pada tata bahasa, gaya, relasi antarparagrag, dan/atau ejaan"',
"'Copypaste"': "'artikel terkesan disalin dari sebuah sumber"',
"'Current"': "'article documents a current event"',
"'Disputed"': "'akurasi aktual isi halaman dipertanyakan"',
"'Essay-like"': "'artikel ditulis seperti esai atau opini"',
"'Expand language"': "'artikel dapat dikembangkan dengan materi dari Wikipedia bahasa lain"',
"'Expert needed"': "'artikel perlu dilihat oleh pengguna yang ahli di bidang ini"',
"'External links"': "'pranala luar artikel tidak mengikuti pedoman dan kebijakan"',
"'Fanpov"': "'artikel mirip dengan situs penggemar"',
"'Fiction"': "'artikel tidak dapat dibedakan antara nyata atau fiksi"',
"'Globalize"': "'artikel tidak mewakili sudut pandang umum subjek tersebut"',
"'GOCEinuse"': "'article is currently undergoing a major copy edit by the Guild of Copy Editors"',
"'History merge"': "'another page should be history merged into this one"',
"'Hoax"': "'artikel berisi informasi palsu"',
"'Improve categories"': "'artikel butuh kategori tambahan"',
"'Incomprehensible"': "'artikel sulit untuk dipahami atau tidak komprehensif"',
"'In-universe"': "'subjek artikel adalah fiksi dan butuh gaya penulisan dari sudut pandang nonfiksi"',
"'In use"': "'artikel dalam pengembangan dalam waktu dekat"',
"'Lead missing"': "'artikel tidak memiliki bagian pengantar dan perlu ditulis"',
"'Lead rewrite"': "'pengantar artikel tidak sesuai pedoman"',
"'Lead too long"': "'pengantar artikel sangat panjang dan harus dibuat lebih ringkas"',
"'Lead too short"': "'pengantar artikel sangat pendek dan harus dikembangkan"',
"'Like resume"': "'article is written like a resume"',
"'Long plot"': "'ringkasan alur di artikel terlalu panjang"',
"'Manual"': "'gaya artikel mirip dengan buku pedoman"',
"'Merge"': "'artikel ini perlu digabungkan ke artikel lain"',
"'Merge from"': "'artikel lain harus digabungkan ke artikel ini"',
"'Merge to"': "'artikel ini harus digabungkan ke artikel lain"',
"'More citations needed"': "'article needs additional references or sources for verification"',
"'More footnotes"': "'artikel sudah punya referensi, namun hanya punya sedikit catatan kaki"',
"'No footnotes"': "'artikel punya referensi, namun tidak punya catatan kaki"',
"'No plot"': "'article is missing a plot summary"',
"'Non-free"': "'artikel mungkin mengandung materi yang berhak cipta yang tidak digunakan sebagaimana mestinya"',
"'Notability"': "'subjek artikel tidak memenuhi kelayakan"',
"'Not English"': "'article is written in a language other than English and needs translation"',
"'One source"': "'artikel hanya merujuk pada sebuah sumber saja"',
"'Original research"': "'artikel memiliki penggunaan riset asli klaim yang tidak terperiksa"',
"'Orphan"': "'artikel tidak memiliki hubungan dengan artikel lain"',
"'Over-coverage"': "'artikel mengandung anggapan atau cakupan tidak sesuai terhadap satu bagian atau lebih"',
"'Overlinked"': "'artikel banyak mengandung pranala duplikat dan/atau tidak berhubungan"',
"'Overly detailed"': "'artikel mengandung jumlah detail yang terlalu banyak"',
"'Over-quotation"': "'article contains too many or too-lengthy quotations for an encyclopedic entry"',
"'Peacock"': "'artikel mengandung istilah hiperbola yang mempromosikan subjek tanpa informasi lengkap"',
"'POV"': "'sudut pandang penulisan artikel tidak netral"',
"'Primary sources"': "'artikel terlalu mengandalkan sumber primer, dan butuh sumber tambahan"',
"'Prose"': "'artikel mengandung format yang lebih sesuai ditulis dalam bentuk prosa"',
"'Recentism"': "'artikel ini terlalu condong dengan peristiwa terkini"',
"'Rough translation"': "'artikel sangat jelek penerjemahannya dan memerlukan perbaikan"',
"'Sections"': "'artikel perlu dibagi dalam subbagian"',
"'Self-published"': "'artikel mengandung sumber yang mungkin tak sesuai untuk sumber yang diterbitkan oleh diri sendiri"',
"'Technical"': "'artikel mengandung banyak istilah yang rumit"',
"'Third-party"': "'artikel terlalu mengandalkan sumber kedua, dan butuh sumber ketiga"',
"'Tone"': "'gaya penulisan tak sesuai"',
"'Too few opinions"': "'artikel tidak mengandung keseluruhan sudut pandang yang penting"',
"'Uncategorized"': "'artikel tidak ada kategori"',
"'Under construction"': "'artikel sedang dalam tahap pengembangan"',
"'Underlinked"': "'artikel perlu lebih banyak pranala wiki"',
"'Undue weight"': "'article lends undue weight to certain ideas, incidents, or controversies"',
"'Unfocused"': "'artikel kurang memfokuskan subjek atau punya topik yang lebih dari satu"',
"'Unreferenced"': "'artikel tidak punya referensi sama sekali"',
"'Unreliable sources"': "'sumber artikel mungkin tidak dapat dipercaya"',
"'Undisclosed paid"': "'article may have been created or edited in return for undisclosed payments"',
"'Update"': "'artikel memerlukan informasi yang lebih aktual"',
"'Very long"': "'artikel sangaaaat panjang"',
"'Weasel"': "'kenetralan artikel diganggu oleh penggunaan kata bersayap"',
"'Dead end"': "'artikel tidak punya hubungan dengan artikel lain"',
"'Linkrot"': "'sumber referensi artikel sudah mati, dan penulisannya harus diperbaiki"',
"'New unreviewed article"': "'tandai artikel untuk diperiksa nanti"',
"'News release"': "'gaya artikel mirip seperti berita"',
"'Not Indonesian"': "'artikel tidak ditulis dalam bahasa Indonesia dan perlu diterjemahkan"',
"'Refimprove"': "'artikel perlu sumber tambahan untuk diperiksa"',
"'Tense"': "'artikel ditulis dalam gaya tidak sesuai"',
"'Tugas sekolah"': "'artikel yang sedang digunakan untuk penilaian di sekolah/universitas"'
/* TODO: Incoming merge
'Advert': 'written like an advertisement',
'All plot': 'almost entirely a plot summary',
'Autobiography': 'autobiography and may not be written neutrally',
'BLP sources': 'BLP that needs additional sources for verification',
'BLP unsourced': 'BLP that has no sources at all (use BLP PROD instead for new articles)',
'Citation style': 'unclear or inconsistent citation style',
'Cleanup': 'requires cleanup',
'Cleanup bare URLs': 'uses bare URLs for references, which are prone to link rot',
'Cleanup-PR': 'reads like a press release or news article',
'Cleanup reorganize': "needs reorganization to comply with Wikipedia's layout guidelines",
'Cleanup rewrite': "needs to be rewritten entirely to comply with Wikipedia's quality standards",
'Cleanup tense': 'does not follow guidelines on use of different tenses.',
'Close paraphrasing': 'contains close paraphrasing of a non-free copyrighted source',
'COI': 'creator or major contributor may have a conflict of interest',
'Condense': 'too many section headers dividing up content',
'Confusing': 'confusing or unclear',
'Context': 'insufficient context for those unfamiliar with the subject',
'Copy edit': 'requires copy editing for grammar, style, cohesion, tone, or spelling',
'Copypaste': 'appears to have been copied and pasted from another location',
'Current': 'documents a current event',
'Dead end': 'article has no links to other articles',
'Disputed': 'questionable factual accuracy',
'Essay-like': 'written like a personal reflection, personal essay, or argumentative essay',
'Expand language': 'should be expanded with text translated from a foreign-language article',
'Expert needed': 'needs attention from an expert on the subject',
'External links': 'external links may not follow content policies or guidelines',
'Fanpov': "written from a fan's point of view",
'Fiction': 'fails to distinguish between fact and fiction',
'Globalize': 'may not represent a worldwide view of the subject',
'GOCEinuse': 'currently undergoing a major copy edit by the Guild of Copy Editors',
'History merge': 'another page should be history merged into this one',
'Hoax': 'may partially or completely be a hoax',
'Improve categories': 'needs additional or more specific categories',
'Incomprehensible': 'very hard to understand or incomprehensible',
'In-universe': 'subject is fictional and needs rewriting to provide a non-fictional perspective',
'In use': 'undergoing a major edit for a short while',
'Lead missing': 'no lead section',
'Lead rewrite': 'lead section needs to be rewritten to comply with guidelines',
'Lead too long': 'lead section is too long for the length of the article',
'Lead too short': 'lead section is too short and should be expanded to summarize key points',
'Like resume': 'written like a resume',
'Long plot': 'plot summary is too long or excessively detailed',
'Manual': 'written like a manual or guidebook',
'Merge': 'should be merged with another given article',
'Merge from': 'another given article should be merged into this one',
'Merge to': 'should be merged into another given article',
'More citations needed': 'needs additional references or sources for verification',
'More footnotes': 'has some references, but insufficient inline citations',
'No footnotes': 'has references, but lacks inline citations',
'No plot': 'needs a plot summary',
'Non-free': 'may contain excessive or improper use of copyrighted materials',
'Notability': 'subject may not meet the general notability guideline',
'Not English': 'written in a language other than English and needs translation',
'One source': 'relies largely or entirely on a single source',
'Original research': 'contains original research',
'Orphan': 'linked to from no other articles',
'Over-coverage': 'extensive bias or disproportional coverage towards one or more specific regions',
'Overlinked': 'too many duplicate and/or irrelevant links to other articles',
'Overly detailed': 'excessive amount of intricate detail',
'Over-quotation': 'too many or too-lengthy quotations for an encyclopedic entry',
'Peacock': 'contains wording that promotes the subject in a subjective manner without adding information',
'POV': 'does not maintain a neutral point of view',
'Primary sources': 'relies too much on references to primary sources, and needs secondary sources',
'Prose': 'written in a list format but may read better as prose',
'Recentism': 'slanted towards recent events',
'Rough translation': 'poor translation from another language',
'Sections': 'needs to be divided into sections by topic',
'Self-published': 'contains excessive or inappropriate references to self-published sources',
'Sources exist': 'notable topic, sources are available that could be added to article',
'Technical': 'too technical for most readers to understand',
'Third-party': 'relies too heavily on sources too closely associated with the subject',
'Tone': 'tone or style may not reflect the encyclopedic tone used on Wikipedia',
'Too few opinions': 'may not include all significant viewpoints',
'Uncategorized': 'not added to any categories',
'Under construction': 'in the process of an expansion or major restructuring',
'Underlinked': 'needs more wikilinks to other articles',
'Undue weight': 'lends undue weight to certain ideas, incidents, or controversies',
'Unfocused': 'lacks focus or is about more than one topic',
'Unreferenced': 'does not cite any sources at all',
'Unreliable sources': 'some references may not be reliable',
'Undisclosed paid': 'may have been created or edited in return for undisclosed payments',
'Update': 'needs additional up-to-date information added',
'Very long': 'too long to read and navigate comfortably',
'Weasel': 'neutrality or verifiability is compromised by the use of weasel words'
*/
};
 
Baris 697 ⟶ 859:
 
Twinkle.tag.article.tagCategories = {
"'Tag rapikan dan pemeliharaan"': {
"'Perapian secara umum"': [
"'Cleanup"', // has a subgroup with text input
"'Cleanup rewrite"',
"'Copy edit"' // has a subgroup with text input
],
"'Mengandung konten yang tidak diinginkan"': [
"'Close paraphrasing"',
"'Copypaste"', // has a subgroup with text input
"'External links"',
"'Non-free"'
],
"'Struktur, format, dan pengantar"': [
"'Cleanup reorganize"',
"'Condense"',
"'Lead missing"',
"'Lead rewrite"',
"'Lead too long"',
"'Lead too short"',
"'Sections"',
"'Very long"'
],
"'Perapian terkait isi fiksi"': [
"'All plot"',
"'Fiction"',
"'In-universe"',
"'Long plot"',
"'No plot"'
]
},
"'Masalah konten secara umum"': {
"'Kepentingan dan kelayakan"': [
"'Notability"' // has a subgroup with subcategories
],
"'Gaya penulisan"': [
"'Advert"',
"'Cleanup tense"',
"'Essay-like"',
"'Fanpov"',
"'Like resume"',
"'Manual"',
"'Cleanup-PR"',
"'Over-quotation"',
"'Prose"',
"'Technical"',
"'Tone"'
],
"'Makna"': [
"'Confusing"',
"'Incomprehensible"',
"'Unfocused"'
],
"'Detail dan informasi"': [
"'Context"',
"'Expert needed"',
"'Overly detailed"',
"'Undue weight"'
],
"'Keaktualan"': [
"'Current"',
"'Update"'
],
"'Netralitas, kecondongan dan akurasi faktual"': [
"'Autobiography"',
"'COI"',
"'Disputed"',
"'Hoax"',
"'Globalize"', // has a subgroup with subcategories
"'Over-coverage"',
"'Peacock"',
"'POV"',
"'Recentism"',
"'Too few opinions"',
"'Undisclosed paid"',
"'Weasel"'
],
"'Pemeriksaan dan sumber"': [
"'BLP sources"',
"'BLP unsourced"',
"'More citations needed"',
"'One source"',
"'Original research"',
"'Primary sources"',
"'Self-published"',
"'Third-party"',
"'Unreferenced"',
"'Unreliable sources"'
]
},
"'Masalah konten tertentu"': {
"'Bahasa"': [
"'Not Indonesian"', // has a subgroup with several options
"'Rough translation"', // has a subgroup with several options
"'Expand language"'
],
"'Pranala dan tautan"': [
"'Orphan"',
"'Overlinked"',
"'Underlinked"'
],
"'Teknik pemberian referensi"': [
"'Citation style"',
"'Cleanup bare URLs"',
"'More footnotes"',
"'No footnotes"'
],
"'Kategori"': [
"'Improve categories"',
"'Uncategorized"'
]
},
"'Penggabungan"': [
"'History merge"',
"'Merge"', // these three have a subgroup with several options
"'Merge from"',
"'Merge to"'
],
"'Informasi halaman"': [
"'GOCEinuse"',
"'In use"',
" 'Tugas sekolah"',
"'Under construction"'
/* TODO: Incoming merge
'Cleanup and maintenance tags': {
'General cleanup': [
'Cleanup', // has a subgroup with text input
'Cleanup rewrite',
'Copy edit' // has a subgroup with text input
],
'Potentially unwanted content': [
'Close paraphrasing',
'Copypaste', // has a subgroup with text input
'External links',
'Non-free'
],
'Structure, formatting, and lead section': [
'Cleanup reorganize',
'Condense',
'Lead missing',
'Lead rewrite',
'Lead too long',
'Lead too short',
'Sections',
'Very long'
],
'Fiction-related cleanup': [
'All plot',
'Fiction',
'In-universe',
'Long plot',
'No plot'
]
},
'General content issues': {
'Importance and notability': [
'Notability' // has a subgroup with subcategories
],
'Style of writing': [
'Advert',
'Cleanup tense',
'Essay-like',
'Fanpov',
'Like resume',
'Manual',
'Cleanup-PR',
'Over-quotation',
'Prose',
'Technical',
'Tone'
],
'Sense (or lack thereof)': [
'Confusing',
'Incomprehensible',
'Unfocused'
],
'Information and detail': [
'Context',
'Expert needed',
'Overly detailed',
'Undue weight'
],
'Timeliness': [
'Current',
'Update'
],
'Neutrality, bias, and factual accuracy': [
'Autobiography',
'COI',
'Disputed',
'Hoax',
'Globalize',
'Over-coverage',
'Peacock',
'POV',
'Recentism',
'Too few opinions',
'Undisclosed paid',
'Weasel'
],
'Verifiability and sources': [
'BLP sources',
'BLP unsourced',
'More citations needed',
'One source',
'Original research',
'Primary sources',
'Self-published',
'Sources exist',
'Third-party',
'Unreferenced',
'Unreliable sources'
]
},
'Specific content issues': {
'Language': [
'Not English', // has a subgroup with several options
'Rough translation', // has a subgroup with several options
'Expand language'
],
'Links': [
'Dead end',
'Orphan',
'Overlinked',
'Underlinked'
],
'Referencing technique': [
'Citation style',
'Cleanup bare URLs',
'More footnotes',
'No footnotes'
],
'Categories': [
'Improve categories',
'Uncategorized'
]
},
'Merging': [
'History merge',
'Merge', // these three have a subgroup with several options
'Merge from',
'Merge to'
],
'Informational': [
'GOCEinuse',
'In use',
'Under construction'
*/
]
};
Baris 825 ⟶ 1.112:
Twinkle.tag.multipleIssuesExceptions = [
'Copypaste',
'Current', // Works but not intended for use in MI
'Expand language',
'GOCEinuse',
Baris 853 ⟶ 1.141:
label: '{{R from initialism}}: dialihkan dari penyingkatan (contoh ANB) ke bentuk panjangnya',
value: 'R from initialism'
},
{
label: '{{R from ASCII-only}}: pengalihan dari sebuah judul dalam ASCII dasar ke judul artikel yang formal, dengan perbedaan yang bukan berupa tanda diakritik atau sebagainya',
value: 'R from ASCII-only'
},
{
Baris 861 ⟶ 1.153:
label: '{{R from misspelling}}: pengalihan dari kesalahan ejaan atau tipografi',
value: 'R from misspelling'
},
{
label: '{{R from modification}}: redirect from a modification of the target\'s title, such as with words rearranged',
value: 'R from modification'
},
{
Baris 892 ⟶ 1.188:
label: '{{R from alternative language}}: pengalihan dari nama bahasa Inggris ke nama dalam bahasa lain, atau sebaliknya',
value: 'R from alternative language',
subgroup : [
{
name: 'altLangFrom',
Baris 917 ⟶ 1.213:
},
{
label: '{{R from former name}}: redirect from a former name or working title',
label: '{{R from ASCII}}: pengalihan dari sebuah judul dalam ASCII dasar ke judul artikel yang formal, dengan perbedaan yang bukan berupa tanda diakritik',
value: 'R from ASCIIformer name'
},
{
Baris 931 ⟶ 1.227:
label: '{{R from long name}}: pengalihan dari sebuah judul yang lebih lengkap',
value: 'R from long name'
},
{
label: '{{R from molecular formula}}: redirect from a molecular/chemical formula to its technical or trivial name',
value: 'R from molecular formula'
},
{
Baris 943 ⟶ 1.243:
label: '{{R from scientific name}}: pengalihan dari nama ilmiah ke nama yang umum',
value: 'R from scientific name'
},
{
label: '{{R from short name}}: redirect from a title that is a shortened form of a person\'s full name, a book title, or other more complete title',
value: 'R from short name'
},
{
label: '{{R from subtopic}}: redirect from a title that is a subtopic of the target article',
value: 'R from subtopic'
},
{
Baris 949 ⟶ 1.257:
},
{
label: '{{R to diacriticsdiacritic}}: pengalihan ke judul dengan disertai tanda diakritik (accents, umlauts, etc.)',
value: 'R to diacriticsdiacritic'
},
{
label: '{{R to related topic}}: redirect to an article about a similar topic',
value: 'R to related topic'
},
{
Baris 960 ⟶ 1.272:
Twinkle.tag.administrativeList = [
{
label: '{{R from ambiguous term}}: redirect from an ambiguous page name to a page that disambiguates it. This template should never appear on a page that has "(disambiguation)" in its title, use R to disambiguation page instead',
label: '{{R from CamelCase}}: pengalihan dari judul CamelCase',
value: 'R from ambiguous term'
},
{
label: '{{R from CamelCase}}: pengalihan dari judul CamelCase',
value: 'R from CamelCase'
},
{
label: '{{R to decade}}: pengalihan dari suatu tahun ke artikel dekade',
value: 'R to decade'
},
{
label: '{{R to disambiguation page}}: pengalihan ke halaman disambiguasi',
value: 'R to disambiguation page'
},
{
Baris 968 ⟶ 1.292:
},
{
label: '{{R from file metadata link}}: redirect of a wikilink created from EXIF, XMP, or other information (i.e. the "metadata" section on some image description pages)',
 
value: 'R from file metadata link'
label: '{{R from EXIF}}: pengalihan pranala wiki yang dibuat dari informasi EXIF JPEG (bagian "metadata" dari beberapa jenis halaman berkas)',
},
value: 'R from EXIF'
{
label: '{{R with history}}: redirect from a page containing substantive page history, kept to preserve content and attributions',
value: 'R with history'
},
{
label: '{{R from incomplete disambiguation}}: redirect from a page name that is too ambiguous to be the title of an article and should redirect to an appropriate disambiguation page',
value: 'R from incomplete disambiguation'
},
{
label: '{{R from merge}}: pengalihan dari halaman yang digabung untuk menyimpan sejarah suntingannya',
value: 'R from merge'
},
{
label: '{{R from other disambiguation}}: redirect from a page name with an alternative disambiguation qualifier',
value: 'R from other disambiguation'
},
{
label: '{{R printworthy}}: redirect from a title that would be helpful in a printed or CD/DVD version of Wikipedia',
value: 'R printworthy'
},
{
Baris 985 ⟶ 1.324:
},
{
label: '{{R from sort name}}: redirect from the target\'s sort name, such as beginning with their surname rather than given name',
label: '{{R to decade}}: pengalihan dari suatu tahun ke artikel dekade',
value: 'R tofrom decadesort name'
},
{
label: '{{R unprintworthy}}: redirect from a title that would NOT be helpful in a printed or CD/DVD version of Wikipedia',
label: '{{R to disambiguation page}}: pengalihan ke halaman disambiguasi',
value: 'R to disambiguation pageunprintworthy'
}
];
Baris 1.007 ⟶ 1.346:
{ label: '{{Copy to Commons}}: media bebas yang perlu dipindahkan ke Commons', value: 'Copy to Commons' },
{ label: '{{Do not move to Commons}} (masalah domain umum): berkas berlisensi domain umum di AS namun tidak dengan negara asalnya', value: 'Do not move to Commons' },
{
{ label: '{{Do not move to Commons}} (alasan lain)',
label: '{{Do not move to Commons}} (alasan lain)',
value: 'Jangan pindahkan ke Commons Commons_reason',
subgroup: {
Baris 1.016 ⟶ 1.356:
}
},
{
{ label: '{{Keep local}}: permintaan untuk menyimpan salinan lokal dari berkas Commons',
label: '{{Keep local}}: permintaan untuk menyimpan salinan lokal dari berkas Commons',
value: 'Keep local',
subgroup: {
Baris 1.025 ⟶ 1.366:
}
},
{
{ label: '{{Now Commons}}: berkas sudah dipindahkan ke Commons',
label: '{{Now Commons}}: berkas sudah dipindahkan ke Commons',
value: 'subst:ncd',
subgroup: {
Baris 1.043 ⟶ 1.385:
{ label: '{{Bad JPEG}}: JPEG yang harus diganti dengan PNG atau SVG', value: 'Bad JPEG' },
{ label: '{{Bad trace}}: sisa SVG yang perlu dibersihkan', value: 'Bad trace' },
{
{ label: '{{Cleanup image}}: perapian umum', value: 'Cleanup image',
label: '{{Cleanup image}}: perapian umum', value: 'Cleanup image',
subgroup: {
type: 'input',
name: 'cleanupimageReason',
label: 'Alasan: ',
tooltip: 'Masukkan alasan perapian (diperlukan)'
}
},
{ label: '{{Cleanup SVG}}: perapian SVG yang memerlukan kode dan/atau tampilan', value: 'Cleanup SVG',
subgroup: {
type: 'input',
name: 'cleanupsvgReason',
label: 'Alasan: ',
tooltip: 'Masukkan alasan perapian (diperlukan)'
Baris 1.065 ⟶ 1.400:
{ label: '{{Opaque}}: latar belakang yang perlu dibuat transparan', value: 'Opaque' },
{ label: '{{Remove border}}: garis pinggir, bagian putih, dsb. yang tak diperlukan', value: 'Remove border' },
{
{ label: '{{Rename media}}: nama berkas perlu diubah, sesuai kriteria',
label: '{{Rename media}}: nama berkas perlu diubah, sesuai kriteria',
value: 'Rename media',
subgroup: [
Baris 1.113 ⟶ 1.449:
{ label: '{{Image-blownout}}', value: 'Image-blownout' },
{ label: '{{Image-out-of-focus}}', value: 'Image-out-of-focus' },
{
{ label: '{{Image-Poor-Quality}}', value: 'Image-Poor-Quality',
label: '{{Image-Poor-Quality}}', value: 'Image-Poor-Quality',
subgroup: {
type: 'input',
Baris 1.122 ⟶ 1.459:
},
{ label: '{{Image-underexposure}}', value: 'Image-underexposure' },
{
{ label: '{{Low quality chem}}: struktur kimia yang dipertentangkan', value: 'Low quality chem',
label: '{{Low quality chem}}: struktur kimia yang dipertentangkan', value: 'Low quality chem',
subgroup: {
type: 'input',
Baris 1.129 ⟶ 1.467:
tooltip: 'Masukkan alasan mengapa diagram ini dipertentangkan (diperlukan)'
}
},
];
 
Twinkle.tag.file.replacementList = [
{ label: '{{Duplicate}}: berkas duplikat, namun masih dipakai dalam artikel', value: 'Duplicate' },
{ label: '{{Obsolete}}: berkas baru telah tersedia', value: 'Obsolete' },
{ label: '{{PNG version available}}', value: 'PNG version available' },
Baris 1.143 ⟶ 1.480:
label: 'Replacement file: ',
tooltip: 'Enter the name of the file which replaces this one (required)',
name: el.value.replace(/ /g, '_') + 'File'
};
});
 
Baris 1.152 ⟶ 1.489:
 
// Remove tags that become superfluous with this action
var pageText = pageobj.getPageText().replace(/\{\{\s*([Uu]serspace draft)\s*(\|(?:\{\{[^{}]*\}\}|[^{}])*)?\}\}\s*/g, ""'');
var summaryText;
var params = pageobj.getCallbackParameters();
 
Baris 1.161 ⟶ 1.497:
*/
var postRemoval = function() {
 
if (params.tagsToRemove.length) {
// Finish summary text
summaryText += ' tag' + ( params.tagsToRemove.length > 1 ? 's' : '') + ' from article';
 
// Remove empty {{multiple issues}} if found
pageText = pageText.replace(/\{\{(multiple ?issues|article ?issues|mi)\s*\|\s*\}\}\n?/im, '');
// Remove single-element {{multiple issues}} if found
pageText = pageText.replace(/\{\{(?:multiple ?issues|article ?issues|mi)\s*\|\s*(\{\{[^}]+\}\})\s*\}\}/im, '$1');
}
 
// Build edit summary
var makeSentence = function(array) {
if (array.length < 3) {
return array.join(' and ');
}
var last = array.pop();
return array.join(', ') + ', and ' + last;
};
var makeTemplateLink = function(tag) {
var text = '{{[[';
// if it is a custom tag with a parameter
if (tag.indexOf('|') !== -1) {
tag = tag.slice(0, tag.indexOf('|'));
}
text += tag.indexOf(':') !== -1 ? tag : 'Template:' + tag + '|' + tag;
return text + ']]}}';
};
 
var summaryText;
var addedTags = params.tags.map(makeTemplateLink);
var removedTags = params.tagsToRemove.map(makeTemplateLink);
if (addedTags.length) {
summaryText = 'Added ' + makeSentence(addedTags);
summaryText += removedTags.length ? '; and removed ' + makeSentence(removedTags) : '';
} else {
summaryText = 'Removed ' + makeSentence(removedTags);
}
summaryText += ' tag' + (addedTags.length + removedTags.length > 1 ? 's' : '');
if (params.reason) {
summaryText += ': ' + params.reason;
}
 
// avoid truncated summaries
if (summaryText.length > (254499 - Twinkle.getPref('summaryAd').length)) {
summaryText = summaryText.replace(/\[\[[^|]+\|([^\]]+)\]\]/g, "'$1"');
}
 
pageobj.setPageText(pageText);
pageobj.setEditSummary(summaryText + Twinkle.getPref('summaryAd'));
pageobj.setWatchlist(Twinkle.getFriendlyPrefgetPref('watchTaggedPages'));
pageobj.setMinorEdit(Twinkle.getFriendlyPrefgetPref('markTaggedPagesAsMinor'));
pageobj.setCreateOption('nocreate');
pageobj.save(function() {
Baris 1.186 ⟶ 1.550:
if (params.mergeReason) {
// post the rationale on the talk page (only operates in main namespace)
var talkpageText = "'\n\n== Proposed merge with [["' + params.nonDiscussArticletalkDiscussionTitleLinked + "]]' ==\n\n"';
talkpageText += params.mergeReason.trim() + "' ~~~~"';
var talkpage = new Morebits.wiki.page('Talk:' + params.discussArticle, 'Posting rationale on talk page');
 
var talkpage = new Morebits.wiki.page("Talk:" + params.discussArticle, "Posting rationale on talk page");
talkpage.setAppendText(talkpageText);
talkpage.setEditSummary('Proposing/* to merge [[:' + params.nonDiscussArticletalkDiscussionTitle + ']] */ new section' + Twinkle.getPref('summaryAd'));
talkpage.setWatchlist(Twinkle.getPref('watchMergeDiscussions'));
(params.mergeTag === 'Merge' ? 'with' : 'into') + ' [[:' + params.discussArticle + ']]' +
Twinkle.getPref('summaryAd'));
talkpage.setWatchlist(Twinkle.getFriendlyPref('watchMergeDiscussions'));
talkpage.setCreateOption('recreate');
talkpage.append();
Baris 1.200 ⟶ 1.561:
if (params.mergeTagOther) {
// tag the target page if requested
var otherTagName = "'Merge"';
if (params.mergeTag === 'Merge from') {
otherTagName = "'Merge to"';
} else if (params.mergeTag === 'Merge to') {
otherTagName = "'Merge from"';
}
var newParams = {
Baris 1.212 ⟶ 1.573:
mergeTarget: Morebits.pageNameNorm,
discussArticle: params.discussArticle,
talkDiscussionTitle: params.talkDiscussionTitle,
talkDiscussionTitleLinked: params.talkDiscussionTitleLinked
};
var otherpage = new Morebits.wiki.page(params.mergeTarget, "'Tagging other page ("' +
params.mergeTarget + "')"');
otherpage.setCallbackParameters(newParams);
otherpage.load(Twinkle.tag.callbacks.article);
Baris 1.223 ⟶ 1.585:
if (params.translationPostAtPNT) {
var pntPage = new Morebits.wiki.page('Wikipedia:Pages needing translation into English',
"'Listing article at Wikipedia:Pages needing translation into English"');
pntPage.setFollowRedirect(true);
pntPage.setCallbackParameters({
template: params.tags.indexOf('Rough translation') !== -1 ? "duflu" : "needtrans",
lang: params.translationLanguage,
reason: params.translationComments
});
pntPage.load(function friendlytagCallbacksTranslationListPage(pageobj) {
var old_text = pageobj.getPageText();
var params = pageobj.getCallbackParameters();
var statelem = pageobj.getStatusElement();
 
var template = params.tags.indexOf('Rough translation') !== -1 ? 'duflu' : 'needtrans';
var templateText = "{{subst:" + params.template + "|pg=" + Morebits.pageNameNorm + "|Language=" +
(params.var lang || "uncertain") + "|Comments=" + params.reason.trim() + "}} ~~~~"translationLanguage;
var reason = params.translationComments;
 
var templateText = '{{subst:' + template + '|pg=' + Morebits.pageNameNorm + '|Language=' +
(lang || 'uncertain') + '|Comments=' + reason.trim() + '}} ~~~~';
 
var text, summary;
if (params.template === "'duflu"') {
text = old_text + "'\n\n"' + templateText;
summary = "'Translation cleanup requested on "';
} else {
text = old_text.replace(/\n+(==\s?Translated pages that could still use some cleanup\s?==)/,
"'\n\n"' + templateText + "'\n\n$1"');
summary = "'Translation"' + (params.lang ? ("' from "' + params.lang) : ""'') + "' requested on "';
}
 
if (text === old_text) {
statelempageobj.getStatusElement().error('failed to find target spot for the discussion');
return;
}
pageobj.setPageText(text);
pageobj.setEditSummary(summary + "' [[:"' + Morebits.pageNameNorm + "']]"' + Twinkle.getPref('summaryAd'));
pageobj.setCreateOption('recreate');
pageobj.save();
Baris 1.259 ⟶ 1.618:
}
if (params.translationNotify) {
pageobj.lookupCreatorlookupCreation(function(innerPageobj) {
var initialContrib = innerPageobj.getCreator();
 
// Disallow warning yourself
if (initialContrib === mw.config.get('wgUserName')) {
innerPageobj.getStatusElement().warn("'You ("' + initialContrib + "') created this page; skipping user notification"');
return;
}
Baris 1.270 ⟶ 1.629:
var userTalkPage = new Morebits.wiki.page('User talk:' + initialContrib,
'Notifying initial contributor (' + initialContrib + ')');
var notifytext = "'\n\n== Your article [["' + Morebits.pageNameNorm + "']]==\n"' +
"'{{subst:uw-notenglish|1="' + Morebits.pageNameNorm +
(params.translationPostAtPNT ? ""'' : "'|nopnt=yes"') + "'}} ~~~~"';
userTalkPage.setAppendText(notifytext);
userTalkPage.setEditSummary("'Notice: Please use English when contributing to the English Wikipedia."' +
Twinkle.getPref('summaryAd'));
userTalkPage.setCreateOption('recreate');
Baris 1.283 ⟶ 1.642:
});
 
if ( params.patrol ) {
pageobj.patroltriage();
}
};
Baris 1.292 ⟶ 1.651:
* Calls postRemoval() when done
*/
var removeTags = function removeTags() {
 
if (params.tagsToRemove.length === 0) {
// finish summary text from adding of tags, in this case where there are
// no tags to be removed
summaryText += ' tag' + ( tags.length > 1 ? 's' : '' ) + ' to article';
 
postRemoval();
return;
}
 
Morebits.status.info( 'Info', 'Removing deselected tags that were already present' );
 
if (params.tags.length > 0) {
summaryText += ( tags.length ? (' tag' + ( tags.length > 1 ? 's' : '' )) : '' ) + ', and removed';
} else {
summaryText = 'Removed';
}
 
var getRedirectsFor = [];
Baris 1.316 ⟶ 1.665:
// otherwise moves it to `getRedirectsFor` array earmarking it for
// later removal
params.tagsToRemove.forEach(function removeTag(tag, tagIndex) {
 
var tag_re = new RegExp('\\{\\{' + Morebits.pageNameRegex(tag) + '\\s*(\\|[^}]+)?\\}\\}\\n?');
if (tag === 'Globalize') {
// special case to catch occurrences like {{Globalize/UK}}, etc
tag_re = new RegExp('\\{\\{[gG]lobalize/?[^}]*\\}\\}\\n?');
}
 
if (tag_re.test(pageText)) {
pageText = pageText.replace(tag_re, '');
} else {
getRedirectsFor.push('Template:' + tag);
}
 
// Producing summary text for current tag removal
if ( tagIndex > 0 ) {
if( tagIndex === (params.tagsToRemove.length - 1) ) {
summaryText += ' and';
} else if ( tagIndex < (params.tagsToRemove.length - 1) ) {
summaryText += ',';
}
}
summaryText += ' {{[[Template:' + tag + '|' + tag + ']]}}';
});
 
if (! getRedirectsFor.length) {
postRemoval();
return;
Baris 1.347 ⟶ 1.681:
 
// Remove tags which appear in page text as redirects
var api = new Morebits.wiki.api("'Getting template redirects"', {
"'action"': "'query"',
"'prop"': "'linkshere"',
"'titles"': getRedirectsFor.join('|'),
"'redirects"': 1, // follow redirect if the class name turns out to be a redirect page
"'lhnamespace"': "'10"', // template namespace only
"'lhshow"': "'redirect"',
"'lhlimit"': "'max"' // 500 is max for normal users, 5000 for bots and sysops
}, function removeRedirectTag(apiobj) {
 
$(apiobj.responseXML).find('page').each(function(idx, page) {
var removed = false;
$(page).find('lh').each(function(idx, el) {
Baris 1.382 ⟶ 1.716:
};
 
if (! params.tags.length) {
removeTags();
return;
}
 
var tagRe, tagText = '', tags = [], groupableTags = [], groupableExistingTags = [];
// Executes first: addition of selected tags
summaryText = 'Added';
var tagRe, tagText = '', tags = [], groupableTags = [], groupableExistingTags = [], totalTags;
 
/**
Baris 1.396 ⟶ 1.729:
* @param {string} tagName
*/
var addTag = function articleAddTag( tagIndex, tagName ) {
var currentTag = ""'';
if( (tagName === 'Uncategorized' || tagName === 'Improve categories' ) {
pageText += '\n\n{{' + tagName + '|date={{subst:CURRENTMONTHNAME}} {{subst:CURRENTYEAR}}}}';
} else {
if(currentTag tagName ==+= 'Globalize{{' )+ {tagName;
currentTag += '{{' + params.globalize;
} else {
currentTag += '{{' + tagName;
}
 
// fill in other parameters, based on the tag
switch ( tagName ) {
case 'Cleanup':
currentTag += '|reason=' + params.cleanup;
Baris 1.441 ⟶ 1.769:
if (params.expertNeededReason) {
currentTag += '|reason=' + params.expertNeededReason;
}
break;
case 'Globalize':
currentTag += '|1=article';
if (params.globalizeRegion) {
currentTag += '|2=' + params.globalizeRegion;
}
break;
Baris 1.447 ⟶ 1.781:
break;
case 'Notability':
if (params.notability !== 'none' ) {
currentTag += '|' + params.notability;
}
Baris 1.473 ⟶ 1.807:
case 'Merge to':
case 'Merge from':
if (params.mergeTarget)mergeTag = {tagName;
// normalize the merge target for now and later
params.mergeTarget = Morebits.string.toUpperCaseFirstChar(params.mergeTarget.replace(/_/g, ' '));
 
currentTag += '|' + params.mergeTarget;
 
// link to the correct section on the talk page, for article space only
if (mw.config.get('wgNamespaceNumber') === 0 && (params.mergeReason || params.discussArticle)) {
if (!params.discussArticle) {
// discussArticle is the article whose talk page will contain the discussion
params.discussArticle = (tagName === "'Merge to"' ? params.mergeTarget : mw.config.get('wgTitle'));
// nonDiscussArticle is the article which won't have the discussion
params.nonDiscussArticle = (tagName === "'Merge to"' ? mw.config.get('wgTitle') : params.mergeTarget);
var direction = '[[' + params.talkDiscussionTitlenonDiscussArticle + ']]' + (params.mergeTag === 'DiusulkanMerge' digabung? dengan' with ' : ' into ') + '[[' + params.nonDiscussArticlediscussArticle + ']]';
params.talkDiscussionTitleLinked = 'Diusulkan digabung dengan ' + direction;
}
params.talkDiscussionTitle = params.talkDiscussionTitleLinked.replace(/\[\[(.*?)\]\]/g, '$1');
currentTag += '|discuss=Talk:' + params.discussArticle + '#' + params.talkDiscussionTitle;
}
currentTag += '|discuss=Talk:' + params.discussArticle + '#' + params.talkDiscussionTitle;
}
break;
Baris 1.499 ⟶ 1.834:
tagText += currentTag;
}
 
if ( tagIndex > 0 ) {
if( tagIndex === (totalTags - 1) ) {
summaryText += ' dan';
} else if ( tagIndex < (totalTags - 1) ) {
summaryText += ',';
}
}
 
summaryText += ' {{[[';
if( tagName === 'Globalize' ) {
summaryText += "Template:" + params.globalize + '|' + params.globalize;
} else {
// if it is a custom tag with a parameter
if( tagName.indexOf("|") !== -1 ) {
tagName = tagName.slice(0,tagName.indexOf("|"));
}
summaryText += (tagName.indexOf(":") !== -1 ? tagName : ("Template:" + tagName + "|" + tagName));
}
summaryText += ']]}}';
 
};
 
Baris 1.528 ⟶ 1.842:
*/
var addUngroupedTags = function() {
totalTags = tags.length;
$.each(tags, addTag);
 
Baris 1.542 ⟶ 1.855:
'(?:((?:\\s*' +
// AfD is special, as the tag includes html comments before and after the actual template
'(?:<!--.*AfD.*\\n\\{\\{(?:Article for deletion\\/dated|AfDM).*\\}\\}\\n<!--.*(?:\\n<!--.*)?AfD.*(?:\\s*\\n))?|' + // trailing whitespace/newline needed since this subst's a newline
// begin template format
'\\{\\{\\s*(?:' +
Baris 1.548 ⟶ 1.861:
'db|delete|db-.*?|speedy deletion-.*?|' +
// PROD
'(?:proposed deletion|prod blp)\\/dated\\n(?:\\s+*\\|(?:concern|user|timestamp|help).*)+|' +
// various hatnote templates
'about|correct title|dablink|distinguish|for|other\\s?(?:hurricaneuses|people|persons|places|uses(?:of)?)|redirect(?:-acronym)?|see\\s?(?:also|wiktionary)|selfref|short description|the' +
// not a hatnote, but sometimes under a CSD or AfD
'|salt|proposed deletion endorsed' +
Baris 1.563 ⟶ 1.876:
// trailing whitespace
'\\s*)?',
'i'), "'$1"' + tagText
);
 
Baris 1.571 ⟶ 1.884:
// Separate tags into groupable ones (`groupableTags`) and non-groupable ones (`tags`)
params.tags.forEach(function(tag) {
tagRe = new RegExp( '\\{\\{' + tag + '(\\||\\}\\})', 'im' );
// regex check for preexistence of tag can be skipped if in canRemove mode
if( (Twinkle.tag.canRemove || !tagRe.exec( pageText ) ) {
// condition Twinkle.tag.article.tags[tag] to ensure that its not a custom tag
// Custom tags are assumed non-groupable, since we don't know whether MI template supports them
if( (Twinkle.tag.article.tags[tag] && Twinkle.tag.multipleIssuesExceptions.indexOf(tag) === -1 ) {
groupableTags.push( tag );
} else {
tags.push( tag );
}
} else {
if (tag === 'Merge from' || tag === 'History merge') {
tags.push( tag );
} else {
Morebits.status.warn( 'Info', 'Ditemukan tag {{' + tag +
'}} di artikel tersebut... membatalkan' );
// don't do anything else with merge tags
if ( ['Merge', 'Merge to'].indexOf(tag) !== -1 ) {
params.mergeTarget = params.mergeReason = params.mergeTagOther = null;
}
Baris 1.596 ⟶ 1.909:
 
// To-be-retained existing tags that are groupable
params.tagsToRemain.forEach( function(tag) {
if (Twinkle.tag.multipleIssuesExceptions.indexOf(tag) === -1) {
groupableExistingTags.push(tag);
Baris 1.604 ⟶ 1.917:
var miTest = /\{\{(multiple ?issues|article ?issues|mi)(?!\s*\|\s*section\s*=)[^}]+\{/im.exec(pageText);
 
if ( miTest && groupableTags.length > 0 ) {
Morebits.status.info( 'Info', 'Menambah tag yang lain ke dalam tag {{multiple issues}}' yang telah ada');
 
tagText = "";
 
tagText = '';
totalTags = groupableTags.length;
$.each(groupableTags, addTag);
 
var miRegex = new RegExp('(\\{\\{\\s*' + miTest[1] + '\\s*(?:\\|(?:\\{\\{[^{}]*\\}\\}|[^{}])*)?)\\}\\}\\s*', 'im');
summaryText += ' tag' + ( groupableTags.length > 1 ? 's' : '' ) + ' (dalam {{[[Template:multiple issues|multiple issues]]}})';
pageText = pageText.replace(miRegex, '$1' + tagText + '}}\n');
if( tags.length > 0 ) {
summaryTexttagText += ', dan';
}
 
var miRegex = new RegExp("(\\{\\{\\s*" + miTest[1] + "\\s*(?:\\|(?:\\{\\{[^{}]*\\}\\}|[^{}])*)?)\\}\\}\\s*", "im");
pageText = pageText.replace(miRegex, "$1" + tagText + "}}\n");
tagText = "";
 
addUngroupedTags();
 
} else if( (params.group && !miTest && (groupableExistingTags.length + groupableTags.length) >= 2 ) {
Morebits.status.info( 'Info', 'Mengelompokkan tag yang didukung ke dalam {{multiple issues}}' );
 
tagText += '{{Multiple issues|\n';
Baris 1.632 ⟶ 1.938:
*/
var addNewTagsToMI = function() {
totalTags = groupableTags.length;
$.each(groupableTags, addTag);
if (groupableTags.length) {
summaryText += ' tags (dalam {{[[Template:multiple issues|multiple issues]]}})';
} else {
summaryText += ' {{[[Template:multiple issues|multiple issues]]}}';
}
if( tags.length > 0 ) {
summaryText += ', dan';
}
tagText += '}}\n';
 
Baris 1.662 ⟶ 1.959:
});
 
if (! getRedirectsFor.length) {
addNewTagsToMI();
return;
}
 
var api = new Morebits.wiki.api("'Getting template redirects"', {
"'action"': "'query"',
"'prop"': "'linkshere"',
"'titles"': getRedirectsFor.join('|'),
"'redirects"': 1,
"'lhnamespace"': "'10"', // template namespace only
"'lhshow"': "'redirect"',
"'lhlimit"': "'max"' // 500 is max for normal users, 5000 for bots and sysops
}, function replaceRedirectTag(apiobj) {
$(apiobj.responseXML).find('page').each(function(idx, page) {
Baris 1.681 ⟶ 1.978:
var tag = $(el).attr('title').slice(9);
var tag_re = new RegExp('(\\{\\{' + Morebits.pageNameRegex(tag) + '\\s*(\\|[^}]*)?\\}\\}\\n?)');
if (tag_re.test(pageText)) {
tagText += tag_re.exec(pageText)[1];
pageText = pageText.replace(tag_re, '');
Baris 1.698 ⟶ 1.995:
 
} else {
tags = tags.concat( groupableTags );
addUngroupedTags();
}
 
},
 
Baris 1.710 ⟶ 2.006:
tags = [], i;
 
for( (i = 0; i < params.tags.length; i++ ) {
tagRe = new RegExp( '(\\{\\{' + params.tags[i] + '(\\||\\}\\}))', 'im' );
if ( !tagRe.exec( pageText ) ) {
tags.push( params.tags[i] );
} else {
Morebits.status.warn( 'Info', 'Found {{' + params.tags[i] +
'}} on the redirect already...excluding' );
}
}
 
var addTag = function redirectAddTag( tagIndex, tagName ) {
tagText += "'\n{{"' + tagName;
if (tagName === 'R from alternative language') {
if (params.altLangFrom) {
tagText += '|from=' + params.altLangFrom;
}
if (params.altLangTo) {
tagText += '|to=' + params.altLangTo;
}
Baris 1.732 ⟶ 2.028:
tagText += '}}';
 
if ( tagIndex > 0 ) {
if( (tagIndex === (tags.length - 1) ) {
summaryText += ' and';
} else if ( tagIndex < (tags.length - 1) ) {
summaryText += ',';
}
}
 
summaryText += ' {{[[:' + (tagName.indexOf("':"') !== -1 ? tagName : ("'Template:"' + tagName + "'|"' + tagName)) + ']]}}';
};
 
Baris 1.748 ⟶ 2.044:
// Check for all Rcat shell redirects (from #433)
if (pageText.match(/{{(?:redr|this is a redirect|r(?:edirect)?(?:.?cat.*)?[ _]?sh)/i)) {
// Regex courtesyinspired by [[User:Kephir/gadgets/sagittarius.js]] at ([[Special:PermaLink/831402893]])
var oldTags = pageText.match(/(\s*{{[A-Za-z ]+\|)((?:[^|{}]*|{{[^|}]*}})+)(}})\s*/i);
pageText = pageText.replace(oldTags[0], oldTags[1] + tagText + oldTags[2] + oldTags[3]);
} else {
// Fold any pre-existing Rcats into taglist and under Rcatshell
var pageTags = pageText.match(/\n{{R(?:edirect)? .*?}}/img);
var oldPageTags = '';
if (pageTags) {
pageTags.forEach(function(pageTag) {
var pageRe = new RegExp(pageTag, 'img');
pageText = pageText.replace(pageRe, '');
oldPageTags += pageTag;
});
Baris 1.765 ⟶ 2.061:
}
 
summaryText += ( tags.length > 0 ? ' tag' + ( tags.length > 1 ? 's' : '' ) : '' ) + ' to redirect';
 
// avoid truncated summaries
if (summaryText.length > (254499 - Twinkle.getPref('summaryAd').length)) {
summaryText = summaryText.replace(/\[\[[^|]+\|([^\]]+)\]\]/g, "'$1"');
}
 
pageobj.setPageText(pageText);
pageobj.setEditSummary(summaryText + Twinkle.getPref('summaryAd'));
pageobj.setWatchlist(Twinkle.getFriendlyPrefgetPref('watchTaggedPages'));
pageobj.setMinorEdit(Twinkle.getFriendlyPrefgetPref('markTaggedPagesAsMinor'));
pageobj.setCreateOption('nocreate');
pageobj.save();
 
if ( params.patrol ) {
pageobj.patroltriage();
}
 
Baris 1.788 ⟶ 2.084:
var text = pageobj.getPageText();
var params = pageobj.getCallbackParameters();
var summary = "'Menambahkan "';
 
// Add maintenance tags
if (params.tags.length) {
 
var tagtext = ""'', currentTag;
$.each(params.tags, function(k, tag) {
// when other commons-related tags are placed, remove "move to Commons" tag
if (["'Keep local"', "'subst:ncd"', "Do'Jangan notpindahkan moveke toCommons Commons_reason"', "Jangan'Do pindahkannot kemove to Commons"',
"'Now Commons"'].indexOf(tag) !== -1) {
text = text.replace(/\{\{(mtc|(copy |move )?to ?commons|move to wikimedia commons|copy to wikimedia commons)[^}]*\}\}/gi, ""'');
}
 
currentTag = "'{{"' + (tag === "'Jangan pindahkan ke Commons Commons_reason"' ? "Jangan'Do pindahkannot kemove to Commons"' : tag);
 
switch (tag) {
case "'subst:ncd"':
if (params.ncdName !== ""'') {
currentTag += '|1=' + params.ncdName;
}
break;
case "'Keep local"':
if (params.keeplocalName !== ""'') {
currentTag += '|1=' + params.keeplocalName;
}
break;
case "'Rename media"':
if (params.renamemediaNewname !== ""'') {
currentTag += '|1=' + params.renamemediaNewname;
}
if (params.renamemediaReason !== "") currentTag += '|2=' + params.renamemediaReason;
if (params.renamemediaReason !== '') {
currentTag += '|2=' + params.renamemediaReason;
}
break;
case "'Cleanup image"':
currentTag += '|1=' + params.cleanupimageReason;
break;
case "Cleanup SVG"'Image-Poor-Quality':
currentTag += '|1=' + params.cleanupsvgReason;
break;
case "Image-Poor-Quality":
currentTag += '|1=' + params.ImagePoorQualityReason;
break;
case "'Low quality chem"':
currentTag += '|1=' + params.lowQualityChemReason;
break;
case "'Vector version available"':
text = text.replace(/\{\{((convert to |convertto|should be |shouldbe|to)?svg|badpng|vectorize)[^}]*\}\}/gi, ""'');
/* falls through */
case "PNG version available":
/* falls through */
case "Obsolete"'PNG version available':
/* falls through */
case "Duplicate"'Obsolete':
currentTag += "'|1="' + params[tag.replace(/ /g, '_') + 'File'];
break;
case "Do'Jangan notpindahkan moveke toCommons Commons_reason"':
currentTag += '|reason=' + params.DoNotMoveToCommons;
break;
case "'subst:orfurrev"':
// remove {{non-free reduce}} and redirects
text = text.replace(/\{\{\s*(Template\s*:\s*)?(Non-free reduce|FairUseReduce|Fairusereduce|Fair Use Reduce|Fair use reduce|Reduce size|Reduce|Fair-use reduce|Image-toobig|Comic-ovrsize-img|Non-free-reduce|Nfr|Smaller image|Nonfree reduce)\s*(\|(?:\{\{[^{}]*\}\}|[^{}])*)?\}\}\s*/ig, ""'');
currentTag += "'|date={{subst:date}}"';
break;
case "'Copy to Commons"':
currentTag += "'|human="' + mw.config.get("'wgUserName"');
break;
case "'Should be SVG"':
currentTag += "'|"' + params.svgCategory;
break;
default:
Baris 1.854 ⟶ 2.153:
}
 
currentTag += "'}}\n"';
 
tagtext += currentTag;
summary += "'{{"' + tag + "'}}, "';
});
 
if (!tagtext) {
pageobj.getStatusElement().warn("'Tindakan pengguna dibatalkan; tugas tidak dilanjutkan"');
return;
}
Baris 1.870 ⟶ 2.169:
pageobj.setPageText(text);
pageobj.setEditSummary(summary.substring(0, summary.length - 2) + Twinkle.getPref('summaryAd'));
pageobj.setWatchlist(Twinkle.getFriendlyPrefgetPref('watchTaggedPages'));
pageobj.setMinorEdit(Twinkle.getFriendlyPrefgetPref('markTaggedPagesAsMinor'));
pageobj.setCreateOption('nocreate');
pageobj.save();
 
if ( params.patrol ) {
pageobj.patroltriage();
}
}
Baris 1.888 ⟶ 2.187:
}
 
// Don't return null if there aren't any available tags
params.tags = form.getChecked( Twinkle.tag.mode + 'Tags' );
params.tags = form.getChecked(Twinkle.tag.mode + 'Tags') || [];
 
// Save values of input fields into params object. This works as quickform input
Baris 1.895 ⟶ 2.195:
 
var name_prefix = Twinkle.tag.mode + 'Tags.';
$(form).find("[name^='" + name_prefix + "']:not(div)").each(function(idx, el) {
// el are the HTMLInputElements, el.name gives the name attribute
params[el.name.slice(name_prefix.length)] =
(el.type === 'checkbox' ? form[el.name].checked : form[el.name].value);
});
 
Baris 1.905 ⟶ 2.205:
params.tagsToRemove = form.getUnchecked('alreadyPresentArticleTags') || [];
params.tagsToRemain = form.getChecked('alreadyPresentArticleTags') || [];
params.reason = form.reason.value.trim();
 
params.group = form.group.checked;
 
// Validation
if ( (params.tags.indexOf("'Merge"') !== -1) || (params.tags.indexOf("'Merge from"') !== -1) ||
(params.tags.indexOf("'Merge to"') !== -1) ) {
if( (((params.tags.indexOf("'Merge"') !== -1) + (params.tags.indexOf("'Merge from"') !== -1) +
(params.tags.indexOf("'Merge to"') !== -1)) > 1 ) {
alert( 'Please select only one of {{merge}}, {{merge from}}, and {{merge to}}. If several merges are required, use {{merge}} and separate the article names with pipes (although in this case Twinkle cannot tag the other articles automatically).' );
return;
}
if ( !params.mergeTarget ) {
alert( 'Please specify the title of the other article for use in the merge template.' );
return;
}
if( ((params.mergeTagOther || params.mergeReason) && params.mergeTarget.indexOf('|') !== -1 ) {
alert( 'Tagging multiple articles in a merge, and starting a discussion for multiple articles, is not supported at the moment. Please turn off "tag other article", and/or clear out the "reason" box, and try again.' );
return;
}
}
if( ((params.tags.indexOf("'Not Indonesian"') !== -1) && (params.tags.indexOf("'Rough translation"') !== -1) ) {
alert( 'Please select only one of {{not Indonesian}} and {{rough translation}}.' );
return;
}
if( (params.tags.indexOf('History merge') !== -1 && params.histmergeOriginalPage.trim() === '') {
alert( 'You must specify a page to be merged for the {{history merge}} tag.' );
return;
}
if( (params.tags.indexOf('Cleanup') !== -1 && params.cleanup.trim() === '') {
alert( 'You must specify a reason for the {{cleanup}} tag.' );
return;
}
if( (params.tags.indexOf('Expand language') !== -1 && params.expandLanguageLangCode.trim() === '') {
alert('You must specify language code for the {{expand language}} tag.');
return;
Baris 1.945 ⟶ 2.246:
case 'file':
 
if( (params.tags.indexOf('Cleanup image') !== -1 && params.cleanupimageReason === '') ||{
alert('You must specify a reason for the cleanup tag.');
(params.tags.indexOf('Cleanup svg') !== -1 && params.cleanupsvgReason === '') ) {
alert( 'You must specify a reason for the cleanup tag.' );
return;
}
if( (params.tags.indexOf('Image-Poor-Quality') !== -1 && params.ImagePoorQualityReason === '' ) {
alert('You must specify a reason for the {{Image-Poor-Quality}} tag');
return;
}
if( (params.tags.indexOf('Low Quality Chem') !== -1 && params.lowQualityChemReason === '' ) {
alert('You must specify a reason for the {{Low Quality Chem}} tag');
return;
}
if( ((params.tags.indexOf('DuplicateObsolete') !== -1 && params.DuplicateFileObsoleteFile === '') ||
(params.tags.indexOf('Obsolete') !== -1 && params.ObsoleteFile === '') ||
(params.tags.indexOf('PNG version available') !== -1 && params.PNG_version_availableFile === '') ||
(params.tags.indexOf('Vector version available') !== -1 && params.Vector_version_availableFile === '')
Baris 1.966 ⟶ 2.265:
return;
}
if( (params.tags.indexOf('DoJangan notpindahkan moveke toCommons Commons_reason') !== -1 && params.DoNotMoveToCommons === '' ) {
alert('You must specify a reason for the {{Do not move to Commons}} tag');
return;
Baris 1.976 ⟶ 2.275:
 
default:
alert("'Twinkle.tag: moda tak dikenal "' + Twinkle.tag.mode);
break;
}
Baris 1.982 ⟶ 2.281:
// File/redirect: return if no tags selected
// Article: return if no tag is selected and no already present tag is deselected
if( (params.tags.length === 0 && (Twinkle.tag.mode !== 'article' || params.tagsToRemove.length === 0)) {
alert( 'Setidaknya Anda harus memiliki satu tag!' );
return;
}
 
Morebits.simpleWindow.setButtonsEnabled( false );
Morebits.status.init( form );
 
Morebits.wiki.actionCompleted.redirect = Morebits.pageNameNorm;
Morebits.wiki.actionCompleted.notice = "'Menandai selesai, sedang memuat kembali halaman ini dalam beberapa detik"';
if (Twinkle.tag.mode === 'redirect') {
Morebits.wiki.actionCompleted.followRedirect = false;
}
 
var wikipedia_page = new Morebits.wiki.page(Morebits.pageNameNorm, "'Menandai "' + Twinkle.tag.mode);
wikipedia_page.setCallbackParameters(params);
wikipedia_page.load(Twinkle.tag.callbacks[Twinkle.tag.mode]);
Baris 2.003 ⟶ 2.302:
 
})(jQuery);
// </nowiki>