Add settings cog (for real)

This commit is contained in:
reesericci
2020-09-09 12:54:02 -05:00
parent 4069f27750
commit 19827e2957
3 changed files with 29 additions and 3 deletions

View File

@@ -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
}
}