Greasy Fork is available in English.

Beatport - from "Tracks" page hide duplicate tracks(rows)

On "Tracks" page if there are multiple same duplicate tracks listed, only one will remains and others will be hidden.

질문, 리뷰하거나, 이 스크립트를 신고하세요.
// ==UserScript==
// @name         Beatport - from "Tracks" page hide duplicate tracks(rows)
// @namespace    http://tampermonkey.net/
// @version      0.12
// @description  On "Tracks" page if there are multiple same duplicate tracks listed, only one will remains and others will be hidden.
// @author       https://puvox.software
// @match        https://www.beatport.com/artist/*/tracks*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=beatport.com
// @grant        none
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    class trackDuplicateClass
    {
        intervalSeconds=3;
        trackRowSelector = '[data-testid="tracks-table-row"]';

        start()
        {
            window.setInterval(this.checkIfHideNeeded.bind(this), this.intervalSeconds * 1000 );
        }

		getCurrentTracksOnPage(){
			const matches = location.href.match('per_page=(.*)?|$');
			const amountString = matches[1] || '25';
			return parseInt(amountString);
		}

        checkIfHideNeeded () {
            const exists= document.querySelector('.duplicatesAreHidden');
            if (!exists) {
                const randomTrack = document.querySelector(this.trackRowSelector);
                if (randomTrack) {
                    randomTrack.classList.add("duplicatesAreHidden");
                    this.hideDuplicateTracks();
                }
            }
        }

		hideDuplicateTracks () {
			const all = document.querySelectorAll(this.trackRowSelector + ' .cell.title');
			const values = Object.values(all).reverse();
			const allTitles = [];
			for(const el of values) {
				const title = el.textContent;
				if (!allTitles.includes(title)) {
					allTitles.push(title);
				} else {
					// delete el.parentNode.parentNode.removeChild(el.parentNode); // causes exception on beatport client-side
					// el.parentNode.style.background = 'red';
					el.parentNode.style.display = 'none';
				}
			}
		}
	}
	(new trackDuplicateClass()).start();
})();