From 3d9082d7f3724d473eb1455dafeaaa13cc786860 Mon Sep 17 00:00:00 2001 From: Ioannis Tsiakkas Date: Sun, 26 Nov 2023 09:00:30 +0200 Subject: [PATCH] Fix CSS styles and update manifest version --- src/css/flaggerToggle.css | 3 --- src/css/style.css | 18 +++++++++--------- src/handlers/sponsoredProductHandler.ts | 4 ++-- src/manifest_chrome.json | 2 +- src/manifest_firefox.json | 2 +- src/utilities/sponsoredUtil.ts | 7 ++++--- 6 files changed, 17 insertions(+), 19 deletions(-) diff --git a/src/css/flaggerToggle.css b/src/css/flaggerToggle.css index c4fb4fb..1e4ff2b 100644 --- a/src/css/flaggerToggle.css +++ b/src/css/flaggerToggle.css @@ -13,9 +13,6 @@ .flagger-toggle-product { - display: flex; - align-items: center; - justify-content: center; margin: 8px 16px 16px 0px !important; padding: 9px 17px !important; display: flex !important; diff --git a/src/css/style.css b/src/css/style.css index fe85e19..1507b47 100644 --- a/src/css/style.css +++ b/src/css/style.css @@ -32,7 +32,6 @@ .align-end { text-align: end !important; - /* font-style: italic !important; */ } text-black { @@ -46,8 +45,9 @@ text-black { .sponsored-label, .flagged-list-title, .label-text { - border-radius: 5px !important; - padding: 2px 6px 2px !important; + border-radius: 2px !important; + padding: 8px 12px !important; + background-color: #ffdbdf !important; font-weight: bold !important; color: red !important; @@ -60,21 +60,21 @@ text-black { } .info-label-positive { - border: 1px solid var(--color-text-success-default) !important; /* Updated to use variable */ + border: 1px solid var(--color-text-success-default) !important; line-height: 1.4 !important; font-size: 16px !important; font-weight: 500 !important; - background-color: var(--color-background-success-weak) !important; /* Updated to use variable */ - color: var(--color-text-success-default) !important; /* Updated to use variable */ + background-color: var(--color-background-success-weak) !important; + color: var(--color-text-success-default) !important; } .info-label-negative { - border: 1px solid var(--custom-light-red, #ff0000) !important; /* Existing implementation */ + border: 1px solid var(--custom-light-red, #ff0000) !important; line-height: 1.4 !important; font-size: 16px !important; font-weight: 500 !important; - background-color: var(--color-background-accent-weak) !important; /* Matches existing color */ - color: var(--color-text-accent-default) !important; /* Matches existing color */ + background-color: var(--color-background-accent-weak) !important; + color: var(--color-text-accent-default) !important; } .sponsored-label svg, diff --git a/src/handlers/sponsoredProductHandler.ts b/src/handlers/sponsoredProductHandler.ts index 48f590f..7417685 100644 --- a/src/handlers/sponsoredProductHandler.ts +++ b/src/handlers/sponsoredProductHandler.ts @@ -51,11 +51,11 @@ export class SponsoredProductHandler { private hasSponsoredLabelText(listItem: Element): boolean { const labelTextElement = listItem.querySelector(".label-text"); - return !!labelTextElement && isSponsored(labelTextElement); + return isSponsored(labelTextElement); } private hasFlaggedLabelText(listItem: Element): boolean { const labelTextElement = listItem.querySelector(".label-text"); - return !!labelTextElement && isFlagged(labelTextElement); + return isFlagged(labelTextElement); } } diff --git a/src/manifest_chrome.json b/src/manifest_chrome.json index 10172d1..18ff865 100644 --- a/src/manifest_chrome.json +++ b/src/manifest_chrome.json @@ -1,7 +1,7 @@ { "name": "Skroutz Sponsored Flagger", "description": "Flags sponsored products on Skroutz.gr", - "version": "1.5.6", + "version": "1.5.7", "manifest_version": 3, "permissions": [], "content_scripts": [ diff --git a/src/manifest_firefox.json b/src/manifest_firefox.json index 165c4d1..28ae661 100644 --- a/src/manifest_firefox.json +++ b/src/manifest_firefox.json @@ -1,7 +1,7 @@ { "name": "Skroutz Sponsored Flagger", "description": "Flags sponsored products on Skroutz.gr", - "version": "1.5.6", + "version": "1.5.7", "manifest_version": 3, "permissions": [], "content_scripts": [ diff --git a/src/utilities/sponsoredUtil.ts b/src/utilities/sponsoredUtil.ts index 9d873e8..bcc04cd 100644 --- a/src/utilities/sponsoredUtil.ts +++ b/src/utilities/sponsoredUtil.ts @@ -49,8 +49,8 @@ export function updateSponsoredTextSingle( } } -export function isSponsored(element: Element | null) { - if (!element || !element?.textContent) { +export function isSponsored(element: Element | null): boolean { + if (!element || !element.textContent) { return false; } @@ -64,5 +64,6 @@ export function isSponsored(element: Element | null) { "Sponsored", ]; - return sponsoredTexts.includes(element.textContent); + return sponsoredTexts.includes(element.textContent.trim()); } +