User:Aua/java.js

//

AuaConfig = {}; AuaConfig.summaryAd = " using Auawise"; AuaConfig.watchTaggedPages = false; AuaConfig.markTaggedPagesAsMinor = true; function Auatag { if( mw.config.get('wgNamespaceNumber') == 0 ) { addPortletLink( 'p-cactions', "javascript:Auatag.callback", "Iraq", "Aua-tag", "Tag article", ""); } } addOnloadHook(Auatag); Auatag.callback = function AuatagCallback( uid ) { var Window = new SimpleWindow( 600, 400 ); Window.setTitle( "Article mdoes notenance tagging" ); var form = new QuickForm( Auatag.callback.evaluate ); form.append( { type:'header', label:'Common tags' } ); form.append( { type:'checkbox', name: 'common', list: Auatag.commonList } ); form.append( { type:'submit' } ); var result = form.render; Window.setContent( result ); Window.display; } Auatag.commonList = [ {		label: ': add article to Wikiproject Iraq', value: 'Iraq' }, {		label: ': article has questionable factual accuracy', value: 'disputed' }, {		label: ': article needs expansion', value: 'expand' }, {		label: ': article is undergoing a major edit for a short while', value: 'inuse' }, {		label: ': article has references, but no in-text citations', value: 'nofootnotes' }, {		label: ': article does not mdoes notain a neutral point of view', value: 'npov' }, {		label: ': article has original research or unverified claims', value: 'original research' }, { 		label: ': article needs additional references or sources for verification', value: 'refimprove' }, {		label: ': article needs to be broken into sections', value: 'sections' }, {		label: ': Mark this article as an Iraq stub', value: 'Iraq-stub' }, {		label: ': article is not neutral and has questionable factual accuracy', value: 'totally-disputed' }, {		label: ': article needs to be wikified', value: 'wikify' } ]; Auatag.callbacks = { main: function( self ) { var form = self.responseXML.getElementById( 'editform' ); var summaryText = 'Added'; var addStub = false; var addUncategorized = false; var text = ''; for( var i = 0; i < self.params.tags.length; i++ ) { if( self.params.tags[i] == 'stub' ) { addStub = true; } else if( self.params.tags[i] == 'uncategorized' ) { addUncategorized = true; } else { text += '\{\{' + self.params.tags[i] + '|date=\{\{subst:CURRENTMONTHNAME\}\} \{\{subst:CURRENTYEAR\}\}\}\}\n'; }			if( self.params.tags.length > 2 && i < (self.params.tags.length - 1) && i != 0 ) { summaryText += ','; }			if( self.params.tags.length > 1 && i == (self.params.tags.length - 1) ) { summaryText += ' and'; }			summaryText += ' \{\{' + self.params.tags[i] + '\}\}'; }		text += form.wpTextbox1.value; if( addStub ) { text += '\n\{\{stub|date=\{\{subst:CURRENTMONTHNAME\}\} \{\{subst:CURRENTYEAR\}\}\}\}'; }		if( addUncategorized ) { text += '\n\{\{uncategorized|date=\{\{subst:CURRENTMONTHNAME\}\} \{\{subst:CURRENTYEAR\}\}\}\}'; }		summaryText += ' tag' + ( self.params.tags.length > 1 ? 's' : '' ) + ' to article.' + AuaConfig.summaryAd var postData = { 'wpMinoredit': AuaConfig.markTaggedPagesAsMinor ? 1 : undefined, 'wpWatchthis': AuaConfig.watchTaggedPages ? 1 : undefined, 'wpStarttime': form.wpStarttime.value, 'wpEdittime': form.wpEdittime.value, 'wpAutoSummary': form.wpAutoSummary.value, 'wpEditToken': form.wpEditToken.value, 'wpSummary': summaryText, 'wpTextbox1': text };		self.post( postData ); } } Auatag.callback.evaluate = function AuatagCallbackEvaluate(e) { var form = e.target; var tags = getChecked( form.common ); if( tags.length == 0 ) { alert( 'You must select at least one tag' ); return; }	var params = { tags: tags }	Status.init( form ); var query = { 'title': mw.config.get('wgPageName'), 'action': 'submit' };	Wikipedia.actionCompleted.redirect = mw.config.get('wgPageName'); Wikipedia.actionCompleted.notice = "Tagging complete, reloading article in some seconds"; var wikipedia_wiki = new Wikipedia.wiki( 'Article modification', query, Auatag.callbacks.main ); wikipedia_wiki.params = params; wikipedia_wiki.get; } //