thedesk/app/js/ui/radio.js

56 lines
2.6 KiB
JavaScript
Raw Permalink Normal View History

2018-02-13 06:16:46 +11:00
var r = document.getElementById("radio");
2019-05-19 17:39:30 +10:00
function Rtoggle() {
if ($("#radio").hasClass("play")) {
2018-02-13 06:16:46 +11:00
Rstop();
2019-05-19 17:39:30 +10:00
} else {
2018-02-13 06:16:46 +11:00
$("#radio-view").toggleClass("hide");
2018-02-25 02:59:53 +11:00
$("#radio-view").toggleClass("show");
2018-02-13 06:16:46 +11:00
$("#radio-input").addClass("hide");
}
}
2019-05-19 17:39:30 +10:00
function Rplay(url, name) {
$("#radio").attr('src', url);
2018-02-13 06:16:46 +11:00
r.load();
r.play();
$("#radio").addClass("play");
$("#radio-btn").addClass("teal-text");
2019-05-19 17:39:30 +10:00
$("#radio-sta").html("<br>Now Playing:" + name);
2018-02-13 06:16:46 +11:00
}
2019-05-19 17:39:30 +10:00
function Rstop() {
$("#radio").attr("src", "");
2018-02-13 06:16:46 +11:00
r.pause();
$("#radio").removeClass("play");
$("#radio-btn").removeClass("teal-text");
$("#radio-sta").html("");
}
2019-05-19 17:39:30 +10:00
function Ryourself() {
2018-02-13 06:16:46 +11:00
$("#radio-input").removeClass("hide");
$("#radio-view").addClass("hide");
}
2019-05-19 17:39:30 +10:00
function Rselect() {
2018-02-13 06:16:46 +11:00
$("#radio-input").addClass("hide");
$("#radio-view").removeClass("hide");
}
2019-05-19 17:39:30 +10:00
function Rinput() {
var url = $("#radio-url").val();
Rplay(url, url)
2018-05-02 14:14:03 +10:00
}
/*
<span id="radio-sta" class="radio"></span>
<div id="radio-view" class="hide radio mize">
<a onclick="nowplaying('spotify')" class="pointer" title="Ctrl+Shift+N"><i class="fa fa-spotify"></i>NowPlaying</a>
<span class="cbadge pointer waves-effect" onclick="Rplay('https://listen.moe/stream','Listen.moe')" data-name="Listen.moe">Listen.moe</span>
<span class="cbadge pointer waves-effect" onclick="Rplay('http://itori.animenfo.com:443/;','AnimeNfo Radio')" data-name="AnimeNfo Radio">AnimeNfo Radio</span>
<span class="cbadge pointer waves-effect" onclick="Rplay('http://hyades.shoutca.st:8043/stream','LoFi hip hop Radio')" data-name="LoFi hip hop Radio">LoFi hip hop Radio</span>
<span class="cbadge pointer waves-effect" onclick="Rplay('http://89.16.185.174:8004/stream','Linn Classical')" data-name="Linn Classical">Linn Classical</span>
<span class="cbadge pointer waves-effect" onclick="Rplay('http://89.16.185.174:8000/stream','Linn Jazz')" data-name="Linn Jazz">Linn Jazz</span>
<span class="cbadge pointer waves-effect" onclick="Rplay('http://edge-ads-01-cr.sharp-stream.com/jazzfmmobile.aac','Jazz FM')" data-name="Jazz FM">Jazz FM</span>
<span class="cbadge pointer waves-effect" onclick="Rplay('http://91.121.59.45:10024/stream','canal-jazz.eu')" data-name="canal-jazz.eu">canal-jazz.eu</span>
<span class="cbadge pointer waves-effect" onclick="Ryourself()">Others</span>
</div>
<div id="radio-input" class="hide radio mize">
<input type="url" id="radio-url" placeholder="URL" style="width:100px">
<button class="btn waves-effect" onclick="Rinput()">Play</button>
<button class="btn waves-effect" onclick="Rselect()">Presets</button>
</div>
*/