init modal stuff.
This commit is contained in:
@@ -68,7 +68,14 @@ function initSearchBar(jsonData) {
|
||||
if (event.key != 'Enter') return
|
||||
|
||||
// Open google with the search results.
|
||||
query = document.getElementById(searchBarId).value.replace(/\ /g, "+")
|
||||
query = document.getElementById(searchBarId).value
|
||||
if (query == "--setting") {
|
||||
showSettings()
|
||||
document.getElementById(searchBarId).value = ""
|
||||
return
|
||||
}
|
||||
|
||||
query = query.replace(/\ /g, "+")
|
||||
document.location = searchUrl + query
|
||||
})
|
||||
}
|
||||
|
||||
18
js/settings.js
Normal file
18
js/settings.js
Normal file
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* File to handle editing the settings from the menu itself.
|
||||
*
|
||||
* A modal will be shown where the user can edit settings
|
||||
* and finally when submitted, the settings will be written to
|
||||
* the config.json and this config is read each time the page
|
||||
* loads.
|
||||
*/
|
||||
|
||||
modalId = "settings"
|
||||
closeBtn = "close"
|
||||
|
||||
function showSettings() {
|
||||
modalEl = document.getElementById(modalId)
|
||||
closeBtn = document.getElementsByClassName(closeBtn)[0]
|
||||
modalEl.style.display = "block"
|
||||
closeBtn.onclick = () => {modalEl.style.display = "none"}
|
||||
}
|
||||
Reference in New Issue
Block a user