1
0
mirror of https://github.com/SuperBFG7/ympd synced 2024-11-26 23:07:17 +00:00

Dirble's token fix

This commit is contained in:
Nofre 2016-02-02 18:47:53 +01:00
parent 4295d15874
commit 0e47d5c4bc

View File

@ -16,6 +16,8 @@
Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/ */
var TOKEN = "";
var socket; var socket;
var last_state; var last_state;
var last_outputs; var last_outputs;
@ -106,6 +108,9 @@ var app = $.sammy(function() {
this.get(/\#\/dirble\/(\d+)\/(\d+)/, function() { this.get(/\#\/dirble\/(\d+)\/(\d+)/, function() {
if (TOKEN === "") context.redirect("#/0");
prepare(); prepare();
current_app = 'dirble'; current_app = 'dirble';
$('#breadcrump').removeClass('hide').empty().append("<li><a href=\"#/dirble/\">Categories</a></li><li>"+dirble_selected_cat+"</li>"); $('#breadcrump').removeClass('hide').empty().append("<li><a href=\"#/dirble/\">Categories</a></li><li>"+dirble_selected_cat+"</li>");
@ -131,6 +136,9 @@ var app = $.sammy(function() {
this.get(/\#\/dirble\//, function() { this.get(/\#\/dirble\//, function() {
if (TOKEN === "") context.redirect("#/0");
prepare(); prepare();
current_app = 'dirble'; current_app = 'dirble';
$('#breadcrump').removeClass('hide').empty().append("<li>Categories</li>"); $('#breadcrump').removeClass('hide').empty().append("<li>Categories</li>");
@ -177,6 +185,9 @@ $(document).ready(function(){
else else
if ($.cookie("notification") === "true") if ($.cookie("notification") === "true")
$('#btnnotify').addClass("active") $('#btnnotify').addClass("active")
if (TOKEN === "") $('#dirble').addClass('hide');
}); });
@ -764,7 +775,7 @@ function dirble_load_categories() {
dirble_page = 1; dirble_page = 1;
$.getJSON( "http://api.dirble.com/v2/categories?token=2e223c9909593b94fc6577361a", function( data ) { $.getJSON( "http://api.dirble.com/v2/categories?token="+TOKEN, function( data ) {
$('#dirble_loading').addClass('hide'); $('#dirble_loading').addClass('hide');
@ -812,7 +823,7 @@ function dirble_load_categories() {
function dirble_load_stations() { function dirble_load_stations() {
$.getJSON( "http://api.dirble.com/v2/category/"+dirble_catid+"/stations?page="+dirble_page+"&per_page=20&token=2e223c9909593b94fc6577361a", function( data ) { $.getJSON( "http://api.dirble.com/v2/category/"+dirble_catid+"/stations?page="+dirble_page+"&per_page=20&token="+TOKEN, function( data ) {
$('#dirble_loading').addClass('hide'); $('#dirble_loading').addClass('hide');
if (data.length == 20) $('#next').removeClass('hide'); if (data.length == 20) $('#next').removeClass('hide');
@ -839,7 +850,7 @@ function dirble_load_stations() {
click: function() { click: function() {
var _this = $(this); var _this = $(this);
$.getJSON( "http://api.dirble.com/v2/station/"+$(this).attr("radioid")+"?token=2e223c9909593b94fc6577361a", function( data ) { $.getJSON( "http://api.dirble.com/v2/station/"+$(this).attr("radioid")+"?token="+TOKEN, function( data ) {
socket.send("MPD_API_ADD_TRACK," + data.streams[0].stream); socket.send("MPD_API_ADD_TRACK," + data.streams[0].stream);
$('.top-right').notify({ $('.top-right').notify({
@ -857,7 +868,7 @@ function dirble_load_stations() {
"<span class=\"glyphicon glyphicon-play\"></span></a>").find('a').click(function(e) { "<span class=\"glyphicon glyphicon-play\"></span></a>").find('a').click(function(e) {
e.stopPropagation(); e.stopPropagation();
$.getJSON( "http://api.dirble.com/v2/station/"+_this.attr("radioid")+"?token=2e223c9909593b94fc6577361a", function( data ) { $.getJSON( "http://api.dirble.com/v2/station/"+_this.attr("radioid")+"?token="+TOKEN, function( data ) {
socket.send("MPD_API_ADD_PLAY_TRACK," + data.streams[0].stream); socket.send("MPD_API_ADD_PLAY_TRACK," + data.streams[0].stream);
$('.top-right').notify({ $('.top-right').notify({
@ -878,7 +889,7 @@ function dirble_load_stations() {
click: function() { click: function() {
var _this = $(this); var _this = $(this);
$.getJSON( "http://api.dirble.com/v2/station/"+$(this).attr("radioid")+"?token=2e223c9909593b94fc6577361a", function( data ) { $.getJSON( "http://api.dirble.com/v2/station/"+$(this).attr("radioid")+"?token="+TOKEN, function( data ) {
socket.send("MPD_API_ADD_TRACK," + data.streams[0].stream); socket.send("MPD_API_ADD_TRACK," + data.streams[0].stream);
$('.top-right').notify({ $('.top-right').notify({
@ -896,7 +907,7 @@ function dirble_load_stations() {
"<span class=\"glyphicon glyphicon-play\"></span></a>").find('a').click(function(e) { "<span class=\"glyphicon glyphicon-play\"></span></a>").find('a').click(function(e) {
e.stopPropagation(); e.stopPropagation();
$.getJSON( "http://api.dirble.com/v2/station/"+_this.attr("radioid")+"?token=2e223c9909593b94fc6577361a", function( data ) { $.getJSON( "http://api.dirble.com/v2/station/"+_this.attr("radioid")+"?token="+TOKEN, function( data ) {
socket.send("MPD_API_ADD_PLAY_TRACK," + data.streams[0].stream); socket.send("MPD_API_ADD_PLAY_TRACK," + data.streams[0].stream);
$('.top-right').notify({ $('.top-right').notify({