Menú alternativo
Menú alternativo personal
No has accedido
Tu dirección IP será visible si haces alguna edición

Diferencia entre revisiones de «MediaWiki:Common.js»

Página de la interfaz de MediaWiki
Sin resumen de edición
Etiqueta: Revertido
Sin resumen de edición
 
(No se muestran 16 ediciones intermedias de 3 usuarios)
Línea 1: Línea 1:
/* Add membership payment buttons */
// ocultar mw-pt-translate-header para los anónimos


var monthlyId = 'monthlyform';
mw.loader.using( [ 'mediawiki.user' ], function () {
var annuallyId = 'annuallyform';
if ( mw.user.isAnon() === 1 ) {
mw.util.addCSS( '.mw-pt-translate-header { display: none; }' );
}
} );


$('#memberbutton-monthly').html('<div class="plainlinks"><form id="monthlyform5" style="display:inline;" action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top"><input type="hidden" name="cmd" value="_s-xclick"><input type="hidden" name="hosted_button_id" value="9MHQE5FETJYFW"><a href="#" onclick="document.getElementById(monthlyId + 5).submit()"><div class="arrowbutton-green roundbutton-large" style="font-size:38px; line-height:1.75em;">$5</div></a></form><form id="monthlyform10" style="display:inline;" action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top"><input type="hidden" name="cmd" value="_s-xclick"><input type="hidden" name="hosted_button_id" value="ZJQJ5SPKDFQTY"><a href="#" onclick="document.getElementById(monthlyId + 10).submit()"><div class="arrowbutton-green roundbutton-large" style="font-size:38px; line-height:1.75em;">$10</div></a></form><form id="monthlyform25" style="display:inline;" action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top"><input type="hidden" name="cmd" value="_s-xclick"><input type="hidden" name="hosted_button_id" value="5XSU2JHD29WA6"><a href="#" onclick="document.getElementById(monthlyId + 25).submit()"><div class="arrowbutton-green roundbutton-large" style="font-size:38px; line-height:1.75em;">$25</div></a></form><form id="monthlyform50" style="display:inline;" action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top"><input type="hidden" name="cmd" value="_s-xclick"><input type="hidden" name="hosted_button_id" value="B7ETK3LZRACLQ"><a href="#" onclick="document.getElementById(monthlyId + 50).submit()"><div class="arrowbutton-green roundbutton-large" style="font-size:38px; line-height:1.75em;">$50</div></a></form><form id="monthlyform100" style="display:inline;" action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top"><input type="hidden" name="cmd" value="_s-xclick"><input type="hidden" name="hosted_button_id" value="B9F73YWFQBYXA"><a href="#" onclick="document.getElementById(monthlyId + 100).submit()"><div class="arrowbutton-gold roundbutton-large" style="font-size:31px; line-height:2.3em;">$100</div></a></form><form id="monthlyform200" style="display:inline;" action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top"><input type="hidden" name="cmd" value="_s-xclick"><input type="hidden" name="hosted_button_id" value="4E42KFD7MCNJ4"><a href="#" onclick="document.getElementById(monthlyId + 200).submit()"><div class="arrowbutton-gold roundbutton-large" style="font-size:31px; line-height:2.3em;">$200</div></a></form></div>');
const ELECTION_2024_PAGE_ID = 1792;
const ELECTION_2024_STATEMENTS_PAGE_ID = 1794;
const ELECTION_2024_RESULTS_PAGE_ID = 1794;


