From 0102823d930b4390c097cd1594f9f2f72008b18b Mon Sep 17 00:00:00 2001 From: Stefan Winer <043456d10a0f8b9e24ebb18fdc141e424ece8b28@cloudflare.com> Date: Sun, 13 Sep 2020 01:45:42 +0200 Subject: [PATCH] log.js --- addons/urejectCR/log.js | 42 ++++++++++++++++++++++++++++++----------- 1 file changed, 31 insertions(+), 11 deletions(-) diff --git a/addons/urejectCR/log.js b/addons/urejectCR/log.js index 5117e5de..eea04f6b 100644 --- a/addons/urejectCR/log.js +++ b/addons/urejectCR/log.js @@ -3,16 +3,36 @@ function newrow(w) { let tr = tt.insertRow(tt.rows.length); tr.innerHTML = w; } -newrow('FQDNServiloStatoKieKiam'); -chrome.runtime.sendMessage('get', g => { - for (let k in g) { - newrow('' + k + '' + g[k][1] + '' + g[k][2] + ' 🔗 ' + g[k][3] + ''); - document.getElementById('export').innerHTML += k + "\n"; - } -}); -document.body.style.display = 'block'; -document.getElementById('clear').addEventListener('click', () => { - chrome.runtime.sendMessage('clear', () => { - location.reload(true); +document.addEventListener('DOMContentLoaded', () => { + chrome.storage.local.get(['ul'], (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('FQDN' + j['lj1'] + '' + j['lj2'] + '' + j['lj3'] + '' + j['lj4'] + ''); + chrome.runtime.sendMessage('get', g => { + for (let k in g) { + newrow('' + k + '' + g[k][1] + '' + g[k][2] + ' 🔗 ' + g[k][3] + ''); + document.getElementById('export').innerHTML += k + "\n"; + } + }); + document.body.style.display = 'block'; + }); + }); + document.getElementById('clear').addEventListener('click', () => { + chrome.runtime.sendMessage('clear', () => { + location.reload(true); + }); + }); + document.getElementById('myul').addEventListener('change', () => { + if (document.getElementById('myul').value != '') { + chrome.storage.local.set({ + 'ul': document.getElementById('myul').value + }, () => { + location.reload(true); + }); + } }); }); \ No newline at end of file