RED : Streaming Search Links

Adds Spotify, Deezer or Tidal search links on RED

Tendrás que instalar una extensión para tu navegador como Tampermonkey, Greasemonkey o Violentmonkey si quieres utilizar este script.

Necesitarás instalar una extensión como Tampermonkey o Violentmonkey para instalar este script.

Necesitarás instalar una extensión como Tampermonkey o Violentmonkey para instalar este script.

Necesitarás instalar una extensión como Tampermonkey o Userscripts para instalar este script.

Necesitará instalar una extensión como Tampermonkey para instalar este script.

Necesitarás instalar una extensión para administrar scripts de usuario si quieres instalar este script.

(Ya tengo un administrador de scripts de usuario, déjame instalarlo)

Necesitará instalar una extensión como Stylus para instalar este estilo.

Necesitará instalar una extensión como Stylus para instalar este estilo.

Necesitará instalar una extensión como Stylus para instalar este estilo.

Necesitará instalar una extensión del gestor de estilos de usuario para instalar este estilo.

Necesitará instalar una extensión del gestor de estilos de usuario para instalar este estilo.

Necesitará instalar una extensión del gestor de estilos de usuario para instalar este estilo.

(Ya tengo un administrador de estilos de usuario, déjame instalarlo)

// ==UserScript==
// @name         RED : Streaming Search Links
// @description  Adds Spotify, Deezer or Tidal search links on RED
// @author       Quoph
// @version      1.3.10
// @include      http*://redacted.ch/*
// @include      http*://*orpheus.network/*
// @include      http*://notwhat.cd/*
// @grant        none
// @namespace    https://greasyfork.org/users/165243
// ==/UserScript==
//
// Quoph's non-API version, credits to orkyl, aphex80, spacepandas and duskyliability for the original Spotify Integration script.
//
// CHANGELOG
// 1.3.10    14/12/2019
//      fix: Improved forum post link translation
//
// 1.3.9     8/11/2019
//      add: Include new Orpheus URL
//      add: Album and Artist search strings for Spotify and Tidal web searches
//
// 1.3.8     20/10/2019
//      fix: Spotify web search url
//
// 1.3.7     28/06/2019
//      add: Links added to official forum post torrent links
//      fix: Reconfigured Tidal search urls as generic searches
//
// 1.3.6     30/03/2018
//      add: Links added to bookmarked requests & requests on user pages
//      fix: Don't display links if no requests found
//      fix: Generate links for Various Artist releases on collages and bookmarks page
//
// 1.3.5     05/03/2018
//      add: Links added requests.php
//      add: Links added to compositions and requests sections on Artist pages
//
// 1.3.4     12/02/2018
//      add: Script settings added to user settings page to allow changes from APL and NWCD
//      fix: General code tidying
//      fix: Only run (get settings) on pages with links
//
// 1.3.3     11/02/2018
//      add: Transfer settings from RED to APL and NWCD
//
// 1.3.2     11/02/2018
//      fix: No blank tabs when opening Spotify app
//
// 1.3.1     11/02/2018
//      add: User preferences placed on forum thread
//    to do: APL & NWCD user settings solution
//      add: (Artist page) Links generated on Singles, Live Albums, Anthologies, Remixes, Mixtapes,
//           Appearances, Produced Bys, Mixed Bys and Compilations
//      fix: Consolidated link creation with functions (DRY)
//   change: Name changed to Streaming Search Links to reflect the additional streaming services
//
// 1.2.1     04/02/2018
//      add: Tidal links
//
// 1.2       02/01/2018
//      add: Deezer Links
//      add: Support for more trackers: APL and NWCD.
//      add: Support for secure and non-secure domain URLs.
//   change: Moved from pastebin to Greasy Fork.

var settings = getSettings();

if (window.location.href.indexOf('threadid=17119') > -1 || window.location.href.indexOf('user.php?action=edit') > -1) {
    showSettings();
}

