පරිශීලක:බිඟුවා/twinklespeedy.js

විකිපීඩියා වෙතින්

සටහන: සුරැකීමෙන් පසුව, වෙනස් කම් දැකගැනුමට ඔබගේ බ්‍රවුසරයෙහි කෑෂය මගහැරයෑමට ඔබට සිදුවිය හැක. ගූගල් ක්‍රෝම්, ෆයර්ෆොක්ස්, මයික්‍රොසොෆ්ට් එජ් සහ සෆාරි: Reload ඔබන අතරතුර ⇧ Shift ඔබන්න. සවිස්තරාත්ම උපදෙස් සහ වෙනත් බ්‍රව්සර වලට අදාළ තොරතුරු සඳහා, විකිපීඩියා:කෑෂය මගහැරයෑම වෙතට යොමු වන්න.

// If TwinkleConfig aint exist.
if( typeof( TwinkleConfig ) == 'undefined' ) {
	TwinkleConfig = {};
}

/**
 TwinkleConfig.summaryAd (string)
 If ad should be added or not to summary, default [[WP:TWINKLE|TWINKLE]]
 */
if( typeof( TwinkleConfig.summaryAd ) == 'undefined' ) {
	TwinkleConfig.summaryAd = " [[WP:TW|TW]] භාවිතයෙන්";
}

/**
 TwinkleConfig.deletionSummaryAd (string)
 If ad should be added or not to deletion summary, default [[WP:TWINKLE|TWINKLE]]
 */
if( typeof( TwinkleConfig.deletionSummaryAd ) == 'undefined' ) {
	TwinkleConfig.deletionSummaryAd = " [[WP:TW|TW]] භාවිතයෙන්";
}

/**
 TwinkleConfig.watchSpeedyPages (array)
 What types of actions that should result in forced addition to watchlist
 */
if( typeof( TwinkleConfig.watchSpeedyPages ) == 'undefined' ) {
	TwinkleConfig.watchSpeedyPages = [ 'g3', 'g5', 'g10', 'g11', 'g12' ];
}

/**
 TwinkleConfig.markSpeedyPagesAsMinor (boolean)
 If, when applying speedy template to page, to mark the edit as minor, default true
 */
if( typeof( TwinkleConfig.markSpeedyPagesAsMinor ) == 'undefined' ) {
	TwinkleConfig.markSpeedyPagesAsMinor = false;
}

/**
 TwinkleConfig.markSpeedyPagesAsPatrolled (boolean)
 If, when applying speedy template to page, to mark the page as patrolled, default true
 */
if( typeof( TwinkleConfig.markSpeedyPagesAsPatrolled ) == 'undefined' ) {
	TwinkleConfig.markSpeedyPagesAsPatrolled = true;
}

/**
 TwinkleConfig.notifyUserOnSpeedyDeletionNomination (array of strings)
 What types of actions that should result that the author of the page should be notified of nomination
 */
if( typeof( TwinkleConfig.notifyUserOnSpeedyDeletionNomination ) == 'undefined' ) {
	TwinkleConfig.notifyUserOnSpeedyDeletionNomination = [ 'g1', 'g2', 'g3', 'g4', 'g10', 'g11', 'g12', 'a1', 'a2', 'a3', 'a5', 'a7', 'a9', 'a10', 'f1', 'f2', 'f3', 'f4', 'f5', 'f6', 'f7', 'f9', 'f10', 'f11', 'u3', 't2', 't3', 'p2' ];
}

/**
 TwinkleConfig.welcomeUserOnSpeedyDeletionNotification (array of strings)
 On what types of speedy deletion notifications shall the user be welcomed
 with a {{firstarticle}} notice if his talk page has not yet been created.
 */
if( typeof( TwinkleConfig.welcomeUserOnSpeedyDeletionNotification ) == 'undefined' ) {
	TwinkleConfig.welcomeUserOnSpeedyDeletionNotification = TwinkleConfig.notifyUserOnSpeedyDeletionNomination;
}

/**
 TwinkleConfig.openUserTalkPageOnSpeedyDelete (array of strings)
 What types of actions that should result user talk page to be opened when speedily deleting (admin only)
 */
if( typeof( TwinkleConfig.openUserTalkPageOnSpeedyDelete ) == 'undefined' ) {
	TwinkleConfig.openUserTalkPageOnSpeedyDelete = [ 'g1', 'g2', 'g3', 'g4', 'g5', 'g10', 'g11', 'g12', 'a1', 'a3', 'a7', 'a9', 'a10', 'f3', 'f4', 'f5', 'f6', 'f7', 'f9', 'f11', 'u3', 't2' ];
}

/**
 TwinkleConfig.userTalkPageMode may take arguments:
 'window': open a new window, remember the opened window
 'tab': opens in a new tab, if possible.
 'blank': force open in a new window, even if a such window exist
 */
if( typeof( TwinkleConfig.userTalkPageMode ) == 'undefined' ) {
	TwinkleConfig.userTalkPageMode = 'window';
}

/**
 TwinkleConfig.deleteTalkPageOnDelete (boolean)
 If talk page if exists should also be deleted (CSD G8) when spedying a page (admin only)
 */
if( typeof( TwinkleConfig.deleteTalkPageOnDelete ) == 'undefined' ) {
	TwinkleConfig.deleteTalkPageOnDelete = false;
}

/**
 TwinkleConfig.orphanNormalPagesOnSpeedyDelete (hash)
 Defines if all backlinks to a page should be removed.
 property 'exclude' defined actions not to orphan
 */
if( typeof( TwinkleConfig.orphanBacklinksOnSpeedyDelete ) == 'undefined' ) {
	TwinkleConfig.orphanBacklinksOnSpeedyDelete = { exclude: ['g6'], orphan:true };
}

/**
 TwinkleConfig.speedyWindowWidth (integer)
 Defines the width of the Twinkle SD window in pixels
 */
if( typeof( TwinkleConfig.speedyWindowWidth ) == 'undefined' ) {
	TwinkleConfig.speedyWindowWidth = 800;
}

/**
 TwinkleConfig.speedyWindowHeight (integer)
 Defines the height of the Twinkle SD window in pixels
 */
if( typeof( TwinkleConfig.speedyWindowHeight ) == 'undefined' ) {
	TwinkleConfig.speedyWindowHeight = 500;
}

/**
 TwinkleConfig.deleteSysopDefaultToTag (boolean)
 Make the CSD screen default to "tag" instead of "delete" (admin only)
 */
if( typeof(TwinkleConfig.deleteSysopDefaultToTag) == 'undefined' ) TwinkleConfig.deleteSysopDefaultToTag = false;

function twinklespeedy() {
	// Disable on:
	// * special pages
	// * pages with neither a page nor local file revision
	if( wgNamespaceNumber < 0 ||
	(wgArticleId==0 && (wgNamespaceNumber!=6 || (document.getElementById("mw-imagepage-section-filehistory") && !(document.getElementById("mw-sharedupload")))))
	)  return;
	
	if( userIsInGroup( 'sysop' ) ) {
		twAddPortletLink( "javascript:twinklespeedy.callback()", "CSD", "tw-csd", "Speedy delete according to WP:CSD", "");
	} else if (twinkleConfigExists) {
		twAddPortletLink( "javascript:twinklespeedy.callback()", "CSD", "tw-csd", "Request speedy deletion according to WP:CSD", "");
	}
	else
	{
		twAddPortletLink( 'javascript:alert("Your account is too new to use Twinkle.");', 'CSD', 'tw-csd', 'Request speedy deletion according to WP:CSD', '');
	}
}
window.TwinkleInit = (window.TwinkleInit || []).concat(twinklespeedy); //schedule initializer

