User:MadeYourReadThis/mytwinkleext.js

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

/** TwinkleConfig.summaryAd (string) If ad should be added or not to summary, default TWINKLE */ if( typeof( TwinkleConfig.summaryAd ) == 'undefined' ) { TwinkleConfig.summaryAd = " using TW"; }

/** TwinkleConfig.watchProd2Pages (boolean) If, when applying prod template to page, watch it, default true */ if( typeof( TwinkleConfig.watchProd2Pages ) == 'undefined' ) { TwinkleConfig.watchProd2Pages = true; }

function twinkleprod2 { if( wgNamespaceNumber != 0 || wgCurRevisionId == false ) { return; }	if (twinkleConfigExists) {		mw.util.addPortletLink( 'p-cactions', "javascript:twinkleprod2.callback", "radioprod", "tw-radioprod", "Propose deletion of radio personality via WP:PROD", ""); }	else {		mw.util.addPortletLink('p-cactions', 'javascript:alert("Your account is too new to use Twinkle.");', 'prod2', 'tw-prod2', 'Propose deletion via WP:PROD', ''); } } $(twinkleprod2);

twinkleprod2.callback = function twinkleprod2Callback { var Window = new SimpleWindow( 800, 400 ); Window.setTitle( "WP:PROD" ); var form = new QuickForm( twinkleprod2.callback.evaluate ); var field = form.append( {			type: 'field',			label: 'Reason for proposed deletion'		} ); field.append( {			type: 'textarea',			name: 'reason',			label: 'iReason:',			value: 'article fails to assert why this radio personality is notable. Lacks 3rd party verifiable references.'		} ); field.append( { type:'submit' } );

var result = form.render; Window.setContent( result ); Window.display; }

twinkleprod2.callbacks = { main: function( self ) { var form = self.responseXML.getElementById('editform'); var text = form.wpTextbox1.value;

var tag_re = /(\{\{(?:db-?|delete|[aitcmrs]fd|md1)[^{}]*?\|?[^{}]*?\}\})/;

if( tag_re.test( text ) ) { self.statelem.warn( 'Page already tagged with a deletion template, aborting procedure' ); return; }		// Notification to first contributor var query = { 'action': 'query', 'prop': 'revisions', 'titles': wgPageName, 'rvlimit': 1, 'rvprop': 'user', 'rvdir': 'newer' }

var postData = { 'wpMinoredit': undefined, // Per memo 'wpWatchthis': TwinkleConfig.watchProd2Pages ? '' : form.wpWatchthis.checked ? '' : undefined, 'wpStarttime': form.wpStarttime.value, 'wpEdittime': form.wpEdittime.value, 'wpAutoSummary': form.wpAutoSummary.value, 'wpEditToken': form.wpEditToken.value, 'wpSummary': "Proposing article for deletion per WP:PROD." + TwinkleConfig.summaryAd, 'wpTextbox1': "\{\{subst:prod|1=" + self.params.reason + "}}\n" + text };

self.post( postData ); } }

twinkleprod2.callback.evaluate = function twinkleprod2CallbackEvaluate(e) { var form = e.target; var reason = form.reason.value;

wgPageName = wgPageName.replace(/_/g, ' ');

Status.init( form ); var query = { 'title': wgPageName, 'action': 'submit' };

var wikipedia_wiki = new Wikipedia.wiki( 'Tagging page', query, twinkleprod2.callbacks.main ); wikipedia_wiki.params = { reason: reason }; wikipedia_wiki.followRedirect = false; wikipedia_wiki.get; }