function showSettings() {
    var div = document.getElementById('SSLSettings');
    var userSettings = window.location.href.indexOf('user.php?action=edit') > -1;
    if (userSettings && !div) {
        div = document.createElement('table');
        div.setAttribute('id', 'SSLSettings');
        $(".main_column").append(div);
    }
    if(window.location.href.indexOf('threadid=17119') > -1 && !div) {
        var before = document.getElementsByClassName('forum_post')[0];
        div = document.createElement('div');
        div.setAttribute('id', 'SSLSettings');
        before.parentNode.insertBefore(div, before);
        div.setAttribute('style', 'width: 100%; text-align: center;');
        div.setAttribute('class', 'box');
    }
    div.innerHTML = (userSettings ? '<tbody><tr class="colhead_dark"><td colspan="2"><strong>Streaming Search Links Settings</strong></td></tr><tr><td>' : '<h2>Streaming Search Links Settings</h2><br />') + '<span>Deezer</span><span>Tidal</span><span>Spotify</span><span>Spotify Player: </span>' + (userSettings ? '</td></tr></tbody>' : '');
    var settings = getSettings();
    var span = div.getElementsByTagName('span');
    function createCheckbox (name, setting, mySpan) {
        var checkbox=document.createElement('input');
        checkbox.type = 'checkbox';
        checkbox.setAttribute("name", name);
        checkbox.setAttribute('style', 'margin: 0 10px;');
        checkbox.checked = setting ? setting:'';
        checkbox.addEventListener('change', changeSettings.bind(undefined, checkbox, div, undefined), false);
        mySpan.appendChild(checkbox);
    }
    createCheckbox ("Deezer", settings.Deezer, span[0]);
    createCheckbox ("Tidal", settings.Tidal, span[1]);
    createCheckbox ("Spotify", settings.Spotify, span[2]);
    var select=document.createElement('select');
    var op = new Option();
    op.text = "APP";
    var op2 = new Option();
    op2.text = "WEB";
    select.options.add(op);
    select.options.add(op2);
    select.selectedIndex = (settings.spotifyApp ? 0 : 1);
    select.addEventListener('change', changeSettings.bind(undefined, select, div, select.selectedIndex), false);
    span[3].appendChild(select);
    div.appendChild(document.createElement('br'));
}

function changeSettings(obj, div, val) {
    var settings = getSettings();
    var x = div.getElementsByTagName('input');
    var sel = div.getElementsByTagName('select');
    if (obj == x[0]) {
        if(x[0].checked) {
            settings.Deezer = true;
        } else
            settings.Deezer = false;
    }
    if (obj == x[2]) {
        if(x[2].checked) {
            settings.Spotify = true;
        } else
            settings.Spotify = false;
    }
    if (obj == x[1]) {
        if(x[1].checked) {
            settings.Tidal = true;
        } else
            settings.Tidal = false;
    }
    if (obj == sel[0]) {
        if(val !== 1) {
            settings.spotifyApp = false;
        } else
            settings.spotifyApp = true;
    }
    window.localStorage.spotifySearchLinksSettings = JSON.stringify(settings);
    showSettings();
}

function getSettings() {
    var settings = window.localStorage.spotifySearchLinksSettings;
    if (!settings) {
        settings = {Deezer:false, Spotify:true, Tidal:false, spotifyApp:true};
    } else
        settings = JSON.parse(settings);
    if (settings.spotifyApp) {
        spotURL = 'spotify:search:';
    } else {
        spotURL = 'https://open.spotify.com/search/';
    }
    return settings;
}

