Add settings cog (for real)
This commit is contained in:
@@ -11,9 +11,26 @@ modalId = "settings"
|
||||
closeId = "close"
|
||||
jsonContainer = "jsoneditor"
|
||||
|
||||
let gear = false
|
||||
|
||||
// Detect browser
|
||||
BROWSER = detectBrowser()
|
||||
|
||||
document.getElementById('settings-cog').onclick = function() {
|
||||
if (gear == false) {
|
||||
gear = true;
|
||||
showSettings()
|
||||
} else if (gear == true) {
|
||||
modalEl.style.display = "none"
|
||||
gear = false;
|
||||
// Get the updated JSON
|
||||
updatedJson = editor.get()
|
||||
BROWSER.storage.sync.set(updatedJson)
|
||||
document.getElementById(jsonContainer).innerHTML = ""
|
||||
location.reload()
|
||||
}
|
||||
}
|
||||
|
||||
function showSettings() {
|
||||
modalEl = document.getElementById(modalId)
|
||||
closeBtn = document.getElementsByClassName(closeId)[0]
|
||||
@@ -57,4 +74,4 @@ function detectBrowser() {
|
||||
BROWSER = chrome
|
||||
|
||||
return BROWSER
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user