$('#memberbutton-annually').html('<div class="plainlinks"><form id="annuallyform5" style="display:inline;" action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top"><input type="hidden" name="cmd" value="_s-xclick"><input type="hidden" name="hosted_button_id" value="ZAKPCZYTXDRYN"><a href="#" onclick="document.getElementById(annuallyId + 5).submit()"><div class="arrowbutton-blue roundbutton" style="font-size:30px; line-height:1.75em;">$5</div></a></form><form id="annuallyform10" style="display:inline;" action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top"><input type="hidden" name="cmd" value="_s-xclick"><input type="hidden" name="hosted_button_id" value="8T8NESE2DWVX6"><a href="#" onclick="document.getElementById(annuallyId + 10).submit()"><div class="arrowbutton-blue roundbutton" style="font-size:30px; line-height:1.75em;">$10</div></a></form><form id="annuallyform25" style="display:inline;" action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top"><input type="hidden" name="cmd" value="_s-xclick"><input type="hidden" name="hosted_button_id" value="GSH4BLP9UTP6Q"><a href="#" onclick="document.getElementById(annuallyId + 25).submit()"><div class="arrowbutton-blue roundbutton" style="font-size:30px; line-height:1.75em;">$25</div></a></form><form id="annuallyform50" style="display:inline;" action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top"><input type="hidden" name="cmd" value="_s-xclick"><input type="hidden" name="hosted_button_id" value="BUJSW3H45AJY8"><a href="#" onclick="document.getElementById(annuallyId + 50).submit()"><div class="arrowbutton-blue roundbutton" style="font-size:30px; line-height:1.75em;">$50</div></a></form><form id="annuallyform100" style="display:inline;" action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top"><input type="hidden" name="cmd" value="_s-xclick"><input type="hidden" name="hosted_button_id" value="DWBBFHL3JKGPC"><a href="#" onclick="document.getElementById(annuallyId + 100).submit()"><div class="arrowbutton-blue roundbutton" style="font-size:25px; line-height:2.1em;">$100</div></a></form><form id="annuallyform200" style="display:inline;" action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top"><input type="hidden" name="cmd" value="_s-xclick"><input type="hidden" name="hosted_button_id" value="CPVX2SG6GSXNL"><a href="#" onclick="document.getElementById(annuallyId + 200).submit()"><div class="arrowbutton-blue roundbutton" style="font-size:25px; line-height:2.1em;">$200</div></a></form></div>');
const ELECTION_2024_PAGE_IDS = [
ELECTION_2024_PAGE_ID,
ELECTION_2024_STATEMENTS_PAGE_ID,
ELECTION_2024_RESULTS_PAGE_ID
];


/* Add donation buttons */
if ( ELECTION_2024_PAGE_IDS.includes( mw.config.get( 'wgArticleId' ) ) ) {
var dwYesMember = 'member';
$( '.navbar li:has(a.selflink)' )
var dwNoMember = 'donation';
.css( {
  'border-radius': '5px 5px 0 0',
'border-bottom-left-radius': '0px',
'border-bottom': '3px solid #833ab4'
} );
}