var deezURL = 'http://www.deezer.com/search/';
var tidURL = 'https://listen.tidal.com/search/';
var SpotAlb = settings.spotifyApp ? '' : "/albums";
var SpotArt = settings.spotifyApp ? '' : "/artists";
var deezIMG = ['Listen on Deezer','data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAKNSURBVFhH7dfvSxNxHAdw/4p6Hj2ydjftrt3Nu1UTIirBSItl5s+VurTNprPpbE1xM9ZkaitTKyVMk9iTIRkUpYjSk7IQeuCTwp4UZESE0IN3uyuaH08RJLaCPXhxx32+3Pd9n+99H3wzMllev4vhopk6bjl+RTL8niuqzJ2h3KwuJlk0I5lfvpYyt9KBdYvJkg6QDpCUAN7xSfTNvyOKXT61lpQAjuvD6IhNEQU1TrW2pQDNJ2ux0PGQeGDvWnes4tJwFOGZBcJS71FrWwrgLKjCnPceMWQLrDtWcbFvBFcfzxEnal1q7f8M8NeXINcoYdpl1eCyDZqXKRzHz+J5yx1ioLodzb5KjMe8hMtTtvlPeEiSseS3axg4QTO54kqRA++vTRCxhgiCvXWYnQ8TgS7b5tvwgJCDCUepxkYdsOWXI9YYIborPXC6S3B31E3YG4thC95E6+gEkW+tU9+lBjgsm/A15NTYqAP+Mw1Y7n1GPG0eRE9/PV4v3iBCkQvxlk9jaPEzUdry66dVA+xjsjDG7NA4dYzD2G2RGOwRYWXzMcLaiQBbhrLzInxhiSipFrHXFYQYuk9kWaoSAY4wLFZ02zWazvFYWZKJD28kdLLl+KaPEFN6D9p6JDx6ZSYuhyTIIzMwv/hC8M7ORACZycYAs1OjMI/DQLdIhAMCSpg83GJriFb2NIqsIpr8EmGpEMDb2yC09xNZhRWJAEfjHYBum4a7mgc+ysSntxKCbAV+6PuIWb0XHREZTxbMhLIM8tgccl9+J5RlSXfgTwAmTtkJa2Vz8ef7eUI28eAYASbGRBiZHHACDzFeX22PgYfOaIZOPkjs5qVEgFRKB0h9gH/haJbiw2lKj+e8/if7hYp3VOy3mwAAAABJRU5ErkJggg=='];
var spotIMG = ['Listen in Spotify','data:image/png;charset=utf-8;base64,iVBORw0KGgoAAAANS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RDhCinpCinpCinrCFjXQA8miDP+TP0sQfgAbiI7MBa0d0QAAAABJRU5ErkJggg=='];
var d, s, t, links, spotURL;

