var LEO_GOOGLE_MAP = new function() {
this.geo;
this.map;
this.gdir;
this.geocoder;
this.addressMarker;
this.trafficInfo;
this.first_try = true;
this.red_marker;
this.minLat;
this.minLng;
this.maxLat;
this.maxLng;
this._event;
this.document;
this.setEvent = function (document, event) {
this.document = document;
this._event = event;
}
this.setMarker = function (data) {
try {
var event = data.event;
var teaserTextAttribute = "Teasertext";
var pictureAttribute = "Bild_Online";
for (i = 0; i < data.statusinfo.count; i++) {
var lat = event[i].date[0].venue.venue_lat;
var lon = event[i].date[0].venue.venue_lon;
lat = lat + (Math.random() * 0.001);
lon = lon + (Math.random() * 0.001);
this.minLat = Math.min(minLat, lat - 0.01);
this.minLng = Math.min(minLng, lon - 0.01);
this.maxLat = Math.max(maxLat, lat + 0.01);
this.maxLng = Math.max(maxLng, lon + 0.01);
var id = event[i].event_id;
var title = event[i].event_identifier;
if (title == _event) {
continue;
}
var staette = event[i].date[0].venue_allocation;
var city = event[i].date[0].venue.venue_town;
var postcode = event[i].date[0].venue.venue_postcode;
var street = event[i].date[0].venue.venue_street;
var house_nr = event[i].date[0].venue.venue_house_number;
if (street != null) {
if (house_nr != null) {
street += " " + house_nr;
}
} else {
street = "";
}
var text = event[i].event_description;
if (text == null) {
if (event[i].textsystem != null && event[i].textsystem[teaserTextAttribute] != null) {
text = event[i].textsystem[teaserTextAttribute].txt_content;
}
}
if (text == null) {
text = "";
}
text.replace("
", "");
text = text.substring(0, 150) + '...';
street = street.substring(0, 28);
staette = staette.substring(0, 28);
title = title.substring(0, 40);
var start = event[i].date[0].date_start;
if (start.indexOf(" 00:00") != -1) {
start = start.replace(" 00:00", "");
} else {
start += ' Uhr';
}
var ende = event[i].date[0].date_end;
if (ende == null) {
ende = event[i].date[0].date_start;
}
if (ende.indexOf(" 23:59") != -1) {
ende = ende.replace(" 23:59", "");
} else {
ende += ' Uhr';
}
if (start == ende) {
start += '
';
ende = "";
} else {
start += ' -
';
}
var bild = 'https://www.kultur-kiste.de/img/icons/veranstaltung.gif';
if (event[i].attributes != null && event[i].attributes[pictureAttribute] != null) {
bild = event[i].attributes[pictureAttribute];
bild = bild.replace("width", "_w");
bild = bild.replace("height", "_h");
bild += '&width=120&height=-1';
}
var html = '
' + title + ''; html += '' + text + 'mehr '; html += ' | |
Wann | '; html += 'Wo | '; html += '
---|---|
' + start + ende + ' | '; html += '' + staette + ' ' + street + ' | ';
html += '