twinklespeedy.callback = function twinklespeedyCallback() {
	var Window = new SimpleWindow( TwinkleConfig.speedyWindowWidth, TwinkleConfig.speedyWindowHeight );
	Window.setTitle( "ඉක්මන් මකාදැමීමේ උපමානය තෝරන්න" );

	var form = new QuickForm( userIsInGroup( 'sysop' ) ? twinklespeedy.callback.evaluateSysop : twinklespeedy.callback.evaluateUser, 'change' );
	if( userIsInGroup( 'sysop' ) ) {
		form.append( {
				type: 'checkbox',
				list: [
					{
						label: 'මකන්න එපා. ටැගය පමණක් එක කරන්න',
						value: 'tag_only',
						name: 'tag_only',
						tooltip: 'If you just want to tag the page, instead of deleting it now',
						checked : TwinkleConfig.deleteSysopDefaultToTag,
						event: function( event ) {
							event.target.form.notify.disabled = ! event.target.checked;
							event.target.form.notify.checked = event.target.checked;
							event.stopPropagation();
						}
					},
					{
						label: 'මෙම පිටුවට ඇති සබැඳුම ඉවත් කරන්න',
						value: 'orphan_backlinks',
						name: 'orphan_backlinks',
						tooltip: 'If you want to orphan the current page. If checked, excludes will still apply',
						checked: TwinkleConfig.orphanBacklinksOnSpeedyDelete.orphan,
						event: function( event ) {
							TwinkleConfig.orphanBacklinksOnSpeedyDelete.orphan = event.target.checked;
							event.stopPropagation();
						}
					}
				]
			} );
	}

	form.append( {
			type: 'checkbox',
			list: [
				{
					label: 'කළහැකි නම් දැනුම් දෙන්න',
					value: 'notify',
					name: 'notify',
					tooltip: 'If a notification is defined in the configuration, then notify if this is true, else no notification',
					checked: !userIsInGroup( 'sysop' ) || TwinkleConfig.deleteSysopDefaultToTag,
					disabled: userIsInGroup( 'sysop' ) && !TwinkleConfig.deleteSysopDefaultToTag,
					event: function( event ) {
						event.stopPropagation();
					}
				}
			]
		}
	);
	
	if( wgNamespaceNumber ==  Namespace.IMAGE ) {
		form.append( {type:'header', label:'ගොනු' } );
		form.append ( { type: 'radio', name: 'csd', list: twinklespeedy.fileList } );
	}

	if( wgNamespaceNumber ==  0 || wgNamespaceNumber == 1 ) {
		form.append( { type:'header', label:'ලිපි' } );
		form.append( { type: 'radio', name: 'csd', list: twinklespeedy.articleList } );
	}
	
	if( wgNamespaceNumber ==  14 || wgNamespaceNumber == 15 ) {
		form.append( { type:'header', label: 'ප්‍රවර්ග' } );
		form.append( { type: 'radio', name: 'csd', list: twinklespeedy.categoryList } );
	}
	
	if( wgNamespaceNumber ==  2 || wgNamespaceNumber == 3 ) {
		form.append( { type:'header', label: 'පරිශීලක පිටු' } );
		form.append( { type: 'radio', name: 'csd', list: twinklespeedy.userList } );
	}
	
	if( wgNamespaceNumber ==  10 || wgNamespaceNumber == 11 ) {
		form.append( { type:'header', label: 'සැකිලි' } );
		form.append( { type: 'radio', name: 'csd', list: twinklespeedy.templateList } );
	}
	
	if( wgNamespaceNumber ==  100 || wgNamespaceNumber == 101 ) {
		form.append( { type:'header', label: 'ද්වාර' } );
		form.append( { type: 'radio', name: 'csd', list: twinklespeedy.portalList } );
	}

	form.append( { type:'header', label:'සාමාන්‍ය උපමාන' } );
	form.append( { type: 'radio', name: 'csd', list: twinklespeedy.generalList });

	form.append( { type:'header', label: 'යළි යොමු කිරීම්' } );
	form.append( { type: 'radio', name: 'csd', list: twinklespeedy.redirectList } );
	
	var result = form.render();
	Window.setContent( result );
	Window.display();
}

twinklespeedy.fileList = [
	{ 
		label: 'F1: අනවශ්‍ය ගොනුව',
		value: 'redundantimage',
		tooltip: 'Any file that is a redundant copy, in the same file format and same or lower resolution, of something else on Wikipedia. Likewise, other media that is a redundant copy, in the same format and of the same or lower quality. This does not apply to files duplicated on Wikimedia Commons, because of licence issues; these should be tagged with \{\{subst:ncd|Image:newname.ext\}\} or \{\{subst:ncd\}\} instead' 
	},
	{ 
		label: 'F2: දූෂිත හෝ ශූන්‍ය පින්තූර',
		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: 'F3: අයුතු බලපත්‍රය',
		value: 'noncom',
		tooltip: '"Files licensed as "for non-commercial use only", "non-derivative use" or "used with permission" that were uploaded on or after 2005-05-19, except where they have been shown to comply with the limited standards for the use of non-free content. This includes files licensed under a "Non-commercial Creative Commons License". Such files uploaded before 2005-05-19 may also be speedily deleted if they are not used in any articles'
	},
	{
		label: 'F4: බලපත්‍රය තොරතුරු හිඟය', 
		value: 'unksource',
		tooltip: 'Files in category "Files with unknown source", "Files with unknown copyright status", or "Files with no copyright tag" that have been tagged with a template that places them in the category for more than seven days, regardless of when uploaded. Note, users sometimes specify their source in the upload summary, so be sure to check the circumstances of the file'
	},
	{
		label: 'F5: භා‍විත නොකළ නොනිදහස් පින්තූර',
		value: 'unfree',
		tooltip: 'Files that are not under a free license or in the public domain that are not used in any article and that have been tagged with a template that places them in a dated subcategory of Category:Orphaned fairuse files for more than seven days. Reasonable exceptions may be made for file uploaded for an upcoming article. Use \{\{subst:orfud\}\} to tag files for forthcoming deletion' 
	},
	{
		label: 'F6: Missing fair-use rationale',
		value: 'norat',
		tooltip: 'Any file without a fair use rationale may be deleted seven days after it is uploaded.  Boilerplate fair use templates do not constitute a fair use rationale.  Files uploaded before 2006-05-04 should not be deleted immediately; instead, the uploader should be notified that a fair-use rationale is needed.  Files uploaded after 2006-05-04 can be tagged with \{\{subst:nrd\}\}, and the uploader notified with \{\{subst:missing rationale|File:image name\}\}. Such files can be found in the dated subcategories of Category:Files with no fair use rationale'
	},
	{ 
		label: 'F7: Invalid fair-use claim',
		value: 'badfairuse', 
		tooltip: 'Any file with a clearly invalid fair-use tag (such as a \{\{logo\}\} tag on a photograph of a mascot) may be deleted at any time. Media that fail any part of the non-free content criteria and were uploaded after 2006-07-13 may be deleted forty-eight hours after notification of the uploader. For media uploaded before 2006-07-13 or tagged with the \{\{Replaceable fair use\}\} template, the uploader will be given seven days to comply with this policy after being notified' 
	},
	{
		label: 'F8: සර්වසම ගොනුව විකිපීඩියා කොමන්හි පැවතීම',
		value: 'nowcommons',
		tooltip: 'Provided the following conditions are met: 1: The file\'s license and source status is beyond reasonable doubt, and the license is undoubtedly accepted at Commons. 2: 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. 3: The file is not protected, and the file description page does not contain a request not to move it to Commons. 4: 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'
	},
	{
		label: 'F9: ව්‍යාංගාර්ථ රහිත කර්තෘ හිමිකම් උල්ලංඝනය කිරීම',
		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'
	},
	{
		label: 'F10: නිෂ්ඵල මාධ්‍යය ගොනුව',
		value: 'badfiletype',
		tooltip: 'Files uploaded that are neither image, sound, nor video files (e.g. .doc, .pdf, or .xls files) which are not used in any article and have no foreseeable encyclopedic use'
	},
	{
		label: 'F11: අවසර දීම ගැන සාක්ෂි නොමැත',
		value: 'nopermission',
		tooltip: 'If an uploader has specified a license and has named a third party as the source/copyright holder without providing evidence that this third party has in fact agreed, the item may be deleted seven days after notification of the uploader'
	}
];

