From d5a8b49a5460ba1d3d63bf24aa2af849cd7d8ee6 Mon Sep 17 00:00:00 2001 From: Danielle Vanzura <043456d10a0f8b9e24ebb18fdc141e424ece8b28@cloudflare.com> Date: Sun, 13 Sep 2020 01:43:30 +0200 Subject: [PATCH] log.js --- addons/urejectFX/log.js | 42 ++++++++++++++++++++++++++++++----------- 1 file changed, 31 insertions(+), 11 deletions(-) diff --git a/addons/urejectFX/log.js b/addons/urejectFX/log.js index 3ea31c605..14c087826 100644 --- a/addons/urejectFX/log.js +++ b/addons/urejectFX/log.js @@ -3,16 +3,36 @@ function newrow(w) { let tr = tt.insertRow(tt.rows.length); tr.innerHTML = w; } -newrow('<tr><td><b>FQDN</b></td><td><b>Servilo</b></td><td><b>Stato</b></td><td><b>Kie</b></td><td><b>Kiam</b></td></tr>'); -browser.runtime.sendMessage('get').then(g => { - for (let k in g) { - newrow('<tr><td>' + k + '</td><td>' + g[k][1] + '</td><td>' + g[k][2] + '</td><td><a href="' + g[k][0] + '" rel="noreferrer noopener" target="_blank"> 🔗 </a></td><td>' + g[k][3] + '</td></tr>'); - document.getElementById('export').innerHTML += k + "\n"; - } -}); -document.body.style.display = 'block'; -document.getElementById('clear').addEventListener('click', () => { - browser.runtime.sendMessage('clear').then(() => { - location.reload(true); +document.addEventListener('DOMContentLoaded', () => { + browser.storage.local.get(['ul']).then((r) => { + fetch('i18n/' + (r.ul || 'eo') + '.json', { + method: 'GET' + }).then(j => j.json()).then(j => { + document.querySelectorAll('span[transk]').forEach(x => { + x.innerText = j[x.getAttribute('transk')]; + }); + newrow('<tr><td><b>FQDN</b></td><td><b>' + j['lj1'] + '</b></td><td><b>' + j['lj2'] + '</b></td><td><b>' + j['lj3'] + '</b></td><td><b>' + j['lj4'] + '</b></td></tr>'); + browser.runtime.sendMessage('get').then(g => { + for (let k in g) { + newrow('<tr><td>' + k + '</td><td>' + g[k][1] + '</td><td>' + g[k][2] + '</td><td><a href="' + g[k][0] + '" rel="noreferrer noopener" target="_blank"> 🔗 </a></td><td>' + g[k][3] + '</td></tr>'); + document.getElementById('export').innerHTML += k + "\n"; + } + }); + document.body.style.display = 'block'; + }); + }); + document.getElementById('clear').addEventListener('click', () => { + browser.runtime.sendMessage('clear').then(() => { + location.reload(true); + }); + }); + document.getElementById('myul').addEventListener('change', () => { + if (document.getElementById('myul').value != '') { + browser.storage.local.set({ + 'ul': document.getElementById('myul').value + }).then(() => { + location.reload(true); + }); + } }); }); \ No newline at end of file