diff --git a/mappaSpacciatori.html b/mappaSpacciatori.html new file mode 100644 index 0000000..942dbba --- /dev/null +++ b/mappaSpacciatori.html @@ -0,0 +1,235 @@ + + +
+diff --git a/js/jqm-config.js b/js/jqm-config.js index 11924b2..f0016db 100644 --- a/js/jqm-config.js +++ b/js/jqm-config.js @@ -11,7 +11,8 @@ define(['jquery'], function ($) { $.mobile.buttonMarkup.hoverDelay = 0; // Remove page from DOM when it's being replaced $(document).on("pagecontainerhide", function (event, ui) { - $("div[data-role='page'][stay-in-page='false']:not(.ui-page-active)").remove(); + ui.prevPage.remove(); + //$("div[data-role='page'][stay-in-page='false']:not(.ui-page-active)").remove(); }); }); }); \ No newline at end of file diff --git a/js/manifest.js b/js/manifest.js index 7d52f66..8ee1ca1 100644 --- a/js/manifest.js +++ b/js/manifest.js @@ -1,7 +1,7 @@ var myManifest = { Debug: (window.location.port !== ""), Name: "Il Lievitario", - Version: "2.9.3.0", + Version: "2.9.3.2", Author: "Denis Ironi", Settings: { DefaultURL: (window.location.port === "" ? "http://" + window.location.host + "/Service": "http://" + window.location.hostname + ":" + window.location.port + "/Service_Manut"), diff --git a/js/modules/home/home.js b/js/modules/home/home.js index 05424cb..48be2e1 100644 --- a/js/modules/home/home.js +++ b/js/modules/home/home.js @@ -23,7 +23,6 @@ define(['jquery', 'underscore', 'backbone', 'text!modules/home/homeViewTemplate. } }, events: { - //"click #goFbGroup": "goFbGroup" }, freeWall: null, @@ -132,9 +131,6 @@ define(['jquery', 'underscore', 'backbone', 'text!modules/home/homeViewTemplate. { var self = this; - $( window ).on( "orientationchange", function( event ) { - }); - self.setupFreeWall(); if (Profile.data.picture !== null) @@ -143,8 +139,6 @@ define(['jquery', 'underscore', 'backbone', 'text!modules/home/homeViewTemplate. } Debug.writeMessage(myManifest.Agent.ua); - //if (window.localStorage.getItem("goFbGroup") !== "1") - // this.$el.find("#nuovoGruppo").popup("open"); }, onClosing: function () { if (this.freeWall !== null) diff --git a/js/modules/maps/maps.js b/js/modules/maps/maps.js index ab27384..89460a5 100644 --- a/js/modules/maps/maps.js +++ b/js/modules/maps/maps.js @@ -9,8 +9,13 @@ define(['jquery', 'underscore', 'backbone', 'text!modules/maps/mapsViewTemplate. template: _.template(mapsViewTemplate), infoWindowtemplate: _.template(infoWindowTemplate), defaultLatLng: new google.maps.LatLng(45.4654219, 9.1859243), // Default to Milan + iconPM: { + url: "http://app.gruppolapastamadre.it/icon.png", + scaledSize: new google.maps.Size(24, 24) + }, initialize: function () { this.id = "MapsView"; + this.markers = []; MapsView.__super__.initialize.call(this); }, _centerControl: function(controlDiv, map) { @@ -56,7 +61,6 @@ define(['jquery', 'underscore', 'backbone', 'text!modules/maps/mapsViewTemplate.     } }); - }, _drawMap: function(LatLng){ var self = this; @@ -75,7 +79,8 @@ define(['jquery', 'underscore', 'backbone', 'text!modules/maps/mapsViewTemplate. self.map = new google.maps.Map($("#map-canvas")[0], myOptions); // Create the search box and link it to the UI element. - var input = $("#pac-input")[0]; + var input = $('')[0]; + self.$el.find('div[data-role="content"]')[0].appendChild(input); var searchBox = new google.maps.places.SearchBox(input); self.map.controls[google.maps.ControlPosition.TOP_CENTER].push(input); var centerControlDiv = document.createElement('div'); @@ -129,11 +134,6 @@ define(['jquery', 'underscore', 'backbone', 'text!modules/maps/mapsViewTemplate. self.map.fitBounds(bounds); }); - var iconPM = { - url: "http://app.gruppolapastamadre.it/icon.png", - scaledSize: new google.maps.Size(24, 24) - }; - self.map.addListener('bounds_changed', function() { var bound = self.map.getBounds(); searchBox.setBounds(bound); @@ -144,26 +144,18 @@ define(['jquery', 'underscore', 'backbone', 'text!modules/maps/mapsViewTemplate. //dataType: "json", //async: false, type: 'GET', - success: function (resp) { + success: function (resp) { resp.forEach(function(ele, index){ - if(!self.markers["|" + ele.Latitudine+ "|" + ele.Longitudine+ "|"]) + var key = "|" + ele.Latitudine+ "|" + ele.Longitudine+ "|"; + if(!self.markers[key]) { - var marker = new google.maps.Marker({ - position: new google.maps.LatLng(ele.Latitudine, ele.Longitudine), - icon: iconPM, - //label: ele.Name, - title: ele.Name, - map: self.map - }); - self.markers["|" + ele.Latitudine+ "|" + ele.Longitudine+ "|"] = marker; - - var infowindow = new google.maps.InfoWindow({ - content: self.infoWindowtemplate({item: ele}) - }); - - marker.addListener('click', function() { - infowindow.open(self.map, marker); - }); + self._makeMarker(ele, key); + } + else if(!self.markers[key][ele.ID]) + { + ele.Latitudine = parseFloat(ele.Latitudine) + (Math.random() / 500); + ele.Longitudine = parseFloat(ele.Longitudine) + (Math.random() / 500); + self._makeMarker(ele, key); } }); } @@ -171,7 +163,33 @@ define(['jquery', 'underscore', 'backbone', 'text!modules/maps/mapsViewTemplate. }); $("#pac-input").show(); }, + _makeMarker: function(ele,key){ + var self = this; + var marker = new google.maps.Marker({ + position: new google.maps.LatLng(ele.Latitudine, ele.Longitudine), + icon: self.iconPM, + //label: ele.Name, + title: ele.Name, + map: self.map + }); + + if(!self.markers[key]) + self.markers[key] = []; + + self.markers[key][ele.ID] = marker; + + var infowindow = new google.maps.InfoWindow({ + content: self.infoWindowtemplate({item: ele}) + }); + + marker.addListener('click', function() { + infowindow.open(self.map, marker); + }); + }, onShowed: function(){ + if(this.map) + return; + var self = this; $( window ).resize( function(){ @@ -193,6 +211,16 @@ define(['jquery', 'underscore', 'backbone', 'text!modules/maps/mapsViewTemplate. self._drawMap(self.defaultLatLng); // No geolocation support, show default map     } }, + onClosing: function(){ + var self = this; + Object.keys(self.markers).forEach(function(key, i){ + Object.keys(self.markers[key]).forEach(function(ID, k){ + self.markers[key][ID].setMap(null); + }); + }); + + self.markers = []; + }, //render the content into div of view render: function () { if (this.created === true) diff --git a/js/modules/maps/mapsViewTemplate.html b/js/modules/maps/mapsViewTemplate.html index 6284bbe..959e89c 100644 --- a/js/modules/maps/mapsViewTemplate.html +++ b/js/modules/maps/mapsViewTemplate.html @@ -31,7 +31,6 @@
diff --git a/mappaSpacciatori.html b/mappaSpacciatori.html new file mode 100644 index 0000000..942dbba --- /dev/null +++ b/mappaSpacciatori.html @@ -0,0 +1,235 @@ + + +
+