From 2924da4bd4456a72e33e6d216ecc27cb628046bd Mon Sep 17 00:00:00 2001 From: martin Date: Wed, 30 Mar 2011 17:06:04 -0400 Subject: [PATCH] CC-1990:Widget to display schedule and "Now Playing" on any website -added internationalization support for all WADR widgets --- plugins/jquery.showinfo.js | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/plugins/jquery.showinfo.js b/plugins/jquery.showinfo.js index 87b5c1ad8..bda16ce29 100644 --- a/plugins/jquery.showinfo.js +++ b/plugins/jquery.showinfo.js @@ -4,6 +4,7 @@ var defaults = { updatePeriod: 20, //seconds sourceDomain: "http://localhost/", //where to get show status from + text: {onAirToday:"On air today"} }; var options = $.extend(defaults, options); options.sourceDomain = addEndingBackslash(options.sourceDomain); @@ -30,7 +31,7 @@ } tableString = ""; - tableString += "

On air today

"; + tableString += "

"+options.text.onAirToday+"

"; tableString += ""+ ""; @@ -41,7 +42,7 @@ tableString += "" + "" + - "" + + "" + ""; } @@ -55,10 +56,13 @@ updateWidget(); } + function airtimeScheduleJsonpError(jqXHR, textStatus, errorThrown){ + } + function getServerData(){ $.ajax({ url: options.sourceDomain + "api/live-info/", dataType:"jsonp", success:function(data){ processData(data); - }, error:function(jqXHR, textStatus, errorThrown){}}); + }, error:airtimeScheduleJsonpError}); setTimeout(getServerData, options.updatePeriod*1000); } }); @@ -72,7 +76,8 @@ var defaults = { updatePeriod: 5, //seconds sourceDomain: "http://localhost/", //where to get show status from - audioStreamSource: "http://localhost:8000/airtime.mp3" //where to get audio stream from + audioStreamSource: "http://localhost:8000/airtime.mp3", //where to get audio stream from + text: {listenLive:"Listen WADR Live", onAirNow:"On Air Now", offline:"Offline", current:"Current", next:"Next"} }; var options = $.extend(defaults, options); options.sourceDomain = addEndingBackslash(options.sourceDomain); @@ -86,7 +91,7 @@ var currentShow = sd.getCurrentShow(); var nextShows = sd.getNextShows(); - var showStatus = "Offline"; + var showStatus = options.text.offline; var currentShowName = ""; var timeElapsed = ""; var timeRemaining = ""; @@ -95,7 +100,7 @@ var nextShowRange = ""; if (currentShow.length > 0){ - showStatus = "On Air Now"; + showStatus = options.text.onAirNow; currentShowName = currentShow[0].getName(); timeElapsed = sd.getShowTimeElapsed(currentShow[0]); @@ -108,14 +113,14 @@ } obj.empty(); - obj.append("Listen WADR Live"); + obj.append(""+options.text.listenLive+""); obj.append("

"+showStatus+" >>

"); obj.append(""); //refresh the UI to update the elapsed/remaining time @@ -127,10 +132,13 @@ updateWidget(); } + function airtimeScheduleJsonpError(jqXHR, textStatus, errorThrown){ + } + function getServerData(){ $.ajax({ url: options.sourceDomain + "api/live-info/", dataType:"jsonp", success:function(data){ processData(data); - }, error:function(jqXHR, textStatus, errorThrown){}}); + }, error:airtimeScheduleJsonpError}); setTimeout(getServerData, options.updatePeriod*1000); } }); @@ -220,10 +228,13 @@ updateWidget(data); } + function airtimeScheduleJsonpError(jqXHR, textStatus, errorThrown){ + } + function getServerData(){ $.ajax({ url: options.sourceDomain + "api/week-info/", dataType:"jsonp", success:function(data){ processData(data); - }, error:function(jqXHR, textStatus, errorThrown){}}); + }, error:airtimeScheduleJsonpError}); setTimeout(getServerData, options.updatePeriod*1000); } });
"+shows[i].getRange()+""+shows[i].getName()+" Listen"+shows[i].getName()+"