User:Aidan9382/scripts/defaultSummaries.js

//Inspired by MediaWiki:Gadget-defaultsummaries.js $.when( $.ready, mw.loader.using( 'oojs-ui' ) ).then( function {	var	// 	moveSummaries = [		"Correct archive indexing for simplicity and template functionality",		"Move subpage left behind during move of parent page",		"Standardise/fix archive name",	],	editSummaries = [		"Correct archive indexing for simplicity and template functionality",		"Merging content unreasonably split due to poor auto-archive management",		"",		"Fix args",		"Do not use 2 archiving bots at once. Archives unified into one consistent format",		"Fix Lint Errors",		"Page protection has expired",		"Fix auto-archive location",		"Fix excerpt target",	];	// 	var dropdown = new OO.ui.DropdownWidget({ label: 'Edit summaries' });	var dropdownElement = dropdown.$element[0];	function addOptions(options) {		dropdown.menu.addItems( options.map( function ( optionText ) {			return new OO.ui.MenuOptionWidget( { label: optionText } );		} ) );	}	var inputBox;	if (mw.config.get("wgCanonicalSpecialPageName") == "Movepage") {		addOptions(moveSummaries);		dropdown.menu.on("select",function(option) { inputBox = document.getElementById("wpReason"); //Fetching inside the select function is intentional here inputBox.firstElementChild.value = option.getLabel; });		dropdownElement.style = "margin-top:12px";		var moveButton = document.getElementsByClassName("oo-ui-flaggedElement-primary")[0];		moveButton.after(dropdownElement);	} else if (document.getElementById("wpTextbox1")) {		addOptions(editSummaries);		inputBox = document.getElementById("wpSummary");		minorEditBox = document.getElementById('wpMinoredit');		dropdown.menu.on("select",function(option) { inputBox.value = option.getLabel; minorEditBox.checked = true; });		dropdownElement.style = "margin-bottom:0";		var watchDropdown = document.getElementById("mw-editpage-watchlist-expiry");		if (watchDropdown) {			watchDropdown.after(dropdownElement);		}	} else {		//nothing	} });