From c5ef434b2835905ba5e21153411e2c2ec4c1f770 Mon Sep 17 00:00:00 2001 From: ManeraKai Date: Wed, 23 Feb 2022 20:21:19 +0300 Subject: Added imgur, tiktok tor support #32 --- src/pages/options/tiktok/tiktok.html | 283 +++++++++++++++++++---------------- src/pages/options/tiktok/tiktok.js | 37 +++++ 2 files changed, 194 insertions(+), 126 deletions(-) (limited to 'src/pages/options/tiktok') diff --git a/src/pages/options/tiktok/tiktok.html b/src/pages/options/tiktok/tiktok.html index 8bec525f..a0cb11cc 100644 --- a/src/pages/options/tiktok/tiktok.html +++ b/src/pages/options/tiktok/tiktok.html @@ -2,146 +2,177 @@ - - - - - - LibRedirect Options: TikTok + + + + + + LibRedirect Options: TikTok - + + + + Wikipedia + +
+ + + + + + + + + + Medium +
+ -
-
-

Enable

- -
+
+
+

Enable

+ +
+ +
+

Protocol

+ +
-
+
+
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
-

Default Instances

+ +
-
-
+
+
+
+
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
-

Custom Instances

+ +
- -
- - -
-
-
-
+ +
+ +
- - - + + + - + \ No newline at end of file diff --git a/src/pages/options/tiktok/tiktok.js b/src/pages/options/tiktok/tiktok.js index d66d0453..13de04d8 100644 --- a/src/pages/options/tiktok/tiktok.js +++ b/src/pages/options/tiktok/tiktok.js @@ -6,9 +6,35 @@ disableTiktokElement.addEventListener("change", (event) => tiktokHelper.setDisable(!event.target.checked) ); +let protocolElement = document.getElementById("protocol") +protocolElement.addEventListener("change", + (event) => { + let protocol = event.target.options[protocolElement.selectedIndex].value + tiktokHelper.setProtocol(protocol); + changeProtocolSettings(protocol); + } +); + +function changeProtocolSettings(protocol) { + let normalDiv = document.getElementById("normal"); + let torDiv = document.getElementById("tor"); + if (protocol == 'normal') { + normalDiv.style.display = 'block'; + torDiv.style.display = 'none'; + } + else if (protocol == 'tor') { + normalDiv.style.display = 'none'; + torDiv.style.display = 'block'; + } +} + tiktokHelper.init().then(() => { disableTiktokElement.checked = !tiktokHelper.getDisable(); + let protocol = tiktokHelper.getProtocol(); + protocolElement.value = protocol; + changeProtocolSettings(protocol); + commonHelper.processDefaultCustomInstances( 'proxiTok', 'normal', @@ -18,5 +44,16 @@ tiktokHelper.init().then(() => { tiktokHelper.setProxiTokNormalRedirectsChecks, tiktokHelper.getProxiTokNormalCustomRedirects, tiktokHelper.setProxiTokNormalCustomRedirects + ); + + commonHelper.processDefaultCustomInstances( + 'proxiTok', + 'tor', + tiktokHelper, + document, + tiktokHelper.getProxiTokTorRedirectsChecks, + tiktokHelper.setProxiTokTorRedirectsChecks, + tiktokHelper.getProxiTokTorCustomRedirects, + tiktokHelper.setProxiTokTorCustomRedirects ) }) \ No newline at end of file -- cgit 1.4.1