MAXIMUM Search

Add search links VK, Yandex Music and Last.fm to radio Maximum (RUS)

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

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

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

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.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name         MAXIMUM Search
// @namespace    http://ext.redleaves.ru
// @version      0.3
// @description  Add search links VK, Yandex Music and Last.fm to radio Maximum (RUS)
// @author       MewForest
// @license      MIT
// @match        http://maximum.ru/online/maximum
// @grant        none
// @require http://code.jquery.com/jquery-latest.js
// ==/UserScript==

(function() {
    'use strict';

    function curTrackUpd() {

        $.ajax({
            type: "GET",
            url: "/currenttrack.aspx?station=maximum",
            success: function(data)
            {
                var curTrack = {
                    song : data.Current.Artist+" - "+data.Current.Song,
                    vk : "https://vk.com/search?c%5Bq%5D="+encodeURIComponent((data.Current.Artist).toLowerCase()+" "+(data.Current.Song).toLowerCase())+"&c%5Bsection%5D=audio",
                    ya : "https://music.yandex.ru/search?text="+encodeURIComponent((data.Current.Artist).toLowerCase()+" "+(data.Current.Song).toLowerCase()),
                    last : "http://www.last.fm/ru/music/"+encodeURIComponent(data.Current.Artist),
                };

                if (curTrack.song != " - " && $(".in-air span").text() != curTrack.song && curTrack.song != "Вы слушаете Радио MAXIMUM")
                {
                    $(".online-radio br").remove();
                    $(".curSearch").remove();
                    $(".online-radio").append('<a href="'+curTrack.vk+'" class="curSearch" target="_blank">Найти трек в VK</a><br>');
                    $(".online-radio").append('<a href="'+curTrack.ya+'" class="curSearch" target="_blank">Найти трек в Яндекс Музыке</a><br>');
                    $(".online-radio").append('<a href="'+curTrack.last+'" class="curSearch" target="_blank">Найти исполнителя в Last.fm</a>');
                }
            }
        });
    }
    curTrackUpd();
    window.setInterval(curTrackUpd,3000);
})();