Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inbox / Cart Badges #267

Merged
merged 3 commits into from
Jan 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions css/dark-theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5908,4 +5908,12 @@
background: var(--headers) !important;
}

div.rnf-unseen-badge {
background: var(--skittle-wantlist) !important;

span.rnf-unseen-badge__count {
color: var(--white) !important;
}
}

}
15 changes: 8 additions & 7 deletions js/extension/features/shopping-spree-mode-new.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,19 +101,20 @@ rl.ready(() => {
if (res.ok) {

let selector = 'nav[class*="_user"] a[href^="/sell/cart"]',
cartTotal = document.querySelector(selector),
cartIcon = cartTotal.querySelector('svg').cloneNode(true),
cartTotal = document.querySelector(selector + ' .rnf-unseen-badge__count'),
currentCartTotal = Number(cartTotal?.textContent?.trim()) || 0,
newCartTotal = currentCartTotal + 1;

if (!cartTotal) {
document.querySelector(selector + ' div').className = 'rnf-unseen-badge';
document.querySelector(selector + ' div span').className = 'rnf-unseen-badge__count';
}

showInCartStatus(addToCartButton);

let totalText = document.createTextNode(newCartTotal),
toolTipId = document.querySelector(selector).getAttribute('aria-describedby');
let toolTipId = document.querySelector(selector).getAttribute('aria-describedby');
// Update total in header
cartTotal.textContent = '';
cartTotal.appendChild(cartIcon);
cartTotal.appendChild(totalText);
document.querySelector(selector + ' .rnf-unseen-badge__count').textContent = newCartTotal;
// Update tooltip
document.getElementById(toolTipId).textContent = `${newCartTotal} ${tooltipTranslations[language]}`;
// Update the sellersInCart data to work with
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "Discogs Enhancer",
"short_name": "Discogs Enhancer",
"description": "Adds a dark theme, block sellers, price comparisons, currency converter, configurable quick search, & more to Discogs!",
"version": "3.6.6",
"version": "3.6.7",
"author": "Matthew Salcido",
"homepage_url": "https://www.discogs-enhancer.com",
"action": {
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "discogs-enhancer",
"version": "3.6.6",
"version": "3.6.7",
"description": "A Chrome extension that adds useful functionality to Discogs.com! https://www.discogs-enhancer.com",
"main": "index.js",
"scripts": {
Expand Down
Loading