twinklespeedy.articleList = [
	{
		label: 'A1: අන්තර්ගතයක් නොමැති වීම',
		value: 'nocontext',
		tooltip: 'Example: "He is a funny man with a red car. He makes people laugh." This applies only to very short articles. Context is different from content, treated in A3, below.'
	},
	{
		label: 'A2: වෙනත් විකිමාධ්‍ය ව්‍යාපෘතියක පවතින විදේශීය භාෂාමය ලිපියකි.',
		value: 'foreign',
		tooltip: 'If the article in question does not exist on another project, the template \{\{notenglish\}\} should be used instead. All articles in a non-English language that do not meet this criteria (and do not meet any other criteria for speedy deletion) should be listed at Pages Needing Translation (PNT) for review and possible translation'
	},
	{
		label: 'A3: අන්තර්ගතයක් නොමැතr',
		value: 'nocontent',
		tooltip: 'Any article consisting only of links elsewhere (including hyperlinks, category tags and "see also" sections), a rephrasing of the title, and/or attempts to correspond with the person or group named by its title. This does not include disambiguation pages'
	},
	{
		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'
	},
	{
		label: 'A7: වැදගත්කම විහිදා නොදක්වයි',
		value: 'a7',
		tooltip: 'An article about a real person, group of people, band, club, company, or web content 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: '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 that does not assert the importance or significance of the subject'
	},
	{
		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: 'A9: වැදගත්කම විහිදා නොදක්වන musical recording where artist\'s article doesn\'t exist',
		value: 'a9',
		tooltip: 'An article about a musical recording which does not indicate why its subject is important or significant, and where the artist\'s article has never existed or has been deleted'
	},
	{
		label: 'A10: පවතින මාතෘකාවක් අනුපිටපත් කරමින් මෑතදී තැනුනු ලිපියක්',
		value: 'a10',
		tooltip: 'A recently created article with no relevant page history that does not aim to expand upon, detail or improve information within any existing article(s) on the subject, and where the title is not a plausible redirect. This does not include content forks, split pages or any article that aims at expanding or detailing an existing one.'
	}
];

twinklespeedy.categoryList = [
	{ 
		label: 'C1: ශූන්‍ය ප්‍රවර්ගයන්',
		value: 'catempty',
		tooltip: '(no articles or subcategories for at least four days) whose only content has consisted of links to parent categories. This does not apply to categories being discussed on WP:CFD or WP:SFD, or disambiguation categories. If the category isn\'t relatively new, it possibly contained articles earlier, and deeper investigation is needed'
	}
];

twinklespeedy.userList = [
	{
		label: 'U1: පරිශීලක ඉල්ලීම',
		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'
	},
	{
		label: 'U2: නොපවතින පරිශීලක',
		value: 'nouser',
		tooltip: 'User pages of users that do not exist (Check Special:Listusers)'
	},
	{
		label: 'U3: නොනිදහස් ගැලරිය',
		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'
	},
];

twinklespeedy.templateList = [
	{
		label: 'T2: Templates that are blatant misrepresentations of established policy',
		value: 'policy',
		tooltip: 'This includes "speedy deletion" templates for issues that are not speedy deletion criteria and disclaimer templates intended to be used in articles'
	},
	{
		label: 'T3: Templates that are not employed in any useful fashion',
		value: 't3',
		tooltip: 'Templates that are either substantial duplications of another template or hardcoded instances of another template where the same functionality could be provided by that other template'
	}
];

twinklespeedy.portalList = [
	{
		label: 'P2: Underpopulated portal',
		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'
	}
];

