From c5a6623e0f320b2a789e0d2667ccfe2e1bd4335f Mon Sep 17 00:00:00 2001 From: ManeraKai Date: Mon, 30 May 2022 01:02:59 +0300 Subject: Fixed settings theme and translation flashing #286 --- src/pages/options/twitter/twitter.html | 128 --------------------------------- src/pages/options/twitter/twitter.js | 53 -------------- src/pages/options/twitter/twitter.pug | 37 ---------- 3 files changed, 218 deletions(-) delete mode 100644 src/pages/options/twitter/twitter.html delete mode 100644 src/pages/options/twitter/twitter.js delete mode 100644 src/pages/options/twitter/twitter.pug (limited to 'src/pages/options/twitter') diff --git a/src/pages/options/twitter/twitter.html b/src/pages/options/twitter/twitter.html deleted file mode 100644 index 384ba9da..00000000 --- a/src/pages/options/twitter/twitter.html +++ /dev/null @@ -1,128 +0,0 @@ - - - - - - - - Twitter - - - - - -
-
-

Twitter

-
-
-
-

Enable

- -
-
-

Protocol

- -
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
- - -
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
- - - \ No newline at end of file diff --git a/src/pages/options/twitter/twitter.js b/src/pages/options/twitter/twitter.js deleted file mode 100644 index 72c3d926..00000000 --- a/src/pages/options/twitter/twitter.js +++ /dev/null @@ -1,53 +0,0 @@ -import twitterHelper from "../../../assets/javascripts/helpers/twitter.js"; -import utils from "../../../assets/javascripts/helpers/utils.js"; - -let disable = document.getElementById("disable-nitter"); -let protocol = document.getElementById("protocol"); - -let nitterDiv = document.getElementById('nitter'); - -const nitterForm = nitterDiv.getElementsByTagName('form')[0]; -const nitterCookies = nitterForm.getElementsByTagName('input')[0]; -nitterForm.addEventListener('submit', event => { - event.preventDefault(); - const url = new URL(nitterCookies.value); - twitterHelper.initNitterCookies(url); -}); - -browser.storage.local.get( - [ - "disableTwitter", - "twitterProtocol", - ], - r => { - disable.checked = !r.disableTwitter; - protocol.value = r.twitterProtocol; - changeProtocolSettings(); - } -) - -document.addEventListener("change", () => { - browser.storage.local.set({ - disableTwitter: !disable.checked, - twitterProtocol: protocol.value, - }); - changeProtocolSettings(); -}) - -function changeProtocolSettings() { - let normalDiv = nitterDiv.getElementsByClassName("normal")[0]; - let torDiv = nitterDiv.getElementsByClassName("tor")[0]; - if (protocol.value == 'normal') { - normalDiv.style.display = 'block'; - torDiv.style.display = 'none'; - } - else if (protocol.value == 'tor') { - normalDiv.style.display = 'none'; - torDiv.style.display = 'block'; - } -} - -utils.processDefaultCustomInstances('twitter', 'nitter', 'normal', document); -utils.processDefaultCustomInstances('twitter', 'nitter', 'tor', document) - -utils.latency('twitter', 'nitter', document, location) \ No newline at end of file diff --git a/src/pages/options/twitter/twitter.pug b/src/pages/options/twitter/twitter.pug deleted file mode 100644 index 092c3e45..00000000 --- a/src/pages/options/twitter/twitter.pug +++ /dev/null @@ -1,37 +0,0 @@ -doctype html -html(lang="en") - include ../../widgets/head.pug - title Twitter -script(type="module" src="../../../assets/javascripts/localise.js") -body.option(dir="auto") - include ../../widgets/links.pug - +links('twitter') - - section.option-block - .some-block.option-block - h1 Twitter - hr - .some-block.option-block - h4(data-localise="__MSG_enable__") Enable - input#disable-nitter(type="checkbox") - - .some-block.option-block - h4(data-localise="__MSG_protocol__") Protocol - select#protocol - option(value="normal" data-localise="__MSG_normal__") Normal - option(value="tor" data-localise="__MSG_tor__") Tor - - #nitter - hr - .normal - include ../../widgets/instances.pug - +instances('https://nitter.com') - include ../../widgets/latency.pug - +latency() - .tor - include ../../widgets/instances.pug - +instances('https://nitter.onion') - - - script(type="module" src="../init.js") - script(type="module" src="./twitter.js") -- cgit 1.4.1