Usuario:Manuelt15/twinklearv.js

De Wikipedia, la enciclopedia libre

Nota: Después de guardar, debes refrescar la caché de tu navegador para ver los cambios. Internet Explorer: mantén presionada Ctrl mientras pulsas Actualizar. Firefox: mientras presionas Mayús pulsas el botón Actualizar, (o presiona Ctrl-Shift-R). Los usuarios de Google Chrome y Safari pueden simplemente pulsar el botón Recargar. Para más detalles e instrucciones acerca de otros exploradores, véase Ayuda:Cómo limpiar la caché.

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

/**
 TwinkleConfig.summaryAd (string)
 If ad should be added or not to summary, default [[WP:TW|TW]]
 */
if( typeof( TwinkleConfig.summaryAd ) == 'undefined' ) {
	TwinkleConfig.summaryAd = " usando [[WP:TW|TW]]";
}

/**
 TwinkleConfig.markAIVReportAsMinor (boolean)
 Defines if a reports to AIV should be marked as minor, if false, default is applied as per preference.
 */
if( typeof( TwinkleConfig.markAIVReportAsMinor ) == 'undefined' ) {
	TwinkleConfig.markAIVReportAsMinor = false;
}

/**
 TwinkleConfig.markUAAReportAsMinor (boolean)
 Defines if a reports to UAA should be marked as minor, if false, default is applied as per preference.
 */
if( typeof( TwinkleConfig.markUAAReportAsMinor ) == 'undefined' ) {
	TwinkleConfig.markUAAReportAsMinor = true;
}

/**
 TwinkleConfig.markSockReportAsMinor (boolean)
 Defines if a reports to SPI should be marked as minor, if false, default is applied as per preference.
 */
if( typeof( TwinkleConfig.markSockReportAsMinor ) == 'undefined' ) {
	TwinkleConfig.markSockReportAsMinor = false;
}

function num2order( num ) {
	switch( num ) {
	case 1: return '';
	case 2: return '2nd';
	case 3: return '3rd';
	default: return num + 'th';
	}
}

function twinklearv(){
	var username;


	if ( wgNamespaceNumber == 3 || wgNamespaceNumber == 2 || ( wgNamespaceNumber == -1 && wgTitle == "Contribuciones" )){

		// If we are on the contributions page, need to parse some then
		if( wgNamespaceNumber == -1 && wgTitle == "Contribuciones" ) {
			username = decodeURIComponent(document.evaluate( 'substring-after(//div[@id="contentSub"]//a[@title="Special:Log"][last()]/@href, "user=")', document, null, XPathResult.STRING_TYPE, null).stringValue.replace( /\+/g, "%20"));
		} else {
			username = wgTitle.split( '/' )[0]; // only first part before any slashes
		}

		if( !username ) return;

		var name = isIPAddress( username ) ? 'Reportar IP' : 'Reportar';
		var title =  isIPAddress( username ) ? 'Reportar IP en VEC' : 'Reportar usuario en VEC';
		if (twinkleConfigExists)
		{
			twAddPortletLink( "javascript:twinklearv.callback(\"" + username.replace( /\"/g, "\\\"") + "\")", "VEC", "tw-arv", name, title );
		}
		else
		{
			twAddPortletLink( 'javascript:alert("Tu cuenta es muy nueva para usar Twinkle.");', 'VEC', 'tw-arv', name, title);
		}
	}
}

window.TwinkleInit = (window.TwinkleInit || []).concat( twinklearv ); //schedule initializer

twinklearv.callback = function twinklearvCallback( uid ) {
	if( uid == wgUserName ){
		alert( 'No querrás reportarte a ti mismo, ¿o sí?' );
		return;
	}

	var Window = new SimpleWindow( 600, 500 );
	Window.setTitle( "Sistema de reportes" ); //Backronym

	var form = new QuickForm( twinklearv.callback.evaluate );
	var categories = form.append( {
			type: 'select',
			name: 'category',
			label: 'Selecciona el tipo de reporte: ',
			event: twinklearv.callback.change_category
		} );
	categories.append( {
			type: 'option',
			label: 'Vandalismo',
			value: 'aiv'
		} );

	form.append( {
			type: 'field',
			label:'Work area',
			name: 'work_area'
		} );
	form.append( {
			type: 'hidden',
			name: 'uid',
			value: uid
		} );
	
	var result = form.render();
	Window.setContent( result );
	Window.display();

	// We must init the
	var evt = document.createEvent( "Event" );
	evt.initEvent( 'change', true, true );
	result.category.dispatchEvent( evt );

}

