Commits

factormystic committed 4eca880

Restore last temp and condition when the sidebar is re-opened

Comments (0)

Files changed (1)

 var fonttype = System.Gadget.Settings.readString("fonttype");
 var fontSizer;
 
+var last_temp = System.Gadget.Settings.readString("temp");
+var last_condition = System.Gadget.Settings.readString("condition");
+
 function settingsClosed()
 {
 	alert("settingsClosed");
 			var start = data.indexOf('<tmp>')+5;
 			var end = data.indexOf('</tmp>',end);
 			temp.value = data.substr(start, end-start) + "°";
+			System.Gadget.Settings.writeString("temp", temp.value);
 
 			var start = data.indexOf('<t>',start)+3;
 			var end = data.indexOf('</t>',start);
             condition.value = data.substr(start, end-start).toUpperCase();
+			System.Gadget.Settings.writeString("condition", condition.value);
 			
 			temp.width = temp.offsetWidth;
 			temp.left = 675-temp.width-10;
         }                    
     }
 	else
-		alert(xmlHttp.readyState);
+		alert("HTTP Status: "+xmlHttp.readyState);
 }
 
 
 
 	if(temp == null)
 	{
-		temp = bg.addTextObject("0", fonttype, 85, "white", 0, 0);
+		alert("Creating temperature text object, with last value: "+last_temp);
+		temp = bg.addTextObject((last_temp=null?last_temp:"70°"), fonttype, 85, "white", 0, 0);
 		temp.opacity = 30;
 	}
 
 	if(condition == null)
 	{
-		condition = bg.addTextObject("YES", fonttype, 60, "white", 0, 70);
+		alert("Creating condition text object, with last value: "+last_condition);
+		condition = bg.addTextObject((last_condition!=null?last_condition:"CLEAR"), fonttype, 60, "white", 0, 70);
 		condition.opacity = 30;
 	}
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.