optimize technical truth

This commit is contained in:
team 1
2026-04-29 17:42:37 +02:00
parent 06f192b28a
commit 19c0f612dc
10 changed files with 454 additions and 307 deletions

View File

@@ -482,11 +482,49 @@ document.addEventListener('DOMContentLoaded', () => {
});
}
function canonicalRetriexSourceChipKey(value) {
return String(value || '')
.replace(/\u00a0/g, ' ')
.replace(/[‐‑‒–—]/g, '-')
.replace(/\s+/g, ' ')
.trim()
.toLowerCase()
.replace(/[^\p{L}\p{N}]+/gu, '');
}
function deduplicateRetriexSourceChips(container) {
if (!container) {
return;
}
container.querySelectorAll('.retriex-source-overview__badges').forEach((badgeGroup) => {
const seen = new Set();
badgeGroup.querySelectorAll('.retriex-source-chip').forEach((chip) => {
let key = canonicalRetriexSourceChipKey(chip.textContent);
if (key === 'shopsystem' || key === 'liveshopdaten') {
chip.textContent = 'Live-Shopdaten';
key = 'liveshopdaten';
}
if (seen.has(key)) {
chip.remove();
return;
}
seen.add(key);
});
});
}
function deduplicateRetriexMetaCards(container) {
if (!container) {
return;
}
deduplicateRetriexSourceChips(container);
const cards = Array.from(container.querySelectorAll('.retriex-meta-card[data-retriex-meta-id]'));
const cardsById = new Map();