Spotify unblock right click and text selection

This userscript restores the ability to right-click and select text on the Spotify web page

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

You will need to install an extension such as Tampermonkey to install this script.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

You will need to install an extension such as Tampermonkey to install this script.

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

// ==UserScript==
// @name         Spotify unblock right click and text selection
// @namespace    http://tampermonkey.net/
// @version      1.0.0
// @description  This userscript restores the ability to right-click and select text on the Spotify web page
// @author       aqemi
// @match        https://open.spotify.com/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=spotify.com
// @grant        none
// @license MIT
// ==/UserScript==



(async function() {
    'use strict';

    async function waitForElement(selector, win = window) {
        return new Promise(resolve => {
            const interval = setInterval(() => {
                const node = win.document.querySelector(selector);
                if (node) {
                    clearInterval(interval);
                    resolve(node);
                }
            }, 250);
        });
    }

    const css = `
    * {
      user-select: text; !important;
    }`;


    const nativeEventListener = EventTarget.prototype.addEventListener;

    EventTarget.prototype.addEventListener = function (event, ...args) {
        if (!['contextmenu'].includes(event)) {
            nativeEventListener.call(this, event, ...args);
        }
    };

    window.addEventListener('load', async () => {
        try {
            const style = document.createElement('style');
            style.innerHTML = css;
            document.head.appendChild(style);
            setInterval(() => {
                document.querySelectorAll('[draggable=true]').forEach(element => {
                    element.draggable = false;
                });
            }, 1000);
        } catch(error) {
            console.error(error);
        }
    });
})();