diff --git a/webext/js/options_accounts.js b/webext/js/options_accounts.js index 6369aa9..dc12a92 100644 --- a/webext/js/options_accounts.js +++ b/webext/js/options_accounts.js @@ -40,7 +40,8 @@ SysTrayX.Accounts = { } accounts[mailAccount[i].type].push({ id: mailAccount[i].id, - name: mailAccount[i].name + name: mailAccount[i].name, + folders: mailAccount[i].folders }); } @@ -70,8 +71,8 @@ SysTrayX.Accounts = { let typeLi = document.createElement("li"); let typeInput = document.createElement("input"); typeInput.setAttribute("type", "checkbox"); - typeInput.setAttribute("name", accounts[prop][i].name); - typeInput.setAttribute("value", accounts[prop][i].id); + typeInput.setAttribute("name", accounts[prop][i].id); + typeInput.setAttribute("value", JSON.stringify(accounts[prop][i])); typeInput.setAttribute("checked", "true"); typeLi.appendChild(typeInput); let typeText = document.createTextNode(" " + accounts[prop][i].name); @@ -91,7 +92,7 @@ SysTrayX.Accounts = { let accounts = result.accounts || []; for (let i = 0; i < accounts.length; ++i) { let checkbox = treeBase.querySelector( - `input[value=${accounts[i].id}]` + `input[name=${accounts[i].id}]` ); if (checkbox) { checkbox.checked = accounts[i].checked; diff --git a/webext/options.js b/webext/options.js index abf237e..720d584 100644 --- a/webext/options.js +++ b/webext/options.js @@ -22,11 +22,8 @@ function saveOptions(e) { let inputs = treeBase.querySelectorAll("input"); let accounts = []; for (let i = 0; i < inputs.length; ++i) { - accounts.push({ - id: inputs[i].value, - name: inputs[i].name, - checked: inputs[i].checked - }); + let account = JSON.parse(inputs[i].value); + accounts.push({ ...account, checked: inputs[i].checked }); } // Store accounts