front: hide everything related to plausible if it's disabled

This commit is contained in:
wukko 2024-03-16 23:33:33 +06:00
parent 49ef0b4e8b
commit 25aa2fb609
2 changed files with 24 additions and 15 deletions

View file

@ -564,8 +564,13 @@ function loadSettings() {
eid("cobalt-body").classList.add('no-animation'); eid("cobalt-body").classList.add('no-animation');
} }
for (let i = 0; i < checkboxes.length; i++) { for (let i = 0; i < checkboxes.length; i++) {
try {
if (sGet(checkboxes[i]) === "true") eid(checkboxes[i]).checked = true; if (sGet(checkboxes[i]) === "true") eid(checkboxes[i]).checked = true;
} }
catch {
console.error(`checkbox ${checkboxes[i]} failed to initialize`)
}
}
for (let i in switchers) { for (let i in switchers) {
changeSwitcher(i, sGet(i)) changeSwitcher(i, sGet(i))
} }

View file

@ -168,10 +168,9 @@ export default function(obj) {
}, { }, {
name: "privacy", name: "privacy",
title: `${emoji("🔒")} ${t("CollapsePrivacy")}`, title: `${emoji("🔒")} ${t("CollapsePrivacy")}`,
body: t("PrivacyPolicy") body: t("PrivacyPolicy") + `${
+ `<br>` process.env.PLAUSIBLE_HOSTNAME ? `<br><br>${t("AnalyticsDescription")}` : ''
+ `<br>` }`
+ t("AnalyticsDescription")
}, { }, {
name: "legal", name: "legal",
title: `${emoji("📑")} ${t("CollapseLegal")}`, title: `${emoji("📑")} ${t("CollapseLegal")}`,
@ -499,7 +498,9 @@ export default function(obj) {
padding: "no-margin" padding: "no-margin"
}]) }])
}) })
+ settingsCategory({ + (() => {
if (process.env.PLAUSIBLE_HOSTNAME) {
return settingsCategory({
name: "privacy", name: "privacy",
title: t('PrivateAnalytics'), title: t('PrivateAnalytics'),
body: checkbox([{ body: checkbox([{
@ -509,6 +510,9 @@ export default function(obj) {
}]) }])
+ explanation(t('SettingsAnalyticsExplanation')) + explanation(t('SettingsAnalyticsExplanation'))
}) })
}
return ''
})()
+ settingsCategory({ + settingsCategory({
name: "miscellaneous", name: "miscellaneous",
title: t('Miscellaneous'), title: t('Miscellaneous'),