Commits

factormystic committed e521901

Initial commit

  • Participants

Comments (0)

Files changed (2)

File content.html

+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=utf-8">
+<style> 
+body {
+	width: 500px;
+	height: 150px;
+	font-size: 12px;
+	margin: 0;
+	font-family: Verdana;
+	color: #FFFFFF;
+} 
+.gadget {
+	margin: 3px;
+} 
+</style>
+
+<script>
+	var debug = true;
+	function alert(msg) { System.Debug.outputString(msg); }
+</script>
+
+<script type="text/javascript">
+var temp;
+var condition;
+
+var xmlHttp = null;
+
+var zip = 45219
+var url = "http://xoap.weather.com/weather/local/"+zip+"?cc=*&dayf=6&link=xoap&prod=xoap&par=1127063443&key=af5d7d563b56d53c";
+
+function ProcessRequest() 
+{
+	if ( xmlHttp.readyState == 4 && xmlHttp.status == 200 ) 
+    {
+        if ( xmlHttp.responseText == "Not found" ) 
+        {
+			if(temp == null)
+			{
+				temp.value = xmlHttp.status;
+				condition.value = "Error";
+			}
+        }
+        else
+        {
+			var data = xmlHttp.responseText;
+			
+			var start = data.indexOf('<tmp>')+5;
+			var end = data.indexOf('</tmp>',end);
+			temp.value = data.substr(start, end-start) + "°";
+
+			var start = data.indexOf('<t>',start)+3;
+			var end = data.indexOf('</t>',start);
+            condition.value = data.substr(start, end-start).toUpperCase();
+			
+			temp.width = temp.offsetWidth;
+			temp.left = 500-temp.width-10;
+			condition.width = condition.offsetWidth;
+			condition.left = 500-condition.width-10;
+        }                    
+    }
+	else
+		alert(xmlHttp.readyState);
+}
+
+
+function update()
+{
+	alert('Updating HUD Weather Gadget...');
+
+	xmlHttp = new XMLHttpRequest(); 
+    xmlHttp.onreadystatechange = ProcessRequest;
+    xmlHttp.open("GET", url, true);
+    xmlHttp.send(null);
+    
+	var bg = document.getElementById("bg");
+	if(temp == null)
+	{
+		temp = bg.addTextObject("0", "Arial", 85, "white", 0, 0);
+		temp.opacity = 30;
+	}
+
+	if(condition == null)
+	{
+		condition = bg.addTextObject("YES", "Arial", 60, "white", 0, 70);
+		condition.opacity = 30;
+	}
+
+	setTimeout('update()', 60*1000);
+}
+</script>
+</head>
+<body onload="update();" style="align:right;">
+	<g:background id="bg" style="width:100%; height:100%; z-index:-1; position:absolute; top:0; left:0; font-weight:bold;" opacity="0%" />
+</body> 
+</html>
+<?xml version="1.0" encoding="utf-8" ?>
+<gadget>
+  <name>HUD Time</name>
+  <namespace>microsoft.windows</namespace>
+  <version>1.0.0.0</version>
+  <author name="Factor Mystic">
+	<info url="http://factormystic.net/utils" />
+  </author>
+  <copyright>&#169; 2009</copyright>
+  <description>"Heads up display" style weather report</description>
+  <version value="1.0.0.0" MinPlatformVersion ="0.3"/>
+  <hosts>
+    <host name="sidebar">
+      <base type="HTML" apiVersion="1.0.0" src="content.html"/>
+      <permissions>Full</permissions>
+      <platform minPlatformVersion="1.0"/>
+    </host>
+  </hosts>
+</gadget>