10,498
தொகுப்புகள்
("//<nowiki> (function($){ /* *********************************..."-இப்பெயரில் புதிய பக்கம் உருவாக்கப்பட்டுள்ளது) |
(update from enwiki) |
||
// <nowiki>
(function($) {
* Mode of invocation: Tab ("CSD")
* Active on: Non-special, existing pages
*
* NOTE FOR DEVELOPERS:
}
Twinkle.addPortletLink(
};
// This function is run when the CSD tab/header link is clicked
Twinkle.speedy.callback = function twinklespeedyCallback() {
Twinkle.speedy.initDialog(Morebits.
};
// Used by unlink feature
Twinkle.speedy.dialog = null;
// Used throughout
Twinkle.speedy.hasCSD = !!$('#delete-reason').length;
// Prepares the speedy deletion dialog and displays it
Twinkle.speedy.initDialog = function twinklespeedyInitDialog(callbackfunc) {
var dialog;
Twinkle.speedy.dialog = new Morebits.simpleWindow(
dialog = Twinkle.speedy.dialog;
dialog.setTitle(
dialog.setScriptName(
dialog.addFooterLink(
dialog.addFooterLink('CSD
dialog.addFooterLink('Twinkle help', 'WP:TW/DOC#speedy');
dialog.addFooterLink('Give feedback', 'WT:TW');
var form = new Morebits.quickForm(
if (
form.append(
}
// enable redirects checkbox
cForm.redirects.checked = !cChecked;
// enable delete multiple
// enable notify checkbox
cForm.notify.checked = cChecked;
// enable deletion notification checkbox
cForm.warnusertalk.checked = !cChecked && !Twinkle.speedy.hasCSD;
// enable multiple
cForm.multiple.checked = false;
// enable requesting creation protection
cForm.salting.checked = false;
Twinkle.speedy.callback.modeChanged(cForm);
event.stopPropagation();
}
});
var deleteOptions = form.append({
type: 'div',
name: 'delete_options'
});
deleteOptions.append({
type: 'header',
label: 'Delete-related options'
});
if (mw.config.get('wgNamespaceNumber') % 2 === 0 && (mw.config.get('wgNamespaceNumber') !== 2 || (/\//).test(mw.config.get('wgTitle')))) { // hide option for user pages, to avoid accidentally deleting user talk page
type: 'checkbox',
list: [
tooltip: "This option deletes the page's talk page in addition. If you choose the F8 (moved to Commons) criterion, this option is ignored and the talk page is *not* deleted.",
checked: Twinkle.getPref('deleteTalkPageOnDelete'),
event: function(event) {
event.stopPropagation();
}
}
]
}
}
type: 'checkbox',
list: [
{
label: '
value: '
name: '
tooltip: 'This option deletes all incoming redirects in addition. Avoid this option for procedural (e.g. move/merge) deletions.',
checked: Twinkle.getPref('deleteRedirectsOnDelete'),
event: function (event) {
event.stopPropagation();
}
},
{
label: '
value: '
name: '
tooltip:
event: function(event) {
Twinkle.speedy.callback.modeChanged(event.target.form);
event.stopPropagation();
}
},
{
label: 'Notify page creator of page deletion',
value: 'warnusertalk',
name: 'warnusertalk',
tooltip: 'A notification template will be placed on the talk page of the creator, IF you have a notification enabled in your Twinkle preferences ' +
'for the criterion you choose AND this box is checked. The creator may be welcomed as well.',
checked: !Twinkle.speedy.hasCSD,
event: function(event) {
event.stopPropagation();
}
}
]
}
}
var tagOptions = form.append(
});
if (Morebits.userIsSysop) {
type: 'header',
label: 'Tag-related options'
});
}
tagOptions.append({
type: 'checkbox',
list: [
{
label: 'Notify page creator if possible',
value: 'notify',
name: 'notify',
tooltip: 'A notification template will be placed on the talk page of the creator, IF you have a notification enabled in your Twinkle preferences ' +
'for the criterion you choose AND this box is checked. The creator may be welcomed as well.',
checked: !Morebits.userIsSysop || !(Twinkle.speedy.hasCSD || Twinkle.getPref('deleteSysopDefaultToDelete')),
event: function(event) {
event.stopPropagation();
}
},
{
label: 'Tag for creation protection (salting) as well',
value: 'salting',
name: 'salting',
tooltip: 'When selected, the speedy deletion tag will be accompanied by a {{salt}} tag requesting that the deleting administrator apply creation protection. Only select if this page has been repeatedly recreated.',
event: function(event) {
event.stopPropagation();
}
},
{
label: 'Tag with multiple criteria',
value: 'multiple',
name: 'multiple',
tooltip: 'When selected, you can select several criteria that apply to the page. For example, G11 and A7 are a common combination for articles.',
event: function(event) {
Twinkle.speedy.callback.modeChanged(event.target.form);
event.stopPropagation();
}
}
]
});
form.append({
type: 'div',
id: 'prior-deletion-count',
style: 'font-style: italic'
});
form.append({
type: 'div',
name: 'work_area',
label: 'Failed to initialize the CSD module. Please try again, or tell the Twinkle developers about the issue.'
});
if (Twinkle.getPref('speedySelectionStyle') !== 'radioClick') {
form.append({ type: 'submit', className: 'tw-speedy-submit' }); // Renamed in modeChanged
}
var result = form.render();
dialog.setContent(
dialog.display();
Twinkle.speedy.callback.modeChanged(
// Check for prior deletions. Just once, upon init
Twinkle.speedy.callback.priorDeletionCount();
};
// first figure out what mode we're in
var mode =
isMultiple: form.tag_only && !form.tag_only.checked ? form.delmultiple.checked : form.multiple.checked,
isRadioClick: Twinkle.getPref('speedySelectionStyle') === 'radioClick'
};
if (mode.isSysop) {
$('[name=delete_options]').show();
$('[name=tag_options]').hide();
$('button.tw-speedy-submit').text('Delete page');
} else {
$('[name=delete_options]').hide();
$('[name=tag_options]').show();
$('button.tw-speedy-submit').text('Tag page');
}
var work_area = new Morebits.quickForm.element(
if (mode.isMultiple
var evaluateType = mode.isSysop ? 'evaluateSysop' : 'evaluateUser';
work_area.append({
label: 'When finished choosing criteria, click:'
});
work_area.append({
name: 'submit-multiple',
label: mode.isSysop ? 'Delete page' : 'Tag page',
Twinkle.speedy.callback[evaluateType](event);
event.stopPropagation();
}
});
}
var radioOrCheckbox =
if (mode.isSysop && !mode.isMultiple) {
work_area.append({ type: 'header', label: 'Custom rationale' });
work_area.append({ type: radioOrCheckbox, name: 'csd', list: Twinkle.speedy.generateCsdList(Twinkle.speedy.customRationale, mode) });
}
if (namespace % 2 === 1 && namespace !== 3) {
// show db-talk on talk pages, but not user talk pages
work_area.append(
work_area.append(
}
if (!Morebits.isPageRedirect()) {
switch (namespace) {
case
case 1: // talk
work_area.append(
work_area.append({ type: radioOrCheckbox, name: 'csd', list: Twinkle.speedy.generateCsdList(Twinkle.speedy.articleList, mode) });
break;
case 2: // user
case 3: // user talk
work_area.append(
work_area.append(
break;
case 6: // file
case 7: // file talk
work_area.append(
work_area.append(
if (!
work_area.append(
}
break;
case
case
work_area.append(
work_area.append(
break;
case
case
work_area.append(
work_area.append(
break;
default:
break;
}
} else {
if (namespace === 2 || namespace === 3) {
work_area.append({ type: 'header', label: 'User pages' });
work_area.append({ type: radioOrCheckbox, name: 'csd', list: Twinkle.speedy.generateCsdList(Twinkle.speedy.userList, mode) });
work_area.append({ type: 'header', label: 'Redirects' });
work_area.append({ type: radioOrCheckbox, name: 'csd', list: Twinkle.speedy.generateCsdList(Twinkle.speedy.redirectList, mode) });
}
var generalCriteria = Twinkle.speedy.generalList;
// custom rationale lives under general criteria when tagging
if (!mode.isSysop) {
generalCriteria = Twinkle.speedy.customRationale.concat(generalCriteria);
}
work_area.append({ type: 'header', label: 'General criteria' });
work_area.append({ type: radioOrCheckbox, name: 'csd', list: Twinkle.speedy.generateCsdList(generalCriteria, mode) });
var old_area = Morebits.quickForm.getElements(form,
form.replaceChild(work_area.render(), old_area);
// if sysop, check if CSD is already on the page and fill in custom rationale
if (mode.isSysop && Twinkle.speedy.hasCSD) {
var customOption = $('input[name=csd][value=reason]')[0];
if (customOption) {
if (Twinkle.getPref('speedySelectionStyle') !== 'radioClick') {
// force listeners to re-init
customOption.click();
customOption.parentNode.appendChild(customOption.subgroup);
}
customOption.subgroup.querySelector('input').value = decodeURIComponent($('#delete-reason').text()).replace(/\+/g, ' ');
}
}
};
Twinkle.speedy.callback.priorDeletionCount = function () {
var query = {
action: 'query',
format: 'json',
list: 'logevents',
letype: 'delete',
leaction: 'delete/delete', // Just pure page deletion, no redirect overwrites or revdel
letitle: mw.config.get('wgPageName'),
leprop: '', // We're just counting we don't actually care about the entries
lelimit: 5 // A little bit goes a long way
};
new Morebits.wiki.api('Checking for past deletions', query, function(apiobj) {
var response = apiobj.getResponse();
var delCount = response.query.logevents.length;
if (delCount) {
var message = delCount + ' previous deletion';
if (delCount > 1) {
message += 's';
if (response.continue) {
message = 'More than ' + message;
}
// 3+ seems problematic
if (delCount >= 3) {
$('#prior-deletion-count').css('color', 'red');
}
}
// Provide a link to page logs (CSD templates have one for sysops)
var link = Morebits.htmlNode('a', '(logs)');
link.setAttribute('href', mw.util.getUrl('Special:Log', {page: mw.config.get('wgPageName')}));
link.setAttribute('target', '_blank');
$('#prior-deletion-count').text(message + ' '); // Space before log link
$('#prior-deletion-count').append(link);
}
}).post();
};
Twinkle.speedy.generateCsdList = function twinklespeedyGenerateCsdList(list, mode) {
var pageNamespace = mw.config.get('wgNamespaceNumber');
var openSubgroupHandler = function(e) {
};
var submitSubgroupHandler = function(e) {
Twinkle.speedy.callback[evaluateType](e);
e.stopPropagation();
};
var criterion = $.extend({}, critElement);
if (
if (criterion.hideWhenMultiple) {
return null;
}
if (mode.isSysop) {
if (criterion.hideWhenSysop) {
return null;
}
if (
return null;
}
if (criterion.showInNamespaces && criterion.showInNamespaces.indexOf(pageNamespace) < 0) {
return null;
}
if (criterion.hideInNamespaces && criterion.hideInNamespaces.indexOf(pageNamespace) > -1) {
return null;
}
if (criterion.subgroup && !mode.isMultiple && mode.isRadioClick) {
if (Array.isArray(criterion.subgroup)) {
criterion.subgroup = criterion.subgroup.concat({
type: 'button',
name: 'submit',
label: mode.isSysop ? 'Delete page' : '
event: submitSubgroupHandler
});
type: 'button',
name: 'submit', // ends up being called "csd.submit" so this is OK
label: mode.isSysop ? 'Delete page' : '
event: submitSubgroupHandler
}
];
}
// FIXME: does this do anything?
criterion.event = openSubgroupHandler;
}
});
};
Twinkle.speedy.customRationale = [
{
label: 'Custom rationale' + (Morebits.userIsSysop ? ' (custom deletion reason)' : ' using {{db}} template'),
value: 'reason',
tooltip: '{{db}} is short for "delete because". At least one of the other deletion criteria must still apply to the page, and you must make mention of this in your rationale. This is not a "catch-all" for when you can\'t find any criteria that fit.',
subgroup: {
name: 'reason_1',
type: 'input',
label: 'Rationale: ',
size: 60
},
hideWhenMultiple: true
}
];
Twinkle.speedy.talkList = [
},
{
label: 'F2: Corrupt, missing, or
value: 'noimage',
tooltip: 'Before deleting this type of file, verify that the MediaWiki engine cannot read it by previewing a resized thumbnail of it. This also includes empty (i.e., no content) file description pages for Commons files'
},
{
label: 'F5: Unused
value: '
tooltip: 'Files that are not under a free license or in the public domain that are not used in any article,
hideWhenUser: true
},
tooltip: 'This is only for files with a clearly invalid fair-use tag, such as a {{Non-free logo}} tag on a photograph of a mascot. For cases that require a waiting period (replaceable images or otherwise disputed rationales), use the options on Twinkle\'s DI tab.',
subgroup: {
name: '
type: 'input',
label: 'Optional explanation: ',
tooltip: 'Non-free images or media from a commercial source (e.g., Associated Press, Getty), where the file itself is not the subject of sourced commentary, are considered an invalid claim of fair use and fail the strict requirements of WP:NFCC.',
subgroup: {
name: '
type: 'input',
label: 'Optional explanation: ',
{
label: 'F8: File available as an identical or higher-resolution copy on Wikimedia Commons',
value: '
tooltip: 'Provided the following conditions are met: 1: The file format of both images is the same. 2: The file\'s license and source status is beyond reasonable doubt, and the license is undoubtedly accepted at Commons. 3: All information on the file description page is present on the Commons file description page. That includes the complete upload history with links to the uploader\'s local user pages. 4: The file is not protected, and the file description page does not contain a request not to move it to Commons. 5: If the file is available on Commons under a different name than locally, all local references to the file must be updated to point to the title used at Commons. 6: For {{c-uploaded}} files: They may be speedily deleted as soon as they are off the Main Page',
subgroup: {
name: '
type: 'input',
label: 'Filename on Commons: ',
value: 'imgcopyvio',
tooltip: 'The file was copied from a website or other source that does not have a license compatible with Wikipedia, and the uploader neither claims fair use nor makes a credible assertion of permission of free use. Sources that do not have a license compatible with Wikipedia include stock photo libraries such as Getty Images or Corbis. Non-blatant copyright infringements should be discussed at Wikipedia:Files for deletion',
subgroup:
{
type: 'input',
label: 'URL of the copyvio, including the "http://". If the copyvio is of a non-internet source and you cannot provide a URL, you must use the deletion rationale box. ',
size: 60
},
{
name: 'imgcopyvio_rationale',
type: 'input',
label: 'Deletion rationale for non-internet copyvios: ',
size: 60
}
]
},
{
label: 'G8: File description page with no corresponding file',
value: 'imagepage',
tooltip: 'This is only for use when the file doesn\'t exist at all. Corrupt files, and local description pages for files on Commons, should use F2; implausible redirects should use R3; and broken Commons redirects should use
}
];
label: 'A5: Transwikied articles',
value: 'transwiki',
tooltip: 'Any article that has been discussed at Articles for Deletion (et al), where the outcome was to transwiki, and where the transwikification has been properly performed and the author information recorded. Alternately, any article that consists of only a dictionary definition, where the transwikification has been properly performed and the author information recorded',
subgroup: {
name: 'transwiki_location',
type: 'input',
label: 'Link to where the page has been transwikied: ',
tooltip: 'For example, https://en.wiktionary.org/wiki/twinkle or [[wikt:twinkle]]'
}
},
{
label: 'A7:
value: 'a7',
tooltip: 'An article about a real person, group of people, band, club, company, web content, individual animal, tour, or party that does not assert the importance or significance of its subject. If controversial, or if a previous AfD has resulted in the article being kept, the article should be nominated for AfD instead',
},
{
label: 'A7:
value: 'person',
tooltip: 'An article about a real person that does not assert the importance or significance of its subject. If controversial, or if there has been a previous AfD that resulted in the article being kept, the article should be nominated for AfD instead',
},
{
label: 'A7:
value: 'band',
tooltip: 'Article about a band, singer, musician, or musical ensemble that does not assert the importance or significance of the subject',
},
{
label: 'A7:
value: 'club',
tooltip: 'Article about a club, society or group that does not assert the importance or significance of the subject',
hideWhenMultiple: true
},
{
label: 'A7:
value: 'corp',
tooltip: 'Article about a company or organization that does not assert the importance or significance of the subject',
},
{
label: 'A7:
value: 'web',
tooltip: 'Article about a web site, blog, online forum, webcomic, podcast, or similar web content that does not assert the importance or significance of its subject',
},
{
label: 'A7:
value: 'animal',
tooltip: 'Article about an individual animal (e.g. pet) that does not assert the importance or significance of its subject',
},
{
label: 'A7:
value: 'event',
tooltip: 'Article about an organized event (tour, function, meeting, party, etc.) that does not assert the importance or significance of its subject',
label: 'C1: Empty categories',
value: 'catempty',
tooltip: 'Categories that have been unpopulated for at least
},
{
label: 'G8: Categories populated by a deleted or retargeted template',
value: 'templatecat',
tooltip: 'This is for situations where a category is effectively empty, because the template(s) that formerly placed pages in that category are now deleted. This excludes categories that are still in use.',
subgroup: {
name: 'templatecat_rationale',
type: 'input',
label: 'Optional explanation: ',
size: 60
}
},
{
label: 'G8: Redirects to non-existent targets',
value: 'redirnone',
tooltip: 'This excludes any page that is useful to the project, and in particular: deletion discussions that are not logged elsewhere, user and user talk pages, talk page archives, plausible redirects that can be changed to valid targets, and file pages or talk pages for files that exist on Wikimedia Commons.',
hideWhenMultiple: true
}
];
value: 'userreq',
tooltip: 'Personal subpages, upon request by their user. In some rare cases there may be administrative need to retain the page. Also, sometimes, main user pages may be deleted as well. See Wikipedia:User page for full instructions and guidelines',
subgroup:
name: 'userreq_rationale',
type: 'input',
tooltip: 'User talk pages are deleted only in highly exceptional circumstances. See WP:DELTALK.',
size: 60
} : null
hideSubgroupWhenMultiple: true
},
label: 'U3: Non-free galleries',
value: 'gallery',
tooltip: 'Galleries in the userspace which consist mostly of "fair use" or non-free files. Wikipedia\'s non-free content policy forbids users from displaying non-free files, even ones they have uploaded themselves, in userspace. It is acceptable to have free files, GFDL-files, Creative Commons and similar licenses along with public domain material, but not "fair use" files',
hideWhenRedirect: true
},
{
label: 'U5: Blatant WP:NOTWEBHOST violations',
value: 'notwebhost',
tooltip: 'Pages in userspace consisting of writings, information, discussions, and/or activities not closely related to Wikipedia\'s goals, where the owner has made few or no edits outside of userspace, with the exception of plausible drafts
hideWhenRedirect: true
},
{
value: 'spamuser',
tooltip: 'A promotional user page, with a username that promotes or implies affiliation with the thing being promoted. Note that simply having a page on a company or product in one\'s userspace does not qualify it for deletion. If a user page is spammy but the username is not, then consider tagging with regular G11 instead.',
hideWhenMultiple: true,
hideWhenRedirect: true
},
{
label: '
value: '
tooltip: 'Any rejected or unsubmitted AfC draft submission or a blank draft, that has not been edited in over 6 months (excluding bot edits).',
hideWhenMultiple: true,
hideWhenRedirect: true
}
];
label: 'P1: Portal that would be subject to speedy deletion if it were an article',
value: 'p1',
tooltip: 'You must specify
subgroup: {
name: '
type: '
label: 'Article criterion that would apply: '
}
},
{
label: 'P2: Underpopulated portal (fewer than three non-stub articles)',
value: 'emptyportal',
tooltip: 'Any Portal based on a topic for which there is not a non-stub header article, and at least three non-stub articles detailing subject matter that would be appropriate to discuss under the title of that Portal'
Twinkle.speedy.generalList = [
{
label: 'G1: Patent nonsense. Pages consisting purely of incoherent text or gibberish with no meaningful content or history.',
value: 'nonsense',
tooltip: 'This does not include poor writing, partisan screeds, obscene remarks, vandalism, fictional material, material not in English, poorly translated material, implausible theories, or hoaxes. In short, if you can understand it, G1 does not apply.',
hideInNamespaces: [ 2 ] // Not applicable in userspace
},
{
label: 'G2: Test page',
value: 'test',
tooltip: 'A page created to test editing or other Wikipedia functions. Pages in the User namespace are not included, nor are valid but unused or duplicate templates
hideInNamespaces: [ 2 ] // Not applicable in userspace
},
{
tooltip: 'A copy, by any title, of a page that was deleted via an XfD process or Deletion review, provided that the copy is substantially identical to the deleted version. This clause does not apply to content that has been "userfied", to content undeleted as a result of Deletion review, or if the prior deletions were proposed or speedy deletions, although in this last case, other speedy deletion criteria may still apply',
subgroup: {
name: '
type: 'input',
label: 'Page where the deletion discussion took place: ',
},
{
label: 'G5:
value: 'banned',
tooltip: 'Pages created by banned or blocked users in violation of their ban or block, and which have no substantial edits by others',
subgroup: {
name: '
type: 'input',
label: 'Username of banned user (if available): ',
tooltip: 'Should not start with "User:"'
}
},
{
subgroup: [
{
name: '
type: 'input',
label: 'Page to be moved here: '
},
{
name: '
type: 'input',
label: 'Reason: ',
label: 'G6: XfD',
value: 'xfd',
tooltip: '
subgroup: {
name: 'xfd_fullvotepage',
type: 'input',
label: 'Page where the deletion discussion was held: ',
tooltip: 'Must start with "Wikipedia:"',
size: 40
},
hideWhenMultiple: true
},
tooltip: 'This only applies for a copy-and-paste page move of another page that needs to be temporarily deleted to make room for a clean page move.',
subgroup: {
name: '
type: 'input',
label: 'Original page that was copy-pasted here: '
},
{
label: 'G6: Housekeeping and non-controversial cleanup',
value: 'g6',
tooltip: 'Other
subgroup: {
name: 'g6_rationale',
tooltip: 'Perhaps linking to where the author requested this deletion.',
size: 60
},
hideSubgroupWhenSysop: true
},
{
label: 'G8: Pages dependent on a non-existent or deleted page',
value: 'g8',
tooltip: 'such as talk pages with no corresponding subject page; subpages with no parent page; file pages without a corresponding file; redirects to
subgroup: {
name: 'g8_rationale',
label: 'Optional explanation: ',
size: 60
},
hideSubgroupWhenSysop: true
},
{
value: 'subpage',
tooltip: 'This excludes any page that is useful to the project, and in particular: deletion discussions that are not logged elsewhere, user and user talk pages, talk page archives, plausible redirects that can be changed to valid targets, and file pages or talk pages for files that exist on Wikimedia Commons.',
hideWhenMultiple: true,
hideInNamespaces: [ 0, 6, 8 ] // hide in main, file, and mediawiki-spaces
},
{
label: 'G10: Attack page',
value: 'attack',
tooltip: 'Pages that serve no purpose but to disparage or threaten their subject or some other entity (e.g., "John Q. Doe is an imbecile"). This includes a biography of a living person that is negative in tone and unsourced, where there is no NPOV version in the history to revert to. Administrators deleting such pages should not quote the content of the page in the deletion summary!'
},
{
},
{
label: 'G11: Unambiguous advertising or promotion',
value: 'spam',
tooltip: 'Pages which exclusively promote a company, product, group, service, or person and which would need to be fundamentally rewritten in order to become encyclopedic. Note that an article about a company or a product which describes its subject from a neutral point of view does not qualify for this criterion; an article that is blatant advertising should have inappropriate content as well'
type: 'input',
label: 'URL (if available): ',
tooltip: 'If the material was copied from an online source, put the URL here, including the "http://" or "https://"
size: 60
},
type: 'input',
label: 'Additional URL: ',
tooltip: 'Optional. Should begin with "http://" or "https://"',
size: 60
},
type: 'input',
label: 'Additional URL: ',
tooltip: 'Optional. Should begin with "http://" or "https://"',
size: 60
}
},
{
label: 'G13:
value: 'afc',
tooltip: 'Any rejected or unsubmitted AfC submission in userspace or any non-redirect page in draft namespace, that has not been edited for more than 6 months. Blank drafts in either namespace are also included.',
hideWhenRedirect: true,
showInNamespaces: [2, 118] // user, draft namespaces only
},
{
label: 'G14: Unnecessary disambiguation page',
value: 'disambig',
tooltip: 'This only applies for orphaned disambiguation pages which either: (1) disambiguate only one existing Wikipedia page and whose title ends in "(disambiguation)" (i.e., there is a primary topic); or (2) disambiguate no (zero) existing Wikipedia pages, regardless of its title. It also applies to orphan "Foo (disambiguation)" redirects that target pages that are not disambiguation or similar disambiguation-like pages (such as set index articles or lists)'
}
];
Twinkle.speedy.redirectList = [
{
label: 'R2:
value: 'rediruser',
tooltip: '
showInNamespaces: [ 0 ]
},
{
label: 'R3:
value: 'redirtypo',
tooltip: 'However, redirects from common misspellings or misnomers are generally useful, as are redirects in other languages'
},
{
label: 'R4: File namespace redirect with a name that matches a Commons page',
value: 'redircom',
tooltip: 'The redirect should have no incoming links (unless the links are cleary intended for the file or redirect at Commons).',
showInNamespaces: [ 6 ]
},
{
label: 'G6: Redirect to malplaced disambiguation page',
value: 'movedab',
tooltip: 'This only applies for redirects to disambiguation pages ending in (disambiguation) where a primary topic does not exist.',
hideWhenMultiple: true
},
{
label: 'G8: Redirects to non-existent targets',
value: 'redirnone',
tooltip: 'This excludes any page that is useful to the project, and in particular: deletion discussions that are not logged elsewhere, user and user talk pages, talk page archives, plausible redirects that can be changed to valid targets, and file pages or talk pages for files that exist on Wikimedia Commons.',
hideWhenMultiple: true
}
];
Twinkle.speedy.normalizeHash = {
};
Twinkle.speedy.callbacks = {
getTemplateCodeAndParams: function(params) {
var code, parameters, i;
if (params.normalizeds.length > 1) {
code = '{{db-multiple';
params.utparams = {};
$.each(params.normalizeds, function(index, norm) {
code += '|' + norm.toUpperCase();
parameters = params.templateParams[index] || [];
for (var i in parameters) {
if (typeof parameters[i] === 'string' && !parseInt(i, 10)) { // skip numeric parameters - {{db-multiple}} doesn't understand them
code += '|' + i + '=' + parameters[i];
}
}
$.extend(params.utparams, Twinkle.speedy.getUserTalkParameters(norm, parameters));
});
code += '}}';
} else {
parameters = params.templateParams[0] || [];
code = '{{db-' + params.values[0];
for (i in parameters) {
if (typeof parameters[i] === 'string') {
code += '|' + i + '=' + parameters[i];
}
}
if (params.usertalk) {
code += '|help=off';
}
code += '}}';
params.utparams = Twinkle.speedy.getUserTalkParameters(params.normalizeds[0], parameters);
}
return [code, params.utparams];
},
parseWikitext: function(wikitext, callback) {
var query = {
action: 'parse',
prop: 'text',
pst: 'true',
text: wikitext,
contentmodel: 'wikitext',
title: mw.config.get('wgPageName'),
disablelimitreport: true,
format: 'json'
};
var statusIndicator = new Morebits.status('Building deletion summary');
var api = new Morebits.wiki.api('Parsing deletion template', query, function(apiobj) {
var reason = decodeURIComponent($(apiobj.getResponse().parse.text).find('#delete-reason').text()).replace(/\+/g, ' ');
if (!reason) {
statusIndicator.warn('Unable to generate summary from deletion template');
} else {
statusIndicator.info('complete');
}
callback(reason);
}, statusIndicator);
api.post();
},
noteToCreator: function(pageobj) {
var params = pageobj.getCallbackParameters();
var initialContrib = pageobj.getCreator();
// disallow notifying yourself
if (initialContrib === mw.config.get('wgUserName')) {
Morebits.status.warn('You (' + initialContrib + ') created this page; skipping user notification');
initialContrib = null;
// don't notify users when their user talk page is nominated/deleted
} else if (initialContrib === mw.config.get('wgTitle') && mw.config.get('wgNamespaceNumber') === 3) {
Morebits.status.warn('Notifying initial contributor: this user created their own user talk page; skipping notification');
initialContrib = null;
// quick hack to prevent excessive unwanted notifications, per request. Should actually be configurable on recipient page...
} else if ((initialContrib === 'Cyberbot I' || initialContrib === 'SoxBot') && params.normalizeds[0] === 'f2') {
Morebits.status.warn('Notifying initial contributor: page created procedurally by bot; skipping notification');
initialContrib = null;
// Check for already existing tags
} else if (Twinkle.speedy.hasCSD && params.warnUser && !confirm('The page is has a deletion-related tag, and thus the creator has likely been notified. Do you want to notify them for this deletion as well?')) {
Morebits.status.info('Notifying initial contributor', 'canceled by user; skipping notification.');
initialContrib = null;
}
if (initialContrib) {
var usertalkpage = new Morebits.wiki.page('User talk:' + initialContrib, 'Notifying initial contributor (' + initialContrib + ')'),
notifytext, i, editsummary;
// special cases: "db" and "db-multiple"
if (params.normalizeds.length > 1) {
notifytext = '\n{{subst:db-' + (params.warnUser ? 'deleted' : 'notice') + '-multiple|1=' + Morebits.pageNameNorm;
var count = 2;
$.each(params.normalizeds, function(index, norm) {
notifytext += '|' + count++ + '=' + norm.toUpperCase();
});
} else if (params.normalizeds[0] === 'db') {
notifytext = '\n{{subst:db-reason-' + (params.warnUser ? 'deleted' : 'notice') + '|1=' + Morebits.pageNameNorm;
} else {
notifytext = '\n{{subst:db-csd-' + (params.warnUser ? 'deleted' : 'notice') + '-custom|1=';
if
notifytext += params.templateParams[0].sourcepage;
} else {
}
notifytext += '|2=' + params.values[0];
}
for (i in params.utparams) {
if (typeof params.utparams[i] === 'string') {
notifytext += '|' + i + '=' + params.utparams[i];
}
}
notifytext += (params.welcomeuser ? '' : '|nowelcome=yes') + '}} ~~~~';
editsummary = 'Notification: speedy deletion' + (params.warnUser ? '' : ' nomination');
if (params.normalizeds.indexOf('g10') === -1) { // no article name in summary for G10 taggings
editsummary += ' of [[:' + Morebits.pageNameNorm + ']].';
} else {
editsummary += ' of an attack page.';
}
usertalkpage.setAppendText(notifytext);
usertalkpage.setEditSummary(editsummary);
usertalkpage.setChangeTags(Twinkle.changeTags);
usertalkpage.setCreateOption('recreate');
usertalkpage.setFollowRedirect(true, false);
usertalkpage.append(function onNotifySuccess() {
// add this nomination to the user's userspace log, if the user has enabled it
if (params.lognomination) {
Twinkle.speedy.callbacks.user.addToLog(params, initialContrib);
}
}, function onNotifyError() {
// if user could not be notified, log nomination without mentioning that notification was sent
if (params.lognomination) {
Twinkle.speedy.callbacks.user.addToLog(params, null);
}
});
} else if (params.lognomination) {
// log nomination even if the user notification wasn't sent
Twinkle.speedy.callbacks.user.addToLog(params, null);
}
},
sysop: {
main: function(params) {
var reason;
if (!params.normalizeds.length && params.normalizeds[0] === 'db') {
reason = prompt('Enter the deletion summary to use, which will be entered into the deletion log:', '');
Twinkle.speedy.callbacks.sysop.deletePage(reason, params);
} else {
var code = Twinkle.speedy.callbacks.getTemplateCodeAndParams(params)[0];
Twinkle.speedy.callbacks.parseWikitext(code, function(reason) {
if (params.promptForSummary) {
reason = prompt('Enter the deletion summary to use, or press OK to accept the automatically generated one.', reason);
}
Twinkle.speedy.callbacks.sysop.deletePage(reason, params);
});
}
},
deletePage: function(reason, params) {
var thispage = new Morebits.wiki.page(mw.config.get('wgPageName'), 'Deleting page');
if (reason === null) {
return Morebits.status.error('Asking for reason', 'User cancelled');
} else if (!reason || !reason.replace(/^\s*/, '').replace(/\s*$/, '')) {
return Morebits.status.error('Asking for reason', "you didn't give one. I don't know... what with admins and their apathetic antics... I give up...");
}
var deleteMain = function(callback) {
thispage.setEditSummary(reason);
thispage.setChangeTags(Twinkle.changeTags);
thispage.setWatchlist(params.watch);
thispage.deletePage(function() {
thispage.getStatusElement().info('done');
typeof callback === 'function' && callback();
Twinkle.speedy.callbacks.sysop.deleteTalk(params);
});
};
// look up initial contributor. If prompting user for deletion reason, just display a link.
// Otherwise open the talk page directly
if (params.warnUser) {
thispage.setCallbackParameters(params);
thispage.lookupCreation(function(pageobj) {
deleteMain(function() {
Twinkle.speedy.callbacks.noteToCreator(pageobj);
});
});
} else {
deleteMain();
}
},
deleteTalk: function(
// delete talk page
if (params.deleteTalkPage &&
params.normalized !== 'f8' &&
document.getElementById(
var talkpage = new Morebits.wiki.page(
talkpage.setEditSummary('[[WP:CSD#G8|G8]]: Talk page of deleted page "' + Morebits.pageNameNorm + '"
talkpage.setChangeTags(Twinkle.changeTags);
talkpage.deletePage();
// this is ugly, but because of the architecture of wiki.api, it is needed
// (otherwise success/failure messages for the previous action would be suppressed)
window.setTimeout(function() {
Twinkle.speedy.callbacks.sysop.deleteRedirects(params);
}, 1800);
} else {
Twinkle.speedy.callbacks.sysop.deleteRedirects(
}
},
deleteRedirects: function(
// delete redirects
if (params.deleteRedirects) {
var query = {
format: 'json'
};
var wikipedia_api = new Morebits.wiki.api(
new Morebits.status(
wikipedia_api.params = params;
wikipedia_api.post();
// promote Unlink tool
var $link, $bigtext;
if
$link = $('<a/>', {
Morebits.wiki.actionCompleted.redirect = null;
Twinkle.speedy.dialog.close();
Twinkle.unlink.callback(
}
});
$bigtext = $('<span/>', {
});
Morebits.status.info($bigtext[0], $link[0]);
} else if (params.normalized !== 'f8') {
$link = $('<a/>', {
Morebits.wiki.actionCompleted.redirect = null;
Twinkle.speedy.dialog.close();
Twinkle.unlink.callback(
}
});
$bigtext = $('<span/>', {
});
Morebits.status.info($bigtext[0], $link[0]);
}
},
var response = apiobj.getResponse();
var
var
var statusIndicator = apiobj.statelem;
if (
statusIndicator.status(
return;
}
statusIndicator.status(
var current = 0;
var onsuccess = function(
var now = parseInt(
statusIndicator.update(
apiobjInner.statelem.unlink();
if (
statusIndicator.info(
Morebits.wiki.removeCheckpoint();
}
Morebits.wiki.addCheckpoint();
var title =
var page = new Morebits.wiki.page(title, 'Deleting redirect "' + title + '"');
page.setEditSummary('[[WP:CSD#G8|G8]]: Redirect to deleted page "' + Morebits.pageNameNorm + '"
page.setChangeTags(Twinkle.changeTags);
page.deletePage(onsuccess);
});
if (!pageobj.exists()) {
statelem.error(
return;
}
var params = pageobj.getCallbackParameters();
// given the params, builds the template and also adds the user talk page parameters to the params that were passed in
// returns => [<string> wikitext, <object> utparams]
var buildData = Twinkle.speedy.callbacks.getTemplateCodeAndParams(params),
code = buildData[0];
params.utparams = buildData[1];
// Set the correct value for |ts= parameter in {{db-g13}}
if (params.normalizeds.indexOf('g13') !== -1) {
code = code.replace('$TIMESTAMP', pageobj.getLastEditTime());
}
// Tag if possible, post on talk if not
if (pageobj.canEdit() && ['wikitext', 'Scribunto', 'javascript', 'css', 'sanitized-css'].indexOf(pageobj.getContentModel()) !== -1) {
var text = pageobj.getPageText();
statelem.status('Checking for tags on the page...');
// check for existing deletion tags
var tag = /(?:\{\{\s*(db|delete|db-.*?|speedy deletion-.*?)(?:\s*\||\s*\}\}))/.exec(text);
// This won't make use of the db-multiple template but it probably should
if (tag && !confirm('The page already has the CSD-related template {{' + tag[1] + '}} on it. Do you want to add another CSD template?')) {
return;
}
var xfd = /\{\{((?:article for deletion|proposed deletion|prod blp|template for discussion)\/dated|[cfm]fd\b)/i.exec(text) || /#invoke:(Redirect for discussion)/.exec(text);
if (xfd && !confirm('The deletion-related template {{' + xfd[1] + '}} was found on the page. Do you still want to add a CSD template?')) {
return;
}
// curate/patrol the page
if (Twinkle.getPref('markSpeedyPagesAsPatrolled')) {
pageobj.triage();
}
// Wrap SD template in noinclude tags if we are in template space.
// Won't work with userboxes in userspace, or any other transcluded page outside template space
if (mw.config.get('wgNamespaceNumber') === 10) { // Template:
code = '<noinclude>' + code + '</noinclude>';
}
// Remove tags that become superfluous with this action
text = text.replace(/\{\{\s*([Uu]serspace draft)\s*(\|(?:\{\{[^{}]*\}\}|[^{}])*)?\}\}\s*/g, '');
if (mw.config.get('wgNamespaceNumber') === 6) {
// remove "move to Commons" tag - deletion-tagged files cannot be moved to Commons
text = text.replace(/\{\{(mtc|(copy |move )?to ?commons|move to wikimedia commons|copy to wikimedia commons)[^}]*\}\}/gi, '');
}
if (params.requestsalt) {
if (params.normalizeds.indexOf('g10') === -1) {
code += '\n{{salt}}';
} else {
code = '{{salt}}\n' + code;
}
}
if (mw.config.get('wgPageContentModel') === 'Scribunto') {
// Scribunto isn't parsed like wikitext, so CSD templates on modules need special handling to work
var equals = '';
while (code.indexOf(']'
equals += '=';
}
code = "require('Module:Module wikitext')._addText([" + equals + '[' + code + ']' + equals + ']);';
} else if (['javascript', 'css', 'sanitized-css'].indexOf(mw.config.get('wgPageContentModel')) !== -1) {
// Likewise for JS/CSS pages
code = '/* ' + code + ' */';
}
// Generate edit summary for edit
var editsummary;
if (params.normalizeds.length > 1) {
editsummary = 'Requesting speedy deletion (';
$.each(params.normalizeds, function(index, norm) {
editsummary += '[[WP:CSD#' + norm.toUpperCase() + '|CSD ' + norm.toUpperCase() + ']], ';
});
editsummary = editsummary.substr(0, editsummary.length - 2); // remove trailing comma
editsummary += ').';
} else if (params.normalizeds[0] === 'db') {
editsummary = 'Requesting [[WP:CSD|speedy deletion]] with rationale "' + params.templateParams[0]['1'] + '".';
} else {
editsummary = 'Requesting speedy deletion ([[WP:CSD#' + params.normalizeds[0].toUpperCase() + '|CSD ' + params.normalizeds[0].toUpperCase() + ']]).';
}
// Blank attack pages
if (params.normalizeds.indexOf('g10') !== -1) {
text = code;
} else {
// Insert tag after short description or any hatnotes
var wikipage = new Morebits.wikitext.page(text);
text = wikipage.insertAfterTemplates(code + '\n', Twinkle.hatnoteRegex).getText();
}
pageobj.setPageText(text);
pageobj.setEditSummary(editsummary);
pageobj.setWatchlist(params.watch);
pageobj.save(Twinkle.speedy.callbacks.user.tagComplete);
} else { // Attempt to place on talk page
var talkName = new mw.Title(pageobj.getPageName()).getTalkPage().toText();
if (talkName !== pageobj.getPageName()) {
if (params.requestsalt) {
code += '\n{{salt}}';
}
pageobj.getStatusElement().warn('Unable to edit page, placing tag on talk page');
var talk_page = new Morebits.wiki.page(talkName, 'Automatically placing tag on talk page');
talk_page.setNewSectionTitle(pageobj.getPageName() + ' nominated for CSD, request deletion');
talk_page.setNewSectionText(code + '\n\nI was unable to tag ' + pageobj.getPageName() + ' so please delete it. ~~~~');
talk_page.setCreateOption('recreate');
talk_page.setFollowRedirect(true);
talk_page.setWatchlist(params.watch);
talk_page.setChangeTags(Twinkle.changeTags);
talk_page.setCallbackParameters(params);
talk_page.newSection(Twinkle.speedy.callbacks.user.tagComplete);
} else
pageobj.getStatusElement().error('Page protected and nowhere to add an edit request, aborting');
}
}
},
var params = pageobj.getCallbackParameters();
// Notification to first contributor, will also log nomination to the user's userspace log
if (params.usertalk) {
var thispage = new Morebits.wiki.page(Morebits.pageNameNorm);
thispage.
thispage.lookupCreation(Twinkle.speedy.callbacks.noteToCreator);
// or, if not notifying, add this nomination to the user's userspace log without the initial contributor's name
} else if (params.lognomination) {
Twinkle.speedy.callbacks.user.addToLog(params, null);
}
},
addToLog: function(params, initialContrib) {
var
usl.initialText =
"This is a log of all [[WP:CSD|speedy deletion]] nominations made by this user using [[WP:TW|Twinkle]]'s CSD module.\n\n" +
'If you no longer wish to keep this log, you can turn it off using the [[Wikipedia:Twinkle/Preferences|preferences panel]], and ' +
'nominate this page for speedy deletion under [[WP:CSD#U1|CSD U1]].' +
(Morebits.userIsSysop ? '\n\nThis log does not track outright speedy deletions made using Twinkle.' : '');
if ((normalize === 'G4' && csdparam === 'xfd') ||
(normalize === 'G6' && csdparam === 'page') ||
(normalize === 'G6' && csdparam === 'fullvotepage') ||
(normalize === 'G6' && csdparam === 'sourcepage') ||
(normalize === 'A2' && csdparam === 'source') ||
(normalize === 'A10' && csdparam === 'article') ||
(normalize === 'F1' && csdparam === 'filename')) {
input = '[[:' + input + ']]';
} else if (normalize === 'G5' && csdparam === 'user') {
input = '[[:User:' + input + ']]';
} else if (normalize === 'G12' && csdparam.lastIndexOf('url', 0) === 0 && input.lastIndexOf('http', 0) === 0) {
input = '[' + input + ' ' + input + ']';
} else if (normalize === 'F8' && csdparam === 'filename') {
input = '[[commons:' + input + ']]';
} else if (normalize === 'P1' && csdparam === 'criterion') {
input = '[[WP:CSD#' + input + ']]';
}
return ' {' + normalize + ' ' + csdparam + ': ' + input + '}';
};
var
// If a logged file is deleted but exists on commons, the wikilink will be blue, so provide a link to the log
var fileLogLink = mw.config.get('wgNamespaceNumber') === 6 ? ' ([{{fullurl:Special:Log|page=' + mw.util.wikiUrlencode(mw.config.get('wgPageName')) + '}} log])' : '';
var editsummary = 'Logging speedy deletion nomination';
var
if (params.normalizeds.indexOf('g10') === -1) { // no article name in log for G10 taggings
appendText +=
editsummary += ' of [[:' + Morebits.pageNameNorm + ']].';
} else {
appendText += '|This]] attack page' + fileLogLink + ': ';
editsummary += ' of an attack page.';
}
if (params.normalizeds.length > 1) {
appendText += 'multiple criteria (';
$.each(params.normalizeds, function(index, norm) {
appendText += '[[WP:CSD#' + norm.toUpperCase() + '|' + norm.toUpperCase() + ']], ';
});
appendText = appendText.substr(0, appendText.length - 2); // remove trailing comma
appendText += ')';
} else if (params.normalizeds[0] === 'db') {
appendText += '{{tl|db-reason}}';
} else {
appendText += '[[WP:CSD#' + params.normalizeds[0].toUpperCase() + '|CSD ' + params.normalizeds[0].toUpperCase() + ']] ({{tl|db-' + params.values[0] + '}})';
}
// If params is "empty" it will still be full of empty arrays, but ask anyway
if (params.
// Treat custom rationale individually
if (params.normalizeds[0] && params.normalizeds[0] === 'db') {
extraInfo += formatParamLog('Custom', 'rationale', params.templateParams[0]['1']);
} else {
var keys = Object.keys(item);
if (keys[0] !== undefined && keys[0].length > 0) {
// Second loop required since some items (G12, F9) may have multiple keys
keys.forEach(function(key, keyIndex) {
if (keys[keyIndex] === 'blanked' || keys[keyIndex] === 'ts') {
return true; // Not worth logging
}
extraInfo += formatParamLog(params.normalizeds[index].toUpperCase(), keys[keyIndex], item[key]);
});
}
});
}
}
if (params.
appendText +=
}
if (extraInfo) {
appendText += '; additional information:' + extraInfo;
}
if (initialContrib) {
appendText += '; notified {{user|1=' + initialContrib + '}}';
}
appendText +=
usl.changeTags = Twinkle.changeTags;
usl.log(appendText, editsummary);
}
}
switch (value) {
case 'reason':
if (form[
var dbrationale = form[
if (!dbrationale || !dbrationale.trim()) {
alert(
parameters = null;
return false;
}
currentParams[
}
break;
case 'userreq': // U1
if (form[
var u1rationale = form[
if (mw.config.get('wgNamespaceNumber') === 3 && !
(!u1rationale || !u1rationale.trim())) {
alert(
parameters = null;
return false;
case 'repost': // G4
if (form[
var deldisc = form[
if (deldisc) {
if (!new RegExp('^:?' + Morebits.namespaceRegex(4) + ':', 'i').test(deldisc)) {
alert(
parameters = null;
return false;
}
currentParams
}
}
case 'banned': // G5
if (form[
currentParams
}
break;
case 'move': // G6
if (form[
var movepage = form[
movereason = form[
if (!movepage || !movepage.trim()) {
alert(
parameters = null;
return false;
}
if (!movereason || !movereason.trim()) {
alert(
parameters = null;
return false;
}
currentParams
currentParams
}
break;
case 'xfd': // G6
if (form[
var xfd = form[
if (xfd) {
if (
alert(
parameters = null;
return false;
case 'copypaste': // G6
if (form[
var copypaste = form[
if (!copypaste || !copypaste.trim()) {
alert(
parameters = null;
return false;
}
currentParams
}
break;
case 'g6': // G6
if (form[
currentParams.rationale = form[
}
break;
case 'author': // G7
if (form[
currentParams.rationale = form[
}
break;
case 'g8': // G8
if (form[
currentParams.rationale = form[
}
break;
case 'templatecat': // G8
if (form['csd.templatecat_rationale'] && form['csd.templatecat_rationale'].value) {
currentParams.rationale = form['csd.templatecat_rationale'].value;
}
break;
case 'copyvio': // G12
if (form[
currentParams.url = form[
}
if (form[
currentParams.url2 = form[
}
if (form[
currentParams.url3 = form[
}
break;
case 'afc': // G13
currentParams.ts = '$TIMESTAMP'; // to be replaced by the last revision timestamp when page is saved
break;
case 'redundantimage': // F1
if (form[
var redimage = form[
if (!redimage || !redimage.trim()) {
alert(
parameters = null;
return false;
}
currentParams.filename =
}
break;
case 'badfairuse': // F7
if (form[
currentParams.
}
break;
case '
if (form[
var filename = form[
if (filename && filename.trim() && filename !== Morebits.pageNameNorm) {
currentParams.filename = new RegExp('^\\s*' + Morebits.namespaceRegex(6) + ':', 'i').test(filename) ? filename : 'File:' + filename;
}
}
break;
case 'imgcopyvio': // F9
if (form[
var f9rationale = form['csd.imgcopyvio_rationale'].value;
if ((!f9url || !f9url.trim()) && (!f9rationale || !f9rationale.trim())) {
alert('CSD F9: You must enter a url or reason (or both) when nominating a file under F9.');
parameters = null;
return false;
}
if (form['csd.imgcopyvio_url'].value) {
currentParams.url = f9url;
}
if (form['csd.imgcopyvio_rationale'].value) {
currentParams.rationale = f9rationale;
}
}
break;
case 'foreign': // A2
if (form[
var foreignlink = form[
if (!foreignlink || !foreignlink.trim()) {
alert(
parameters = null;
return false;
}
currentParams.source = foreignlink;
}
break;
case 'transwiki': // A5
if (form['csd.transwiki_location'] && form['csd.transwiki_location'].value) {
currentParams.location = form['csd.transwiki_location'].value;
}
break;
case 'a10': // A10
if (form[
var duptitle = form[
if (!duptitle || !duptitle.trim()) {
alert(
parameters = null;
return false;
}
currentParams.article = duptitle;
}
break;
case 'p1': // P1
if (form[
var criterion = form[
if (!criterion || !criterion.trim()) {
alert(
parameters = null;
return false;
}
currentParams
}
break;
};
//
// key1/value1: for {{db-criterion-[notice|deleted]}} (via {{db-csd-[notice|deleted]-custom}})
// utparams.param: for {{db-[notice|deleted]-multiple}}
Twinkle.speedy.getUserTalkParameters = function twinklespeedyGetUserTalkParameters(normalized, parameters) {
var utparams = [];
// Special cases
if (normalized === 'db') {
utparams['2'] = parameters['1'];
} else if (normalized === 'g6') {
} else if (normalized === 'g12') {
['url', 'url2', 'url3'].forEach(function(item, idx) {
if (parameters[item]) {
idx++;
utparams['key' + idx] = item;
utparams['value' + idx] = utparams[item] = parameters[item];
});
} else {
// Handle the rest
var param;
switch (normalized) {
case 'g4':
param = 'xfd';
break;
case 'a2':
param = 'source';
break;
case 'a5':
param = 'location';
break;
case 'a10':
param = 'article';
break;
case 'f9':
param = 'url';
break;
case 'p1':
param = 'criterion';
break;
default:
break;
}
// No harm in providing a usertalk template with the others' parameters
if (param && parameters[param]) {
utparams.key1 = param;
utparams.value1 = utparams[param] = parameters[param];
}
}
return utparams;
};
/**
* @param {Event} e
* @returns {Array}
*/
Twinkle.speedy.resolveCsdValues = function twinklespeedyResolveCsdValues(e) {
var values = (e.target.form ? e.target.form : e.target).getChecked('csd');
if (values.length === 0) {
alert(
return null;
}
Twinkle.speedy.callback.evaluateSysop = function twinklespeedyCallbackEvaluateSysop(e) {
var form =
if (e.target.type === 'checkbox' || e.target.type === 'text' ||
e.target.type === 'select') {
return;
}
var tag_only = form.tag_only;
if (
Twinkle.speedy.callback.evaluateUser(e);
return;
}
var
if (!
return;
}
var templateParams = Twinkle.speedy.getParameters(form, values);
if (!templateParams) {
return;
}
var normalizeds = values.map(function(value) {
return Twinkle.speedy.normalizeHash[value];
});
// analyse each criterion to determine whether to watch the page, prompt for summary, or notify the creator
var watchPage, promptForSummary;
normalizeds.forEach(function(norm) {
if (Twinkle.getPref('watchSpeedyPages').indexOf(norm) !== -1) {
watchPage = Twinkle.getPref('watchSpeedyExpiry');
}
if (Twinkle.getPref('promptForSpeedyDeletionSummary').indexOf(norm) !== -1) {
promptForSummary = true;
}
});
var warnusertalk = form.warnusertalk.checked && normalizeds.some(function (norm, index) {
return Twinkle.getPref('warnUserOnSpeedyDelete').indexOf(norm) !== -1 &&
!(norm === 'g6' && values[index] !== 'copypaste');
});
var welcomeuser = warnusertalk && normalizeds.some(function (norm) {
return Twinkle.getPref('welcomeUserOnSpeedyDeletionNotification').indexOf(norm) !== -1;
});
var params = {
normalizeds: normalizeds,
watch: watchPage,
deleteTalkPage: form.talkpage && form.talkpage.checked,
deleteRedirects: form.redirects.checked,
warnUser: warnusertalk,
welcomeuser: welcomeuser,
promptForSummary: promptForSummary,
templateParams: templateParams
};
Morebits.simpleWindow.setButtonsEnabled(
Morebits.status.init(
Twinkle.speedy.callbacks.sysop.main(
};
Twinkle.speedy.callback.evaluateUser = function twinklespeedyCallbackEvaluateUser(e) {
var form =
if (e.target.type ===
e.target.type ===
return;
}
return;
}
var templateParams = Twinkle.speedy.getParameters(form, values);
if (!templateParams) {
return;
}
// var multiple = form.multiple.checked;
var normalizeds = values.map(function(value) {
return Twinkle.speedy.normalizeHash[value];
});
// analyse each criterion to determine whether to watch the page/notify the creator
var watchPage =
return Twinkle.getPref('watchSpeedyPages').indexOf(norm) !== -1 && Twinkle.getPref('watchSpeedyExpiry');
});
var notifyuser = form.notify.checked && normalizeds.some(function(norm, index) {
return Twinkle.getPref('notifyUserOnSpeedyDeletionNomination').indexOf(norm) !== -1 &&
!(norm === 'g6' && values[index] !== 'copypaste');
});
var welcomeuser = notifyuser && normalizeds.some(function(norm) {
return Twinkle.getPref('welcomeUserOnSpeedyDeletionNotification').indexOf(norm) !== -1;
});
var csdlog = Twinkle.getPref('logSpeedyNominations') && normalizeds.some(function(norm) {
return Twinkle.getPref('noLogOnSpeedyNomination').indexOf(norm) === -1;
});
var params = {
welcomeuser: welcomeuser,
lognomination: csdlog,
requestsalt: form.salting.checked,
templateParams: templateParams
};
Morebits.simpleWindow.setButtonsEnabled(
Morebits.status.init(
Morebits.wiki.actionCompleted.redirect = mw.config.get('wgPageName');
Morebits.wiki.actionCompleted.notice =
var wikipedia_page = new Morebits.wiki.page(mw.config.get('wgPageName'),
wikipedia_page.setChangeTags(Twinkle.changeTags); // Here to apply to triage
wikipedia_page.setCallbackParameters(params);
wikipedia_page.load(Twinkle.speedy.callbacks.user.main);
};
Twinkle.addInitCallback(Twinkle.speedy, 'speedy');
})(jQuery);
// </nowiki>
|