mic_none

User:Chew/scripts/TemplateSearchSuggestions.js Source: en.wikipedia.org/wiki/User:Chew/scripts/TemplateSearchSuggestions.js

// THIS SCRIPT IS A WORK IN PROGRESS!!
// IF YOU INSTALL, THINGS WILL BREAK!!
// If you're helping me break it, feel free!
// YOU ARE RESPONSIBLE FOR ANY EDITS MADE WITH THIS (though none should be made)

const dropdown5 = new OO.ui.DropdownInputWidget( {
	label: 'Select one',
	options: [ {
				data: 'a',
				label: 'First'
			} , {
				data: 'b',
				label: 'Second',
			} , {
				data: 'c',
				label: 'Third'
			} , {
				data: 'c',
				label: 'The fourth option has an overly long label'
			} , {
				data: 'd',
				label: 'The fifth option has an icon'
			}
		]
	}
 )

$( '.ve-ui-mwTwoPaneTransclusionDialogLayout-stackLayout' )[0].append(dropdown5.$element)

dropdown5.on('change', (e) => {
    const inp = document.getElementById("ooui-8"); // not a hard-coded ID, need more permanent
    inp.value = e;
    inp.focus();

    document.querySelector(".ve-ui-mwTransclusionDialog-addButton").children[0].click();

    dropdown5.$element.html("")
})