mirror of
https://github.com/farcasclaudiu/myfriendsaround.git
synced 2026-06-28 23:01:53 +03:00
- App check if running on device or emulator
- LocationString on update - web app markers icons
This commit is contained in:
@@ -11,11 +11,20 @@
|
||||
var i = 0;
|
||||
|
||||
// A function to create the marker and set up the event window
|
||||
function createMarker(point, name, html) {
|
||||
var marker = new GMarker(point);
|
||||
GEvent.addListener(marker, "click", function() {
|
||||
marker.openInfoWindowHtml(html);
|
||||
});
|
||||
function createMarker(point, name, html, icon, lastUpdated) {
|
||||
var mIcon = new GIcon();
|
||||
if(icon.length >0)
|
||||
mIcon.image = icon;
|
||||
mIcon.iconSize = new GSize(32, 32);
|
||||
mIcon.iconAnchor = new GPoint(16, 16);
|
||||
var opts = {
|
||||
icon: mIcon,
|
||||
title: name + ' - ' + lastUpdated
|
||||
};
|
||||
var marker = new GMarker(point, opts);
|
||||
// GEvent.addListener(marker, "click", function() {
|
||||
// marker.openInfoWindowHtml(html);
|
||||
// });
|
||||
// save the info we need to use later for the side_bar
|
||||
gmarkers[i] = marker;
|
||||
htmls[i] = html;
|
||||
@@ -30,13 +39,13 @@
|
||||
}
|
||||
|
||||
// Process the Json file
|
||||
processJson = function(doc) {
|
||||
processJson = function (doc) {
|
||||
var jsonData = eval('(' + doc + ')');
|
||||
|
||||
// Plot the markers
|
||||
for (var i = 0; i < jsonData.markers.length; i++) {
|
||||
var point = new GLatLng(jsonData.markers[i].lat, jsonData.markers[i].lng);
|
||||
var marker = createMarker(point, jsonData.markers[i].label, jsonData.markers[i].html);
|
||||
var marker = createMarker(point, jsonData.markers[i].label, jsonData.markers[i].html, jsonData.markers[i].icon, jsonData.markers[i].lastUpdated);
|
||||
map.addOverlay(marker);
|
||||
}
|
||||
}
|
||||
@@ -46,7 +55,7 @@
|
||||
map.clearOverlays();
|
||||
for (var i = 0; i < jsonData.markers.length; i++) {
|
||||
var point = new GLatLng(jsonData.markers[i].lat, jsonData.markers[i].lng);
|
||||
var marker = createMarker(point, jsonData.markers[i].label, jsonData.markers[i].html);
|
||||
var marker = createMarker(point, jsonData.markers[i].label, jsonData.markers[i].html, jsonData.markers[i].icon, jsonData.markers[i].lastUpdated);
|
||||
map.addOverlay(marker);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user