From 2e6f6fe729a224438cdc3a26caf8ae69d0c0fcf2 Mon Sep 17 00:00:00 2001 From: Frederico Santos Date: Sun, 28 Jul 2024 18:10:54 +0100 Subject: [PATCH] chore: Add Termly consent preferences and policies links (#3187) * chore: Add Termly consent preferences and policies links Added Termly consent preferences link and links to Privacy Policy, Cookie Disclaimer, Terms & Conditions, and Acceptable Use Policy in the HTML file. Also included a script for blocking resources from Termly. * feat: Add consent preferences menu option This commit adds a new menu option for "Consent Preferences" in the UI. When clicked, it triggers a click event on the consent link element and focuses on it. This allows users to easily access and manage their consent preferences. --- index.html | 7 ++++++- src/ui/menu-ui-handler.ts | 24 +++++++++++++++++++----- 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/index.html b/index.html index 3722bdd3422..0634385f38b 100644 --- a/index.html +++ b/index.html @@ -39,6 +39,7 @@ + + + Privacy Policy + Cookie Disclaimer + Terms & Conditions + Acceptable Use Policy - \ No newline at end of file diff --git a/src/ui/menu-ui-handler.ts b/src/ui/menu-ui-handler.ts index 88c9791c689..a0cea2f78d5 100644 --- a/src/ui/menu-ui-handler.ts +++ b/src/ui/menu-ui-handler.ts @@ -193,17 +193,31 @@ export default class MenuUiHandler extends MessageUiHandler { handler: () => { this.scene.gameData.tryExportData(GameDataType.SYSTEM); return true; + } + }, + { + label: "Consent Preferences", + handler: () => { + const consentLink = document.querySelector(".termly-display-preferences") as HTMLInputElement; + const clickEvent = new MouseEvent("click", { + view: window, + bubbles: true, + cancelable: true + }); + consentLink.dispatchEvent(clickEvent); + consentLink.focus(); + return true; }, keepOpen: true - }); - manageDataOptions.push({ + }, + { label: i18next.t("menuUiHandler:cancel"), handler: () => { this.scene.ui.revertMode(); return true; - } - } - ); + }, + keepOpen: true + }); this.manageDataConfig = { xOffset: 98,