optimize technical truth
This commit is contained in:
@@ -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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user