// <nowiki>
AuaConfig = {};
AuaConfig.summaryAd = " using [[User:Auawise|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: '{{Iraq}}: add article to Wikiproject Iraq',
value: 'Iraq' },
{
label: '{{disputed}}: article has questionable factual accuracy',
value: 'disputed' },
{
label: '{{expand}}: article needs expansion',
value: 'expand' },
{
label: '{{inuse}}: article is undergoing a major edit for a short while',
value: 'inuse' },
{
label: '{{nofootnotes}}: article has references, but no in-text citations',
value: 'nofootnotes' },
{
label: '{{npov}}: article does not mdoes notain a neutral point of view',
value: 'npov' },
{
label: '{{original research}}: article has original research or unverified claims',
value: 'original research' },
{
label: '{{refimprove}}: article needs additional references or sources for verification',
value: 'refimprove' },
{
label: '{{sections}}: article needs to be broken into sections',
value: 'sections' },
{
label: '{{Iraq-stub}}: Mark this article as an Iraq stub',
value: 'Iraq-stub' },
{
label: '{{totally-disputed}}: article is not neutral and has questionable factual accuracy',
value: 'totally-disputed' },
{
label: '{{wikify}}: 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();
}
// </nowiki>