function linkSetting() {
    var settings = getSettings();
    var linksArray = [];
    if (settings.Deezer) {linksArray.push(d);}
    if (settings.Spotify) {linksArray.push(s);}
    if (settings.Tidal) {linksArray.push(t);}
    links = linksArray;
    return links;
}
function createLink(link, linkData) {
    var a = document.createElement('a');
    a.href = link;
    if (link.indexOf('spotify:search:') === -1) {
        a.setAttribute('target', '_blank'); }
    a.title = linkData[0];
    var img = document.createElement('img');
    img.style.border = 'none';
    img.style.marginLeft = '3px';
    img.style.marginRight = '3px';
    img.style.position = "relative";
    img.style.top = '2px';
    img.src = linkData[1];
    img.width = 14;
    a.appendChild(img);
    return a;
}
function createLinks (whatArtist, whatAlbum) {
    d = createLink(deezURL + encodeURIComponent(whatArtist) + "%20" + encodeURIComponent(whatAlbum) + "/album", deezIMG);
    s = createLink(spotURL + encodeURIComponent(whatArtist) + "%20" + encodeURIComponent(whatAlbum) + SpotAlb, spotIMG);
    t = createLink(tidURL + "albums?q=" + encodeURIComponent(whatArtist) + "%20" + encodeURIComponent(whatAlbum), tidIMG);
    linkSetting();
}
function createArtistLinks (whatArtist) {
    d = createLink(deezURL + encodeURIComponent(whatArtist) + "/artist", deezIMG);
    s = createLink(spotURL + encodeURIComponent(whatArtist) + SpotArt, spotIMG);
    t = createLink(tidURL + "artists?q=" + encodeURIComponent(whatArtist), tidIMG);
    linkSetting();
}
/*****************************************/
/** Top 10 / Collage Updates / Torrents **/
/*****************************************/
if (window.location.href.indexOf('top10.php') > -1 || window.location.href.indexOf('userhistory.php') > -1 || window.location.href.indexOf('torrents.php') > -1) {
    var groups = $('div.group_info');
    $(groups).each(function(i, group) {
        var myArtist = $(group).find('a[href*="artist.php"]')[0];
        var myAlbum = $(group).find('a[href*="torrents.php?id"]')[0];
        createLinks($(myArtist).text(), $(myAlbum).text());
        $(group).prepend(links);
    });
}
/*************************************/
/** Collage & Bookmark torrent page **/
/*************************************/
if (window.location.href.indexOf('collages.php') > -1 || window.location.href.indexOf('collage.php?id') > -1 || window.location.href.indexOf('bookmarks.php?type=torrents') > -1) {
    var groups = $('.group');
    $(groups).each(function(i, group) {
        var whatArtistElement = $(group).find('a[href*="artist.php"]')[0];
        var whatAlbumElement = $(group).find('a[href*="torrents.php?id"]')[0];
        createLinks($(whatArtistElement).text(), $(whatAlbumElement).text());
        if (typeof whatArtistElement == "undefined") {
            $(whatAlbumElement).before(links);}
        else {
            $(whatArtistElement).before(links);}
    });
}
/*************************************/
/*********** Artist page *************/
/*************************************/
if (window.location.href.indexOf('artist.php') > -1) {
    createArtistLinks($('h2').first().text());
    {$('h2').append(links);}
    var groups = $('#torrents_album, #torrents_ep, #torrents_anthology, #torrents_single, #torrents_live_album, #torrents_remix, #torrents_mixtape').find('div.group_info');
    var groups2 = $('#torrents_guest_appearance, #torrents_produced_by, #torrents_remixed_by, #torrents_compilation, #torrents_composition').find('div.group_info');
    $(groups).each(function (i, group) {
        whatAlbum = $(group).find('a[href*="torrents.php?id"]')[0];
        createLinks($('h2').first().text(), $(whatAlbum).text());
        $(group).prepend(links);
    });
    $(groups2).each(function (i, group) {
        whatArtistElement = $(group).find('a[href*="artist.php"]')[0];
        whatAlbum = $(group).find('a[href*="torrents.php?id"]')[0];
        createLinks($(whatArtistElement).text(), $(whatAlbum).text());
        $(group).prepend(links);
    });
}
/*************************************/
/*********** Torrent page ************/
/*************************************/
if (window.location.href.indexOf('torrents.php?id') > -1) {
    createLinks($('h2 > a').first().text(), $('h2 > span').text());
    $('h2').append(links);
}
/*************************************/
/******* Bookmark artist page ********/
/*************************************/
if (window.location.href.indexOf('bookmarks.php?type=artists') > -1) {
    var tds = $('.artist_table').find('.rowa, .rowb').find('td');
    var artists = $('.artist_table').find('a[href*="artist.php?id"]');
    $(artists).each(function(i, artistElement) {
        createArtistLinks($(artistElement).text());
        $(tds[i]).prepend(links);
    });
}
/*************************************/
/************* Requests **************/
/*************************************/
if (window.location.href.indexOf('requests.php') > -1 || window.location.href.indexOf('bookmarks.php?type=requests') > -1 || window.location.href.indexOf('user.php?id=') > -1 || window.location.href.indexOf('artist.php') > -1) {
    var tds = $('.request_table').find('.rowa, .rowb').find('td:first');
    $(tds).each(function(i, group) {
        var whatArtist = $(group).find('a[href*="artist.php?id"]')[0];
        var whatAlbum = $(group).find('a[href*="requests.php?action=view&id"]')[0];
        if (typeof whatAlbum != "undefined") {
            createLinks($(whatArtist).text(), $(whatAlbum).text().slice(0, -7));
            $(group).prepend(links);
        }
    });
}
/*************************************/
/*********** Request page ************/
/*************************************/
if (window.location.href.indexOf('requests.php?action=view&id') > -1) {
    var whatArtist = $('h2').find('a[href*="artist.php?id"]')[0];
    var whatAlbum = $('h2').find('a[href*="torrents.php?torrentid"]')[0];
    createLinks($(whatArtist).text(), $(whatAlbum).length ? $(whatAlbum).text() : $('h2 > span').text());
    $('h2').append(links);
}
/*************************************/
/*********** Forum Posts *************/
/*************************************/
    var post = $('.forum_post .body');
    $(post).each(function(i, b){
        var as = $(this).find('a');
        $(as).each(function() {
            if (this.href.indexOf('torrents.php?id=') > -1 || this.href.indexOf('bandcamp.com/album/') > -1 ){
                var [thisArtist, thisAlbum] = $(this).text().split(" - ");
                if (typeof thisAlbum != "undefined") {
                    var year = thisAlbum.search(/\s\(\d{4}\)/);
                    if (year > -1 ) {
                        createLinks((thisArtist), (thisAlbum).slice(0, year));}
                    else {
                        createLinks((thisArtist), (thisAlbum));}
                    $(this).prepend(links);
                }
        }});
           });