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/tiktok/tiktok.html | 66 +++++++++++------------------------- src/pages/options/tiktok/tiktok.js | 44 ++++-------------------- src/pages/options/tiktok/tiktok.pug | 21 ------------ 3 files changed, 27 insertions(+), 104 deletions(-) (limited to 'src/pages/options/tiktok') diff --git a/src/pages/options/tiktok/tiktok.html b/src/pages/options/tiktok/tiktok.html index 5f969d82..9b5932fc 100644 --- a/src/pages/options/tiktok/tiktok.html +++ b/src/pages/options/tiktok/tiktok.html @@ -12,9 +12,9 @@
@@ -66,34 +66,8 @@ -
-

Enable Custom Settings (will use cookies)

- -

-
-
-

General

-
-
-

Theme

- -
-
-

Api

-
-
-

Legacy mode

- -
-

Default Instances

diff --git a/src/pages/options/tiktok/tiktok.js b/src/pages/options/tiktok/tiktok.js index 56cf93dc..8055fc95 100644 --- a/src/pages/options/tiktok/tiktok.js +++ b/src/pages/options/tiktok/tiktok.js @@ -4,24 +4,12 @@ import commonHelper from "../../../assets/javascripts/helpers/common.js"; let disable = document.getElementById("disable-tiktok"); let protocol = document.getElementById("protocol") -let enableCustomSettings = document.getElementById("enable-custom-settings"); -let customSettingsDiv = document.getElementsByClassName("custom-settings"); - -let theme = document.getElementById('proxiTok').getElementsByClassName('theme')[0]; -let api_legacy = document.getElementById('proxiTok').getElementsByClassName('api-legacy')[0]; - -document.addEventListener("change", async () => { - await browser.storage.local.set({ +document.addEventListener("change", () => { + browser.storage.local.set({ disableTiktok: !disable.checked, tiktokProtocol: protocol.value, - - enableTiktokCustomSettings: enableCustomSettings.checked, - - proxiTokTheme: theme.value, - proxiTokApiLegacy: api_legacy.value, - }); - changeProtocolSettings(protocol.value); + changeProtocolSettings(); }) window.onblur = tiktokHelper.initProxiTokCookies; @@ -30,16 +18,11 @@ browser.storage.local.get( [ "disableTiktok", "tiktokProtocol", - - "enableTiktokCustomSettings", - - "proxiTokTheme", - "proxiTokApiLegacy", ], r => { disable.checked = !r.disableTiktok; protocol.value = r.tiktokProtocol; - changeProtocolSettings(r.tiktokProtocol); + changeProtocolSettings(); let normalDiv = document.getElementsByClassName("normal")[0]; let torDiv = document.getElementsByClassName("tor")[0]; if (r.tiktokProtocol == 'normal') { @@ -50,33 +33,20 @@ browser.storage.local.get( normalDiv.style.display = 'none'; torDiv.style.display = 'block'; } - - enableCustomSettings.checked = r.enableTiktokCustomSettings; - if (r.enableTiktokCustomSettings) - customSettingsDiv.style.display = 'block'; - else - customSettingsDiv.style.display = 'none'; - - theme.value = r.proxiTokTheme; - api_legacy.value = r.proxiTokApiLegacy; } ) -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'; } - if (enableCustomSettings.checked) - for (const item of customSettingsDiv) item.style.display = 'block'; - else - for (const item of customSettingsDiv) item.style.display = 'none'; } commonHelper.processDefaultCustomInstances('tiktok', 'proxiTok', 'normal', document); diff --git a/src/pages/options/tiktok/tiktok.pug b/src/pages/options/tiktok/tiktok.pug index 31ae18df..528f6ae2 100644 --- a/src/pages/options/tiktok/tiktok.pug +++ b/src/pages/options/tiktok/tiktok.pug @@ -17,30 +17,9 @@ body.option(dir="auto") select#protocol option(value="normal" data-localise="__MSG_normal__") Normal option(value="tor" data-localise="__MSG_tor__") Tor - - .some-block.option-block - h4(data-localise="__MSG_enableCustomSettings__") Enable Custom Settings (will use cookies) - input#enable-custom-settings(type="checkbox") #proxiTok hr - .custom-settings - .some-block.option-block - h2 General - .some-block.option-block - h4(data-localise="__MSG_theme__") Theme - select.theme - option(value="default") Default - option(value="card") Card - - .some-block.option-block - h2 Api - .some-block.option-block - h4(data-localise="__MSG_legacyMode__") Legacy mode - select.api-legacy - option(value="on") On - option(value="off") Off - .normal include ../../widgets/instances.pug +instances('https://proxitok.com') -- cgit 1.4.1