From 16c20788c1ac33f60d94d721dee94d09a8c4dfff Mon Sep 17 00:00:00 2001 From: Amit Lift <91e6ae1d170b73e295f148e49c24bec31174a320@cloudflare.com> Date: Tue, 10 Nov 2020 08:44:17 +0100 Subject: [PATCH] cg.js --- addons/ismitmlinkCR/cg.js | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/addons/ismitmlinkCR/cg.js b/addons/ismitmlinkCR/cg.js index 85ab43468..13e8bf333 100644 --- a/addons/ismitmlinkCR/cg.js +++ b/addons/ismitmlinkCR/cg.js @@ -1,5 +1,5 @@ document.addEventListener('DOMContentLoaded', () => { - chrome.storage.local.get(['ign1', 'ign2', 'obs', 'dbg', 'alt', 'mul', 'opd'], (g) => { + chrome.storage.local.get(['ign1', 'ign2', 'obs', 'dbg', 'alt', 'mul', 'opd', 'cep'], (g) => { document.getElementById('ign1').checked = (g.ign1 == 'y') ? true : false; document.getElementById('ign2').checked = (g.ign2 == 'y') ? true : false; document.getElementById('obs').checked = (g.obs == 'y') ? true : false; @@ -7,6 +7,23 @@ document.addEventListener('DOMContentLoaded', () => { document.getElementById('opon').checked = (g.opd != 'n' && g.opd != 'l') ? true : false; document.getElementById('opoff').checked = (g.opd == 'n') ? true : false; document.getElementById('opol').checked = (g.opd == 'l') ? 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' @@ -67,6 +84,21 @@ document.getElementById('crs').addEventListener('click', () => { location.reload(); }); }); +document.getElementById('ut0').addEventListener('click', () => { + chrome.runtime.sendMessage('urltype,0', () => { + location.reload(); + }); +}); +document.getElementById('ut1').addEventListener('click', () => { + chrome.runtime.sendMessage('urltype,1', () => { + location.reload(); + }); +}); +document.getElementById('ut2').addEventListener('click', () => { + chrome.runtime.sendMessage('urltype,2', () => { + location.reload(); + }); +}); function get_realdomain(w) { let wa = w.split('.'); let wa_l = wa.length;