twinklearv.callback.change_category = function twinklearvCallbackChangeCategory(e) {
	var value = e.target.value;
	var root = e.target.form;
	var old_area;
	for( var i = 0; i < root.childNodes.length; ++i ) {
		var node = root.childNodes[i];
		if( 
			node instanceof Element &&
			node.getAttribute( 'name' ) == 'work_area' 
		) {
			old_area = node;
			break;
		}
	}
	var work_area = null;

	switch( value ) {
	default:
	case 'aiv':
		work_area = new QuickForm.element( { 
				type: 'field',
				label: 'Reportar a un usuario por vandalismo',
				name: 'work_area'
			} );
		work_area.append( {
				type: 'input',
				name: 'page',
				label: 'Artículo primario: ',
				tooltip: 'Déjalo en blanco si no quieres enlazar ningún artículo',
				value: QueryString.exists( 'vanarticle' ) ? QueryString.get( 'vanarticle' ) : '',
				event: function(e) {
					var value = e.target.value;
					var root = e.target.form;
					if( value == '' ) {
						root.badid.disabled = root.goodid.disabled = true;
					} else {
						root.badid.disabled = false;
						root.goodid.disabled = root.badid.value == '';
					}
				}
			} );

		work_area.append( {
				type: 'checkbox',
				name: 'arvtype',
				list: [
					{ 
						label: 'Vandalismo luego de la alerta final',
						value: 'final'
					},
					{ 
						label: 'Vandalismo justo después de que su bloqueo expiró',
						value: 'postblock'
					},
					{ 
						label: 'Cuenta creada para vandalizar',
						value: 'vandalonly',
						disabled: isIPAddress( root.uid.value )
					},
					{ 
						label: 'La cuenta es spam bot o fue corrompida',
						value: 'spambot'
					},
					{ 
						label: 'Intimidación/acoso a usuarios',
						value: 'intimidación'
					},
					{ 
						label: 'Proxy abierto confirmado',
						value: 'openproxy'
					}
				]
			} );

		work_area.append( {
				type: 'textarea',
				name: 'reason',
				label: 'Commentarios y diffs:'
			} );

		work_area.append( { type:'submit' } );
		work_area = work_area.render();
		old_area.parentNode.replaceChild( work_area, old_area );
		break;
	}
}

