87,7 → 87,7 |
--> |
</style> |
|
<script type="text/javascript" src="scripts/builder?src=object,dom,dom/storage,dom/events,dom/timeout,dom/window<?php |
<script type="text/javascript" src="scripts/builder?src=object,dom,dom/storage,dom/events,dom/timeout,dom/widgets,dom/window,http,lcars<?php |
if ($isLocal) |
{ |
?>&verbose=1&debug=1<?php |
372,7 → 372,7 |
<div class="multi-display"> |
<div class="upper"> |
<div class="content"> |
<div class="title"><span>Home</span></div> |
<div class="title" id="title"><span>Home</span></div> |
<div class="analysis"> |
<table> |
<tr> |
501,6 → 501,86 |
<td><script type="text/javascript"> |
var fullscreen = jsx.dom.window.fullscreen; |
|
var map, circle; |
|
function initGMap () |
{ |
var coords = jsx.dom.geolocation.position.coords; |
//var title = document.getElementById("title"); |
//title.firstChild.textContent = [coords.latitude.toFixed(), "° ", coords.longitude, "° (", coords.accuracy, "\xA0m)"].join(""); |
var center = new google.maps.LatLng(coords.latitude, coords.longitude); |
var zoom = 9; |
|
var zoomAccuracy = [ |
1e7, 5e6, 2e6, 2e6, 1e6, 5e5, 2e5, 1e5, 5e4, |
2e4, 1e4, 5e3, 2000, 2000, 1000, 500, 200, |
100, 50, 20 |
]; |
|
var accuracy = coords.accuracy; |
if (!isNaN(accuracy)) |
{ |
for (var i = 0, len = zoomAccuracy.length; i < len; ++i) |
{ |
if (accuracy > zoomAccuracy[i]) |
{ |
zoom = i; |
break; |
} |
} |
} |
|
if (!map) |
{ |
var mapOptions = { |
center: center, |
zoom: zoom, |
mapTypeId: google.maps.MapTypeId.HYBRID, |
backgroundColor: "#000", |
noClear: true, |
scaleControl: true |
}; |
|
map = new google.maps.Map(document.getElementById("map-canvas"), mapOptions); |
} |
else |
{ |
map.setCenter(center); |
map.setZoom(zoom); |
} |
|
if (!circle) |
{ |
if (!isNaN(coords.accuracy)) |
{ |
circle = new google.maps.Circle({ |
map: map, |
center: center, |
radius: coords.accuracy, |
fillColor: "white", |
fillOpacity: 0.125, |
strokeColor: "white", |
strokeOpacity: 0.5 |
}); |
} |
} |
else |
{ |
if (!isNaN(coords.accuracy)) |
{ |
circle.setCenter(center); |
circle.setRadius(coords.accuracy); |
} |
else |
{ |
circle.setMap(null); |
} |
} |
|
/* Restore transition */ |
document.getElementById("content").style.transition = ""; |
} |
|
jsx.dom.geolocation = { |
getText: function (position) { |
var coords = position.coords; |
523,7 → 603,36 |
}, |
|
show: function (position) { |
window.alert("<?php echo tr('Your current coordinates on Terra'); ?>\n\n" + this.getText(position)); |
this.position = position; |
//document.getElementById("content").innerHTML = "<?php echo tr('Your current coordinates on Terra'); ?>\n\n" + this.getText(position); |
var title = document.getElementById("title"); |
title.firstChild.textContent = "<?php echo tr('Geolocation'); ?>"; |
var content = document.getElementById("content"); |
|
if (!map) |
{ |
/* Disable transition while map is loading */ |
content.style.transition = "none"; |
content.className = "fixed"; |
content.innerHTML = |
// '<select><option>Google Maps</option><option>OpenStreetMap</option></select>' |
'<div id="map-canvas" style="position: absolute; width: 100%; height: 100%"></div>'; |
} |
|
var scriptId = "google-maps"; |
var script = document.getElementById(scriptId); |
if (!script) |
{ |
script = document.createElement("script"); |
script.id = scriptId; |
script.type = "text/javascript"; |
script.src = "http://maps.googleapis.com/maps/api/js?key=AIzaSyCpW3bu57j4V7_vcK_cVpvFkXMmKkKgADI&sensor=true&callback=initGMap&language=<?php echo $language; ?>"; |
document.body.appendChild(script); |
} |
else |
{ |
initGMap(); |
} |
} |
}; |
|