Make gear cog work with closing settings.
This commit is contained in:
@@ -10,8 +10,7 @@
|
||||
modalId = "settings"
|
||||
closeId = "close"
|
||||
jsonContainer = "jsoneditor"
|
||||
|
||||
let gear = false
|
||||
let gear = false;
|
||||
|
||||
// Detect browser
|
||||
BROWSER = detectBrowser()
|
||||
@@ -20,15 +19,7 @@ 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() {
|
||||
@@ -53,6 +44,14 @@ function showSettings() {
|
||||
document.getElementById(jsonContainer).innerHTML = ""
|
||||
location.reload()
|
||||
}
|
||||
document.getElementById('settings-cog').onclick = () => {
|
||||
modalEl.style.display = "none"
|
||||
// Get the updated JSON
|
||||
updatedJson = editor.get()
|
||||
BROWSER.storage.sync.set(updatedJson)
|
||||
document.getElementById(jsonContainer).innerHTML = ""
|
||||
location.reload()
|
||||
}
|
||||
}
|
||||
|
||||
async function loadJson(editor) {
|
||||
@@ -64,7 +63,7 @@ async function loadJson(editor) {
|
||||
// Populate the editor
|
||||
editor.set(result)
|
||||
})
|
||||
}
|
||||
};
|
||||
|
||||
function detectBrowser() {
|
||||
// Firefox
|
||||
@@ -73,5 +72,5 @@ function detectBrowser() {
|
||||
else if (!!window.chrome && (!!window.chrome.webstore || !!window.chrome.runtime))
|
||||
BROWSER = chrome
|
||||
|
||||
return BROWSER
|
||||
}
|
||||
return BROWSER;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user