From df9ae590a6097ef6b7357213ad6be1210ab7d808 Mon Sep 17 00:00:00 2001 From: Matthew Salcido Date: Wed, 6 Nov 2024 08:02:40 -0800 Subject: [PATCH 01/10] Styles for Cards --- css/dark-theme.scss | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/css/dark-theme.scss b/css/dark-theme.scss index ce818d9e..96373721 100644 --- a/css/dark-theme.scss +++ b/css/dark-theme.scss @@ -6258,7 +6258,35 @@ color: var(--text-muted) !important; } + figure[class*="card_"] { + border-color: var(--borders) !important; + box-shadow: 0 4px 8px -2px var(--box-shadow-light); + } + figcaption { + div[class*="_concatenatedLinks"] span a { + color: var(--text-muted) !important; + } + div[class*="_released"] span { + color: var(--text-muted) !important; + } + div[class*="_format"] { + border-top: 1px solid var(--borders) !important; + } + div[class*="_format"] svg path { + fill: var(--text-muted) !important; + } + } + + div[class*="searchBarContainer_"] { + border: none !important; + background: none !important; + } + [class*="searchInputContainer_"] { + [class*="_button"] { + background: var(--filter-chip) !important; + } + } [class*="collectionListContainer_"] { [class*="searchContainer_"] { From be72d224c26b51a2046d082b30600d4d81a981d2 Mon Sep 17 00:00:00 2001 From: Matthew Salcido Date: Wed, 6 Nov 2024 08:02:47 -0800 Subject: [PATCH 02/10] Update learn.html --- html/learn.html | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/html/learn.html b/html/learn.html index c19d9e37..41528f22 100644 --- a/html/learn.html +++ b/html/learn.html @@ -311,12 +311,6 @@

Editing Notepad

This feaure was developed by ToastyMallows!

-
-

Everlasting Collection

- -

The Everlasting Collection feature enables seamless scrolling through your Collection without the need to click 'Prev' or 'Next' buttons, as long as you are using the 'Text With Covers' or 'Text Only' layouts. This allows for a more convenient and continuous browsing experience.

-
-

Everlasting Marketplace

@@ -465,12 +459,6 @@

Hide Min, Median, Max Columns

This hides the Min, Median, Max columns in the collection page. Helpful if you'd like more space when viewing your collection.

- -
-

Improved Collection UI

-

This makes the Collection page a little more organized by moving some links around and colorizing the Move Selected and Remove Selected buttons.

-
-

Inventory Ratings

@@ -579,7 +567,7 @@

Artists

Any release link, thumbnail, or list.

Collection

-

Any release link or thumbnail.

+

Any release text link.

Dashboard

Any link inside a dashboard module.

@@ -949,6 +937,7 @@

Thank You

  • Andy G.
  • Archibald P.
  • Arturo S.
  • +
  • Bart
  • Bob P.
  • Borys S.
  • Brad S.
  • From a907a61f76e0702f1ce5ec02703f419dcb6d718d Mon Sep 17 00:00:00 2001 From: Matthew Salcido Date: Wed, 6 Nov 2024 08:03:13 -0800 Subject: [PATCH 03/10] Remove deprecated features --- html/popup.html | 49 ----- js/extension/background.js | 17 +- js/extension/features/better-collection-ui.js | 56 ----- .../features/everlasting-collection-notes.js | 150 -------------- .../everlasting-collection-ratings.js | 195 ------------------ .../features/everlasting-collection-sm-med.js | 186 ----------------- 6 files changed, 10 insertions(+), 643 deletions(-) delete mode 100644 js/extension/features/better-collection-ui.js delete mode 100644 js/extension/features/everlasting-collection-notes.js delete mode 100644 js/extension/features/everlasting-collection-ratings.js delete mode 100644 js/extension/features/everlasting-collection-sm-med.js diff --git a/html/popup.html b/html/popup.html index 96453a41..3bab1ad2 100644 --- a/html/popup.html +++ b/html/popup.html @@ -311,31 +311,6 @@

    👋 Heads up!

    - -
    -

    Everlasting Collection

    -
    Everlasting Collection Neverending Scroll Forever
    - -
    - - -
    - -
    - -
    -
    - Lets you continously scroll in your Collection without having to click "Prev" or "Next" as long as you are using the "Text With Covers" or "Text Only" layouts. - -
    -
    -
    -
    -
    -

    Everlasting Marketplace

    @@ -674,30 +649,6 @@

    👋 Heads up!

    - -
    -

    Improved Collection UI

    -
    Improved Collection UI User Interface
    - -
    - - -
    - -
    - -
    -
    - Rearranges some of the links in the Collection page. Also colorizes the Move and Remove buttons. -
    -
    -
    -
    -
    -

    diff --git a/js/extension/background.js b/js/extension/background.js index 0a56c0f3..4a7ebf87 100644 --- a/js/extension/background.js +++ b/js/extension/background.js @@ -23,7 +23,6 @@ let prefs = { blockSellers: true, confirmBeforeRemoving: false, collectionBoxFix: false, - collectionUi: false, compactArtist: false, converter: true, darkTheme: false, @@ -31,7 +30,6 @@ let prefs = { darkThemeSystemPref: false, demandIndex: false, editingNotepad: false, - everlastingCollection: false, everlastingMarket: true, favoriteSellers: true, feedback: true, @@ -293,7 +291,7 @@ chrome.contextMenus.onClicked.addListener((event) => { break; case 'clone': - path = 'https://clone.nl/search/?instock=1&query='; + path = 'https://clone.nl/all/search?query='; break; case 'decks': @@ -321,7 +319,7 @@ chrome.contextMenus.onClicked.addListener((event) => { break; case 'hardwax': - path = 'https://hardwax.com/?search='; + path = 'https://hardwax.com/?find='; break; case 'juno': @@ -355,8 +353,7 @@ chrome.contextMenus.onClicked.addListener((event) => { break; case 'rubadub': - path = 'https://rubadub.co.uk/search?type=product&options%5Bunavailable_products%5D=last&options%5Bprefix%5D=none&q='; - suffix = '*'; + path = 'https://rubadub.co.uk/search?q='; break; case 'rushhour': @@ -364,7 +361,8 @@ chrome.contextMenus.onClicked.addListener((event) => { break; case 'sotu': - path = 'https://soundsoftheuniverse.com/search/?q='; + path = 'https://soundsoftheuniverse.com/search/'; + suffix = '/'; break; case 'soundcloud': @@ -392,9 +390,14 @@ chrome.contextMenus.onClicked.addListener((event) => { encodeStr = str.replace(/ /g, '+'); } + if ( path.includes('sotu') ) { + encodeStr = str.replace(/ /g, '+'); + } + if ( path.includes('juno') ) { encodeStr = str.replace('–', ''); } + chrome.tabs.create({ url: path + encodeStr + suffix }); }); diff --git a/js/extension/features/better-collection-ui.js b/js/extension/features/better-collection-ui.js deleted file mode 100644 index 908773d1..00000000 --- a/js/extension/features/better-collection-ui.js +++ /dev/null @@ -1,56 +0,0 @@ -/** - * - * Discogs Enhancer - * - * @author: Matthew Salcido - * @website: http://www.msalcido.com - * @github: https://github.com/salcido - * - * This rearranges the UI on the collection page - * to what I think is a better layout and colors the - * Move and Remove Selected buttons. - */ - -rl.ready(() => { - - if ( rl.pageIs('collection') ) { - - let int = setInterval(() => { - - if ( document.getElementById('move_folder_id_bottom') - && document.getElementById('move_folder_id_bottom').length ) { - - clearInterval(int); - - let - bottomButtons = document.querySelector('.release_list_actions.multiple-buttons.bottom .fright'), - bottomSelectFolder = document.getElementById('move_folder_id_bottom').outerHTML, - moveButtonMarkup = document.querySelector('[name^="Action.MoveItems"]').outerHTML, - toFolderString = '  to folder:  ', - topButtons = document.querySelector('.release_list_actions.multiple-buttons.top .fright'), - topSelectFolder = document.getElementById('move_folder_id_top').outerHTML; - - // Swap the 'Move Selected' button with the 'Folder' select element on top - topButtons.innerHTML = ''; - topButtons.insertAdjacentHTML('beforeend', moveButtonMarkup); - topButtons.insertAdjacentHTML('beforeend', toFolderString); - topButtons.insertAdjacentHTML('beforeend', topSelectFolder); - // Swap the 'Move Selected' button with the 'Folder' select element on bottom - bottomButtons.innerHTML = ''; - bottomButtons.insertAdjacentHTML('beforeend', moveButtonMarkup); - bottomButtons.insertAdjacentHTML('beforeend', toFolderString); - bottomButtons.insertAdjacentHTML('beforeend', bottomSelectFolder); - - // Label the 'Folder' select element with "Current folder:" - document.querySelector('label[for="folder_top"]').textContent = 'Current folder: '; - document.querySelector('label[for="folder_bottom"]').textContent = 'Current folder: '; - // Move the 'Random Item' link over to the right - document.getElementById('random_list_form').style = 'float: right; margin-top: 11px;'; - // Make the 'Remove Selected' buttons red - [...document.querySelectorAll('.release_list_remove')].forEach(b => b.classList.add('button-red')); - // Make the 'Move Selected' buttons green - [...document.querySelectorAll('[name^="Action.MoveItems"]')].forEach(b => b.classList.add('button-green')); - } - }, 100); - } -}); diff --git a/js/extension/features/everlasting-collection-notes.js b/js/extension/features/everlasting-collection-notes.js deleted file mode 100644 index 3703e9ee..00000000 --- a/js/extension/features/everlasting-collection-notes.js +++ /dev/null @@ -1,150 +0,0 @@ -/** - * - * Discogs Enhancer - * - * @author: Matthew Salcido - * @website: http://www.msalcido.com - * @github: https://github.com/salcido - */ - -// ======================================================== -// All of these functions are used with the Everlasting -// Collection feature. When appending new sets of pages -// to the DOM, the event listeners are not updated -// so the new elements will not function. These functions -// recreate the missing functionality on the new DOM -// elements. -// ======================================================== - -// ======================================================== -// Functions (Alphabetical) -// ======================================================== - -/** - * Removes the `.notes_editing` class from the - * element which closes the notes textarea. - * @param {object} event The event object - * @returns {undefined} - */ -function cancelNotes(event) { - event.target.closest('.notes_field').classList.remove('notes_editing'); -} - -/** - * Opens the note field for editing and adds - * event listeners to the save and cancel buttons - * @param {object} event The event object - * @returns {undefined} - */ -function openNoteField(event) { - - let content = event.target.dataset.content || '', - target = event.target.closest('.notes_field'); - - target.classList.add('notes_editing'); - target.querySelector('.notes_textarea').value = content; - target.querySelector('.notes_textarea').focus(); -} - -/** - * Sends the new notes data to Discogs - * @returns {undefined} - */ -async function postNotes(notesData, event) { - - let query = queryString(notesData), - value = query, - headers = { 'content-type': 'application/x-www-form-urlencoded' }, - url = 'https://www.discogs.com/list/coll_update', - initObj = { - body: value, - credentials: 'include', - headers: headers, - method: 'POST' - }, - response = await fetch(url, initObj); - - if ( response.ok ) { - - let res = await response.json(), - target = event.target.closest('.notes_field'); - - target.classList.remove('notes_editing'); - - // Add the appropriate classes depending on what was edited - if ( !res.html ) { - target.classList.add('notes_not_edited'); - target.classList.remove('notes_edited'); - } else { - target.classList.remove('notes_not_edited'); - target.classList.add('notes_edited'); - } - - target.querySelector('.notes_text').dataset.content = res.content; - target.querySelector('.notes_text').innerHTML = res.html; - } -} - -/** - * Converts an object to a query string for - * posting notes data to Discogs - * @param {object} obj The object to strigify - * @returns {string} - */ -function queryString(obj) { - return Object.keys(obj).map(key => key + '=' + obj[key]).join('&'); -} - -/** - * Gathers the new note data to send to Discogs - * @param {object} event The event object - * @returns {method} - */ -function saveNotes(event) { - - let colId = event.target.closest('.notes_field').dataset.collId, - fieldId = event.target.closest('.notes_field').dataset.field, - folderId, // TODO: what is this value for? - val = event.target.closest('.notes_field').querySelector('.notes_textarea').value, - notes = event.target.closest('.notes_field').querySelector('.notes_textarea').value, - releaseId = event.target.closest('.notes_field').dataset.id, - notesObj = { - release_id: releaseId, - coll_id: colId, - field_id: fieldId, - folder_id: folderId || null, - val: val, - notes: notes - }; - - return postNotes(notesObj, event); -} - -// ======================================================== -// Event listeners -// ======================================================== - -rl.ready(() => { - - if (rl.pageIs('collection')) { - document.querySelector('body').addEventListener('click', event => { - - let target = event.target; - - // cancel button - if ( target.className.includes('notes_edit_cancel') ) { - return cancelNotes(event); - } - // edit/add notes - if ( target.closest('.de-notes-show') ) { - return openNoteField(event); - } - // save notes - if ( target.parentElement.previousElementSibling - && target.parentElement.previousElementSibling.closest('.de-notes-show') - && target.className.includes('notes_edit_save') ) { - return saveNotes(event); - } - }); - } -}); diff --git a/js/extension/features/everlasting-collection-ratings.js b/js/extension/features/everlasting-collection-ratings.js deleted file mode 100644 index 97c7a199..00000000 --- a/js/extension/features/everlasting-collection-ratings.js +++ /dev/null @@ -1,195 +0,0 @@ -/** - * - * Discogs Enhancer - * - * @author: Matthew Salcido - * @website: http://www.msalcido.com - * @github: https://github.com/salcido - */ - -// ======================================================== -// All of these functions are used with the Everlasting -// Collection feature. When appending new sets of pages -// to the DOM, the event listeners are not updated -// so the new elements will not function. These functions -// recreate the missing functionality on the new DOM -// elements. -// ======================================================== - -// ======================================================== -// Functions (Alphabetical) -// ======================================================== - -/** - * Returns the star value from the element - * @param {object} elem The element to get the rating class from - * @returns {string} - */ -function getRatingClass(elem) { - - let classes = Array.from(elem.classList), - num = /\d/g; - - classes = classes.join(''); - return classes.match(num)[0]; -} - -/** - * Injects the star rating component template in to each - * empty ratings td that has been inserted by the - * everlasting-collection feature. - * @returns {undefined} - */ -window.injectStars = function injectStars() { - - let ratings = [...document.querySelectorAll('span.rating')]; - - ratings.forEach(rating => { - - if ( !rating.querySelector('.rating_icons') ) { - - let value = rating.dataset.value || 0; - - if ( value === 0 ) rating.classList.add('not_rated'); - - rating.insertAdjacentHTML('beforeend', starTemplate(value)); - } - }); -}; - -/** - * Posts the new rating to Discogs. - * @param {string} releaseId The release_id to be rated - * @param {string} rating The rating value that will be used to rate the release - * @param {object} event The event object from the click event - * @returns {method} - */ -async function postRating(releaseId, rating, event) { - - let value = `value=${rating}`, - headers = { 'content-type': 'application/x-www-form-urlencoded' }, - url = `https://www.discogs.com/release/rate?release_id=${releaseId}`, - initObj = { - body: value, - credentials: 'include', - headers: headers, - method: 'POST' - }, - response = await fetch(url, initObj); - - if ( response.ok ) { - - // Update with the new rating - if ( rating !== '0' ) { - event.target.closest('.rating').dataset.value = rating; - return event.target.closest('.rating').classList.remove('not_rated'); - } - - // ... or remove it if it was 0 ('x' was clicked) - event.target.closest('.rating').removeAttribute('data-value'); - removeStarClass(event.target.closest('.rating').querySelector('.rating_range')); - event.target.closest('.rating').querySelector('.rating_range').classList.add('fill0'); - return event.target.closest('.rating').classList.add('not_rated'); - } -} - -/** - * Previews the star rating when hovering over the star icons - * @param {object} event The Event object - * @returns {undefined} - */ -function previewRating(event) { - - let rating = getRatingClass(event.target); - - removeStarClass(event.target.closest('.rating_range')); - event.target.closest('.rating_range').classList.add(`fill${rating}`); -} - -/** - * Removes all of the `.fillN` classes from the passed element. - * @param {object} elem The object to remove the classes from - */ -function removeStarClass(elem) { - for (let i = 0; i <= 5; i++) { - elem.classList.remove(`fill${i}`); - } -} - -/** - * Restores the initial rating of the release after the mouse leaves - * @param {object} event The event object - * @returns {undefined} - */ -function restoreRating(event) { - - let notRated = event.target.closest('.rating').classList.contains('not_rated'), - target = event.target.closest('.rating .rating_range'), - value = event.target.closest('.rating').dataset.value; - - if ( notRated ) { - removeStarClass(target); - target.classList.add('fill0'); - - } else { - removeStarClass(target); - target.classList.add(`fill${value}`); - } -} - -/** - * Initiates the POST to discogs with the new rating data - * @param {object} event The event object - * @returns {undefined} - */ -function saveRating(event) { - - let nums = /\d+/g, - releaseId = event.target.closest('.rating').dataset.postUrl.match(nums)[0], - rating = event.target.dataset.value; - - postRating(releaseId, rating, event); -} - -/** - * Returns the markup for the star ratings - * @param {number} value The rating value - * @returns {string} - */ -function starTemplate(value) { - let template = ``; - return template; -} - -// ======================================================== -// Event listeners -// ======================================================== - -rl.ready(() => { - document.querySelector('body').addEventListener('click', event => { - - let target = event.target; - // save/reset star rating - if ( target.closest('.de-rating-icons') ) { - return saveRating(event); - } - }); - - document.querySelector('body').addEventListener('mouseover', event => { - - let target = event.target; - // hover over rating - if ( target.closest('.de-rating-icons .rating_range') ) { - return previewRating(event); - } - }); - - document.querySelector('body').addEventListener('mouseout', event => { - - let target = event.target; - // mouseout from rating - if ( target.closest('.de-rating-icons .rating_range') ) { - return restoreRating(event); - } - }); -}); diff --git a/js/extension/features/everlasting-collection-sm-med.js b/js/extension/features/everlasting-collection-sm-med.js deleted file mode 100644 index aeb0b4c5..00000000 --- a/js/extension/features/everlasting-collection-sm-med.js +++ /dev/null @@ -1,186 +0,0 @@ -/** - * - * Discogs Enhancer - * - * @author: Matthew Salcido - * @website: http://www.msalcido.com - * @github: https://github.com/salcido - */ - -rl.ready(() => { - - let href = window.location.href, - reactApp = document.querySelector('#CollectionApp'), - layout = rl.getCookie('rl_layout'), - username = rl.username(); - - if ( href.includes(`/${username}/collection`) - && layout !== 'big' - && !reactApp ) { - - let hasLoaded = false, - initialPage = (new URL(document.location)).searchParams.get('page') || 1, - pageNum = initialPage, - max = document.querySelector('.pagination.bottom li a.pagination_next') - ?.parentElement?.previousElementSibling?.textContent.trim() || 1; - - // ======================================================== - // Functions (Alphabetical) - // ======================================================== - - /** - * Appends the next page of the collection to the DOM - * @param data {array.} The next page of the collection data - * @returns {undefined} - */ - function appendCollectionData(data) { - - let body = document.querySelector('#collection tbody'), - fragment = document.createDocumentFragment(), - lastChild = '#collection tbody:last-child', - pageStamp = assignPageStamp(layout); - - // Insert the page stamp in between each set of page results that are appended - document.querySelector(lastChild).insertAdjacentHTML('beforeEnd', pageStamp); - // Populate the document fragment - data.forEach(tr => fragment.appendChild(tr)); - // Append the fragment to the DOM - body.appendChild(fragment); - - setTimeout(() => window.injectStars(), 100); - // Optional notes-counter feature functionality - if ( window.addNotesCounter ) setTimeout(() => window.addNotesCounter(), 100); - } - - /** - * Determines the markup to use as the pageStamp - * @param {string} cookie The layout value from the cookie (sm, med, big) - * @returns {string} - */ - function assignPageStamp(cookie) { - - let pageStamp; - - switch (cookie) { - - case 'sm': - pageStamp = ` - -
    - -

    Page: ${pageNum}

    - - - - - - - - - - `; - return pageStamp; - - case 'med': - pageStamp = ` - -
    - - -

    Page: ${pageNum}

    - - - - - - - - - - `; - return pageStamp; - } - } - - /** - * Gets the next page of the collection - * @returns {undefined} - */ - async function getNextPage() { - - pageNum++; - - try { - - let url = `https://www.discogs.com/user/${username}/collection?page=${pageNum}${rl.removePageParam(href)}`, - data = await fetch(`${url}`, { credentials: 'include' }), - response = await data.text(), - tr = '#collection tbody tr', - div = document.createElement('div'), - loader = document.querySelector('#de-next'), - markup, - noItems = '

    End of collection

    ', - notes; - - div.innerHTML = response; - // Modify .notes-show elements with custom class to hook on to - notes = [...div.querySelectorAll('.notes_show')]; - notes.forEach(note => note.classList.add('de-notes-show')); - // Select subset of markup to pass into DOM - markup = div.querySelectorAll(tr); - /* - If the requested page number exceeds the total number of requestable - pages, Discogs will return the first page of the collection. So check - the page request number against the total number of pages and append - a notice if we've reached the end. - */ - if ( pageNum <= Number(max) ) { - - appendCollectionData(markup); - rl.updatePageParam(pageNum); - } else { - - loader.remove(); - document.querySelector('#collection table').insertAdjacentHTML('afterend', noItems); - } - - hasLoaded = false; - // Call Open links in new tabs feature - window.modifyLinks(); - - } catch (err) { - return console.log('Error getting next page of collection', err); - } - } - - // ======================================================== - // DOM Setup / Init - // ======================================================== - // Hide pagination - document.querySelectorAll('.pagination.bottom').forEach(el => { el.style.display = 'none'; }); - - if ( !document.getElementById('de-next') ) { - - let loaderMarkup = `
    -
    - Loading next page... -
    - ${rl.css.preloader} -
    `; - - document.querySelector('.release_list_table').insertAdjacentHTML('afterend', loaderMarkup); - } - - // ======================================================== - // Scrolling Functionality - // ======================================================== - window.addEventListener('scroll', () => { - let kurtLoder = document.querySelector('#de-next'); - - if ( rl.isOnScreen(kurtLoder) && !hasLoaded ) { - hasLoaded = true; - return getNextPage(); - } - }); - } -}); From 30876156881eaf1265cb02d0cf6021e2eaa1d9b8 Mon Sep 17 00:00:00 2001 From: Matthew Salcido Date: Wed, 6 Nov 2024 08:03:31 -0800 Subject: [PATCH 04/10] Update to work with new Collection page --- js/extension/features/links-in-new-tabs.js | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/js/extension/features/links-in-new-tabs.js b/js/extension/features/links-in-new-tabs.js index 57d4fe98..20d80823 100644 --- a/js/extension/features/links-in-new-tabs.js +++ b/js/extension/features/links-in-new-tabs.js @@ -35,9 +35,7 @@ rl.ready(() => { artLinks = '.de-artist [class*="textWithCoversRow_"] td a[class*="link_"]', artMRToggles = '.de-artist [class*="versionsTextWithCoversRow_"] td a[class*="link_"]', // Collection - colThumbs = '#collection .collection-image-wrapper a', - colThumbsLg = '#collection .card_large a', - colTitle = '#collection .release_list_table .collection-release-title-cell a', + colTitles = '[class*="collectionContainer_"] [class*="itemContainer_"] a', // colNew = '[class*="itemContainer_"] a', // Labels labThumbs = '#label .card .image a', @@ -74,7 +72,7 @@ rl.ready(() => { let sections = { artists: [artThumbs, artTitles, artLabels, artLists, artLinks, artMRToggles], - collection: [colThumbs, colThumbsLg, colTitle], + collection: [colTitles], dashboard: '.module_blocks a', labels: [labThumbs, labArtist, labTitle, labLists, labLinks, labMRToggles], lists: [listsOld, listsNew], @@ -97,7 +95,8 @@ rl.ready(() => { */ window.modifyLinks = function modifyLinks() { if (selectors.length) { - document.querySelectorAll(selectors.join(',')).forEach(a => { + let selectorString = selectors.join(','); + document.querySelectorAll(selectorString).forEach(a => { a.setAttribute('target', '_blank'); }); } @@ -217,8 +216,6 @@ rl.ready(() => { // New collection page loads async so wait for calls to finish if ( linksInTabs.collection && rl.pageIs('collection') ) { // Don't modify nav links at top of page - // Old Collection - document.querySelectorAll('#page_content [class*="tabs-wrap"] a').forEach(link => link.classList.add('de-ignore')); // New Collection rl.waitForElement('[class*="horizontalLinks_"]').then(() => { document.querySelectorAll('[class*="horizontalLinks_"] a').forEach(link => link.classList.add('de-ignore')); @@ -231,8 +228,8 @@ rl.ready(() => { document.body.addEventListener('mouseover', (event) => { if ( event.target.tagName === 'A' && !event.target.className.startsWith('de-') - && ![...event.target.classList].includes('de-ignore') - && !event.target.role == 'option') { + && ![...event.target.classList].includes('de-ignore') ) { + event.target.setAttribute('target', '_blank'); } }); From 157567e7c95a9990b85164b849bd671ca1d507df Mon Sep 17 00:00:00 2001 From: Matthew Salcido Date: Wed, 6 Nov 2024 08:03:43 -0800 Subject: [PATCH 05/10] Prevent error from being thrown --- js/extension/features/notes-counter-react.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/js/extension/features/notes-counter-react.js b/js/extension/features/notes-counter-react.js index 6e7ce448..8616e39b 100644 --- a/js/extension/features/notes-counter-react.js +++ b/js/extension/features/notes-counter-react.js @@ -122,12 +122,14 @@ && focus.classList && focus.classList.contains('notes_textarea') ) { - let notesCount = focus?.parentElement?.querySelector('.de-notes-count'); + let notesCount = focus?.parentElement?.querySelector('.de-notes-count') || null; // update count value count = focus.value.length; - notesCount.textContent = `${count} / 255`; + if (notesCount) { + notesCount.textContent = `${count} / 255`; + } // warn when count total approaches limit return count > 240 From 1701242351077b5b2b59acf4f648b4871e725f1c Mon Sep 17 00:00:00 2001 From: Matthew Salcido Date: Wed, 6 Nov 2024 08:03:56 -0800 Subject: [PATCH 06/10] Fix quick search --- js/extension/features/quick-search-react.js | 2 +- js/extension/features/quick-search-tracklists.js | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/js/extension/features/quick-search-react.js b/js/extension/features/quick-search-react.js index 8d94e7d2..3870eb14 100644 --- a/js/extension/features/quick-search-react.js +++ b/js/extension/features/quick-search-react.js @@ -36,7 +36,7 @@ // Match patterns: // Tissu - Unmanned Vehicle (Vinyl, UK, 2015) - Discogs // Tissu - Unmanned Vehicle (Vinyl, UK, 2015) For Sale | Discogs - re = /(?:.(?!\(.+\).+\- Discogs))+$/g; + re = /– [^–]*$/g; shouldRun = true; } diff --git a/js/extension/features/quick-search-tracklists.js b/js/extension/features/quick-search-tracklists.js index d12c7491..836ba798 100644 --- a/js/extension/features/quick-search-tracklists.js +++ b/js/extension/features/quick-search-tracklists.js @@ -34,7 +34,7 @@ if ( event?.target?.classList.length && event?.target?.classList[0]?.includes('trackTitle_')) { - let artist = event.target.parentElement.previousElementSibling, + let artist = event.target.parentElement.parentElement.previousElementSibling, artistText = artist?.textContent?.replace('–', '').replaceAll('*', ''), trackTitle = event.target.textContent; // Only fire if track title span is clicked on @@ -74,7 +74,7 @@ && event?.target?.classList[0]?.includes('trackTitle_') && event.target.tagName === 'SPAN') { // Get artist name from document title to avoid including descriminators - let artist = document.title.split(' –')[0], + let artist = document.title.split(' – ')[0], searchString = encodeURIComponent(`${artist} - ${event.target.textContent}`); window.open('https://www.google.com/search?udm=14&q=' + searchString); @@ -83,7 +83,7 @@ if ( event?.target.tagName === 'SPAN' && event?.target?.parentElement?.classList[0]?.includes('trackTitleNoArtist_')) { // Get artist name from document title to avoid including descriminators - let artist = document.title.split(' -')[0], + let artist = document.title.split(' – ')[0], searchString = encodeURIComponent(`${artist} - ${event.target.textContent}`); window.open('https://www.google.com/search?udm=14&q=' + searchString); From 8c8d2838ccb764c52a21914771f35d4a6837be23 Mon Sep 17 00:00:00 2001 From: Matthew Salcido Date: Wed, 6 Nov 2024 08:04:26 -0800 Subject: [PATCH 07/10] Remove deprecated features --- js/extension/user-preferences.js | 43 -------------------------------- js/popup/popup-logic/popup.js | 6 ----- js/popup/popup-logic/utils.js | 2 -- 3 files changed, 51 deletions(-) diff --git a/js/extension/user-preferences.js b/js/extension/user-preferences.js index ce189775..b0fd6fc3 100644 --- a/js/extension/user-preferences.js +++ b/js/extension/user-preferences.js @@ -526,18 +526,6 @@ appendFragment([resourceLibrary]) elems.push(collectionBoxFix); } - if (prefs.collectionUi) { - - // better-collection-ui.js - let collectionUi = document.createElement('script'); - - collectionUi.type = 'text/javascript'; - collectionUi.src = chrome.runtime.getURL('js/extension/features/better-collection-ui.js'); - collectionUi.className = 'de-init'; - - elems.push(collectionUi); - } - if (prefs.converter && !window.location.href.includes('wantlister') && !window.location.href.includes('/order/prints?')) { @@ -647,37 +635,6 @@ appendFragment([resourceLibrary]) elems.push(editingNotepad); } - // everlasting collection - if (prefs.everlastingCollection) { - - // everlasting-collection-notes.js - let everlastingCollectionNotes = document.createElement('script'); - - everlastingCollectionNotes.type = 'text/javascript'; - everlastingCollectionNotes.src = chrome.runtime.getURL('js/extension/features/everlasting-collection-notes.js'); - everlastingCollectionNotes.className = 'de-init'; - - elems.push(everlastingCollectionNotes); - - // everlasting-collection-ratings.js - let everlastingCollectionRatings = document.createElement('script'); - - everlastingCollectionRatings.type = 'text/javascript'; - everlastingCollectionRatings.src = chrome.runtime.getURL('js/extension/features/everlasting-collection-ratings.js'); - everlastingCollectionRatings.className = 'de-init'; - - elems.push(everlastingCollectionRatings); - - // everlasting-collection-sm-med.js - let everlastingCollection = document.createElement('script'); - - everlastingCollection.type = 'text/javascript'; - everlastingCollection.src = chrome.runtime.getURL('js/extension/features/everlasting-collection-sm-med.js'); - everlastingCollection.className = 'de-init'; - - elems.push(everlastingCollection); - } - // everlasting marketplace if (prefs.everlastingMarket) { diff --git a/js/popup/popup-logic/popup.js b/js/popup/popup-logic/popup.js index 88f69028..d342187a 100644 --- a/js/popup/popup-logic/popup.js +++ b/js/popup/popup-logic/popup.js @@ -81,13 +81,11 @@ window.addEventListener('load', () => { toggleBlockSellers = document.getElementById('toggleBlockSellers'), toggleCompactArtist = document.getElementById('toggleCompactArtist'), toggleCollectionBoxFix = document.getElementById('toggleCollectionBoxFix'), - toggleCollectionUi = document.getElementById('toggleCollectionUi'), toggleConfirmBeforeRemoving = document.getElementById('toggleConfirmBeforeRemoving'), toggleConverter = document.getElementById('toggleConverter'), toggleDarkTheme = document.getElementById('toggleDarkTheme'), toggleDemandIndex = document.getElementById('toggleDemandIndex'), toggleEditingNotepad = document.getElementById( 'toggleEditingNotepad' ), - toggleEverlastingCollection = document.getElementById('toggleEverlastingCollection'), toggleEverlastingMarket = document.getElementById('toggleEverlastingMarket'), toggleFavoriteSellers = document.getElementById('toggleFavoriteSellers'), toggleFeedback = document.getElementById('toggleFeedback'), @@ -283,13 +281,11 @@ window.addEventListener('load', () => { toggleBlockSellers.addEventListener('change', triggerSave); toggleCompactArtist.addEventListener('change', compactArtist.toggleCompactArtist); toggleCollectionBoxFix.addEventListener('change', triggerSave); - toggleCollectionUi.addEventListener('change', triggerSave); toggleConfirmBeforeRemoving.addEventListener('change', triggerSave); toggleConverter.addEventListener('change', triggerSave); toggleDarkTheme.addEventListener('change', darkTheme.useDarkTheme); toggleDemandIndex.addEventListener('change', triggerSave); toggleEditingNotepad.addEventListener('change', triggerSave); - toggleEverlastingCollection.addEventListener('change', triggerSave); toggleEverlastingMarket.addEventListener('change', triggerSave); toggleFavoriteSellers.addEventListener('change', triggerSave); toggleFeedback.addEventListener('change', triggerSave); @@ -470,14 +466,12 @@ window.addEventListener('load', () => { toggleBlockBuyers.checked = prefs.blockBuyers; toggleBlockSellers.checked = prefs.blockSellers; toggleCollectionBoxFix.checked = prefs.collectionBoxFix; - toggleCollectionUi.checked = prefs.collectionUi; toggleCompactArtist.checked = prefs.compactArtist; toggleConfirmBeforeRemoving.checked = prefs.confirmBeforeRemoving; toggleConverter.checked = prefs.converter; toggleDarkTheme.checked = prefs.darkTheme; toggleDemandIndex.checked = prefs.demandIndex; toggleEditingNotepad.checked = prefs.editingNotepad; - toggleEverlastingCollection.checked = prefs.everlastingCollection; toggleEverlastingMarket.checked = prefs.everlastingMarket; toggleFavoriteSellers.checked = prefs.favoriteSellers; toggleFeedback.checked = prefs.feedback; diff --git a/js/popup/popup-logic/utils.js b/js/popup/popup-logic/utils.js index e5fbbd56..0ebf2439 100644 --- a/js/popup/popup-logic/utils.js +++ b/js/popup/popup-logic/utils.js @@ -42,7 +42,6 @@ export function applySave(message, event, currencyTarget = 'currency') { blockBuyers: document.getElementById('toggleBlockBuyers').checked, blockSellers: document.getElementById('toggleBlockSellers').checked, collectionBoxFix: document.getElementById('toggleCollectionBoxFix').checked, - collectionUi: document.getElementById('toggleCollectionUi').checked, compactArtist: document.getElementById('toggleCompactArtist').checked, confirmBeforeRemoving: document.getElementById('toggleConfirmBeforeRemoving').checked, converter: document.getElementById('toggleConverter').checked, @@ -51,7 +50,6 @@ export function applySave(message, event, currencyTarget = 'currency') { darkThemeSystemPref: document.getElementById('automaticTheme').checked, demandIndex: document.getElementById('toggleDemandIndex').checked, editingNotepad: document.getElementById( 'toggleEditingNotepad' ).checked, - everlastingCollection: document.getElementById('toggleEverlastingCollection').checked, everlastingMarket: document.getElementById('toggleEverlastingMarket').checked, favoriteSellers: document.getElementById('toggleFavoriteSellers').checked, feedback: document.getElementById('toggleFeedback').checked, From d2903b79008750642a09af33bf221a9669000177 Mon Sep 17 00:00:00 2001 From: Matthew Salcido Date: Wed, 6 Nov 2024 08:05:01 -0800 Subject: [PATCH 08/10] Update readme.md --- readme.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/readme.md b/readme.md index 6a409f1c..d26e7741 100644 --- a/readme.md +++ b/readme.md @@ -43,7 +43,6 @@ Discogs Enhancer adds extra features to both Discogs.com and Chrome. You can blo * Scan Artist/Label releases for comments * Scan your seller inventory for items priced below the median Marketplace value * Tweak Artist/Label Discriminators -* Everlasting Collection * Everlasting Marketplace * Buyer/Seller feedback notifications * Seller inventory ratings @@ -128,9 +127,7 @@ Discogs Enhancer gets a near perfect score with [Google's Lighthouse](https://de

    #### AUTHENTICATED - - [ ] Better Collection UI - [ ] Block Buyers _(Requires user w/ sales history)_ - - [ ] Everlasting Collection - [ ] Feedback Notifications _(Requires user w/ Buyer/Seller feedback)_ - [x] Hide Min/Med/Max columns - [x] Larger BAOI Fields From 2424392578caefabc67acb51732deafae0947d1d Mon Sep 17 00:00:00 2001 From: Matthew Salcido Date: Wed, 6 Nov 2024 08:05:04 -0800 Subject: [PATCH 09/10] Update change-log.js --- js/popup/change-log.js | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/js/popup/change-log.js b/js/popup/change-log.js index a89b1456..59ef35a3 100644 --- a/js/popup/change-log.js +++ b/js/popup/change-log.js @@ -1,19 +1,22 @@ module.exports = { current: [ { - features: [{ - name: 'Quick Search Tracklists', - description: 'Allows you to search Google for the artist + trackname by clicking on the track title on a Master Release or Release page. I tested this against my own collection and it seems to work well but please get in touch if you find any issues with it: discogs.enhancer@gmail.com', - link: '#quick-search-tracklists', + features: [], + removedFeatures: [{ + name: 'Everlasting Collection', + description: 'Everlasting Collection has been removed since it\'s incompatible with the new Collection page.', + }, + { + name: 'Improved Collection UI', + description: 'Improved Collection UI has been removed since it\'s incompatible with the new Collection page.', }], - removedFeatures: [], updates: [ { name: 'Bug Fix', - description: 'Release Scanner has been updated to work with the new Artist and Label Pages. Let me know if you find any issues with it.' + description: 'Quick Search has been updated to work with the new changes Discogs rolled out this week.' }, ], - thanks: ['Huge thank you to Joe B, Rob P. and Semen I. for their donations!'], + thanks: ['Huge thank you to Joe B, Rob P. Bart, and Semen I. for their donations!'], }, ], previous: [] From 344596e5dfbc0566b4d9f9b2d116f5b3c17bc6b8 Mon Sep 17 00:00:00 2001 From: Matthew Salcido Date: Wed, 6 Nov 2024 08:05:16 -0800 Subject: [PATCH 10/10] Version bump to 3.7.6 --- manifest.json | 2 +- package-lock.json | 2 +- package.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/manifest.json b/manifest.json index 908aced5..bc540e8e 100644 --- a/manifest.json +++ b/manifest.json @@ -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.7.5", + "version": "3.7.6", "author": "Matthew Salcido", "homepage_url": "https://www.discogs-enhancer.com", "action": { diff --git a/package-lock.json b/package-lock.json index df8696b8..aec69340 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "discogs-enhancer", - "version": "3.7.5", + "version": "3.7.6", "lockfileVersion": 2, "requires": true, "packages": { diff --git a/package.json b/package.json index 2fb32bf0..5397d5f3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "discogs-enhancer", - "version": "3.7.5", + "version": "3.7.6", "description": "A Chrome extension that adds useful functionality to Discogs.com! https://www.discogs-enhancer.com", "main": "index.js", "scripts": {