_ _    _ _____  ___   __                       
 __      _(_) | _(_)___ / ( _ ) / /_   ___ ___  _ __ ___  
 \ \ /\ / / | |/ / | |_ \ / _ \| '_ \ / __/ _ \| '_ ` _ \ 
  \ V  V /| |   <| |___) | (_) | (_) | (_| (_) | | | | | |
   \_/\_/ |_|_|\_\_|____/ \___/ \___(_)___\___/|_| |_| |_|

User:Ostrichyearning3/challenge-submit.js

In this article, we will explore the most relevant aspects related to User:Ostrichyearning3/challenge-submit.js. It is a topic that has aroused great interest in various areas, since its impact extends to different aspects of daily life. Along these lines, we will analyze in depth its implications, its evolution over time and its relevance today. User:Ostrichyearning3/challenge-submit.js has been the subject of study by experts in different disciplines, who have contributed to enriching the panorama of knowledge around this topic. Through this article, we will seek to provide a complete and up-to-date overview of User:Ostrichyearning3/challenge-submit.js, with the aim of offering our readers a clearer and more detailed understanding.
/* jshint maxerr: 999 */
/* <nowiki> */
$.when(
	mw.loader.using(),
	$.ready
).then(function() {

// hide on special pages and talk pages
if (mw.config.get('wgNamespaceNumber') < 0 || mw.config.get('wgNamespaceNumber') % 2 === 1 || !mw.config.get('wgRevisionId')) {
	return;
}

var advert = ' (])';

var menu = mw.util.addPortletLink('p-cactions', '#', 'challenge-submit', 'p-challenge-submit', 'Redirect to another article and add merge templates to talk pages');
menu.addEventListener('click', callback);

function callback(e) {
	if (e) e.preventDefault();
	var Window = new Morebits.simpleWindow(600, 500);
	Window.setScriptName('challenge-submit');
	Window.setTitle("Submit articles to challenges");
	Window.addFooterLink('10000 Challenge', 'Wikipedia:The 10,000 Challenge');

	var form = new Morebits.quickForm(evaluate);

	form.append({
		type: 'input',
		label: 'Location (used for {{flag}}',
		name: 'location',
		value: ''
	});

	// form.append({
	// 	type: 'input', // changed to 'date' after render
	// 	name: 'date',
	// 	label: 'Date of merger: ',
	// 	value: new Date().toISOString().slice(0, 10),
	// 	tooltip: 'This date is used in the {{merged-from}} and {{merged-to}} templates'
	// });

	form.append({
		type: 'checkbox',
		name: 'challenges',
		list: [
			{
				label: 'Submit to the 10000 challenge',
				name: 'chall_10_submit',
				checked: true
			},
			{
				label: 'Submit to the 50000 challenge',
				name: 'chall_50_submit',
				checked: true
			}			// {
		]
	});

	form.append({ type: 'submit', label: 'Submit' });

	var result = form.render();

	Window.setContent(result);
	Window.display();

}

function evaluate(e) {
	var form = e.target;

	var params = {};
	params.target = form.target.value;
	if (!params.target.trim()) {
		alert('Please enter a flag');
		return;
	}
	params.current = Morebits.pageNameNorm;

	// params.redirect = form.redirect.checked;
	// params.summary = form && form.value.replace('###', params.target);
	// params.removemerge = form.removemerge.checked;
	// params.addmergedfrom = form.addmergedfrom.checked;
	// params.addmergedto = form.addmergedto.checked;
	// params.adjusttalktemplates = form.adjusttalktemplates.checked;
	params.chall_10_submit = form.chall_10_submit.checked;
	params.chall_50_submit = form.chall_50_submit.checked;
	
	params.location = form.location.value;

	// var dateobj = new Date(form.date.value);
	// if (isNaN(dateobj.getTime())) {
	// 	alert('Invalid date. Please enter in YYYY-MM-DD format'); // should arise only for browsers w/o datepicker
	// 	return;
	// }
	// params.date = dateobj.getUTCDate() + ' ' + dateobj.getUTCMonthName() + ' ' + dateobj.getUTCFullYear();

	Morebits.simpleWindow.setButtonsEnabled(false);
	Morebits.status.init(form);
	Morebits.wiki.api.setApiUserAgent(']');

	if (params.chall_10_submit) {
		// var page = new Morebits.wiki.page(params.current, 'Submitting');
		var challenge_page = new Morebits.wiki.page(63582974, 'Submitting');

		page.load(function(page) {
			
			var pageText = page.getPageText() + "append"

			page.setPageText(pageText);
			page.setEditSummary(params.summary + advert);
			page.setCreateOption('nocreate');
			page.save();
		});
	}

}

});
/* </nowiki> */