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
*/
Twinkle.tag = function friendlytag() {
// redirect tagging
if (
Twinkle.tag.mode = 'redirect';
Twinkle.addPortletLink(
// file tagging
} else if
Twinkle.tag.mode = 'file';
Twinkle.addPortletLink(
// article/draft article tagging
} else if
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(
}
};
Baris 40 ⟶ 37:
Twinkle.tag.callback = function friendlytagCallback() {
var Window = new Morebits.simpleWindow(
Window.setScriptName(
// anyone got a good policy/guideline/info page/instructional page link??
Window.addFooterLink(
var form = new Morebits.quickForm(
form.append({
type: 'input',
name: 'quickfilter',
size: '30px',
event: function twinkletagquickfilter() {
// flush the DOM of all existing underline spans
$allCheckboxDivs.find('.search-hit').each(function(i, e) {
var label_element = e.parentElement;
// 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) {
$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(
form.append({
Baris 72 ⟶ 96:
event: Twinkle.tag.updateSortOrder,
list: [
{ type: 'option', value: 'cat', label: 'Menurut kategori', selected: Twinkle.
{ type: 'option', value: 'alpha', label: 'Menurut abjad', selected: Twinkle.
]
});
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(
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(
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.
form.append({ type: 'header', label: 'Tag kustom' });
form.append({ type: 'checkbox', name: 'fileTags', list: Twinkle.
}
break;
case 'redirect':
Window.setTitle(
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.
form.append({ type: 'header', label: 'Custom tags' });
form.append({ type: 'checkbox', name: 'redirectTags', list: Twinkle.
}
break;
default:
alert(
break;
}
if (document.getElementsByClassName('patrollink').length) {
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(
Window.display();
// for quick filter:
$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(
// 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 ($(
Twinkle.tag.alreadyPresentTags.push('Uncategorized');
}
if ($(
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(
evt.initEvent(
result.sortorder.dispatchEvent(evt);
} else {
// Redirects and files: Add a link to each template's description page
Morebits.quickForm.getElements(result, Twinkle.tag.mode +
}
};
// $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 =
var container = new Morebits.quickForm.element({ type:
// function to generate a checkbox, with appropriate subgroup if needed
var makeCheckbox = function(tag, description) {
var checkbox = { value: tag, label:
if (Twinkle.tag.checkedTags.indexOf(tag) !== -1) {
checkbox.checked = true;
}
switch (tag) {
case
checkbox.subgroup = {
name: 'cleanup',
Baris 244 ⟶ 316:
};
break;
case
checkbox.subgroup = {
name: 'closeParaphrasing',
Baris 252 ⟶ 324:
};
break;
case
checkbox.subgroup = {
name: 'copyEdit',
Baris 261 ⟶ 333:
};
break;
case
checkbox.subgroup = {
name: 'copypaste',
Baris 270 ⟶ 342:
};
break;
case
checkbox.subgroup = [ {
];
break;
case
checkbox.subgroup = [
{
Baris 306 ⟶ 378:
];
break;
case
checkbox.subgroup = {
name: '
type: '
label: 'Tidak mewakili seluruh negara atau wilayah'
};
break;
case
checkbox.subgroup = [
{
Baris 359 ⟶ 407:
];
break;
case
case
case
var otherTagName =
switch (tag) {
case 'Merge from':
break;
case
otherTagName =
break;
// no default
}
checkbox.subgroup = [
Baris 396 ⟶ 444:
type: 'textarea',
label: 'Alasan penggabungan (akan dikirimkan ke ' +
(tag ===
tooltip: 'Opsional, namun sangat disarankan. Kosongkan jika tidak diinginkan. Hanya tersedia jika nama artikel tunggal diberikan.'
});
}
break;
case
checkbox.subgroup = [
{
name: 'translationLanguage',
}
];
if (tag === 'Not Indonesian') {
checkbox.subgroup.push({
{
tooltip: 'Tempatkan {{uw-notenglish}} di halaman pembicaraannya.'
}
]
});
}
if (mw.config.get('wgNamespaceNumber') === 0) {
checkbox.subgroup.push({
name: 'translationPostAtPNT',
{
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:
{ label:
{ label:
{ label:
{ label:
{ label:
{ label:
{ label:
{ label:
{ label:
{ label:
{ label:
{ label:
{ 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:
var subdiv = container.append({ type:
var checkboxes = [];
var unCheckedTags = e.target.form.getUnchecked('alreadyPresentArticleTags') || [];
Twinkle.tag.alreadyPresentTags.forEach(function(tag) {
var description = Twinkle.tag.article.tags[tag];
var checkbox =
{
value: tag,
label:
checked:
style: 'font-style: italic'
};
checkboxes.push(checkbox);
}
subdiv.append({
type:
name:
list: checkboxes
});
};
if (sortorder === 'cat') { // categorical sort order
// function to iterate through the tags and create a checkbox for each one
var doCategoryCheckboxes = function(subdiv, array) {
Baris 510 ⟶ 557:
});
subdiv.append({
type:
name:
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:
var subdiv = container.append({ type:
if (Array.isArray(content)) {
doCategoryCheckboxes(subdiv, content);
} else {
$.each(content, function(subtitle, subcontent) {
subdiv.append({ type:
doCategoryCheckboxes(subdiv, subcontent);
});
}
});
} else { // alphabetical sort order
if (Twinkle.tag.alreadyPresentTags.length > 0) {
makeCheckboxesForAlreadyPresentTags();
container.append({ type:
}
var checkboxes = [];
Baris 547 ⟶ 592:
});
container.append({
type:
name:
list: checkboxes
});
Baris 554 ⟶ 599:
// append any custom tags
if (Twinkle.
container.append({ type: 'header', label: 'Tag yang disesuaikan' });
container.append({ type: 'checkbox', name: 'articleTags',
list: Twinkle. el.checked = Twinkle.tag.checkedTags.indexOf(el.value) !== -1;
return el;
})
});
}
var $workarea = $(
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(
$workarea.find(
$workarea.find(
var alreadyPresentTags = Morebits.quickForm.getElements(
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(
link.setAttribute(
var tagname = checkbox.values;
link.setAttribute(
(tagname.indexOf(
(tagname.indexOf(
));
link.setAttribute(
$(checkbox).parent().append([
};
Baris 600 ⟶ 676:
Twinkle.tag.article.tags = {
/* 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 = {
],
],
],
]
},
],
],
],
],
],
],
]
},
],
],
],
]
},
],
/* 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',
value: 'R from
},
{
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
value: 'R to
},
{
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',
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 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',
value: 'R
},
{
label: '{{R unprintworthy}}: redirect from a title that would NOT be helpful in a printed or CD/DVD version of Wikipedia',
value: 'R
}
];
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)',
value: 'Jangan pindahkan ke Commons Commons_reason',
subgroup: {
Baris 1.016 ⟶ 1.356:
}
},
{
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',
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',
subgroup: {
type: 'input',
name: 'cleanupimageReason',
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',
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',
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',
subgroup: {
type: 'input',
Baris 1.129 ⟶ 1.467:
tooltip: 'Masukkan alasan mengapa diagram ini dipertentangkan (diperlukan)'
}
}
];
Twinkle.tag.file.replacementList = [
{ 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 params = pageobj.getCallbackParameters();
Baris 1.161 ⟶ 1.497:
*/
var postRemoval = function() {
if (params.tagsToRemove.length) {
// 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 > (
summaryText = summaryText.replace(/\[\[[^|]+\|([^\]]+)\]\]/g,
}
pageobj.setPageText(pageText);
pageobj.setEditSummary(summaryText + Twinkle.getPref('summaryAd'));
pageobj.setWatchlist(Twinkle.
pageobj.setMinorEdit(Twinkle.
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 =
talkpageText += params.mergeReason.trim() +
var talkpage = new Morebits.wiki.page('Talk:' + params.discussArticle, 'Posting rationale on talk page');
talkpage.setAppendText(talkpageText);
talkpage.setEditSummary('
talkpage.setWatchlist(Twinkle.getPref('watchMergeDiscussions'));
talkpage.setCreateOption('recreate');
talkpage.append();
Baris 1.200 ⟶ 1.561:
if (params.mergeTagOther) {
// tag the target page if requested
var otherTagName =
if (params.mergeTag === 'Merge from') {
otherTagName =
} else if (params.mergeTag === 'Merge to') {
otherTagName =
}
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,
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',
pntPage.setFollowRedirect(true);
pntPage.load(function friendlytagCallbacksTranslationListPage(pageobj) {
var old_text = pageobj.getPageText();
var template = params.tags.indexOf('Rough translation') !== -1 ? 'duflu' : 'needtrans';
var reason = params.translationComments;
var templateText = '{{subst:' + template + '|pg=' + Morebits.pageNameNorm + '|Language=' +
(lang || 'uncertain') + '|Comments=' + reason.trim() + '}} ~~~~';
var text, summary;
if (
text = old_text +
summary =
} else {
text = old_text.replace(/\n+(==\s?Translated pages that could still use some cleanup\s?==)/,
summary =
}
if (text === old_text) {
return;
}
pageobj.setPageText(text);
pageobj.setEditSummary(summary +
pageobj.setCreateOption('recreate');
pageobj.save();
Baris 1.259 ⟶ 1.618:
}
if (params.translationNotify) {
pageobj.
var initialContrib = innerPageobj.getCreator();
// Disallow warning yourself
if (initialContrib === mw.config.get('wgUserName')) {
innerPageobj.getStatusElement().warn(
return;
}
Baris 1.270 ⟶ 1.629:
var userTalkPage = new Morebits.wiki.page('User talk:' + initialContrib,
'Notifying initial contributor (' + initialContrib + ')');
var notifytext =
(params.translationPostAtPNT ?
userTalkPage.setAppendText(notifytext);
userTalkPage.setEditSummary(
Twinkle.getPref('summaryAd'));
userTalkPage.setCreateOption('recreate');
Baris 1.283 ⟶ 1.642:
});
if (
pageobj.
}
};
Baris 1.292 ⟶ 1.651:
* Calls postRemoval() when done
*/
var removeTags = function removeTags()
if (params.tagsToRemove.length === 0) {
postRemoval();
return;
}
Morebits.status.info(
var getRedirectsFor = [];
Baris 1.316 ⟶ 1.665:
// otherwise moves it to `getRedirectsFor` array earmarking it for
// later removal
params.tagsToRemove.forEach(function removeTag(tag
var tag_re = new RegExp('\\{\\{' + Morebits.pageNameRegex(tag) + '\\s*(\\|[^}]+)?\\}\\}\\n?');
if (tag_re.test(pageText)) {
pageText = pageText.replace(tag_re, '');
} else {
getRedirectsFor.push('Template:' + tag);
}
});
if (!
postRemoval();
return;
Baris 1.347 ⟶ 1.681:
// Remove tags which appear in page text as redirects
var api = new Morebits.wiki.api(
}, 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 (!
removeTags();
return;
}
var tagRe, tagText = '', tags = [], groupableTags = [], groupableExistingTags = [];
// Executes first: addition of selected tags
/**
Baris 1.396 ⟶ 1.729:
* @param {string} tagName
*/
var addTag = function articleAddTag(
var currentTag =
if
pageText += '\n\n{{' + tagName + '|date={{subst:CURRENTMONTHNAME}} {{subst:CURRENTYEAR}}}}';
} else {
// fill in other parameters, based on the tag
switch (
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':
params.talkDiscussionTitleLinked = 'Diusulkan digabung dengan ' + direction;
params.talkDiscussionTitle = params.talkDiscussionTitleLinked.replace(/\[\[(.*?)\]\]/g, '$1');
}
currentTag += '|discuss=Talk:' + params.discussArticle + '#' + params.talkDiscussionTitle;
}
break;
Baris 1.499 ⟶ 1.834:
tagText += currentTag;
}
};
Baris 1.528 ⟶ 1.842:
*/
var addUngroupedTags = function() {
$.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
// 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'),
);
Baris 1.571 ⟶ 1.884:
// Separate tags into groupable ones (`groupableTags`) and non-groupable ones (`tags`)
params.tags.forEach(function(tag) {
tagRe = new RegExp(
// regex check for preexistence of tag can be skipped if in canRemove mode
if
// 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
groupableTags.push(
} else {
tags.push(
}
} else {
if (tag === 'Merge from' || tag === 'History merge') {
tags.push(
} else {
Morebits.status.warn(
'}} di artikel tersebut... membatalkan'
// don't do anything else with merge tags
if (
params.mergeTarget = params.mergeReason = params.mergeTagOther = null;
}
Baris 1.596 ⟶ 1.909:
// To-be-retained existing tags that are groupable
params.tagsToRemain.forEach(
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 (
Morebits.status.info(
tagText = '';
$.each(groupableTags, addTag);
var miRegex = new RegExp('(\\{\\{\\s*' + miTest[1] + '\\s*(?:\\|(?:\\{\\{[^{}]*\\}\\}|[^{}])*)?)\\}\\}\\s*', 'im');
pageText = pageText.replace(miRegex, '$1' + tagText + '}}\n');
addUngroupedTags();
} else if
Morebits.status.info(
tagText += '{{Multiple issues|\n';
Baris 1.632 ⟶ 1.938:
*/
var addNewTagsToMI = function() {
$.each(groupableTags, addTag);
tagText += '}}\n';
Baris 1.662 ⟶ 1.959:
});
if (!
addNewTagsToMI();
return;
}
var api = new Morebits.wiki.api(
}, 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(
addUngroupedTags();
}
},
Baris 1.710 ⟶ 2.006:
tags = [], i;
for
tagRe = new RegExp(
if (
tags.push(
} else {
Morebits.status.warn(
'}} on the redirect already...excluding'
}
}
var addTag = function redirectAddTag(
tagText +=
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 (
if
summaryText += ' and';
} else if (
summaryText += ',';
}
}
summaryText += ' {{[[:' + (tagName.indexOf(
};
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
var oldTags = pageText.match(/(\s*{{[A-Za-z ]+\|)((?:[^|{}]*|{{[^
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 += (
// avoid truncated summaries
if (summaryText.length > (
summaryText = summaryText.replace(/\[\[[^|]+\|([^\]]+)\]\]/g,
}
pageobj.setPageText(pageText);
pageobj.setEditSummary(summaryText + Twinkle.getPref('summaryAd'));
pageobj.setWatchlist(Twinkle.
pageobj.setMinorEdit(Twinkle.
pageobj.setCreateOption('nocreate');
pageobj.save();
if (
pageobj.
}
Baris 1.788 ⟶ 2.084:
var text = pageobj.getPageText();
var params = pageobj.getCallbackParameters();
var summary =
// Add maintenance tags
if (params.tags.length) {
var tagtext =
$.each(params.tags, function(k, tag) {
// when other commons-related tags are placed, remove "move to Commons" tag
if ([
text = text.replace(/\{\{(mtc|(copy |move )?to ?commons|move to wikimedia commons|copy to wikimedia commons)[^}]*\}\}/gi,
}
currentTag =
switch (tag) {
case
if (params.ncdName !==
currentTag += '|1=' + params.ncdName; }
break;
case
if (params.keeplocalName !==
currentTag += '|1=' + params.keeplocalName; }
break;
case
if (params.renamemediaNewname !==
currentTag += '|1=' + params.renamemediaNewname; }
if (params.renamemediaReason !== '') {
currentTag += '|2=' + params.renamemediaReason;
}
break;
case
currentTag += '|1=' + params.cleanupimageReason;
break;
case
currentTag += '|1=' + params.ImagePoorQualityReason;
break;
case
currentTag += '|1=' + params.lowQualityChemReason;
break;
case
text = text.replace(/\{\{((convert to |convertto|should be |shouldbe|to)?svg|badpng|vectorize)[^}]*\}\}/gi,
/* falls through */
case
/* falls through */
case
currentTag +=
break;
case
currentTag += '|reason=' + params.DoNotMoveToCommons;
break;
case
// 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 +=
break;
case
currentTag +=
break;
case
currentTag +=
break;
default:
Baris 1.854 ⟶ 2.153:
}
currentTag +=
tagtext += currentTag;
summary +=
});
if (!tagtext) {
pageobj.getStatusElement().warn(
return;
}
Baris 1.870 ⟶ 2.169:
pageobj.setPageText(text);
pageobj.setEditSummary(summary.substring(0, summary.length - 2) + Twinkle.getPref('summaryAd'));
pageobj.setWatchlist(Twinkle.
pageobj.setMinorEdit(Twinkle.
pageobj.setCreateOption('nocreate');
pageobj.save();
if (
pageobj.
}
}
Baris 1.888 ⟶ 2.187:
}
// Don't return null if there aren't any available 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)] =
});
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(
if
(params.tags.indexOf(
alert(
return;
}
if (
alert(
return;
}
if
alert(
return;
}
}
if
alert(
return;
}
if
alert(
return;
}
if
alert(
return;
}
if
alert('You must specify language code for the {{expand language}} tag.');
return;
Baris 1.945 ⟶ 2.246:
case 'file':
if
alert('You must specify a reason for the cleanup tag.');
return;
}
if
alert('You must specify a reason for the {{Image-Poor-Quality}} tag');
return;
}
if
alert('You must specify a reason for the {{Low Quality Chem}} tag');
return;
}
if
(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
alert('You must specify a reason for the {{Do not move to Commons}} tag');
return;
Baris 1.976 ⟶ 2.275:
default:
alert(
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
alert(
return;
}
Morebits.simpleWindow.setButtonsEnabled(
Morebits.status.init(
Morebits.wiki.actionCompleted.redirect = Morebits.pageNameNorm;
Morebits.wiki.actionCompleted.notice =
if (Twinkle.tag.mode === 'redirect') {
Morebits.wiki.actionCompleted.followRedirect = false;
}
var wikipedia_page = new Morebits.wiki.page(Morebits.pageNameNorm,
wikipedia_page.setCallbackParameters(params);
wikipedia_page.load(Twinkle.tag.callbacks[Twinkle.tag.mode]);
Baris 2.003 ⟶ 2.302:
})(jQuery);
// </nowiki>
|