User:Ucucha/autofc.js: Difference between revisions

Content deleted Content added
change
m Fix erroneous replacement
 
(3 intermediate revisions by 2 users not shown)
Line 39:
 
function autofc() {
if( mw.config.get('wgNamespaceNumber') < 0 || mw.config.get('wgCurRevisionId') == false ) {
return;
}
Line 68:
type: 'option',
label: 'FAC',
selected: mw.config.get('wgNamespaceNumber') == Namespace.MAIN,
value: 'fac'
} );
Line 80:
type: 'option',
label: 'FPC',
selected: mw.config.get('wgNamespaceNumber') == Namespace.IMAGE,
value: 'fpc'
} );
Line 92:
type: 'option',
label: 'FPOC',
selected: mw.config.get('wgNamespaceNumber') == Namespace.PORTAL ,
value: 'fpoc'
} );*/
Line 234:
 
// First, simple test, is there an instance with this exact name?
if( title == 'WP:Featured article candidates/' + mw.config.get('wgPageName') + '/archive1') {
number = Math.max( number, 1 );
continue;
Line 240:
 
var order_re = new RegExp( '^' +
RegExp.escape( 'WP:Featured article candidates/' + mw.config.get('wgPageName'), true ) +
'/archive?'
);
Line 257:
}
 
Status.info( 'Next discussion page","[[WP:Featured article candidates/' + mw.config.get('wgPageName') + self.params.numbering + ']]' );
 
// Discussion page
var query = {
'title': 'WP:Featured article candidates/' + mw.config.get('wgPageName') + self.params.numbering,
'action': 'submit'
};
Line 275:
// Tagging article
var query = {
'title': 'Talk:' + mw.config.get('wgPageName'),
'action': 'submit'
};
Line 303:
'wpEditToken': form.wpEditToken.value,
'wpSection': form.wpSection.value,
'wpSummary': "Nominated as a featured article candidate; see [[WP:Featured article candidates/" + mw.config.get('wgPageName') + self.params.numbering + ']].'+ summaryAdd,
'wpTextbox1': "\{\{featured article candidates|" + mw.config.get('wgPageName') + self.params.numbering + " \}\}\n" + form.wpTextbox1.value
};
self.post( postData );
Line 310:
discussionPage: function( self ) {
var form = self.responseXML.getElementById('editform');
var nomtext = "===\[\[" + mw.config.get('wgPageName') + "\]\]===\n" +
"\n" +
"<noinclude>\{\{la|" + mw.config.get('wgPageName') + "\}\}\n" +
"\{\{Wikipedia:Featured article tools|1=" + mw.config.get('wgPageName') + "\}\}</noinclude>\n" +
"\n" +
"<!-- Please don't edit anything above here. Be sure to include your reasons for nominating below. -->\n" +
Line 325:
'wpEditToken': form.wpEditToken.value,
'wpSection': form.wpSection.value,
'wpSummary': "Creating FAC nomination page for \[\[" + mw.config.get('wgPageName') + '\]\].' + summaryAdd,
'wpTextbox1': nomtext + self.params.reason + " \~\~\~\~"
};
Line 334:
var old_text = form.wpTextbox1.value;
 
var text = old_text.replace( /(<\!-- Add new nominations at the top of the list below this comment. Before nominating, please make sure the article meets the FA criteria. -->\n+)/, "$1\{\{Wikipedia:Featured article candidates/" + mw.config.get('wgPageName') + self.params.numbering + "\}\}\n");
if( text == old_text ) {
self.statelem.error( 'failed to find target spot for the discussion' );
Line 347:
'wpEditToken': form.wpEditToken.value,
'wpSection': form.wpSection.value,
'wpSummary': "Adding \[\[WP:Featured article candidates/" + mw.config.get('wgPageName') + self.params.numbering + '\|FAC\]\] for \[\[' + mw.config.get('wgPageName') + '\]\].' + summaryAdd,
'wpTextbox1': text
};
Line 357:
autofc.callback.evaluate = function(e) {
 
wgPageName = mw.config.get('wgPageName').replace( /_/g, ' ' ); // for queen/king/whatever and country!
 
var type = e.target.category.value;