mirror of
https://github.com/StarCitizenTools/mediawiki-skins-Citizen.git
synced 2024-11-16 02:54:06 +00:00
Merge pull request #119 from StarCitizenTools/dev
Open search when shortcut key is pressed
This commit is contained in:
commit
d3b41789d4
25
resources/skins.citizen.scripts/search.js
Normal file
25
resources/skins.citizen.scripts/search.js
Normal 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 );
|
|
@ -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 );
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue