/**
* @brief Definition of the MovimMap object
*/
var MovimMap = {
init: function() {
if(document.getElementById('postsmap') == null) return;
MovimMap.postsmap = L.map('postsmap').setView([40,0], 2);
L.tileLayer("http://tile.openstreetmap.org/{z}/{x}/{y}.png", {
attribution: "Map data © OpenStreetMap contributors, CC-BY-SA, Mapnik ©",
maxZoom: 18
}).addTo(MovimMap.postsmap);
MovimMap.bound = [];
MovimMap.layerGroup = new L.LayerGroup().addTo(MovimMap.postsmap);
},
refresh: function() {
if(document.getElementById('postsmap') == null) return;
if(MovimMap.postsmap != null) {
MovimMap.layerGroup.clearLayers();
}
var articles = document.querySelectorAll('article');
for(var i = 0; i < articles.length; i++) {
var article = articles[i];
if(article.dataset.lat != null) {
MovimMap.addMarker(article.dataset.lat, article.dataset.lon, article.id);
}
}
MovimMap.addContact();
MovimMap.fit();
},
addContact: function() {
if(document.getElementById('postsmap') == null) return;
var profile = document.querySelector('#contactsummary_widget .profile');
if(profile.dataset != null && profile.dataset.lat != null) {
var popup = "" +
"