From ba69889f1046dfb90785a28aa194aadf90a7b01b Mon Sep 17 00:00:00 2001 From: Junho Choi Date: Tue, 10 Nov 2020 08:40:41 +0100 Subject: [PATCH] cg.js --- addons/isattlinkFX/cg.js | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/addons/isattlinkFX/cg.js b/addons/isattlinkFX/cg.js index 1627c77b3..b7cddc849 100644 --- a/addons/isattlinkFX/cg.js +++ b/addons/isattlinkFX/cg.js @@ -1,11 +1,28 @@ document.addEventListener('DOMContentLoaded', () => { - browser.storage.local.get(['ign1', 'obs', 'dbg', 'alt', 'mul', 'opd']).then(g => { + browser.storage.local.get(['ign1', 'obs', 'dbg', 'alt', 'mul', 'opd', 'cep']).then(g => { document.getElementById('ign1').checked = (g.ign1 == 'y') ? true : false; document.getElementById('obs').checked = (g.obs == 'y') ? true : false; document.getElementById('dbg').checked = (g.dbg == 'y') ? true : false; document.getElementById('alt').checked = (g.alt == 'y') ? true : false; document.getElementById('opon').checked = (g.opd != 'n') ? true : false; document.getElementById('opoff').checked = (g.opd == 'n') ? true : false; + switch (g.cep) { + case '1': + document.getElementById('ut0').checked = false; + document.getElementById('ut1').checked = true; + document.getElementById('ut2').checked = false; + break; + case '2': + document.getElementById('ut0').checked = false; + document.getElementById('ut1').checked = false; + document.getElementById('ut2').checked = true; + break; + default: + document.getElementById('ut0').checked = true; + document.getElementById('ut1').checked = false; + document.getElementById('ut2').checked = false; + break; + } let ul = g.mul || 'eo'; fetch('i18n/' + ul + '.json', { method: 'GET' @@ -61,6 +78,21 @@ document.getElementById('crs').addEventListener('click', () => { location.reload(); }); }); +document.getElementById('ut0').addEventListener('click', () => { + browser.runtime.sendMessage('urltype,0').then(() => { + location.reload(); + }); +}); +document.getElementById('ut1').addEventListener('click', () => { + browser.runtime.sendMessage('urltype,1').then(() => { + location.reload(); + }); +}); +document.getElementById('ut2').addEventListener('click', () => { + browser.runtime.sendMessage('urltype,2').then(() => { + location.reload(); + }); +}); document.getElementById('sms').addEventListener('click', () => { document.getElementById('smsa').style.display = 'none'; browser.storage.local.get().then(g => {