You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wookie.apache.org by sc...@apache.org on 2011/04/12 12:46:15 UTC

svn commit: r1091366 - in /incubator/wookie/trunk/widgets/weather: config.xml weather.css weather.js

Author: scottbw
Date: Tue Apr 12 10:46:15 2011
New Revision: 1091366

URL: http://svn.apache.org/viewvc?rev=1091366&view=rev
Log:
Updated the weather widget to better conform to W3C: renamed "Widget" to "widget", added a white background, fixed the service URL to avoid a redirect, and only call proxify() if the function exists (i.e., its in Wookie and not another widget engine like Opera)

Modified:
    incubator/wookie/trunk/widgets/weather/config.xml
    incubator/wookie/trunk/widgets/weather/weather.css
    incubator/wookie/trunk/widgets/weather/weather.js

Modified: incubator/wookie/trunk/widgets/weather/config.xml
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/widgets/weather/config.xml?rev=1091366&r1=1091365&r2=1091366&view=diff
==============================================================================
--- incubator/wookie/trunk/widgets/weather/config.xml (original)
+++ incubator/wookie/trunk/widgets/weather/config.xml Tue Apr 12 10:46:15 2011
@@ -20,7 +20,7 @@
   <description>A silly Weather widget</description>  
   <icon src="icon.png"/>  
   <content src="index.htm"/>  
-  <access origin="http://feeds.bbc.co.uk"/>  
+  <access origin="http://newsrss.bbc.co.uk"/>  
   <author>Scott Wilson</author>  
   <licence>Licensed under the Apache 2.0 License (see http://www.apache.org/licenses/LICENSE-2.0).</licence> 
 </widget>

Modified: incubator/wookie/trunk/widgets/weather/weather.css
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/widgets/weather/weather.css?rev=1091366&r1=1091365&r2=1091366&view=diff
==============================================================================
--- incubator/wookie/trunk/widgets/weather/weather.css (original)
+++ incubator/wookie/trunk/widgets/weather/weather.css Tue Apr 12 10:46:15 2011
@@ -31,6 +31,7 @@ body{
  margin-top:0px;	
  margin-left:0px;
  color: #000000;
+ background-color: #FFFFFF;
 } 
 
 div#front

Modified: incubator/wookie/trunk/widgets/weather/weather.js
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/widgets/weather/weather.js?rev=1091366&r1=1091365&r2=1091366&view=diff
==============================================================================
--- incubator/wookie/trunk/widgets/weather/weather.js (original)
+++ incubator/wookie/trunk/widgets/weather/weather.js Tue Apr 12 10:46:15 2011
@@ -16,7 +16,8 @@
  */
 // A widget for showing the weather in a given location.
 
-var serviceLocation = "http://feeds.bbc.co.uk/weather/feeds/rss/5day/world/"
+//var serviceLocation = "http://feeds.bbc.co.uk/weather/feeds/rss/5day/world/"
+var serviceLocation = "http://newsrss.bbc.co.uk/weather/forecast/";
 var city="manchester";
 
 var iconTable = new Array;
@@ -78,7 +79,7 @@ function getDropDownList(){	
 }
 
 function init(){	
-	var pref = Widget.preferences.getItem("city");
+	var pref = widget.preferences.getItem("city");
     setLocation(pref);
 }
 
@@ -87,7 +88,7 @@ function setLocation(obj){
     if (obj && obj != "null") thecity = obj.toLowerCase();
     if (thecity == null) thecity = "manchester";
     if (cities[thecity] != null) city = thecity;
-    Widget.preferences.setItem("city",city);
+    widget.preferences.setItem("city",city);
     startFetchingWeather();
 }
 
@@ -116,8 +117,10 @@ function startFetchingWeather()
 }
 
 function fetchWeatherData(){
-	var loc = serviceLocation + cities[city]+".xml";    
-    loc = Widget.proxify(loc);
+	var loc = serviceLocation + cities[city]+"/Next3DaysRSS.xml";    
+    if (window.widget && typeof window.widget.proxify == 'function'){
+        loc = widget.proxify(loc);
+    }
     var xml_request = new XMLHttpRequest();
 	xml_request.open("GET", loc, true);	
 	xml_request.onreadystatechange = function()
@@ -163,6 +166,6 @@ function updateDisplay()
 
 function setCity(theCity){
 	city = theCity.toLowerCase();    
-    Widget.preferences.setItem("city", city);
+    widget.preferences.setItem("city", city);
     fetchWeatherData();
 }