Skip to content

Commit

Permalink
Added proper title for final price
Browse files Browse the repository at this point in the history
  • Loading branch information
keybraker committed Dec 14, 2023
1 parent 9b1f6cf commit f052d64
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 6 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,6 @@ output
tsconfig.tsbuildinfo

# build
/build
/build

webpack.zip
9 changes: 6 additions & 3 deletions src/background.ts
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -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() {
Expand All @@ -50,6 +52,7 @@ const btsIndicator = new PriceCheckerIndicator(state);
async function flagAdditionalContent() {
toggleContentVisibility(state);
await btsIndicator.start();
await correctFinalPrice.start();
}

function observeMutations() {
Expand Down
18 changes: 18 additions & 0 deletions src/decorators/CorrectFinalPrice.ts
Original file line number Diff line number Diff line change
@@ -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)" : " (με αντικαταβολή)";
}
}
}
2 changes: 1 addition & 1 deletion src/manifest_chrome.json
Original file line number Diff line number Diff line change
@@ -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": [
Expand Down
2 changes: 1 addition & 1 deletion src/manifest_firefox.json
Original file line number Diff line number Diff line change
@@ -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": [
Expand Down

0 comments on commit f052d64

Please sign in to comment.