diff --git a/script.js b/script.js index a02307e..df10d60 100644 --- a/script.js +++ b/script.js @@ -10,10 +10,10 @@ function update(){ if (first == null) { playing = 'Mitte munnigi ei mängi prg'; } - else if (first.artist != undefined) { - playing = first.artist + ' - '; - playing += first.title; - } else { + else if (first.artist != undefined) { + playing = first.artist + ' - '; + playing += first.title; + } else { playing += first.title; } var nowPlaying = playing; @@ -31,16 +31,16 @@ function update_field(field, data){ } function update_listeners(json_obj){ - var nowPlaying = getFirstPlaying(json_obj); + var nowPlaying = getFirstPlaying(json_obj); if(nowPlaying != null) { update_field('listeners1', nowPlaying.listeners); - } + } } function autoupdate(){ update(); - setInterval(function(){ update(); }, 30000); + setInterval(function(){ update(); }, 30000); } function change_bg(id){ @@ -60,9 +60,9 @@ function getFirstPlaying(jsonObj){ for(o=0; o < sources.length; o++) { if (sources[o].title != undefined && masterStreams.some(stream=>sources[o].listenurl.endsWith(stream))) { //check if source has a title key AND belongs to masterStreams return sources[o]; - } + } } - + return null; }