Subversion Repositories LCARS

Compare Revisions

Last modification

Ignore whitespace Rev 180 → Rev 181

/trunk/index.phtml
125,6 → 125,8
var fullscreenLI = jsx.dom.getElementById("cmd3");
fullscreenLI.firstChild.style.cursor = "";
}
 
lcars.multiDisplay = new lcars.MultiDisplay();
}
</script>
<?php /* <bgsound src="media/interface/sound/beginop.wav" loop="infinite"> */ ?>
501,90 → 503,6
<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
});
circle.addListener("click", function () {
window.alert("<?php echo tr('Your current coordinates on Terra'); ?>\n\n"
+ jsx.dom.geolocation.getText(jsx.dom.geolocation.position));
});
}
}
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;
605,39 → 523,6
"<?php echo tr('Heading:'); ?> " + (heading != null && !isNaN(heading) ? heading + "°" : TEXT_NOT_AVAILABLE)
].join("\n");
},
 
show: function (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();
}
}
};
 
(function () {
686,8 → 571,7
if (navigator.geolocation)
{
features.push('<a href="#" title="<?php echo tr('Get location'); ?>"'
+ ' onclick="navigator.geolocation.getCurrentPosition('
+ 'function (position) { jsx.dom.geolocation.show(position); }); return false"'
+ ' onclick="return lcars.multiDisplay.geolocate(\'<?php echo tr('Geolocation'); ?>\', \'<?php echo $language; ?>\')"'
+ '><?php echo tr('Geolocation'); ?><\/a>');
}