mediawiki-skins-Citizen/resources/scripts/searchfocus.js
2020-06-06 14:47:03 -04:00

20 lines
480 B
JavaScript

/*
* Citizen - Search focus JS
* https://starcitizen.tools
*
* Focus on search input when checkbox is toggled
* TODO: Clean up all the JS files after the skin is converted to Mustache
*/
var searchToggle = document.getElementById( 'search-toggle' );
function searchInputFocus() {
var searchInput = document.getElementById( 'searchInput' );
if ( searchToggle.checked !== false ) {
searchInput.focus();
}
}
searchToggle.addEventListener( 'click', searchInputFocus );