Merge pull request #119 from StarCitizenTools/dev

Open search when shortcut key is pressed
This commit is contained in:
alistair3149 2020-06-09 00:31:34 -04:00 committed by GitHub
commit d3b41789d4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 27 additions and 20 deletions

View file

@ -0,0 +1,25 @@
/*
* Citizen - Search JS
* https://starcitizen.tools
*
* Focus on search input when checkbox is toggled
* Open the search box when the input is in focus
*/
var searchToggle = document.getElementById( 'search-toggle' ),
searchInput = document.getElementById( 'searchInput' );
function searchInputFocus() {
if ( searchToggle.checked !== false ) {
searchInput.focus();
}
}
function searchToggleCheck() {
if ( searchToggle.checked === false ) {
searchToggle.checked = true;
}
}
searchToggle.addEventListener( 'click', searchInputFocus );
searchInput.addEventListener( 'focus', searchToggleCheck );

View file

@ -1,19 +0,0 @@
/*
* 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 );

View file

@ -13,6 +13,7 @@
}
.suggestions-dropdown {
padding-top: 4px;
width: @search-bar-width;
max-width: calc( ~'100vw -'@icon-box-size + @icon-padding * 2 + @margin-side );
display: flex; // Needed to show margin

View file

@ -200,7 +200,7 @@
"skins.citizen.scripts": {
"scripts": [
"resources/skins.citizen.scripts/toc.js",
"resources/skins.citizen.scripts/searchfocus.js"
"resources/skins.citizen.scripts/search.js"
]
},
"skins.citizen.scripts.search": {