var dwPartOne = '<div class="plainlinks"><form id="member" action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top"><input type="hidden" name="cmd" value="_s-xclick"><input type="hidden" name="hosted_button_id" value="';
mw.loader.using( [
'oojs-ui',
'mediawiki.api',
'mediawiki.widgets.DateInputWidget'
] ).then( () => {
if (
mw.config.get( 'wgArticleId' ) !== ELECTION_2024_STATEMENTS_PAGE_ID ||
!mw.config.get( 'wgUserName' )
) {
return;
}
const FALLBACK_LANGUAGE_CODE = 'es';


var dwPartTwo = '"><a href="#" onclick="document.getElementById(dwYesMember).submit()"><div class="arrowbutton arrowbutton-green" style="font-size:115%; width:300px; margin-bottom:0.5em;"><span style="font-weight:bold;">Yes</span>, sign me up as a member!</div></a></form><form id="donation" action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top"><input type="hidden" name="cmd" value="_s-xclick"><input type="hidden" name="hosted_button_id" value="';
const userLanguage = mw.user.options.get( 'language' );
const messages = {
realNameInputPlaceholder: {
en: 'Your real name (optional)',
es: 'Tu nombre real (opcional)'
},
realNameInputLabel: {
en: 'Real name',
es: 'Nombre real'
},
statementInputPlaceholder: {
en: 'Why do you want to join the Administrative Council?',
es: 'Por qué quieres ser miembro del Consejo de Administración...'
},
statementInputLabel: {
en: 'Statement',
es: 'Presentacion'
},
submitButtonLabel: {
en: 'Submit',
es: 'Publicar'
},
spokenLanguagesInputLabel: {
en: 'Spoken languages',
es: 'Idiomas hablados'
},
signupDateInputLabel: {
en: 'Sign-up date',
es: 'Fecha de ingreso'
},
projectsInputLabel: {
en: 'Projects',
es: 'Proyectos'
},
agreesWithPoliciesCheckboxLabel: {
en: 'I confirm I have read and understood <a href="$1">this group\'s policies</a>, ' +
'which I am committed to abide with, if elected.',
es: 'He leído <a href="$1">las políticas del grupo</a> ' +
'y tengo el compromiso suficiente en caso de ser electo.'
},
legalAgeCheckboxLabel: {
en: 'I am of legal age in my country of residence.',
es: 'Soy mayor de edad en mi país de residencia.'
},
fieldsetLabel: {
en: 'Insert your data',
es: 'Ingresa los datos de tu candidatura'
},
formSubmitted: {
en: 'Statement added successfully. Reloading...',
es: 'Candidatura agregada con éxito. Recargando...'
}
};
function getMessage( key, language, ...parameters ) {
const parsedParameters = parseParameters( parameters );
const message = findMessage( key, language );
const parsedMessage = parseMessage( message, parsedParameters );
return parsedMessage;
}
function parseParameters( ...parameters ) {
const parsedParameters = {};
for ( const [ index, value ] of parameters.entries() ) {
parsedParameters[ `$${index + 1}` ] = value;
}
return parsedParameters;
}
function findMessage( key, language ) {
return (
messages[ key ][ language ] ||
messages[ key ][ FALLBACK_LANGUAGE_CODE ]
);
}
function parseMessage( message, parameters ) {
let parsedMessage = message;
for ( const [ key, value ] of Object.entries( parameters ) ) {
parsedMessage = parsedMessage.replaceAll( key, value );
}
return parsedMessage;
}
const realNameInput = new OO.ui.TextInputWidget( {
placeholder: getMessage( 'realNameInputPlaceholder', userLanguage )
} );
const spokenLanguagesInput = new OO.ui.TextInputWidget( {
placeholder: 'es-n, en-2, ...',
required: true,
indicator: 'required'
} );
const signupDateInput = new mw.widgets.DateInputWidget( {
required: true,
indicator: 'required'
} );
const projectsInput = new OO.ui.TextInputWidget( {
placeholder: 'eswiki, eswikivoyage, ...',
required: true,
indicator: 'required'
} );
const statementInput = new OO.ui.MultilineTextInputWidget( {
placeholder: getMessage( 'statementInputPlaceholder', userLanguage ),
required: true,
indicator: 'required',
rows: 5
} );
const agreesWithPoliciesCheckbox = new OO.ui.CheckboxInputWidget( {
required: true
} );
const legalAgeCheckbox = new OO.ui.CheckboxInputWidget( {
required: true
} );


var dwPartThree = '"><a href="#" onclick="document.getElementById(dwNoMember).submit()"><div class="arrowbutton arrowbutton-blue" style="font-size:115%; width:190px; margin-bottom:0.5em;"><span style="font-weight:bold;"></span>Just the donation</div></a></form></div>';
const submitButton = new OO.ui.ButtonInputWidget( {
label: getMessage( 'submitButtonLabel', userLanguage ),
type: 'submit',
flags: [
'primary',
'progressive'
]
} );
const fieldset = new OO.ui.FieldsetLayout( {
label: getMessage( 'fieldsetLabel', userLanguage ),
classes: [ 'container' ]
} );
fieldset.addItems( [
new OO.ui.FieldLayout( realNameInput, {
label: getMessage( 'realNameInputLabel', userLanguage )
} ),
new OO.ui.FieldLayout( spokenLanguagesInput, {
label: getMessage( 'spokenLanguagesInputLabel', userLanguage )
} ),
new OO.ui.FieldLayout( signupDateInput, {
label: getMessage( 'signupDateInputLabel', userLanguage )
} ),
new OO.ui.FieldLayout( projectsInput, {
label: getMessage( 'projectsInputLabel', userLanguage )
} ),
new OO.ui.FieldLayout( statementInput, {
label: getMessage( 'statementInputLabel', userLanguage )
} ),
new OO.ui.FieldLayout( agreesWithPoliciesCheckbox, {
label: $(
`<span>${getMessage(
'agreesWithPoliciesCheckboxLabel',
userLanguage,
'https://wikisp.org/wiki/Pol%C3%ADtica_electoral'
)}</span>`
),
align: 'inline'
} ),
new OO.ui.FieldLayout( legalAgeCheckbox, {
label: getMessage( 'legalAgeCheckboxLabel', userLanguage ),
align: 'inline'
} ),
new OO.ui.FieldLayout( submitButton )
] );
const form = new OO.ui.FormLayout( {
items: [ fieldset ],
id: 'create-new-statement'
} );


var dwPartOneCir = '<div class="plainlinks"><form id="donation" action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top"><input type="hidden" name="cmd" value="_s-xclick"><input type="hidden" name="hosted_button_id" value="';
form.on( 'submit', ( event ) => {
const username = mw.config.get( 'wgUserName' );
const realName = realNameInput.getValue();
const spokenLanguages = spokenLanguagesInput.getValue();
const signupDate = signupDateInput.getValue();
const projects = projectsInput.getValue();
const statement = statementInput.getValue();


var dwPartTwoCir = '"><a href="#" onclick="document.getElementById(dwNoMember).submit()"><span class="roundbutton arrowbutton-blue" style="line-height:1.75em; font-size:30px;">';
const template = `
{{election/statement
|username = ${username}
|real-name = ${realName}
|languages = ${spokenLanguages}
|signup-date = ${signupDate}
|projects = ${projects}
|statement = ${statement}
}}`.replace( /\s{2,}/g, '\n');


var dwPartThreeCir = '</span></a></form></div>';
const parameters = {
action: 'edit',
title: 'Internal:Elecciones/CA/2024/Candidaturas/lista',
appendtext: template,
format: 'json'
};
const api = new mw.Api();


$('#dw-5m').html(dwPartOne + '9MHQE5FETJYFW' + dwPartTwo + 'VHB9L9U8THY9A' + dwPartThree);
api.postWithToken( 'csrf', parameters ).done( () => {
$('#dw-10m').html(dwPartOne + 'ZJQJ5SPKDFQTY' + dwPartTwo + 'ELPHVEA56BGBA' + dwPartThree);
mw.notify( getMessage( 'formSubmitted', userLanguage ) );
$('#dw-25m').html(dwPartOne + '5XSU2JHD29WA6' + dwPartTwo + 'Y9PGPAGD2EMP8' + dwPartThree);
$('#dw-50m').html(dwPartOne + 'B7ETK3LZRACLQ' + dwPartTwo + 'PR7VLZVEEX8CA' + dwPartThree);
$('#dw-100m').html(dwPartOne + 'B9F73YWFQBYXA' + dwPartTwo + 'WDJKYZF7XPRUL' + dwPartThree);
$('#dw-200m').html(dwPartOne + '4E42KFD7MCNJ4' + dwPartTwo + '4KL7SURFTFHA4' + dwPartThree);
$('#dw-5a').html(dwPartOne + 'ZAKPCZYTXDRYN' + dwPartTwo + 'FUHX7TBVKE2BG' + dwPartThree);
$('#dw-10a').html(dwPartOne + '8T8NESE2DWVX6' + dwPartTwo + 'UEBVSV6KF9SSE' + dwPartThree);
$('#dw-25a').html(dwPartOne + 'GSH4BLP9UTP6Q' + dwPartTwo + 'A922FAUXLDQSN' + dwPartThree);
$('#dw-50a').html(dwPartOne + 'BUJSW3H45AJY8' + dwPartTwo + 'MPXGN9SKV7HVY' + dwPartThree);
$('#dw-100a').html(dwPartOne + 'DWBBFHL3JKGPC' + dwPartTwo + 'SLSKUBGGA63C8' + dwPartThree);
$('#dw-200a').html(dwPartOne + 'CPVX2SG6GSXNL' + dwPartTwo + 'X4HUYHNVHN8M2' + dwPartThree);
$('#dw-5x').html(dwPartOne + 'QLWRD4W5AEYK4' + dwPartTwo + 'FG88LU479HZ7J' + dwPartThree);
$('#dw-10x').html(dwPartOne + '8Z4XGBQYJFP2L' + dwPartTwo + 'S7YX2BAZDVSAE' + dwPartThree);
$('#dw-25x').html(dwPartOne + '8SDTJWLUAE3TW' + dwPartTwo + 'J3RV9PVMSRH8Y' + dwPartThree);
$('#dw-50x').html(dwPartOne + '9C2JUGA7CWZWJ' + dwPartTwo + '3E66M99JDV836' + dwPartThree);
$('#dw-100x').html(dwPartOne + '4736NTBYA9SGN' + dwPartTwo + 'GNEQ7GUKNF9BS' + dwPartThree);
$('#dw-200x').html(dwPartOne + 'ZUK7NJQSFMBX4' + dwPartTwo + 'BU3YMWQSVJ9HW' + dwPartThree);


$('#dw-25c').html(dwPartOne + '6AJJ62C5FUTTA' + dwPartTwo + 'HLF8JWCU25KTW' + dwPartThree);
setTimeout( () => {
$('#dw-30c').html(dwPartOne + 'K8SUU6YWXTZGE' + dwPartTwo + 'WLLLRUEEDYKMY' + dwPartThree);
window.location.reload();
$('#dw-35c').html(dwPartOne + 'DQMBQLH46RT6E' + dwPartTwo + 'C69MHKJU4DUQC' + dwPartThree);
}, 3000 );
$('#dw-50c').html(dwPartOne + 'PKJNESR6LNRPU' + dwPartTwo + 'LJE5WTYQZZK5W' + dwPartThree);
} );
$('#dw-75c').html(dwPartOne + 'VYQLHU33XSKKL' + dwPartTwo + 'WJG7S47XVZGGN' + dwPartThree);
} );
$('#dw-100c').html(dwPartOne + 'MBPUCFKJ3DVTL' + dwPartTwo + '2M4WLALKET9RL' + dwPartThree);
 
$( '#form-anchor' ).append( form.$element );
} );

