From 077adefd4f3ee33293e4feb4b96b0542ca5186ec Mon Sep 17 00:00:00 2001 From: Matthew Salcido Date: Tue, 19 Aug 2025 16:17:15 -0700 Subject: [PATCH 1/6] Add dashboard notice feature --- js/extension/dependencies/resource-library.js | 38 ++++++++ .../features/dashboard-notification.js | 88 +++++++++++++++++++ js/extension/user-preferences.js | 16 +++- 3 files changed, 138 insertions(+), 4 deletions(-) create mode 100644 js/extension/features/dashboard-notification.js diff --git a/js/extension/dependencies/resource-library.js b/js/extension/dependencies/resource-library.js index 8a1ad106..6ed9dd07 100644 --- a/js/extension/dependencies/resource-library.js +++ b/js/extension/dependencies/resource-library.js @@ -1011,6 +1011,44 @@ } }, + /** + * Set a cookie + * + * @param {string} name - The name of the cookie + * @param {string} value - The value of the cookie + * @param {Object} [options] - Optional settings + * @param {number} [options.days] - Number of days until the cookie expires + * @param {string} [options.path] - The path where the cookie is valid (default: "/") + * @param {string} [options.domain] - The domain for the cookie + * @param {boolean} [options.secure] - Whether the cookie should only be sent over HTTPS + * @param {boolean} [options.sameSite] - "Strict", "Lax", or "None" + */ + setCookie: function(name, value, options = {}) { + let cookieString = `${encodeURIComponent(name)}=${encodeURIComponent(value)}`; + + if (options.days) { + const date = new Date(); + date.setTime(date.getTime() + options.days * 24 * 60 * 60 * 1000); + cookieString += `; expires=${date.toUTCString()}`; + } + + cookieString += `; path=${options.path || '/'}`; + + if (options.domain) { + cookieString += `; domain=${options.domain}`; + } + + if (options.secure) { + cookieString += '; secure'; + } + + if (options.sameSite) { + cookieString += `; samesite=${options.sameSite}`; + } + + document.cookie = cookieString; + }, + /** * Convenience method so I don't forget to stringify * my values before setting them. diff --git a/js/extension/features/dashboard-notification.js b/js/extension/features/dashboard-notification.js new file mode 100644 index 00000000..3abc2dc3 --- /dev/null +++ b/js/extension/features/dashboard-notification.js @@ -0,0 +1,88 @@ +rl.ready(() => { + + if ( rl.pageIs('dashboard') ) { + + let dashboard = document.querySelector('#page_aside ul.module_blocks.right'), + forumPost = 'https://www.discogs.com/group/thread/1133832', + isAdmin = window.dsdata().userIsAdmin, + cookieName = 'de-subscription-notice', + cookie = rl.getCookie(cookieName); + + let rules = /* css */` + .de-dashboard-notification { + --bg-col: #ffffff; + } + .de-dark-theme .de-dashboard-notification { + --bg-col: var(--main-bg-color); + } + .de-dashboard-notification .alert-message { + background: radial-gradient(circle at 100% 100%, var(--bg-col) 0, var(--bg-col) 8px, transparent 8px) 0% 0%/10px 10px no-repeat, + radial-gradient(circle at 0 100%, var(--bg-col) 0, var(--bg-col) 8px, transparent 8px) 100% 0%/10px 10px no-repeat, + radial-gradient(circle at 100% 0, var(--bg-col) 0, var(--bg-col) 8px, transparent 8px) 0% 100%/10px 10px no-repeat, + radial-gradient(circle at 0 0, var(--bg-col) 0, var(--bg-col) 8px, transparent 8px) 100% 100%/10px 10px no-repeat, + linear-gradient(var(--bg-col), var(--bg-col)) 50% 50%/calc(100% - 4px) calc(100% - 20px) no-repeat, + linear-gradient(var(--bg-col), var(--bg-col)) 50% 50%/calc(100% - 20px) calc(100% - 4px) no-repeat, + repeating-linear-gradient(45deg, #8848e0 0%, #c848e0 25%, #fe6e01 50%, rgba(245, 181, 65, 1) 75%, #efec73 100%) no-repeat; + border-radius: 10px; + padding: 16px; + box-sizing: content-box; + } + + .de-close-icon { + float: right; + height: 22px; + text-decoration: none; + font-size: 18px; + font-weight: bold; + color: #000; + background: none; + border: none; + padding: 0px; + } + + .de-dark-theme .de-dashboard-notification .alert-message a.de-learn-more { + color: var(--link) !important; + } + `; + + let markup = /* html */` +
+
+
+ + + + + + + + + A Message from Discogs Enhancer + + + + + A Message from Discogs Enhancer +
+ Discogs Enhancer will soon require a subscription plan. The move to a paid model is necessary due to the amount of work now required to support this extension across the entirety of Discogs. Learn more. +
+
+
+
+ `; + + document.body.addEventListener('click', (event) => { + if ( event.target.classList.contains('de-close-icon') + || event.target.classList.contains('icon-times') ) { + + rl.setCookie(cookieName, 'true', { days: 180 }); + document.querySelector('.de-dashboard-notification').style.display = 'none'; + } + }); + + if (!isAdmin && !cookie) { + rl.attachCss('de-notification', rules); + dashboard.insertAdjacentHTML('afterbegin', markup); + } + } +}); diff --git a/js/extension/user-preferences.js b/js/extension/user-preferences.js index cc6393b9..3ea6e5a6 100644 --- a/js/extension/user-preferences.js +++ b/js/extension/user-preferences.js @@ -146,7 +146,7 @@ function migratePreferences() { } /** - * docuemnt.readyState check via promise + * document.readyState check via promise * @returns {Promise} */ function documentReady(document) { @@ -210,7 +210,7 @@ function getCurrentFilterState(prefs) { } /** - * Gets the specified cookie. Used for retreving the username + * Gets the specified cookie. Used for retrieving the username * @param {string} name - The name of the cookie * @returns {string} */ @@ -220,10 +220,10 @@ window.getCookie = function (name) { }; // ======================================================== -// Script Appension +// Script Appending // ======================================================== -// Dark Theme CSS is automatically appened via manifest.json on 'document_start' +// Dark Theme CSS is automatically appended via manifest.json on 'document_start' document.documentElement.classList.add('de-dark-theme', 'de-enabled'); // Get the user's preferences (preferences are created on install in background.js) @@ -280,6 +280,14 @@ appendFragment([resourceLibrary]) // Preference-agnostic scripts (always appended) // ======================================================== + // Dashboard Notification + let dashboardNotification = document.createElement('script'); + dashboardNotification.type = 'text/javascript'; + dashboardNotification.className = 'de-init'; + dashboardNotification.src = chrome.runtime.getURL('js/extension/features/dashboard-notification.js'); + + elems.push(dashboardNotification); + // GraphQL Hashes hashes = document.createElement('script'); hashes.type = 'text/javascript'; From e9cb2600884a4f1c7e04f4019cd4ffb1cb19b3c4 Mon Sep 17 00:00:00 2001 From: Matthew Salcido Date: Wed, 20 Aug 2025 09:04:11 -0700 Subject: [PATCH 2/6] Hide donation links --- css/popup/learn.css | 3 ++- css/popup/popup.scss | 4 ++++ html/learn.html | 25 +------------------------ html/popup.html | 4 ++-- js/extension/features/donate-modal.js | 2 +- 5 files changed, 10 insertions(+), 28 deletions(-) diff --git a/css/popup/learn.css b/css/popup/learn.css index bf33c089..a274919e 100644 --- a/css/popup/learn.css +++ b/css/popup/learn.css @@ -209,7 +209,7 @@ select { width: 100%; display: flex; flex-direction: row; - justify-content: space-between; + justify-content: space-evenly; } .sidebar .info-box .nav a { @@ -704,6 +704,7 @@ figcaption { } .paypal { + display: none; background: #ffc439; border-radius: 4px; color: #000; diff --git a/css/popup/popup.scss b/css/popup/popup.scss index 8a66c0bc..990cf2aa 100644 --- a/css/popup/popup.scss +++ b/css/popup/popup.scss @@ -336,6 +336,10 @@ input[type="checkbox"]:focus { padding: 0 20px; } +#rate { + display: none; +} + /* Filter Marketplace Items by Condition */ /*sub-menu*/ .hide-condition, diff --git a/html/learn.html b/html/learn.html index bee33007..de47f9a5 100644 --- a/html/learn.html +++ b/html/learn.html @@ -36,7 +36,7 @@

Discogs Enhancer

- -

Open Source Discogs Enhancer is an open source project. You can find the code here on GitHub: https://github.com/salcido/discogs-enhancer

diff --git a/html/popup.html b/html/popup.html index a7083bda..a8760508 100644 --- a/html/popup.html +++ b/html/popup.html @@ -1496,8 +1496,8 @@

⚠️     Extension Issues      diff --git a/js/extension/features/donate-modal.js b/js/extension/features/donate-modal.js index 79ddd437..9260c206 100644 --- a/js/extension/features/donate-modal.js +++ b/js/extension/features/donate-modal.js @@ -31,7 +31,7 @@ rl.ready(() => { const disclaimer = 'This message is shown once a year'; - const url = 'https://www.paypal.com/donate/?business=SQ4MHRDMMJQHQ&no_recurring=0&item_name=Thank+you+for+supporting+Discogs+Enhancer!¤cy_code=USD'; + const url = ''; const modal = `
From 1dfd68a1f41803096b070749f270942f1355c086 Mon Sep 17 00:00:00 2001 From: Matthew Salcido Date: Wed, 20 Aug 2025 09:04:18 -0700 Subject: [PATCH 3/6] Update notification copy --- js/extension/features/dashboard-notification.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/extension/features/dashboard-notification.js b/js/extension/features/dashboard-notification.js index 3abc2dc3..60a60490 100644 --- a/js/extension/features/dashboard-notification.js +++ b/js/extension/features/dashboard-notification.js @@ -64,7 +64,7 @@ rl.ready(() => { A Message from Discogs Enhancer
- Discogs Enhancer will soon require a subscription plan. The move to a paid model is necessary due to the amount of work now required to support this extension across the entirety of Discogs. Learn more. + Discogs Enhancer will soon be moving to a subscription model. This change is necessary to support the growing amount of work required to keep the extension running across all areas of Discogs. Learn more.

From 2753feebf6a4f6eb4b03ccdfa213cf91994069c0 Mon Sep 17 00:00:00 2001 From: Matthew Salcido Date: Thu, 21 Aug 2025 06:42:32 -0700 Subject: [PATCH 4/6] Update user-preferences.js --- js/extension/user-preferences.js | 1 + 1 file changed, 1 insertion(+) diff --git a/js/extension/user-preferences.js b/js/extension/user-preferences.js index 3ea6e5a6..a0b069a1 100644 --- a/js/extension/user-preferences.js +++ b/js/extension/user-preferences.js @@ -265,6 +265,7 @@ appendFragment([resourceLibrary]) // https://github.com/salcido/discogs-enhancer/issues/14 if (!window.location.href.includes('www') || window.location.href.includes('/order/prints?') + || window.location.href.includes('merch.discogs.com') || window.location.href.includes('discogs.com/company') || window.location.href.includes('discogs.com/selling') || window.location.href.includes('/company/careers') From cb9c7585cbef50beba91f1a8c33ecafe03d423e8 Mon Sep 17 00:00:00 2001 From: Matthew Salcido Date: Thu, 21 Aug 2025 07:26:45 -0700 Subject: [PATCH 5/6] Update thread link --- html/learn.html | 2 +- js/extension/features/dashboard-notification.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/html/learn.html b/html/learn.html index de47f9a5..6e015773 100644 --- a/html/learn.html +++ b/html/learn.html @@ -46,7 +46,7 @@

Discogs Enhancer

-

Announcement:Many features no longer work with the new Shop My Wants Marketplace. It will take a significant amount of work to get things back in order. I've written a post in the DE group with more details. Please take a moment to read it and give feedback if you like. Thank you!

+

Announcement:Discogs Enhancer will soon be moving to a subscription model. This change is necessary to support the growing amount of work required to keep the extension running across all areas of Discogs. Learn More.

diff --git a/js/extension/features/dashboard-notification.js b/js/extension/features/dashboard-notification.js index 60a60490..bf617288 100644 --- a/js/extension/features/dashboard-notification.js +++ b/js/extension/features/dashboard-notification.js @@ -3,7 +3,7 @@ rl.ready(() => { if ( rl.pageIs('dashboard') ) { let dashboard = document.querySelector('#page_aside ul.module_blocks.right'), - forumPost = 'https://www.discogs.com/group/thread/1133832', + forumPost = 'https://www.discogs.com/group/thread/1136261', isAdmin = window.dsdata().userIsAdmin, cookieName = 'de-subscription-notice', cookie = rl.getCookie(cookieName); @@ -40,7 +40,7 @@ rl.ready(() => { padding: 0px; } - .de-dark-theme .de-dashboard-notification .alert-message a.de-learn-more { + .de-dark-theme .de-dashboard-notification .alert-message-announcement.alert-message .alert-message-text a.de-learn-more { color: var(--link) !important; } `; From 042d536fbec70bdf026d0850d383f26e51f8069e Mon Sep 17 00:00:00 2001 From: Matthew Salcido Date: Thu, 21 Aug 2025 07:26:58 -0700 Subject: [PATCH 6/6] Version bump to 3.12.1 --- package-lock.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 6a30826d..3e28a07a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "discogs-enhancer", - "version": "3.12.0", + "version": "3.12.1", "lockfileVersion": 2, "requires": true, "packages": { diff --git a/package.json b/package.json index a9708569..fe7ef23d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "discogs-enhancer", - "version": "3.12.0", + "version": "3.12.1", "description": "A web extension that adds useful functionality to Discogs.com! https://www.discogs-enhancer.com", "main": "index.js", "scripts": {