This commit is contained in:
Danielle Vanzura 2020-09-13 01:43:30 +02:00
parent 90c5c19508
commit d5a8b49a54
1 changed files with 31 additions and 11 deletions

View File

@ -3,7 +3,15 @@ function newrow(w) {
let tr = tt.insertRow(tt.rows.length); let tr = tt.insertRow(tt.rows.length);
tr.innerHTML = w; 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>'); 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 => { browser.runtime.sendMessage('get').then(g => {
for (let k in 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"> &#128279; </a></td><td>' + g[k][3] + '</td></tr>'); 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"> &#128279; </a></td><td>' + g[k][3] + '</td></tr>');
@ -11,8 +19,20 @@ browser.runtime.sendMessage('get').then(g => {
} }
}); });
document.body.style.display = 'block'; document.body.style.display = 'block';
});
});
document.getElementById('clear').addEventListener('click', () => { document.getElementById('clear').addEventListener('click', () => {
browser.runtime.sendMessage('clear').then(() => { browser.runtime.sendMessage('clear').then(() => {
location.reload(true); 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);
});
}
});
});