Revisión actual - 17:40 28 oct 2024

// ocultar mw-pt-translate-header para los anónimos

mw.loader.using( [ 'mediawiki.user' ], function () {
	if ( mw.user.isAnon() === 1 ) {
		mw.util.addCSS( '.mw-pt-translate-header { display: none; }' );
	}
} );

const ELECTION_2024_PAGE_ID = 1792;
const ELECTION_2024_STATEMENTS_PAGE_ID = 1794;
const ELECTION_2024_RESULTS_PAGE_ID = 1794;

const ELECTION_2024_PAGE_IDS = [
	ELECTION_2024_PAGE_ID,
	ELECTION_2024_STATEMENTS_PAGE_ID,
	ELECTION_2024_RESULTS_PAGE_ID
];

if ( ELECTION_2024_PAGE_IDS.includes( mw.config.get( 'wgArticleId' ) ) ) {
	$( '.navbar li:has(a.selflink)' )
		.css( {
	  		'border-radius': '5px 5px 0 0',
			'border-bottom-left-radius': '0px',
			'border-bottom': '3px solid #833ab4'
		} );
}

mw.loader.using( [
	'oojs-ui',
	'mediawiki.api',
	'mediawiki.widgets.DateInputWidget'
] ).then( () => {
	if (
		mw.config.get( 'wgArticleId' ) !== ELECTION_2024_STATEMENTS_PAGE_ID ||
		!mw.config.get( 'wgUserName' )
	) {
		return;
	}
	
	const FALLBACK_LANGUAGE_CODE = 'es';

	const userLanguage = mw.user.options.get( 'language' );
	const messages = {
		realNameInputPlaceholder: {
			en: 'Your real name (optional)',
			es: 'Tu nombre real (opcional)'
		},
		realNameInputLabel: {
			en: 'Real name',
			es: 'Nombre real'
		},
		statementInputPlaceholder: {
			en: 'Why do you want to join the Administrative Council?',
			es: 'Por qué quieres ser miembro del Consejo de Administración...'
		},
		statementInputLabel: {
			en: 'Statement',
			es: 'Presentacion'
		},
		submitButtonLabel: {
			en: 'Submit',
			es: 'Publicar'
		},
		spokenLanguagesInputLabel: {
			en: 'Spoken languages',
			es: 'Idiomas hablados'
		},
		signupDateInputLabel: {
			en: 'Sign-up date',
			es: 'Fecha de ingreso'
		},
		projectsInputLabel: {
			en: 'Projects',
			es: 'Proyectos'
		},
		agreesWithPoliciesCheckboxLabel: {
			en:  'I confirm I have read and understood <a href="$1">this group\'s policies</a>, ' +
				'which I am committed to abide with, if elected.',
			es: 'He leído <a href="$1">las políticas del grupo</a> ' +
				'y tengo el compromiso suficiente en caso de ser electo.'
		},
		legalAgeCheckboxLabel: {
			en: 'I am of legal age in my country of residence.',
			es: 'Soy mayor de edad en mi país de residencia.'
		},
		fieldsetLabel: {
			en: 'Insert your data',
			es: 'Ingresa los datos de tu candidatura'
		},
		formSubmitted: {
			en: 'Statement added successfully. Reloading...',
			es: 'Candidatura agregada con éxito. Recargando...'
		}
	};
	
	function getMessage( key, language, ...parameters ) {
		const parsedParameters = parseParameters( parameters );
		const message = findMessage( key, language );
		const parsedMessage = parseMessage( message, parsedParameters );
		
		return parsedMessage;
	}
	
	function parseParameters( ...parameters ) {
		const parsedParameters = {};
		
		for ( const [ index, value ] of parameters.entries() ) {
			parsedParameters[ `$${index + 1}` ] = value;
		}
		
		return parsedParameters;
	}
	
	function findMessage( key, language ) {
		return (
			messages[ key ][ language ] ||
			messages[ key ][ FALLBACK_LANGUAGE_CODE ]
		);
	}
	
	function parseMessage( message, parameters ) {
		let parsedMessage = message;
		
		for ( const [ key, value ] of Object.entries( parameters ) ) {
			parsedMessage = parsedMessage.replaceAll( key, value );
		}
		
		return parsedMessage;
	}
	
	const realNameInput = new OO.ui.TextInputWidget( {
		placeholder: getMessage( 'realNameInputPlaceholder', userLanguage )
	} );
	const spokenLanguagesInput = new OO.ui.TextInputWidget( {
		placeholder: 'es-n, en-2, ...',
		required: true,
		indicator: 'required'
	} );
	const signupDateInput = new mw.widgets.DateInputWidget( {
		required: true,
		indicator: 'required'
	} );
	const projectsInput = new OO.ui.TextInputWidget( {
		placeholder: 'eswiki, eswikivoyage, ...',
		required: true,
		indicator: 'required'
	} );
	const statementInput = new OO.ui.MultilineTextInputWidget( {
		placeholder: getMessage( 'statementInputPlaceholder', userLanguage ),
		required: true,
		indicator: 'required',
		rows: 5
	} );
	const agreesWithPoliciesCheckbox = new OO.ui.CheckboxInputWidget( {
		required: true
	} );
	const legalAgeCheckbox = new OO.ui.CheckboxInputWidget( {
		required: true
	} );

	const submitButton = new OO.ui.ButtonInputWidget( { 
		label: getMessage( 'submitButtonLabel', userLanguage ),
		type: 'submit',
		flags: [
			'primary',
			'progressive'
		]
	} );
	 
	const fieldset = new OO.ui.FieldsetLayout( { 
		label: getMessage( 'fieldsetLabel', userLanguage ),
		classes: [ 'container' ]
	} );
	 
	fieldset.addItems( [ 
		new OO.ui.FieldLayout( realNameInput, {
			label: getMessage( 'realNameInputLabel', userLanguage )
		} ),
		new OO.ui.FieldLayout( spokenLanguagesInput, {
			label: getMessage( 'spokenLanguagesInputLabel', userLanguage )
		} ),
		new OO.ui.FieldLayout( signupDateInput, {
			label: getMessage( 'signupDateInputLabel', userLanguage )
		} ),
		new OO.ui.FieldLayout( projectsInput, {
			label: getMessage( 'projectsInputLabel', userLanguage )
		} ),
		new OO.ui.FieldLayout( statementInput, {
			label: getMessage( 'statementInputLabel', userLanguage )
		} ),
		new OO.ui.FieldLayout( agreesWithPoliciesCheckbox, {
			label: $(
				`<span>${getMessage(
					'agreesWithPoliciesCheckboxLabel',
					userLanguage,
					'https://wikisp.org/wiki/Pol%C3%ADtica_electoral'
				)}</span>`
			),
			align: 'inline'
		} ),
		new OO.ui.FieldLayout( legalAgeCheckbox, {
			label: getMessage( 'legalAgeCheckboxLabel', userLanguage ),
			align: 'inline'
		} ),
		new OO.ui.FieldLayout( submitButton )	 
	] );
	 
	const form = new OO.ui.FormLayout(	{
		items: [ fieldset ],
		id: 'create-new-statement'
	} );

	form.on( 'submit', ( event ) => {
		const username = mw.config.get( 'wgUserName' );
		const realName = realNameInput.getValue();
		const spokenLanguages = spokenLanguagesInput.getValue();
		const signupDate = signupDateInput.getValue();
		const projects = projectsInput.getValue();
		const statement = statementInput.getValue();

		const template = `
			{{election/statement
			 |username = ${username}
			 |real-name = ${realName}
			 |languages = ${spokenLanguages}
			 |signup-date = ${signupDate}
			 |projects = ${projects}
			 |statement = ${statement}
			}}`.replace( /\s{2,}/g, '\n');

		const parameters = {
			action: 'edit',
			title: 'Internal:Elecciones/CA/2024/Candidaturas/lista',
			appendtext: template,
			format: 'json'
		};
		const api = new mw.Api();

		api.postWithToken( 'csrf', parameters ).done( () => {
			mw.notify( getMessage( 'formSubmitted', userLanguage ) );

			setTimeout( () => {
				window.location.reload();
			}, 3000 );
		} );
	} );

	$( '#form-anchor' ).append( form.$element );
} );