From ab44fd04ffa1055bd17a3da02017e8de3da88af2 Mon Sep 17 00:00:00 2001 From: ManeraKai Date: Sun, 15 May 2022 18:44:28 +0300 Subject: Complete on supporting Unify #234 --- src/pages/options/lbry/lbry.html | 40 ++++++++++++++++++++-------------------- src/pages/options/lbry/lbry.js | 28 ++++++++++++++-------------- 2 files changed, 34 insertions(+), 34 deletions(-) (limited to 'src/pages/options/lbry') diff --git a/src/pages/options/lbry/lbry.html b/src/pages/options/lbry/lbry.html index a5167f21..4e3c1316 100644 --- a/src/pages/options/lbry/lbry.html +++ b/src/pages/options/lbry/lbry.html @@ -12,9 +12,9 @@
diff --git a/src/pages/options/lbry/lbry.js b/src/pages/options/lbry/lbry.js index f1cb49da..fcac7bd8 100644 --- a/src/pages/options/lbry/lbry.js +++ b/src/pages/options/lbry/lbry.js @@ -1,25 +1,25 @@ import lbryHelper from "../../../assets/javascripts/helpers/lbry.js"; import commonHelper from "../../../assets/javascripts/helpers/common.js"; -let disableLbryElement = document.getElementById("disable-lbry"); -let protocolElement = document.getElementById("protocol") +let disable = document.getElementById("disable-lbry"); +let protocol = document.getElementById("protocol") document.addEventListener("change", async () => { await browser.storage.local.set({ disableLbryTargets: !lbryHelper.checked, - lbryTargetsProtocol: protocolElement.value, + lbryTargetsProtocol: protocol.value, }); - changeProtocolSettings(protocolElement.value) + changeProtocolSettings() }) -function changeProtocolSettings(protocol) { +function changeProtocolSettings() { let normalDiv = document.getElementsByClassName("normal")[0]; let torDiv = document.getElementsByClassName("tor")[0]; - if (protocol == 'normal') { + if (protocol.value == 'normal') { normalDiv.style.display = 'block'; torDiv.style.display = 'none'; } - else if (protocol == 'tor') { + else if (protocol.value == 'tor') { normalDiv.style.display = 'none'; torDiv.style.display = 'block'; } @@ -31,14 +31,14 @@ browser.storage.local.get( "lbryTargetsProtocol" ], r => { - disableLbryElement.checked = !r.disableLbryTargets; + disable.checked = !r.disableLbryTargets; + protocol.value = r.lbryTargetsProtocol; + changeProtocolSettings(); + } +) - let protocol = r.lbryTargetsProtocol; - protocolElement.value = protocol; - changeProtocolSettings(protocol); - }) -commonHelper.processDefaultCustomInstances('lbry', 'librarian', 'normal', document); -commonHelper.processDefaultCustomInstances('lbry', 'librarian', 'tor', document); +commonHelper.processDefaultCustomInstances('lbryTargets', 'librarian', 'normal', document); +commonHelper.processDefaultCustomInstances('lbryTargets', 'librarian', 'tor', document); let latencyElement = document.getElementById("latency"); let latencyLabel = document.getElementById("latency-label"); -- cgit 1.4.1