twinklearv.callbacks = {
	aiv: function( self ) {
		uid = self.params.uid;
		reason = self.params.reason;
		var form = self.responseXML.getElementById('editform');

		if( !form ) {
			self.statelem.error( 'no se pudo obtener el formulario de edición.' );
			return;
		}
		var text = form.wpTextbox1.value;

		var re = new RegExp( "\\{\\{\\subst:s*(?:(?:[Ii][Pp])?[Vv]ándalo|[Uu]serlinks)\\s*\\|\\s*(?:1=)?\\s*" + RegExp.escape( uid, true ) + "\\s*\\}\\}" );

		var myArr;
		if( ( myArr = re.exec( text ) ) ) {
			self.statelem.info( 'Ya hay un reporte, no añadiremos este' );
			return;
		}
		self.statelem.status( 'añadiendo nuevo reporte...' );
		var postData = {
			'wpMinoredit': ( form.wpMinoredit.checked || TwinkleConfig.markAIVReportAsMinor ) ? '' : undefined, 
			'wpWatchthis': form.wpWatchthis.checked ? '' : undefined,
			'wpStarttime': form.wpStarttime.value,
			'wpEdittime': form.wpEdittime.value,
			'wpAutoSummary': form.wpAutoSummary.value,
			'wpEditToken': form.wpEditToken.value,
			'wpSection': form.wpSection.value,
			'wpSummary': 'Reportando a [[Special:Contributions/' + uid + '|' + uid + ']].'+ TwinkleConfig.summaryAd,
			'wpTextbox1': text + '\{\{'+'subst:' + ( isIPAddress( uid ) ? 'VandalIP' : 'vandal' ) + '|' + (/\=/.test( uid ) ? '1=' : '' ) + uid + '\}\}\{\{subst:Usuario:Pericallis/vec| ' + reason + '|~~' + '~~' +  '\}\}'
		};

		self.post( postData );
	},
	username: function( self ) {
		uid = self.params.uid;
		reason = self.params.reason;
		var form = self.responseXML.getElementById('editform');

		if( !form ) {
			self.statelem.error( 'No se pudo obtener el formulario de edición.' );
			return;
		}
		var text = form.wpTextbox1.value;

		if (new RegExp( "\\{\\{\\s*user-uaa\\s*\\|\\s*(1\\s*=\\s*)?" + RegExp.escape(uid, true) + "\\s*(\\||\\})" ).test(text)) {
			self.statelem.error( 'El usuario ya está reportado en VEC.' );
			return;
		}

		self.statelem.status( 'Añadiendo nuevo reporte...' );
		var postData = {
			'wpMinoredit': ( form.wpMinoredit.checked || TwinkleConfig.markUAAReportAsMinor ) ? '' : undefined, 
			'wpWatchthis': form.wpWatchthis.checked ? '' : undefined,
			'wpStarttime': form.wpStarttime.value,
			'wpEdittime': form.wpEdittime.value,
			'wpAutoSummary': form.wpAutoSummary.value,
			'wpEditToken': form.wpEditToken.value,
			'wpSection': form.wpSection.value,
			'wpSummary': 'Reportando a [[Special:Contributions/' + uid + '|' + uid + ']].'+ TwinkleConfig.summaryAd,
			'wpTextbox1': text.replace( /-->/, "-->\n" + reason.replace( '\$', "$$$$" ) )
		};
		self.post( postData );
	},
	sock: {
		main: function( self ) { 
			var form = self.responseXML.getElementById('editform');
			var text = form.wpTextbox1.value;
			var open = false;

			if( text.match( /(^\s*$|^\s*\{\{spiarchive notice\|.+?\}\}\s*$|\{\{spiclose\|archive\}\}(?![\s\S]*?report date))/i ) ) {
				self.statelem.info( 'Open discussion not found, creating new discussion' );
			} else {
				self.statelem.info( 'Open discussion found' );
				if( !confirm( "Would you like to continue?\n(Twinkle will add your non-redundant information to the open discussion)" ) ) {
					self.statelem.info( 'Open discussion found, aborted per user request' );
					return;
				}
				open = true;
				self.statelem.info( 'Open discussion found, adding additional information' );
			}

			if( !open ) {
				var query = {
					'title': 'User talk:' + self.params.uid,
					'action': 'submit'
				};

				var wikipedia_wiki = new Wikipedia.wiki( 'Notifying suspected sockpuppeteer', query, twinklearv.callbacks.sock.notifySock );
				wikipedia_wiki.params = self.params;
				wikipedia_wiki.followRedirect = true;
				wikipedia_wiki.get();
			}

			var statusIndicator2 = new Status('Notifying suspected sockpuppets', '0%');

			var total = self.params.sockpuppets.length * 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();

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

			var socks = self.params.sockpuppets;
			for( var i = 0; i < socks.length; ++i ) {
				var query = {
					'title': 'User talk:' + socks[i],
					'action': 'submit'
				};
				var wikipedia_wiki = new Wikipedia.wiki( "Notification for " +  socks[i], query, twinklearv.callbacks.sock.notifySock );
				wikipedia_wiki.params = params2;
				wikipedia_wiki.onloaded = onloaded;
				wikipedia_wiki.onsuccess = onsuccess;
				wikipedia_wiki.followRedirect = true;
				wikipedia_wiki.get();
			}

			if( open ) {
				for( var i = self.params.sockpuppets.length - 1; i >= 0; i-- ) {
					var re = new RegExp( "\\{\\{(checkuser|checkip)\\| *(1=)?" + RegExp.escape( self.params.sockpuppets[i], true ) + " *\\}\\}(?![\\s\\S]*?\\{\\{spiclose\\|archive\\}\\})", "i" );
					if( re.exec( text ) ) {
						self.params.sockpuppets.splice( i, 1 );
						i--;
					}
				}

				if( self.params.sockpuppets.length > 0 ) {
					if( text.match( /(\s*?;[ \t]*evidence submitted by)(?![\s\S]*?\{\{spiclose\|archive\}\})/i ) ) {
						Status.info( 'Info', 'Reporting suspected sockpuppets not yet listed in open discussion' );
						text = text.replace( /(\s*?;[ \t]*evidence submitted by)(?![\s\S]*?\{\{spiclose\|archive\}\})/i,
								'\n' + self.params.sockpuppets.map( function(v) { return '* \{\{' + ( isIPAddress( v ) ? 'checkip' : 'checkuser' ) + '|1=' + v + '\}\}' } ).join( '\n' ) + '$1' );
					} else {
						Status.info( 'Error', 'Unable to find appropriate location to insert new sockpuppets');
					}
				} else {
					Status.info( 'Info', 'All suspected sockpuppets found in open discussion, skipping' );
				}

				if( !self.params.evidence.match( /^\s*$/ ) ) {
					if( text.match( /(\s*?;[ \t]*comments by accused parties)(?![\s\S]*?\{\{spiclose\|archive\}\})/i ) ) {
						Status.info( 'Info', 'Adding new evidence section to open discussion' );
						text = text.replace( /(\s*?;[ \t]*comments by accused parties)(?![\s\S]*?\{\{spiclose\|archive\}\})/i, 
								'\n\n\n;Evidence submitted by \~\~\~\n' + self.params.evidence + " \~\~\~\~$1" );
					} else if( text.match( /(\s*?;[ \t]*comments by other users)(?![\s\S]*?\{\{spiclose\|archive\}\})/i ) ) {
						Status.info( 'Info', 'Adding new evidence section to open discussion' );
						text = text.replace( /(\s*?;[ \t]*comments by other users)(?![\s\S]*?\{\{spiclose\|archive\}\})/i, 
								'\n\n\n;Evidence submitted by \~\~\~\n' + self.params.evidence + " \~\~\~\~$1" );
					} else {
						Status.info( 'Error', 'Unable to find appropriate location to insert new evidence');
					}
				} else {
					Status.info( 'Info', 'No new evidence provided, skipping' );
				}

				if( self.params.checkuser ) {
					var newSection = false;
					if( !text.match( /;[ \t]*checkuser requests(?![\s\S]*?\{\{spiclose\|archive\}\})/i ) ) {
						text = text.replace( /(\s*?;[ \t]*clerk, patrolling admin and checkuser comments)(?![\s\S]*?\{\{spiclose\|archive\}\})/i, '\n\n\n;CheckUser requests$1');
						newSection = true;
					}

					var re = new RegExp( "\\{\\{rfcu\\| *(" + self.params.checkusercode + " *\\| *No2ndletter|" + self.params.checkusercode + " *\\| *[A-F]{1}|[A-F]{1} *\\| *" + self.params.checkusercode + ") *\\| *\\w*? *\\}\\}(?![\\s\\S]*?\\{\\{spiclose\\|archive\\}\\})", "i" );
					if( !re.exec( text ) ) {
						if( text.match( /(\s*?;[ \t]*clerk, patrolling admin and checkuser comments)(?![\s\S]*?\{\{spiclose\|archive\}\})/i ) ) {
						Status.info( 'Info', 'Adding CheckUser request to open discussion' );
						text = text.replace( /(\s*?;[ \t]*clerk, patrolling admin and checkuser comments)(?![\s\S]*?\{\{spiclose\|archive\}\})/i, 
								( newSection ? '' : '\n' ) + '\n\{\{RFCU|' + self.params.checkusercode + '|No2ndletter|New\}\} &nbsp;&nbsp; <small>Requested by \~\~\~\~</small>\n$1' );
						} else {
							Status.info( 'Error', 'Unable to find appropriate location to insert new CheckUser request');
						}
					} else {
						Status.info( 'Info', 'Identical CheckUser request found in open discussion, skipping' );
					}
				}
			} else {
				text += 
					"\{\{subst:Wikipedia:Sockpuppet investigations/SPI/Blank report template header\}\}\n\n" +
					";Suspected sockpuppets\n" +
					self.params.sockpuppets.map( function(v) { return "* \{\{" + ( isIPAddress( v ) ? "checkip" : "checkuser" ) + "|1=" + v + "\}\}" } ).join( "\n" ) +
					"\n\n\n;Evidence submitted by \~\~\~\n" +
					self.params.evidence + " \~\~\~\~\n\n\n" +
					";Comments by accused parties  &nbsp;&nbsp; <small><span style=\"font-weight:normal\">\'\'See \[\[Wikipedia:Sockpuppet investigations/SPI/Guidance#Defending yourself against claims|Defending yourself against claims\]\].\'\'</span></small>\n\n\n" +
					";Comments by other users\n\n\n";
				
				if( self.params.checkuser ) {
					text += ";CheckUser requests\n" +
						"\{\{RFCU|" + self.params.checkusercode + "|No2ndletter|New\}\} &nbsp;&nbsp; <small>Requested by \~\~\~\~</small>\n\n\n";
				}
				
				text += ";Clerk, patrolling admin and checkuser comments\n\n\n" +
					"----\n";
			}

			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': form.wpSection.value,
				'wpSummary': ( open ? 'Extending' : 'Creating new' ) + ' discussion for [[Special:Contributions/' + self.params.uid + '|' + self.params.uid + ']].'+ TwinkleConfig.summaryAd,
				'wpTextbox1': text
			};
			
			var query = {
				'title': 'Wikipedia:Sockpuppet investigations',
				'action': 'submit'
			};

			var wikipedia_wiki = new Wikipedia.wiki( 'Listing discussion at Wikipedia:Sockpuppet investigations', query, twinklearv.callbacks.sock.listCase );
			wikipedia_wiki.params = self.params;
			wikipedia_wiki.followRedirect = true;
			wikipedia_wiki.get();
			
			self.post( postData );
		},
		notifySock: function( self ) {
			var form = self.responseXML.getElementById('editform');
			text = form.wpTextbox1.value;
			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': form.wpSection.value,
				'wpSummary': "Notifying about suspicion of sockpuppeteering." + TwinkleConfig.summaryAd,
				'wpTextbox1': text + "\n\{\{subst:socksuspectnotice|1=" + self.params.uid + "\}\} \~\~\~\~"
			};

			self.post( postData );
		},
		listCase: function( self ) {
			var form = self.responseXML.getElementById('editform');
			text = form.wpTextbox1.value;
			
			if( !self.params.checkuser ) {
				if( text.match( /\=\=\=[ ]*User\-reported cases[ ]*\=\=\=[\s]+/i ) ) {
					text.replace( /\=\=\=[ ]*User\-reported cases[ ]*\=\=\=[\s]+/i,
							'=== User-reported cases ===\n\{\{SPI|' + self.params.uid + '\}\}\n');
				} else {
					Status.info( 'Error', 'Unable to find appropriate location to add investigation at WP:SSP' );
					return;
				}
			} else {
				if( text.match( /\=\=\=[ ]*Awaiting Clerk approval[ ]*\=\=\=[\s]+/i ) ) {
					text.replace( /\=\=\=[ ]*Awaiting Clerk approval[ ]*\=\=\=[\s]+/i,
							'=== Awaiting Clerk approval ===\n\{\{SPI|' + self.params.uid + '\}\}\n');
				} else {
					Status.info( 'Error', 'Unable to find appropriate location to add investigation at WP:SSP' );
					return;
				}
			}
			
			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': form.wpSection.value,
				'wpSummary': "Listing [[Wikipedia:Sockpuppet investigations/" + self.params.uid + "|" + self.params.uid + "]] for investigation" + (self.params.checkuser ? " (Checkuser requested)" : "") + "." + TwinkleConfig.summaryAd,
				'wpTextbox1': text
			};

			self.post( postData );
		}
	}
}

