var browser = browser || chrome; browser.storage.local.get(['theme'], obj => { var theme = obj.theme || 'green-red'; var themeSettingsContainer = document.getElementById('theme-settings'); [ 'green-red', 'purple-yellow', 'cyan-orange', ].map(x => { themeSettingsContainer.insertAdjacentHTML('beforeend', ` `); }); }); document.getElementById('save-button').addEventListener('click', async () => { var theme = [...document.querySelectorAll('.shinigami-eyes-theme input')] .filter(x => x.checked)[0].dataset.theme; browser.runtime.sendMessage({ closeCallingTab: true, setTheme: theme }, () => { }); }); document.getElementById('cancel-button').addEventListener('click', async () => { browser.runtime.sendMessage({ closeCallingTab: true }, () => { }); });