Deezer Enhancements

Search Genius for the currently playing song and open song.link page for easier sharing

Bu betiği kurabilmeniz için Tampermonkey, Greasemonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği yüklemek için Tampermonkey gibi bir uzantı yüklemeniz gerekir.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Userscripts gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği indirebilmeniz için ayrıca Tampermonkey gibi bir eklenti kurmanız gerekmektedir.

Bu komut dosyasını yüklemek için bir kullanıcı komut dosyası yöneticisi uzantısı yüklemeniz gerekecek.

(Zaten bir kullanıcı komut dosyası yöneticim var, kurmama izin verin!)

Bu stili yüklemek için Stylus gibi bir uzantı yüklemeniz gerekir.

Bu stili yüklemek için Stylus gibi bir uzantı kurmanız gerekir.

Bu stili yükleyebilmek için Stylus gibi bir uzantı yüklemeniz gerekir.

Bu stili yüklemek için bir kullanıcı stili yöneticisi uzantısı yüklemeniz gerekir.

Bu stili yüklemek için bir kullanıcı stili yöneticisi uzantısı kurmanız gerekir.

Bu stili yükleyebilmek için bir kullanıcı stili yöneticisi uzantısı yüklemeniz gerekir.

(Zateb bir user-style yöneticim var, yükleyeyim!)

// ==UserScript==
// @name         Deezer Enhancements
// @namespace    http://schuppentier.org
// @version      2024-03-18
// @description  Search Genius for the currently playing song and open song.link page for easier sharing
// @author       Dennis
// @match        https://www.deezer.com/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=deezer.com
// @grant        GM_registerMenuCommand
// @license      MIT
// ==/UserScript==

/* global dzPlayer */
(function() {
    'use strict';

    GM_registerMenuCommand('Search for song in Genius', () => {
		const currentSong = dzPlayer.getCurrentSong();
        const searchString = `${currentSong.SNG_TITLE} ${currentSong.ART_NAME}`;
        const geniusUrl = `https://genius.com/search?q=${encodeURIComponent(searchString)}`;
        window.open(geniusUrl, "_blank");
	});

    function odesli(itunesJson) {
        const currentSongTitle = dzPlayer.getCurrentSong().SNG_TITLE;

        const matchingSongs = itunesJson.results.filter((item) => item.trackName === currentSongTitle);
        const songId = matchingSongs[0].trackId;
        const odesliUrl = `https://song.link/i/${songId}`;

        window.open(odesliUrl, "_blank");
        navigator.clipboard.setText(odesliUrl);
    }

    var callbackFunctionTag = document.createElement('SCRIPT');
    callbackFunctionTag.textContent = odesli.toString();

    document.getElementsByTagName('HEAD')[0].appendChild(callbackFunctionTag);

    GM_registerMenuCommand('Open song.link page', () => {
        const currentSong = dzPlayer.getCurrentSong();
        const currentSongTitle = currentSong.SNG_TITLE;
        const currentSongArtist = currentSong.ART_NAME;

        var scriptTag = document.createElement('SCRIPT');
        scriptTag.src = `https://itunes.apple.com/search?term=${encodeURIComponent(currentSongTitle)}%20${encodeURIComponent(currentSongArtist)}&country=DE&entity=song&callback=odesli`;

        document.getElementsByTagName('HEAD')[0].appendChild(scriptTag);
    });
})();