twinklespeedy.generalList = [
	{ 
		label: 'G1: විකාරය: නොගැළපෙන පිටුව හෝ  අරුත්බර නොවන අන්තර්ගතය.', 
		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' },
	{ 
		label: 'G2: අත්හදා බැලීම් පිටුව',
		value: 'test',
		tooltip: 'e.g., "Can I really create a page here?"' 
	},
	{ 
		label: 'G3: නාශකවාදය',
		value: 'vandalism',
		tooltip: 'Plain pure vandalism'
	},
	{ 
		label: 'G3: වංචාව හෝ බොරුව',
		value: 'hoax',
		tooltip: 'Blatant and obvious hoax, to the point of vandalism'
	},				{ 
		label: 'G3: පිටු ගෙනයා හා  බැඳි නාශකවාදය', 
		value: 'pagemove',
		tooltip: 'Nonsense redirects that are created from the cleanup of page move vandalism'
	},
	{
		label: 'G4: මකා දැමූ ලිපියක් නැවත සැදීම',
		value: 'repost',
		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 and that any revisions made clearly do not address the reasons for which the page was deleted. 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, the previous speedy criterion, or other speedy deletion criteria, may apply'
	},
	{
		label: 'G5: වාරණය කළ පරිශීලකයකුගේ නිර්මාණයක්', 
		value: 'banned',
		tooltip: 'Pages created by banned users while they were banned'
	},
	{
		label: 'G6: ඉතිහාසය ඒකාබද්ධ කිරීම', 
		value: 'histmerge',
		tooltip: 'Temporarily deleting a page in order to merge page histories' 
	},
	{
		label: 'G6: ගෙන යනවා', 
		value: 'move',
		tooltip: 'Making way for a noncontroversial move like reversing a redirect' 
	},
	{
		label: 'G6: Afd',
		value: 'afd',
		tooltip: 'An admin has closed an Articles for deletion debate as a "delete"'
	},
	{
		label: 'G6: එදිනෙදා දිනචරියාවට අනුව කෙරෙන ශුද්ධ පවිත්‍ර කිරීම',
		value: 'g6',
		tooltip: 'Other non-controversial "housekeeping" tasks'
	},
	{
		label: 'G7: කර්තෘ ඉල්ලීම යටතේ මකා දැමීම හෝ හිස් පිටුව',
		value: 'author',
		tooltip: 'Any page for which deletion is requested by the original author in good faith, provided the page\'s only substantial content was added by its author'
	},
	{
		label: 'G7: කර්තෘ හිස් කල පිටුව',
		value: 'blanked',
		tooltip: ' If the author blanks the page, this can be taken as a deletion request'
	},
	{
		label: 'G8: දැනට-නොපවතින හෝ මකාදමා ඇති පිටුවක් මත යැපෙන පිටුව',
		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 invalid targets, such as nonexistent targets, redirect loops, and bad titles; or categories populated by deleted or retargeted templates. 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.'
	},
	{
		label: 'G8:  විශය අනූරූප නොවන සංවාද පිටුව',
		value: 'talk',
		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.'
	},
	{
		label: 'G8: ජනක පිටුවක් නොමැති උප පිටුව',
		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.'
	},
	{
		label: 'G8: Redirects to invalid targets, such as nonexistent targets, redirect loops, and bad titles',
		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.'
	},
	{
		label: 'G8: Categories populated by deleted or retargeted templates',
		value: 'templatecat',
		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.'
	},
	{ 
		label: 'G10: ආක්‍රමණය පිටුව',
		value: 'attack', 
		tooltip: 'Pages that serve no purpose but to disparage 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: ව්‍යාංගාර්ථ රහිත දැන්වීම් ප්‍රචාරය',
		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 simply having a company, product, group, service, or person as its subject does not qualify an article for this criterion; an article that is blatant advertising should have inappropriate content as well'
	},
	{ 
		label: 'G12: ව්‍යාංගාර්ථ රහිත කර්තෘ හිමිකම් උල්ලංඝනය කිරීම', 
		value: 'copyvio', 
		tooltip: 'Either, 1: Material was copied from another website that does not have a license compatible with Wikipedia, or is photography from a stock photo seller (such as Getty Images or Corbis) or other commercial content provider; 2: There is no non-infringing content in the page history worth saving; or 3: The infringement was introduced at once by a single person rather than created organically on wiki and then copied by another website such as one of the many Wikipedia mirrors' 
	}
];

twinklespeedy.redirectList = [
	{ 
		label: 'R2: Redirects from mainspace to any other namespace except the Category:, Template:, Wikipedia:, Help: and Portal: namespaces', 
		value: 'rediruser', 
		tooltip: '(this does not include the Wikipedia shortcut pseudo-namespaces). If this was the result of a page move, consider waiting a day or two before deleting the redirect'
	},
	{ 
		label: 'R3: මැතදී සාදන ලද විශ්වාස නොකළ හැකි අකුරු කිරීමේ දෝශය හෝ වැරදි ව්‍යවහාරය.', 
		value: 'redirtypo', 
		tooltip: 'කෙසේ වුවත්, වැරදි අකුරු සහිත යළි යොමු කිරීම වැදගත් වන අවස්ථාද තිබේ. උදාහරණ ලෙසින් වෙනත් භාෂාවකදී එම වචනය නිවැරදි එකක් වන අවස්තාව සැලකිය හැකිය.'
	}
];

twinklespeedy.normalizeHash = {
	'nonsense': 'g1',
	'test': 'g2',
	'vandalism': 'g3',
	'hoax': 'g3',
	'pagemove': 'g3',
	'repost': 'g4',
	'banned': 'g5',
	'histmerge': 'g6',
	'move': 'g6',
	'afd': 'g6',
	'g6': 'g6',
	'author': 'g7',
	'blanked': 'g7',
	'g8': 'g8',
	'talk': 'g8',
	'subpage': 'g8',
	'redirnone': 'g8',
	'templatecat': 'g8',
	'attack': 'g10',
	'spam': 'g11',
	'copyvio': 'g12',
	'nocontext': 'a1',
	'foreign': 'a2',
	'nocontent': 'a3', 
	'transwiki': 'a5',
	'a7': 'a7',
	'person': 'a7',
	'corp': 'a7',
	'web': 'a7',
	'band': 'a7',
	'club': 'a7',
	'a9': 'a9',
	'a10': 'a10',
	'rediruser': 'r2',
	'redirtypo': 'r3',
	'redundantimage': 'f1',
	'noimage': 'f2',
	'noncom': 'f3',
	'unksource': 'f4',
	'unfree': 'f5',
	'norat': 'f6',
	'badfairuse': 'f7',
	'nowcommons': 'f8',
	'imgcopyvio': 'f9',
	'badfiletype': 'f10',
	'nopermission': 'f11',
	'catempty': 'c1',
	'userreq': 'u1',
	'nouser': 'u2',
	'gallery': 'u3',
	'policy':'t2',
	't3':'t3',
	'emptyportal': 'p2'
};

twinklespeedy.reasonHash = {
	'nonsense': 'විකාරය: නොගැළපෙන පිටුව හෝ  අරුත්බර නොවන අන්තර්ගතය',
	'test': 'අත්හදා බැලීම් පිටුව',
	'vandalism': 'නාශකවාදය',
	'hoax': 'වංචාව හෝ බොරුව',
	'pagemove': 'redirect created during cleanup of page move vandalism',
	'repost': 'a substantially identical copy of a page deleted via a [[WP:XFD|deletion discussion]]',
	'banned': 'a page created by a [[WP:BAN|banned user]] in violation of his or her ban, with no substantial edits by others',
	'histmerge': 'පිටු ඉතිහාසය ඒකාබද්ධ කිරීම වෙනුවෙන් කෙරෙන තාවකාලික මැකීම ',
	'move': 'making way for a non-controversial move',
	'afd': 'deleting page per result of [[WP:AfD|AfD සාකච්ඡාව හා තීරණය]]',
	'g6': 'එදිනෙදා දිනචරියාවට අනුව කෙරෙන ශුද්ධ පවිත්‍ර කිරීම',
	'author': 'කර්තෘ ඉල්ලීම යටතේ මකා දැමීම හෝ හිස් පිටුව',
	'blanked': 'the only editor who provided substantial content blanked the page',
	'g8': 'මකා දැමූ හෝ දැනට නොපවතින පිටුවක් හා බැඳුනු පිටුව',
	'talk': '[[Help:Talk page|talk page]] of a deleted or non-existent page',
	'subpage': '[[Wikipedia:Subpages|subpage]] of a deleted or non-existent page',
	'redirnone': '[[Wikipedia:Redirect|redirect]] to a deleted or non-existent page',
	'templatecat': 'category populated by deleted or retargeted template',
	'attack': 'page that serves no purpose but to disparage or threaten its subject or someone else',
	'spam': 'was blatant advertising, used only to promote someone or something',
	'copyvio': 'was an unambiguous copyright infringement',
	'nocontext': 'was a very short article providing little or no context',
	'foreign': 'was a foreign language article that exists on another Wikimedia project',
	'nocontent': 'had no content whatsoever except possibly links elsewhere, a rephrasing of the title, and/or attempts to correspond', 
	'transwiki': 'was properly transwikified elsewhere',
	'a7': 'was an article about a real person, group of people, band, club, company, or web content that didn\'t assert the importance or significance of its subject',
	'person' : 'was an article about a real person that didn\'t assert the importance or significance of its subject',
	'web': 'was an article about a web site, blog, online forum, webcomic, podcast, or similar web content that didn\'t assert the importance or significance of its subject',
	'corp': 'was an article about a company or organization that didn\'t assert the importance or significance of its subject',
	'club': 'was an article about a club that didn\'t assert the importance or significance of the subject',
	'band': 'was an article about a band, singer, musician, or musical ensemble that didn\'t assert the importance or significance of the subject',
	'a9': 'was an article about a musical recording which does not indicate why its subject is important or significant, and where the artist\'s article has never existed or has been deleted',
	'a10': 'was a recently created article that duplicated an existing topic',
	'rediruser': 'Cross-[[WP:NS|namespace]] [[WP:R|redirect]] from mainspace',
	'redirtypo': 'විශ්වාස නොකළ හැකි අකුරු කිරීමේ දෝශය සහිත යළි යොමුව',
	'redundantimage': 'විකිපීඩියාවේ සමාන හෝ වඩා හොඳ පින්තූරයක් තිබීම',
	'noimage': 'was a corrupt or empty file, or a file description page for a file on Wikimedia Commons',
	'noncom': 'was licensed as "for non-commercial use only", "non-derivative use" or "used with permission", uploaded on or after May 19, 2005, and no assertion of fair use was provided',
	'unksource': 'දින 7ක් ඇතුළත බලපත්‍රය තොරතුරු එක් නොකළ පින්තූරය',
	'unfree': 'දින 7ක් ඇතුළත භාවිතා නොකළ ගොනුව',
	'norat': 'was a file with fair use tag but no fair use rationale for more than seven days',
	'badfairuse': 'was a file with an invalid fair use rationale and the uploader was notified more than 48 hours ago',
	'nowcommons': 'සර්වසම ගොනුව විකිපීඩියා කොමෙන්ස් තුළ පවතී.',
	'imgcopyvio': 'ව්‍යාංගාර්ථ රහිත කර්තෘ හිමිකම උල්ලංඝනය කිරීම',
	'badfiletype':'was a file that was not an image, video, nor sound, was unused, and had no foreseeable encyclopedic use',
	'nopermission':'uploader has specified a license and has named a third party as the source/copyright holder without providing evidence that this third party has in fact agreed',
	'catempty': 'අවුරුදු 4ක් තිස්සේ හිස්ව පැවති ප්‍රවර්ගය',
	'userreq': 'පරිශීලක ඉල්ලීම යටතේ පරිශීලක පිටුව මැකීම',
	'nouser': 'was a user page of a user that did not exist',
	'gallery': 'was a gallery in the user space which consisted mostly of fair use files',
	'policy': 'was an template that was a blatant misrepresentation of established policy',
	't3': 'was a template which was a duplicate of, hard-coded instance of, or an inferior alternative to a other template',
	'emptyportal': 'was an underpopulated portal'
};

twinklespeedy.callbacks = {
	sysop: {
		main: function( self ) {
			var xmlDoc = self.responseXML;
			var normal = xmlDoc.evaluate( '//normalized/n/@to', xmlDoc, null, XPathResult.STRING_TYPE, null ).stringValue;
			if( normal ) {
				wgPageName = normal;
			}
			var exists = xmlDoc.evaluate( 'boolean(//pages/page[not(@missing)])', xmlDoc, null, XPathResult.BOOLEAN_TYPE, null ).booleanValue;

			if( ! exists ) {
				self.statelem.error( "It seems that the page doesn't exists, perhaps it has already been deleted" );
				return;
			}

			if( self.params.openusertalk ) {
				// Open talk page of first contributor
				var query = {
					'action': 'query',
					'prop': 'revisions',
					'titles': wgPageName,
					'rvlimit': 1,
					'rvprop': 'user',
					'rvdir': 'newer'
				}

				var wikipedia_api = new Wikipedia.api( 'Grabbing username of initial contributor', query, twinklespeedy.callbacks.sysop.openUserTalkPage );
				wikipedia_api.params = self.params;
				wikipedia_api.post();
			}
			
			var query = { 
				'title': wgPageName, 
				'action': 'delete'
			};

			var wikipedia_wiki = new Wikipedia.wiki( 'Deleting page', query, twinklespeedy.callbacks.sysop.deletePage );
			wikipedia_wiki.params = self.params;
			wikipedia_wiki.followRedirect = false;
			wikipedia_wiki.get();

			if( 
				TwinkleConfig.deleteTalkPageOnDelete && 
				self.params.normalized != 'f8' &&
				wgNamespaceNumber % 2 == 0 && 
				wgNamespaceNumber != Namespace.USER && 
				document.getElementById( 'ca-talk' ).className != 'new' 
			) {
				var talk_page = namespaces[ wgNamespaceNumber  + 1 ] + ':' + wgTitle;
				var query = query = {
					'title': talk_page,
					'action': 'delete'
				};
				var wikipedia_wiki = new Wikipedia.wiki( 'Deleting talk page', query, twinklespeedy.callbacks.sysop.deleteTalkPage );
				wikipedia_wiki.params = self.params;
				wikipedia_wiki.followRedirect = false;
				wikipedia_wiki.get();
			}

			if( wgNamespaceNumber == 6 && self.params.normalized != 'f8' ) {
				var query = {
					'action': 'query',
					'list': 'imageusage',
					'titles': wgPageName,
					'iulimit': userIsInGroup( 'sysop' ) ? 5000 : 500 // 500 is max for normal users, 5000 for bots and sysops
				};
				var wikipedia_api = new Wikipedia.api( 'Grabbing file links', query, twinklespeedy.callbacks.sysop.unlinkImageInstancesMain );
				wikipedia_api.params = self.params;
				wikipedia_api.post();
			}
			var doOrphan = TwinkleConfig.orphanBacklinksOnSpeedyDelete;
			if( 
				doOrphan.orphan && 
				doOrphan.exclude.indexOf( self.params.normalized.toLowerCase() ) == -1 
			) {
				var query = {
					'action': 'query',
					'list': 'backlinks',
					'blfilterredir': 'nonredirects',
					'bltitle': wgPageName,
					'bllimit': userIsInGroup( 'sysop' ) ? 5000 : 500, // 500 is max for normal users, 5000 for bots and sysops
					'blnamespace': [0, 100] // Main namespace and portal namespace only, keep on talk pages.
				};
				var wikipedia_api = new Wikipedia.api( 'Grabbing backlinks', query, twinklespeedy.callbacks.sysop.unlinkBacklinksMain );
				wikipedia_api.params = self.params;
				wikipedia_api.post();
			}
			var query = {
				'action': 'query',
				'list': 'backlinks',
				'blfilterredir': 'redirects',
				'bltitle': wgPageName,
				'bllimit': userIsInGroup( 'sysop' ) ? 5000 : 500 // 500 is max for normal users, 5000 for bots and sysops
			};
			var wikipedia_api = new Wikipedia.api( 'Grabbing redirects', query, twinklespeedy.callbacks.sysop.deleteRedirectsMain );
			wikipedia_api.params = self.params;
			wikipedia_api.post();

		},
		openUserTalkPage: function( self ) {
			var xmlDoc = self.responseXML;
			var user = xmlDoc.evaluate( '//rev/@user', xmlDoc, null, XPathResult.STRING_TYPE, null ).stringValue;
			var statusIndicator = new Status('Opening user talk page edit form for user ' + user, 'opening');
			
			var query = {
				'title': 'User talk:' + user,
				'action': 'edit',
				'preview': 'yes',
				'vanarticle': wgPageName.replace(/_/g, ' ')
			};
			switch( TwinkleConfig.userTalkPageMode ) {
			case 'tab':
				window.open( mw.config.get('wgServer') + mw.config.get('wgScriptPath') + '/index.php?' + QueryString.create( query ), '_tab' );
				break;
			case 'blank':
				window.open( mw.config.get('wgServer') + mw.config.get('wgScriptPath') + '/index.php?' + QueryString.create( query ), '_blank', 'location=no,toolbar=no,status=no,directories=no,scrollbars=yes,width=1200,height=800' );
				break;
			case 'window':
				default :
				window.open( mw.config.get('wgServer') + mw.config.get('wgScriptPath') + '/index.php?' + QueryString.create( query ), 'twinklewarnwindow', 'location=no,toolbar=no,status=no,directories=no,scrollbars=yes,width=1200,height=800' );
				break;
			}
			
			statusIndicator.info( 'complete' );
		},
		unlinkBacklinksMain: function( self ) {
			var xmlDoc = self.responseXML;
			var snapshot = xmlDoc.evaluate('//backlinks/bl/@title', xmlDoc, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null );

			if( snapshot.snapshotLength == 0 ) {
				return;
			}

			var statusIndicator = new Status('Removing backlinks', '0%');

			var total = snapshot.snapshotLength * 2;

			var onsuccess = function( self ) {
				var obj = self.params.obj;
				var total = self.params.total;
				var now = parseInt( 100 * ++(self.params.current)/total ) + '%';
				obj.update( now );
				self.statelem.unlink();
				if( self.params.current >= total ) {
					obj.info( now + ' (completed)' );
					Wikipedia.removeCheckpoint();
				}
			}
			var onloaded = onsuccess;

			var onloading = function( self ) {}


			Wikipedia.addCheckpoint();
			if( snapshot.snapshotLength == 0 ) {
				statusIndicator.info( '100% (completed)' );
				Wikipedia.removeCheckpoint();
				return;
			}

			var params = clone( self.params );
			params.current = 0;
			params.total = total;
			params.obj = statusIndicator;
			params.page = wgPageName;


			for ( var i = 0; i < snapshot.snapshotLength; ++i ) {
				var title = snapshot.snapshotItem(i).value;
				var query = {
					'title': title,
					'action': 'submit'
				}
				var wikipedia_wiki = new Wikipedia.wiki( "Unlinking on " + title, query, twinklespeedy.callbacks.sysop.unlinkBacklinks );
				wikipedia_wiki.params = params;
				wikipedia_wiki.onloading = onloading;
				wikipedia_wiki.onloaded = onloaded;
				wikipedia_wiki.onsuccess = onsuccess;
				wikipedia_wiki.get();
			}
		},
		unlinkBacklinks: function( self ) {
			var form = self.responseXML.getElementById('editform');
			var text = form.wpTextbox1.value;
			var old_text = text;
			var wikiPage = new Mediawiki.Page( text );
			wikiPage.removeLink( self.params.page );

			text = wikiPage.getText();
			if( text == old_text ) {
				// Nothing to do, return
				self.onsuccess( self );
				Wikipedia.actionCompleted( self );
				return;
			}
			var postData = {
				'wpMinoredit': form.wpMinoredit.checked ? '' : undefined,
				'wpWatchthis': undefined,
				'wpStarttime': form.wpStarttime.value,
				'wpEdittime': form.wpEdittime.value,
				'wpAutoSummary': form.wpAutoSummary.value,
				'wpEditToken': form.wpEditToken.value,
				'wpSection': '',
				'wpSummary': 'Removing backlinks to ' + self.params.page + " that has been speedily deleted per ([[WP:CSD#" + self.params.normalized.toUpperCase() + "|CSD " + self.params.normalized.toUpperCase() + "]])" + "; " + TwinkleConfig.deletionSummaryAd,
				'wpTextbox1': text
			};
			self.post( postData );
		},
		deleteRedirectsMain: function( self ) {
			var xmlDoc = self.responseXML;
			var snapshot = xmlDoc.evaluate('//backlinks/bl/@title', xmlDoc, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null );

			var total = snapshot.snapshotLength * 2;

			if( snapshot.snapshotLength == 0 ) {
				return;
			}

			var statusIndicator = new Status('Deleting redirects', '0%');

			var onsuccess = function( self ) {
				var obj = self.params.obj;
				var total = self.params.total;
				var now = parseInt( 100 * ++(self.params.current)/total ) + '%';
				obj.update( now );
				self.statelem.unlink();
				if( self.params.current >= total ) {
					obj.info( now + ' (completed)' );
					Wikipedia.removeCheckpoint();
				}
			}
			var onloaded = onsuccess;

			var onloading = function( self ) {}


			Wikipedia.addCheckpoint();
			if( snapshot.snapshotLength == 0 ) {
				statusIndicator.info( '100% (completed)' );
				Wikipedia.removeCheckpoint();
				return;
			}

			var params = clone( self.params );
			params.current = 0;
			params.total = total;
			params.obj = statusIndicator;


			for ( var i = 0; i < snapshot.snapshotLength; ++i ) {
				var title = snapshot.snapshotItem(i).value;
				var query = {
					'title': title,
					'action': 'delete'
				}
				var wikipedia_wiki = new Wikipedia.wiki( "Deleting " + title, query, twinklespeedy.callbacks.sysop.deleteRedirects );
				wikipedia_wiki.params = params;
				wikipedia_wiki.onloading = onloading;
				wikipedia_wiki.onloaded = onloaded;
				wikipedia_wiki.onsuccess = onsuccess;
				wikipedia_wiki.followRedirect = false;
				wikipedia_wiki.get();
			}
		},
		deleteRedirects: function( self ) {
			var form = this.responseXML.getElementById( 'deleteconfirm' );
			if( ! form ) { // Hell, file deletion is b0rked :(
				form = this.responseXML.getElementsByTagName( 'form' )[0];
				var postData = {
					'wpDeleteReasonList': 'other',
					'wpReason': "ඉක්මන් මකාදැමීමේ උපමානය‎ [[WP:CSD#G8|CSD G8]], redirect to deleted page \"" + wgPageName + "\"." + TwinkleConfig.deletionSummaryAd,
					'wpEditToken': form.wpEditToken.value
				}
			} else {

				var postData = {
					'wpWatch': form.wpWatch.checked ? '' : undefined,
					'wpDeleteReasonList': 'other',
					'wpReason': "ඉක්මන් මකාදැමීමේ උපමානය‎ [[WP:CSD#G8|CSD G8]], redirect to deleted page \"" + wgPageName + "\"." + TwinkleConfig.deletionSummaryAd,
					'wpEditToken': form.wpEditToken.value
				}
			}
			self.post( postData );
		},
		unlinkImageInstancesMain: function( self ) {
			var xmlDoc = self.responseXML;
			var snapshot = xmlDoc.evaluate('//imageusage/iu/@title', xmlDoc, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null );

			if( snapshot.snapshotLength == 0 ) {
				return;
			}

			var statusIndicator = new Status('Unlinking file instances ', '0%');

			var total = snapshot.snapshotLength * 2;

			var onsuccess = function( self ) {
				var obj = self.params.obj;
				var total = self.params.total;
				var now = parseInt( 100 * ++(self.params.current)/total ) + '%';
				obj.update( now );
				self.statelem.unlink();
				if( self.params.current >= total ) {
					obj.info( now + ' (completed)' );
					Wikipedia.removeCheckpoint();
				}
			}
			var onloaded = onsuccess;

			var onloading = function( self ) {}


			Wikipedia.addCheckpoint();
			if( snapshot.snapshotLength == 0 ) {
					statusIndicator.info( '100% (completed)' );
					Wikipedia.removeCheckpoint();
					return;
			}

			var params = clone( self.params );
			params.current = 0;
			params.total = total;
			params.obj = statusIndicator;
			params.image = wgTitle;

			for ( var i = 0; i < snapshot.snapshotLength; ++i ) {
				var title = snapshot.snapshotItem(i).value;
				var query = {
					'title': title,
					'action': 'submit'
				}
				var wikipedia_wiki = new Wikipedia.wiki( "Unlinking on " + title, query, twinklespeedy.callbacks.sysop.unlinkImageInstances );
				wikipedia_wiki.params = params;
				wikipedia_wiki.onloading = onloading;
				wikipedia_wiki.onloaded = onloaded;
				wikipedia_wiki.onsuccess = onsuccess;
				wikipedia_wiki.get();
			}
		},
		unlinkImageInstances: function( self ) {
			var form = self.responseXML.getElementById('editform');
			var text = form.wpTextbox1.value;
			var old_text = text;
			var wikiPage = new Mediawiki.Page( text );
			wikiPage.commentOutImage( self.params.image, 'Commented out because file was deleted' );

			text = wikiPage.getText();
			if( text == old_text ) {
				// Nothing to do, return
				self.onsuccess( self );
				Wikipedia.actionCompleted( self );
				return;
			}
			var postData = {
				'wpMinoredit': form.wpMinoredit.checked ? '' : undefined,
				'wpWatchthis': undefined,
				'wpStarttime': form.wpStarttime.value,
				'wpEdittime': form.wpEdittime.value,
				'wpAutoSummary': form.wpAutoSummary.value,
				'wpEditToken': form.wpEditToken.value,
				'wpSection': '',
				'wpSummary': 'Removing instance of file ' + self.params.image + " that has been speedily deleted per ([[WP:CSD#" + self.params.normalized.toUpperCase() + "|CSD " + self.params.normalized.toUpperCase() + "]])" + "; " + TwinkleConfig.deletionSummaryAd,
				'wpTextbox1': text
			};
			self.post( postData );
		},
		deletePage: function( self ) {
			var form = this.responseXML.getElementById( 'deleteconfirm' );
			if( ! form ) { // Hell, file deletion is b0rked :(
				form = this.responseXML.getElementsByTagName( 'form' )[0];
				var postData = {
					'wpDeleteReasonList': 'other',
					'wpReason': "ඉක්මන් මකාදැමීමේ උපමානය‎ [[WP:CSD#" + self.params.normalized.toUpperCase() + "|CSD " + self.params.normalized.toUpperCase() + "]], " + self.params.reason + "." + TwinkleConfig.deletionSummaryAd,
					'wpEditToken': form.wpEditToken.value
				}
				self.post( postData );
			} else {

				var postData = {
					'wpWatch': (self.params.watch || form.wpWatch.checked) ? '' : undefined,
					'wpDeleteReasonList': 'other',
					'wpReason': "ඉක්මන් මකාදැමීමේ උපමානය‎ [[WP:CSD#" + self.params.normalized.toUpperCase() + "|CSD " + self.params.normalized.toUpperCase() + "]], " + self.params.reason + "." + TwinkleConfig.deletionSummaryAd,
					'wpEditToken': form.wpEditToken.value
				}
				self.post( postData );
			}
		},
		deleteTalkPage: function( self ) {
			form = this.responseXML.getElementById( 'deleteconfirm' );

			var postData = {
				'wpWatch': (self.params.watch || form.wpWatch.checked) ? '' : undefined,
				'wpDeleteReasonList': 'other',
				'wpReason': "ඉක්මන් මකාදැමීමේ උපමානය‎ [[WP:CSD#G8|CSD G8]], was a talk page or redirect of a deleted or nonexistent page." + TwinkleConfig.deletionSummaryAd,
				'wpEditToken': form.wpEditToken.value
			}
			self.post( postData );
		}
	},
	user: {
		main: function( self ) {
			var xmlDoc = self.responseXML;

			var exists = xmlDoc.evaluate( 'boolean(//pages/page[not(@missing)])', xmlDoc, null, XPathResult.BOOLEAN_TYPE, null ).booleanValue;

			if( ! exists ) {
				self.statelem.error( "It seems that the page doesn't exists, perhaps it has already been deleted" );
				return;
			}
			var query = { 
				'title': wgPageName, 
				'action': 'submit'
			};

			var wikipedia_wiki = new Wikipedia.wiki( 'Tagging page', query, twinklespeedy.callbacks.user.tagPage );
			wikipedia_wiki.params = self.params;
			wikipedia_wiki.followRedirect = false;
			wikipedia_wiki.get();
		},
		tagPage: function( self ) {
			form = this.responseXML.getElementById( 'editform' );

			var text = form.wpTextbox1.value;

			self.statelem.status( 'Checking for tags on the page...' );

			var tag = /(\{\{\s*(?:db|delete|db-.*?)(?:\||\s*\}\}))/.exec( text );

			if( tag ) {
				self.statelem.error( [ htmlNode( 'strong', tag[0] ) , " is already placed on the page." ] )
				return;
			}

			var xfd = /(\{\{(?:[rsaitcm]fd|md1)[^{}]*?\}\})/i.exec( text );

			if( xfd && !confirm( "The deletion related template " + xfd[0] + " is already present on the page, do you still want to apply CSD template?" ) ) {
				return;
			}
			var code;
			switch( self.params.normalized ) {
				case 'u1':
					var rationale = '';
					if (wgNamespaceNumber==3 && !(/\//.test(wgTitle)))
					{
						var rationale = prompt('Please provide a mandatory rationale to explain why this user talk page should be deleted:');
						if (rationale == null || rationale.replace(/^\s*/, "").replace(/\s*$/, "") == '')
						{
							self.statelem.error( 'Aborted by user.' );
							return;
						}
					}
					code = "\{\{db-" +  self.params.value + (rationale==''?"":"|rationale=" + rationale) + "\}\}";
					break;
				case 'f8':
					var filename = prompt( 'Please enter the name of the file on Commons:', wgPageName.replace( '_', ' ' ) );
					if (filename == null)
					{
						self.statelem.error( 'Aborted by user.' );
						return;
					}
					if( filename == '' ) {
						filename = wgPageName.replace( '_', ' ' );
					}
					var date = new Date();
					var code = "\{\{db-" + self.params.value + "|1=" + filename + "\}\}";
					break;
				case 'g6':
					var rationale = null;
					switch( self.params.value ) {
						case 'histmerge':
							var title = prompt( 'Please enter the title to merge into:' );
							if (title == null)
							{
								self.statelem.error( 'Aborted by user.' );
								return;
							}
							code = "\{\{db-" +  self.params.value + "|1=" + title + "\}\}";
							break;
						case 'move':
							var title = prompt( 'Please enter the title of the page to be moved here:' );
							if (title == null)
							{
								self.statelem.error( 'Aborted by user.' );
								return;
							}
							var reason = prompt( 'Please enter the reason for the page move:' );
							if (reason == null)
							{
								self.statelem.error( 'Aborted by user.' );
								return;
							}
							code = "\{\{db-" +  self.params.value + "|1=" + title + "|2=" + reason + "\}\}";
							break;
						case 'g6':
							rationale = prompt( 'Please provide an optional rationale (leave empty to skip):' );
							if (rationale == null)
							{
								self.statelem.error( 'Aborted by user.' );
								return;
							}
						default:
							code = "\{\{db-" +  self.params.value + ( rationale != '' ? ( '|rationale=' + rationale ) : '' ) + "\}\}";
							break;
					}
					break;
				case 'g10':
					text = ''; //blank attack pages.
					code = "\{\{db-" +  self.params.value + "|blanked=yes\}\}";
					break; 
				case 'f9':
				case 'g12':
					var url = prompt( 'Please enter the URL if available, including the "http://":' );
					if (url == null)
					{
						self.statelem.error( 'Aborted by user.' );
						return;
					}
					code = "\{\{db-" +  self.params.value + "|url=" + url + "\}\}";
					break;
				case 'a10':
					var title = prompt( 'Enter the article name that is duplicated:' );
					if (title == null)
					{
						self.statelem.error( 'Aborted by user.' );
						return;
					}
					code = "\{\{db-" +  self.params.value + "|article=" + title + "\}\}";
					self.params.key1 = "article";
					self.params.value1 = title;
					break;
				case 'f1':
					var img = prompt( 'Enter the file this is redundant to, excluding the "Image:" or "File:" prefix:' );
					if (img == null)
					{
						self.statelem.error( 'Aborted by user.' );
						return;
					}
					code = "\{\{db-" +  self.params.value + "|1=" + img + "\}\}";
					break;
				case 't3':
					var template = prompt( 'Enter the template this is redundant to, excluding the "Template:" prefix:' );
					if (template == null)
					{
						self.statelem.error( 'Aborted by user.' );
						return;
					}
					code = "\{\{db-" + self.params.value + "|\~\~\~\~\~|2=" + template + "\}\}";
					break;
				default:
					code = "\{\{db-" +  self.params.value + "\}\}";
					break;
			}

			if( TwinkleConfig.markSpeedyPagesAsPatrolled && self.params.rcid != '' ) {
				var query = {
					'title': wgPageName,
					'action': 'markpatrolled',
					'rcid': self.params.rcid
				};

				var wikipedia_wiki = new Wikipedia.wiki( 'Marking page as patrolled', query );
				wikipedia_wiki.post();
			}

			// Notification to first contributor
			var query = {
				'action': 'query',
				'prop': 'revisions',
				'titles': wgPageName,
				'rvlimit': 1,
				'rvprop': 'user',
				'rvdir': 'newer'
			}
			var callback = function( self ) {
				var xmlDoc = self.responseXML;
				var user = xmlDoc.evaluate( '//rev/@user', xmlDoc, null, XPathResult.STRING_TYPE, null ).stringValue;
				if( wgPageName != ( 'User talk:' + user ) ) {
					var query = {
						'title': 'User talk:' + user,
						'action': 'submit'
					};
					var wikipedia_wiki = new Wikipedia.wiki( 'Notifying of initial contributor (' + user + ')', query, twinklespeedy.callbacks.user.userNotification );
					wikipedia_wiki.params = self.params;
					wikipedia_wiki.get();
				} else {
					Status.info( 'Info', 'Current page is initial contributor\'s talk page, aborting notification' );
				}
			}

			if( self.params.usertalk ) {
				var wikipedia_api = new Wikipedia.api( 'Grabbing data of initial contributor', query, callback );
				wikipedia_api.params = self.params;
				wikipedia_api.post();
			}

			//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 (self.params.wgCanonicalNamespace == "Template") code = "<noinclude>" + code + "</noinclude>";

			//Remove tags that become superfluous with this action
			text = text.replace(/{\{\s*(New unreviewed article|Userspace draft)\s*(\|(?:{{[^{}]*}}|[^{}])*)?}}\s*/ig, "");

			var postData = {
				'wpMinoredit': TwinkleConfig.markSpeedyPagesAsMinor ? '' : undefined,
				'wpWatchthis': (self.params.watch || form.wpWatchthis.checked ) ? '' : undefined,
				'wpStarttime': form.wpStarttime.value,
				'wpEdittime': form.wpEdittime.value,
				'wpAutoSummary': form.wpAutoSummary.value,
				'wpEditToken': form.wpEditToken.value,
				'wpSection': '',
				'wpSummary': "Requesting speedy deletion ([[WP:CSD#" + self.params.normalized.toUpperCase() + "|CSD " + self.params.normalized.toUpperCase() + "]])." + TwinkleConfig.summaryAd,
				'wpTextbox1': code + "\n" + text
			};
			self.post( postData );
		},
		userNotification: function( self ) {
			var nowelcome = TwinkleConfig.welcomeUserOnSpeedyDeletionNotification.indexOf( self.params.normalized ) == -1;
			var form = self.responseXML.getElementById( 'editform' );
			var text = form.wpTextbox1.value;
			text += "\n\{\{subst:db-csd-notice-custom|1=" + wgPageName + "|2=" + self.params.value + (nowelcome?"|nowelcome=yes":"") +
				(typeof(self.params.key1)!=typeof(undefined)?("|key1="+self.params.key1+"|value1="+self.params.value1):"")+
				"\}\} \~\~\~\~";
			var postData = {
				'wpMinoredit': form.wpMinoredit.checked ? '' : undefined,
				'wpWatchthis': form.wpWatchthis.checked ? '' : undefined,
				'wpStarttime': form.wpStarttime.value,
				'wpEdittime': form.wpEdittime.value,
				'wpAutoSummary': form.wpAutoSummary.value,
				'wpEditToken': form.wpEditToken.value,
				'wpSection': '',
				'wpSummary': 'Notification: Speedy deletion nomination of \[\[' + wgPageName + '\]\].' + TwinkleConfig.summaryAd,
				'wpTextbox1': text
			};
			self.post( postData );
		}
	}
}

twinklespeedy.callback.evaluateSysop = function twinklespeedyCallbackEvaluateSysop(e) {

	wgPageName = wgPageName.replace( /_/g, ' ' ); // for queen/king/whatever and country!

	var tag_only = e.target.form.tag_only;
	if( tag_only && tag_only.checked ) {
		return twinklespeedy.callback.evaluateUser(e);
	}

	var value = e.target.value;
	var normalized = twinklespeedy.normalizeHash[ value ];

	var params = {
		value: value,
		normalized: normalized,
		watch: TwinkleConfig.watchSpeedyPages.indexOf( normalized ) != -1,
		reason: twinklespeedy.reasonHash[ value ],
		openusertalk: TwinkleConfig.openUserTalkPageOnSpeedyDelete.indexOf( normalized ) != -1
	};
	Status.init( e.target.form );

	var query = {
		'action': 'query',
		'titles': wgPageName
	}
	var wikipedia_api = new Wikipedia.api( 'Checking if page exists', query, twinklespeedy.callbacks.sysop.main );
	wikipedia_api.params = params;
	wikipedia_api.post();
}

twinklespeedy.callback.evaluateUser = function twinklespeedyCallbackEvaluateUser(e) {
	wgPageName = wgPageName.replace( /_/g, ' ' ); // for queen/king/whatever and country!
	var value = e.target.value;
	var normalized = twinklespeedy.normalizeHash[ value ];

	var params = {
		value: value,
		normalized: normalized,
		watch: TwinkleConfig.watchSpeedyPages.indexOf( normalized ) != -1,
		usertalk: TwinkleConfig.notifyUserOnSpeedyDeletionNomination.indexOf( normalized ) != -1 && e.target.form.notify.checked,
		rcid: QueryString.exists( 'rcid' ) ? QueryString.get( 'rcid' ) : '',
		wgCanonicalNamespace : wgCanonicalNamespace
	};

	Status.init( e.target.form );

	Wikipedia.actionCompleted.redirect = wgPageName;
	Wikipedia.actionCompleted.notice = "Tagging complete";

	var query = {
		'action': 'query',
		'titles': wgPageName
	}

	var wikipedia_api = new Wikipedia.api( 'Checking if page exists', query, twinklespeedy.callbacks.user.main );
	wikipedia_api.params = params;
	wikipedia_api.post();

}
"https://si.wikipedia.org/w/index.php?title=පරිශීලක:බිඟුවා/twinklespeedy.js&oldid=476037" වෙතින් සම්ප්‍රවේශනය කෙරිණි