First full release
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
// Note to myself: please optimize and remove the redundacy of the code written in multiple classes to achieve the same result as this
|
||||
|
||||
const focusOnCompletePromtBase = queryInput => {
|
||||
queryInput.focus()
|
||||
queryInput.select()
|
||||
}
|
||||
|
||||
// Tradeoff: Declare a variable for the element to reduce duplication?
|
||||
const inputQuery = document.querySelector('#search-query')
|
||||
if (inputQuery) {
|
||||
focusOnCompletePromtBase(inputQuery)
|
||||
|
||||
if (window.location.pathname === '/slovarji') {
|
||||
document
|
||||
.querySelector('#dicts-search-btn')
|
||||
.addEventListener('click', () => {
|
||||
focusOnCompletePromtBase(inputQuery)
|
||||
})
|
||||
|
||||
document
|
||||
.querySelector('#search-in-filter-modal')
|
||||
.addEventListener('click', () => {
|
||||
focusOnCompletePromtBase(inputQuery)
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user