--- a/src/main/resources/scripts/Utils.js Wed Aug 24 17:45:08 2011 -0400
+++ b/src/main/resources/scripts/Utils.js Wed Aug 24 17:52:18 2011 -0400
@@ -1,5 +1,24 @@
+var Const = {
+ distance : { km : 1, mile : 0.621371192 },
+ height : { cm : 1, inch : 0.393700787 },
+ weight : { kg : 1, lb : 2.20462262 },
+
+ // wait for at least 2 consecutive GPS data before declaring the GPS ready
+ gps_max_errors : 2
+
+
+};
+
var Util = {
+ // get the name of a property as a string, based on its value
+ getPropertyString : function(obj, propertyValue) {
+ for (key in obj) {
+ if (obj[key] === propertyValue) return key;
+ }
+ return "";
+ },
+
// Web Storage handling
store : {
@@ -26,16 +45,20 @@
}
},
+ htmlLog : function (msg) {
+ var element = document.getElementById("log");
+ if (element != null) {
+ if (element.textContent) element.textContent = msg;
+ if (element.innerHTML) element.innerHTML = msg;
+ }
+ },
+
log : function (msg) {
try {
-
console.log(msg);
+ // Util.htmlLog(msg);
} catch (e) {
- var element = document.getElementById("log");
- if (element != null) {
- if (element.textContent != null) element.textContent = msg;
- if (element.innerHTML != null) element.innerHTML = msg;
- }
+ Util.htmlLog(msg);
}
},