twinklearv.callback.evaluate = function(e) {
	var form = e.target;
	var reason = "";
	if( form.reason ) {
		comment = form.reason.value;
	}
	var uid = form.uid.value;
	switch( form.category.value ) {
	default:
	case 'aiv':
		var types = form.getChecked( 'arvtype' );
		if( types.length == 0 && comment == '' ) {
			alert( 'Debes elegir un motivo' );
			return;
		}

		types = types.map( function(v) {
				switch(v) {
				case 'final':
					return 'Vandalismo luego de la alerta final';
					break;
				case 'postblock':
					return 'Vandalismo justo después de que su bloqueo expiró';
					break;
				case 'spambot':
					return 'La cuenta es spam bot o fue corrompida';
					break;
				case 'vandalonly':
					return 'Las acciones demuestran que es una cuenta creada para vandalizar';
					break;
				case 'intimidación':
					return 'Intimidación/acoso a usuarios';
					break;
				case 'openproxy':
					return 'Proxy abierto confirmado';
					break;
				}
			} ).join( ', ' );


		if( form.page.value != '' ) {
			reason += 'On [[' + form.page.value.replace( /^(Image|Category|File):/i, ':$1:' ) + ']]';

			if( form.badid.value != '' ) {
				var query = {
					'title': form.page.value,
					'diff': form.badid.value,
					'oldid': form.goodid.value
				};
				reason += ' ([' +  mw.config.get('wgServer') + mw.config.get('wgScriptPath') + '/index.php?' + QueryString.create( query ) + ' diff])';
			}
			reason += ';';
		}

		if( types ) {
			reason += " " + types;
		}
		if (comment != '' ) {
			reason += ". " + comment + '.';
		}
		Status.init( form );

		var query = {
			'title': 'Wikipedia:Vandalismo en curso',
			'action': 'submit',
			'section': 1
		};
		wikipedia_wiki = new Wikipedia.wiki( 'Procesando reporte a VEC', query, twinklearv.callbacks.aiv );
		wikipedia_wiki.params = { reason:reason, uid:uid };
		wikipedia_wiki.followRedirect = true;
		wikipedia_wiki.get();
		break;
	case 'username':
		var types = form.getChecked( 'arvtype' );
		if( types.length == 0 ) {
			alert( 'Debes especificar almenos un motivo' );
			return;
		}
		types = types.map( function( v ) { return v.toLowerCaseFirstChar(); } );

		if( types.length <= 2 ) {
			types = types.join( ' and ' );
		} else {
			types = [ types.slice( 0, -1 ).join( ', ' ), types.slice( -1 ) ].join( ' and ' );
		}
		var article = 'a';
		if( /[aeiouwyh]/.test( types[0] ) ) { // non 100% correct, but whatever inlcuding 'h' for Cockney
			article = 'an';
		}
		reason = "*\{\{user-uaa|1=" + uid + "\}\} &mdash; Violation of username policy because it's " + article + " " + types + " username; ";
		if (comment != '' ) {
			reason += "''" + comment.toUpperCaseFirstChar() + "''. ";
		}
		reason += "\~\~\~\~";
		Status.init( form );

		var query = {
			'title': 'Wikipedia:Usernames for administrator attention',
			'action': 'submit',
			'section': 1
		};

		wikipedia_wiki = new Wikipedia.wiki( 'Processing UAA request', query, twinklearv.callbacks.username );
		wikipedia_wiki.params = { reason:reason, uid:uid };
		wikipedia_wiki.followRedirect = true;
		wikipedia_wiki.get();
		break;
	case 'sock':
		var sockpuppets = form.getTexts( 'sockpuppet' );
		var evidence = form.evidence.value.rtrim();
		var checkuser = form.checkuser.checked;
		var checkusercode = form.getChecked( 'checkuser.checkusercode' );
		Status.init( form );

		var query = {
			'title': 'Wikipedia:Sockpuppet investigations/' +  uid,
			'action': 'submit'
		};

		var wikipedia_wiki = new Wikipedia.wiki( 'Retrieving discussion page', query, twinklearv.callbacks.sock.main );
		wikipedia_wiki.params = { uid:uid, sockpuppets:sockpuppets, evidence:evidence, checkuser:checkuser, checkusercode:checkusercode?checkusercode[0]:null };
		wikipedia_wiki.followRedirect = true;
		wikipedia_wiki.get();
	}
}