var dftAlbumArt='https://cdnrf.securenetsystems.net/file_radio/stations_large/JCH/v5/album-art-default.png'; var xmlpath='https://radio.securenetsystems.net/player_status_update/JCH.xml'; var livepath='https://radio.securenetsystems.net/cirrusencore/JCH'; var d = new Date(); var localServerTSoffset = d.getTime()+d.getTimezoneOffset()*60000 - Date.parse("06 Dec 2021 11:34:13"); //load params var scripts = document.getElementsByTagName('script'); var index = scripts.length - 1; var myScript = scripts[index]; var queryString = myScript.src.replace(/^[^\?]+\??/,''); //console.log(queryString); var params = ssilive_parseQuery( queryString ); var rc=params['b']; var b_id=rc.replace('.',''); document.write('
On now
Listen live
'); //load jquery if is not included if(window.addEventListener){ window.addEventListener('load', ssiLiveButton_loadJq(b_id)) }else{ window.attachEvent('onload', ssiLiveButton_loadJq(b_id)) } function ssiLiveButton_loadJq(b_id){ //load jquery if is not present if (typeof(jQuery) == 'undefined') { var script = document.createElement('script'); script.type = "text/javascript"; script.onload = function(){ssiLiveButton_makeWidget(b_id);setTimeout("ssi_pulsateButton()",1000); } script.src = "https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"; document.getElementsByTagName('head')[0].appendChild(script); }else{ ssiLiveButton_makeWidget(b_id); setTimeout("ssi_pulsateButton()",1000); } var cssfile = document.createElement('link'); cssfile.rel = "stylesheet"; cssfile.type = "text/css"; cssfile.href = "//radio.securenetsystems.net/cirrusencore/livebutton/livebutton.css"; document.getElementsByTagName('head')[0].appendChild(cssfile); }; function ssi_pulsateButton(){ //jQuery('.ssiLiveButton_playButtonClone').animate({opacity:0.3},{ duration: 800, queue: false, complete:function(){ssi_pulsateButtonBack() }}); //jQuery('.ssiLiveButton_playButtonClone').animate({borderLeftWidth:64,borderTopWidth:32,borderBottomWidth:32,bottom:'0px',right:'0px',opacity:0},{ duration: 1500, queue: false, complete:function(){ssi_pulsateButtonBack() }}); //jQuery('.ssiLiveButton_playButtonClone2').animate({borderLeftWidth:58,borderTopWidth:29,borderBottomWidth:29,bottom:'3px',right:'3px',opacity:1},{ duration: 1500, queue: false, complete:function(){ }}); } function ssi_pulsateButtonBack(){ //jQuery('.ssiLiveButton_playButtonClone').animate({opacity:0},{ duration: 200, queue: false, complete:function(){setTimeout("ssi_pulsateButton()",1000); }}); jQuery('.ssiLiveButton_playButtonClone').animate({borderLeftWidth:40,borderTopWidth:20,borderBottomWidth:20,bottom:'12px',right:'15px',opacity:0},{ duration: 200, queue: false, complete:function(){jQuery('.ssiLiveButton_playButtonClone').css('opacity',1);setTimeout("ssi_pulsateButton()",1500); }}); jQuery('.ssiLiveButton_playButtonClone2').animate({borderLeftWidth:40,borderTopWidth:20,borderBottomWidth:20,bottom:'12px',right:'15px',opacity:1},{ duration: 200, queue: false, complete:function(){ }}); } //get station settings and podcasts list function ssiLiveButton_makeWidget(b_id){ if (typeof(jQuery) == 'undefined') { setTimeout(function(){ssiLiveButton_makeWidget(b_id);},200); return false; } var xmlpath=jQuery("#b_"+b_id).data('xmlpath'); var localServerTSoffset=jQuery("#b_"+b_id).data('localservertsoffset'); jQuery.ajax({url: xmlpath+"?randStr=" + Math.random(), type: "GET", dataType: "xml", success: function(xml){ var nextsongReqTime=5000; if(jQuery(xml).find("programType").text() && jQuery(xml).find("title").text()){ if(jQuery(xml).find("title").text()==jQuery("#b_"+b_id).find('.ssiLiveButton_Title').html() && jQuery(xml).find("programStartTS").text()==jQuery("#b_"+b_id).find('.ssiLiveButton').data('programstartts')){ nextsongReqTime=2000; }else{ //console.log('set current play'); jQuery("#b_"+b_id).find('.ssiLiveButton_Title').html(jQuery(xml).find("title").text()); jQuery("#b_"+b_id).find('.ssiLiveButton_Artist').html(jQuery(xml).find("artist").text()); jQuery("#b_"+b_id).find('.ssiLiveButton_Album').html(jQuery(xml).find("album").text()); if(jQuery(xml).find("cover").text()==undefined){ var nprogramCover=jQuery("#b_"+b_id).data('dftalbumart'); }else{ var nprogramCover=jQuery(xml).find("cover").text(); } if(nprogramCover==''){ nprogramCover=jQuery("#b_"+b_id).data('dftalbumart'); } if(nprogramCover!=undefined && nprogramCover!=''){ nprogramCover=nprogramCover.replace('http:','https:'); if(jQuery("#b_"+b_id).css('background-image')!='url("'+nprogramCover+'")'){ jQuery("#b_"+b_id).css('background-image',"url('"+nprogramCover+"')"); } } var programDuration=jQuery(xml).find("duration").text(); var programStartTS=jQuery(xml).find("programStartTS").text(); jQuery("#b_"+b_id).find('.ssiLiveButton').data('programstartts',programStartTS) var d = new Date(); var current_play= parseInt(((d.getTime()+d.getTimezoneOffset()*60000) - localServerTSoffset - Date.parse(programStartTS))/1000); var nextsongReqTime=(parseInt(programDuration)-current_play)*1000-10000; if(nextsongReqTime<2000){ nextsongReqTime=2000; } } //console.log(':refresh:'+nextsongReqTime); setTimeout("ssiLiveButton_makeWidget('"+b_id+"')",nextsongReqTime); }else{ var nprogramCover=''; if(nprogramCover==''){ nprogramCover=jQuery("#b_"+b_id).data('dftalbumart');; } nprogramCover=nprogramCover.replace('http:','https:'); jQuery("#b_"+b_id).css('background-image',"url('"+nprogramCover+"')"); //console.log(programType+':refresh:5000'); setTimeout("ssiLiveButton_makeWidget('"+b_id+"')",5000); } }, error: function() { } }); } function ssilive_parseQuery ( query ) { var Params = new Object (); if ( ! query ) return Params; // return empty object var Pairs = query.split(/[;&]/); for ( var i = 0; i < Pairs.length; i++ ) { var KeyVal = Pairs[i].split('='); if ( ! KeyVal || KeyVal.length != 2 ) continue; var key = unescape( KeyVal[0] ); var val = unescape( KeyVal[1] ); val = val.replace(/\+/g, ' '); Params[key] = val; } return Params; }