From f052d6407508d7b7b4cf162698b4899b9e304927 Mon Sep 17 00:00:00 2001 From: "ryzenbeast\\Ioannis Tsiakkas" Date: Thu, 14 Dec 2023 20:18:05 +0200 Subject: [PATCH] Added proper title for final price --- .gitignore | 4 +++- src/background.ts | 9 ++++++--- src/decorators/CorrectFinalPrice.ts | 18 ++++++++++++++++++ src/manifest_chrome.json | 2 +- src/manifest_firefox.json | 2 +- 5 files changed, 29 insertions(+), 6 deletions(-) create mode 100644 src/decorators/CorrectFinalPrice.ts diff --git a/.gitignore b/.gitignore index ec18b2f..fa987f6 100644 --- a/.gitignore +++ b/.gitignore @@ -13,4 +13,6 @@ output tsconfig.tsbuildinfo # build -/build \ No newline at end of file +/build + +webpack.zip \ No newline at end of file diff --git a/src/background.ts b/src/background.ts index 3e09c5b..d5736cf 100644 --- a/src/background.ts +++ b/src/background.ts @@ -1,15 +1,16 @@ +import { toggleContentVisibility } from "./actions/visibilityAction"; +import { BlockIndicator } from "./decorators/BlockIndicator"; +import { CorrectFinalPrice } from "./decorators/CorrectFinalPrice"; +import { PriceCheckerIndicator } from "./decorators/PriceCheckerIndicator"; import { Language } from "./enums/Language"; import { PromotionalVideoHandler } from "./handlers/promotionalVideoHandler"; import { SponsoredFBTHandler } from "./handlers/sponsoredFBTHandler"; import { SponsoredProductHandler } from "./handlers/sponsoredProductHandler"; import { SponsoredProductListHandler } from "./handlers/sponsoredProductListHandler"; import { SponsoredShelfHandler } from "./handlers/sponsoredShelfHandler"; -import { toggleContentVisibility } from "./actions/visibilityAction"; import { retrieveLanguage } from "./retrievers/languageRetriever"; import { retrieveVisibility } from "./retrievers/visibilityRetriever"; import { State } from "./types/State"; -import { BlockIndicator } from "./decorators/BlockIndicator"; -import { PriceCheckerIndicator } from "./decorators/PriceCheckerIndicator"; const state: State = { visible: true, @@ -27,6 +28,7 @@ const sponsoredFBTHandler = new SponsoredFBTHandler(state); const blockIndicator = new BlockIndicator(state); const btsIndicator = new PriceCheckerIndicator(state); +const correctFinalPrice = new CorrectFinalPrice(state); (function () { async function initializer() { @@ -50,6 +52,7 @@ const btsIndicator = new PriceCheckerIndicator(state); async function flagAdditionalContent() { toggleContentVisibility(state); await btsIndicator.start(); + await correctFinalPrice.start(); } function observeMutations() { diff --git a/src/decorators/CorrectFinalPrice.ts b/src/decorators/CorrectFinalPrice.ts new file mode 100644 index 0000000..16a90d5 --- /dev/null +++ b/src/decorators/CorrectFinalPrice.ts @@ -0,0 +1,18 @@ +import { Language } from "../enums/Language"; +import { State } from "../types/State"; + +export class CorrectFinalPrice { + private state: State; + + constructor(state: State) { + this.state = state; + } + + public async start() { + const finalPriceLabel = document.querySelector("label.toggle-switch-label"); + + if (finalPriceLabel) { + finalPriceLabel.textContent += this.state.language === Language.ENGLISH ? " (with cash on delivery)" : " (με αντικαταβολή)"; + } + } +} diff --git a/src/manifest_chrome.json b/src/manifest_chrome.json index 35c84b7..2835d76 100644 --- a/src/manifest_chrome.json +++ b/src/manifest_chrome.json @@ -1,7 +1,7 @@ { "name": "reSkroutzed", "description": "Flags sponsored products on Skroutz.gr", - "version": "1.5.9", + "version": "1.6.0", "manifest_version": 3, "permissions": [], "host_permissions": [ diff --git a/src/manifest_firefox.json b/src/manifest_firefox.json index 40b30d5..156ea71 100644 --- a/src/manifest_firefox.json +++ b/src/manifest_firefox.json @@ -1,7 +1,7 @@ { "name": "reSkroutzed", "description": "Flags sponsored products on Skroutz.gr", - "version": "1.5.9", + "version": "1.6.0", "manifest_version": 3, "permissions": [], "host_permissions": [