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