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.
This commit is contained in:
Frederico Santos 2024-07-28 18:10:54 +01:00 committed by GitHub
parent 8a883ea079
commit 2e6f6fe729
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 25 additions and 6 deletions

View File

@ -39,6 +39,7 @@
</style>
<link rel="stylesheet" type="text/css" href="./index.css" />
<link rel="manifest" href="./manifest.webmanifest">
<script type="text/javascript" src="https://app.termly.io/resource-blocker/c5dbfa2f-9723-4c0f-a84b-2895124e851f?autoBlock=on"></script>
<script>
if ("serviceWorker" in navigator) {
window.addEventListener("load", function () {
@ -116,6 +117,10 @@
<script type="module" src="./src/main.ts"></script>
<script src="./src/touch-controls.ts" type="module"></script>
<script src="./src/debug.js" type="module"></script>
<a href="#" class="termly-display-preferences" style="display: none;">Consent Preferences</a>
<a href="https://app.termly.io/policy-viewer/policy.html?policyUUID=bc96778b-3f04-4d25-bafc-0deba53e8bec">Privacy Policy</a>
<a href="https://app.termly.io/policy-viewer/policy.html?policyUUID=8b523c05-7ec2-4646-9534-5bd61b386e2a">Cookie Disclaimer</a>
<a href="https://app.termly.io/policy-viewer/policy.html?policyUUID=b01e092a-9721-477f-8356-45576702ff9e">Terms & Conditions</a>
<a href="https://app.termly.io/policy-viewer/policy.html?policyUUID=3b5d1928-3f5b-4ee1-b8df-2d6c276b0bcc">Acceptable Use Policy</a>
</body>
</html>

View File

@ -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,