Sha256: f2d5c86c89a244a7545e6d0661ad3a693804a66b2ca5085e69031e58c4c59ce5

Contents?: true

Size: 1.44 KB

Versions: 469

Compression:

Stored size: 1.44 KB

Contents

var xmlHttpReq = null;

function setTag(tag,value) {
	if (document.getElementsByTagName) {
		var el=document.getElementsByTagName(tag);
		for (i=0;i<el.length;i++) {
			el[i].innerText = value;
  		}
	}
}

function doHttpReadyStateChange() {
	if (xmlHttpReq.readyState == 4) {
		if (xmlHttpReq.status == 200) {
      		var data = xmlHttpReq.responseText;
      		if (data != null) {
				data = data.split(";");
				setTag("geolatitude",data[1]);
				setTag("geolongitude",data[2]);
				setTag("geolocation",data[0]);
				//alert("setTimeout");
			    setTimeout(getGeoLocation,5000);
			}
		}
	}
}

function ajaxCall(url)
{
        //Construct an XMLHTTP Object to handle our HTTP Request
        if (xmlHttpReq != null){
			xmlHttpReq = null;
		}

        if (xmlHttpReq == null){
        	try {
            	xmlHttpReq = new ActiveXObject("Msxml2.XMLHTTP");
        	} catch (err) {
            	alert("Can't make the call using Msxml2.XMLHTTP");
            	try {
                	xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
				} catch (err2) {
            		alert("Can't make the call - xmlHttpReq is not available");
            		return;
            	}
        	}
		}
		//alert("about to open xmlHttpReq");
   		xmlHttpReq.open("GET", url, true);
        xmlHttpReq.onreadystatechange = doHttpReadyStateChange;
		//alert("about to send Req");
   		xmlHttpReq.send();
}

function getGeoLocation() {
	ajaxCall("/system/geolocation");
}

getGeoLocation();

Version data entries

469 entries across 140 versions & 3 rubygems

Version Path
rhodes-7.6.0 spec/server_spec/rhoconnect_push_client/public/js/rhogeolocation-wm.js
rhodes-7.6.0 spec/server_spec/gcm_push_client/public/js/rhogeolocation-wm.js
rhodes-7.6.0 spec/framework_spec/public/js/rhogeolocation-wm.js
rhodes-7.6.0 res/generators/templates/application/public/js/rhogeolocation-wm.js
rhodes-7.6.0 platform/osx/Rhodes Launcher/rhorunner.app/apps/public/js/rhogeolocation-wm.js
rhodes-7.5.1 spec/server_spec/rhoconnect_push_client/public/js/rhogeolocation-wm.js
rhodes-7.5.1 spec/server_spec/gcm_push_client/public/js/rhogeolocation-wm.js
rhodes-7.5.1 spec/framework_spec/public/js/rhogeolocation-wm.js
rhodes-7.5.1 res/generators/templates/application/public/js/rhogeolocation-wm.js
rhodes-7.5.1 platform/osx/Rhodes Launcher/rhorunner.app/apps/public/js/rhogeolocation-wm.js
rhodes-7.4.1 spec/server_spec/gcm_push_client/public/js/rhogeolocation-wm.js
rhodes-7.4.1 spec/server_spec/rhoconnect_push_client/public/js/rhogeolocation-wm.js
rhodes-7.4.1 platform/osx/Rhodes Launcher/rhorunner.app/apps/public/js/rhogeolocation-wm.js
rhodes-7.4.1 res/generators/templates/application/public/js/rhogeolocation-wm.js
rhodes-7.4.1 spec/framework_spec/public/js/rhogeolocation-wm.js
rhodes-7.1.17 res/generators/templates/application/public/js/rhogeolocation-wm.js
rhodes-7.1.17 spec/server_spec/rhoconnect_push_client/public/js/rhogeolocation-wm.js
rhodes-7.1.17 spec/framework_spec/public/js/rhogeolocation-wm.js
rhodes-7.1.17 spec/server_spec/gcm_push_client/public/js/rhogeolocation-wm.js
rhodes-7.1.17 platform/osx/Rhodes Launcher/rhorunner.app/apps/public/js/rhogeolocation-wm.js