$(document).ready(function() { RefreshTitleswonder(); }); function addTimeStamp(){ tstmp = new Date(); return tstmp.getTime(); } function RefreshTitleswonder() { $.ajax({ type: "GET", url: "/whatson/wonder/NowOnAir.xml?timestamp="+addTimeStamp(), dataType: "xml", success: ShowTitleArtistwonder }); //alert("/whatson_remote/updateartistpic.asp?timestamp="+addTimeStamp()+"&q="+qArtist); $.ajax({ type: "GET", url: "/whatson/wonder/AirPlayNext.xml?timestamp="+addTimeStamp(), dataType: "xml", success: ShowNextSongswonder }); $.ajax({ type: "GET", url: "/whatson/wonder/AirPlayHistory.xml?timestamp="+addTimeStamp(), dataType: "xml", success: ShowLastSongswonder }); } function ShowTitleArtistwonder(xml) { $(xml).find("Song").each(function() { qTitle = $(this).attr("title"); $("#wonder_title").html($(this).attr("title")); $(xml).find("Artist").each(function() { $("#wonder_artist").html($(this).attr("name")); qArtist = $(this).attr("name"); $.ajax({ type: "GET", url: "/whatson_remote/updatetrackpic.asp?timestamp="+addTimeStamp()+"&t="+qTitle+"&a="+qArtist, dataType: "text", success: ShowNowPicwonder }); }); }); } function ShowNowPicwonder(txt) { if (txt!=''){ $("#wonder_pic").attr("src",txt); $("#wonder_pic").show(); } else{ $("#wonder_pic").attr("src",''); $("#wonder_pic").hide(); } } function ShowLastSongswonder(xml) { var tmpLastSongs=""; $(xml).find("Song").each(function() { tmpLastSongs = tmpLastSongs + $(this).find("Info").attr("StartTime")+ " > "; tmpLastSongs = tmpLastSongs +"" + $(this).attr("title") + " >"; tmpLastSongs = tmpLastSongs + $(this).find("Artist").attr("name")+ "
"; }); $("#wonder_lastsongs").html(tmpLastSongs); } function ShowNextSongswonder(xml) { var j=0; $(xml).find("Song").each(function() { if (j==0 ){ $("#wonder_nexttitle").html( $(this).attr("title") ); $("#wonder_nextartist").html( $(this).find("Artist").attr("name") ); } j=j+1; $("#nextheader").show(); }); } var oRefreshwonder; oRefreshwonder = window.setInterval("RefreshTitleswonder()", 50000);