PageSourceSearch

https://cdn.ticketportal.cz/Scripts/timelinemap.js?etag=D4CA17472AE68EE897CC01CB26848D78

js ticketportal.cz collected 2026-09-24 09:30:48 UTC 14,467 bytes, 386 lines download raw bytes

1//*******************
2//*** region mapa ***
3//*******************
4
5var map = null;                                             // Objekt mapy
6var infoWindowOpened = null;                                // Ukazovatel na informacne okno na mape ktore je prave otvorene
7var zoznamMarkerov = new Array();                           // Zoznam vsetkych znaciek na mape
8var map_is_init = false;                                    // Info ci je mapa inicializovana
9var map_is_init2 = false;                                   // Ci je mapa inicializovana kompletne
10var markerClusterer = null;
11
12window.initialize = function () {
13    //...
14}
15
16function init_map() {
17
18    if (map_is_init == false) {
19        map_is_init = true;
20
21        var script = document.createElement('script');
22        script.type = 'text/javascript';
23        script.src = googleAPIScript + '&callback=initialize';          // Parameter zabezpeci ze gogole skript bude fungovat, aj ked bol vlozeny asynchronne
24        document.body.appendChild(script);
25
26        var script2 = document.createElement('script');
27        script2.type = 'text/javascript';
28        script2.src = absoluteUri + 'Scripts/MarkerClusterer.js'; // 'http://google-maps-utility-library-v3.googlecode.com/svn/tags/markerclustererplus/2.1.2/src/markerclusterer.js';
29        document.body.appendChild(script2);
30
31        init_map2();
32    }
33
34}
35
36function init_map2() {
37
38    if (typeof (google) != 'undefined' && typeof (MarkerClusterer) != "undefined" && map_is_init2 == false) {                               // Cakame kym sa google skripty nenacitaju
39        if (typeof (google.maps.LatLng) != 'undefined') {
40
41            var lat = 48.1458923;
42            var lon = 17.107137299999977;
43            var z = 11;
44
45            if (lokalita == "bg") {
46                lat = 42.697101;
47                lon = 25.170013;
48                z = 8;
49            }
50
51            var mapOptions = {
52                zoom: z,
53                scrollwheel: false,
54                scaleControl: true,
55                zoomControl: true,
56                zoomControlOptions: {
57                    style: google.maps.ZoomControlStyle.LARGE
58                },
59                center: new google.maps.LatLng(lat, lon), 
60                styles: [{ "featureType": "administrative", "elementType": "labels.text.fill", "stylers": [{ "color": "#444444" }] }, { "featureType": "landscape", "elementType": "all", "stylers": [{ "color": "#f2f2f2" }] }, { "featureType": "poi", "elementType": "all", "stylers": [{ "visibility": "off" }] }, { "featureType": "poi.attraction", "elementType": "labels.text.stroke", "stylers": [{ "saturation": "0" }] }, { "featureType": "road", "elementType": "all", "stylers": [{ "saturation": -100 }, { "lightness": 45 }] }, { "featureType": "road.highway", "elementType": "all", "stylers": [{ "visibility": "simplified" }] }, { "featureType": "road.arterial", "elementType": "labels.icon", "stylers": [{ "visibility": "off" }] }, { "featureType": "transit", "elementType": "all", "stylers": [{ "visibility": "off" }] }, { "featureType": "water", "elementType": "all", "stylers": [{ "color": "#00ab94" }, { "visibility": "on" }] }]
61                // [{ "featureType": "all", "stylers": [{ "saturation": 0 }, { "hue": "#e7ecf0" }] }, { "featureType": "road", "stylers": [{ "saturation": -70 }] }, { "featureType": "transit", "stylers": [{ "visibility": "off" }] }, { "featureType": "poi", "stylers": [{ "visibility": "off" }] }, { "featureType": "water", "stylers": [{ "visibility": "simplified" }, { "saturation": -60 }] }]
62            };
63            var mapElement = document.getElementById('mapa-kamzazabavou');
64            map = new google.maps.Map(mapElement, mapOptions);
65            
66
67            // Ked klikne na mapu, tak povolime zoomivanie koleckom
68            google.maps.event.addListener(map, 'click', function (event) {
69                this.setOptions({ scrollwheel: true });
70            });
71
72            // ked klikne mimo tak zakazeme
73            $(document).click(function (evt) {
74                var target = $(evt.target);
75                var isMap = false;
76
77                while (true) {
78                    if (target.attr('id') == "mapa-kamzazabavou") {
79                        isMap = true;
80                        break;
81                    }
82                    if (target[0] == document)
83                        break;
84
85                    target = target.parent();
86
87                    if (target.length == 0)
88                        return;
89                }
90
91                if (isMap == false)
92                    map.setOptions({ scrollwheel: false });
93            });
94
95        
96            for (var id_hladisko in dic_hladisko) {
97                var hladisko = dic_hladisko[id_hladisko];
98                if (hladisko.LAT != null && hladisko.LON != null && hladisko.LAT != 0) {
99
100                    var pocet = 0;
101                    for (var i in hladisko.predstavenia)
102                        pocet = pocet + 1;
103
104                    var icon = {
105                        url: absoluteUri + "/svgcircleikon.ashx?number=" + pocet,
106                        anchor: new google.maps.Point(15, 15),
107                        scaledSize: new google.maps.Size(38, 38)
108                    }
109
110                    var marker = new google.maps.Marker({
111                        position: new google.maps.LatLng(hladisko.LAT, hladisko.LON),
112                        //map: map,
113                        animation: google.maps.Animation.DROP,
114                        title: hladisko.nazov,
115                        icon: icon
116                    });
117
118                    marker["Hladisko_id"] = hladisko.id;
119                    marker["pocet"] = pocet;
120                    hladisko["marker"] = marker;
121                    zoznamMarkerov.push(marker);
122
123                    google.maps.event.addListener(marker, 'click', function () {
124                        map.setOptions({ scrollwheel: true })
125                        timeline_marker_click(this);
126                    });
127                }
128            }
129
130            if (zoznamMarkerov.length != 0) {
131
132                markerClusterer = new MarkerClusterer(map, zoznamMarkerov, {
133                    maxZoom: 10,
134                    gridSize: 40,
135                    maxZoom: 14,
136                    calculator: timeline_mapClustered_calculator
137                });
138
139
140                centruj(zoznamMarkerov);
141            }
142
143
144            map_is_init2 = true;
145            
146            prvu_zmenu_vynechaj = true;
147            google.maps.event.addListener(map, 'bounds_changed', function () {
148                timeline_map_bounds_changed();
149            });
150
151            timeline_map_filter();
152        }
153        else {
154            setTimeout('init_map2();', 250);
155        }
156    }
157    else {
158        setTimeout('init_map2();', 250);
159    }
160}
161
162// Zavola sa po kliknuti na ikonu hladiska na mape
163function timeline_marker_click(marker) {
164    var hladisko = dic_hladisko[marker.Hladisko_id];
165    var infowindow = null;
166
167    if (typeof (hladisko.infowindow) != "undefined" && hladisko.infowindow != null) {
168        infowindow = hladisko.infowindow;
169    }
170    else {
171
172        var content = "<div style='margin:10px'>";
173        content += "<span style='font-size:12px; font-weight:bold'>" + hladisko.nazov + "</span>";
174        content += "&nbsp;&nbsp;<a href='" + linkIframe(absoluteUri + "Venue/" + hladisko.id) + "'>" + lang["btnDetail"] + "</a><br/>";
175
176        if (lokalita == "empik")
177            content += "<span style='font-weight:bold'>" + lang["Adresa"] + ":&nbsp;</span><span>" + hladisko.adresa + ", " + hladisko.mesto.nazov + "</span><br/>";
178        else
179            content += "<span style='font-weight:bold'>" + lang["Adresa"] + ":&nbsp;</span><span>" + hladisko.adresa + ", " + hladisko.psc + " " + hladisko.mesto.nazov + "</span><br/>";
180
181        if (hladisko.www != null && hladisko.www.length > 3)
182            content += "<span style='font-weight:bold'>www:</span><a href='" + (hladisko.www.indexOf('http') == -1 ? 'http://' + hladisko.www : hladisko.www) + "' target='_blank'>" + hladisko.www + "</a><br>";
183        if (lokalita != "empik")
184            content += "<br/><b>" + lang["Podujatia"] + "</b>&nbsp;&nbsp;&nbsp;(Počet predstavení)<br/>";
185        else
186            content += "<br/><b>" + lang["Podujatia"] + "</b><br/>";
187
188        var buff_podujatia = new Array();
189
190        for (var i in hladisko.predstavenia) {
191            var predstavenie = hladisko.predstavenia[i];
192            var podujatie = predstavenie.podujatie;
193
194            if (isnull(buff_podujatia[podujatie.id_podujatie_out]))
195                buff_podujatia[podujatie.id_podujatie_out] = dic_podujatie_out[podujatie.id_podujatie_out];
196        }
197
198        for (var i in buff_podujatia) {
199            var podujatie = buff_podujatia[i];
200            var c = 0;
201
202            for (var ii in podujatie.podujatia)
203                for (var iii in podujatie.podujatia[ii].predstavenia)
204                    if (podujatie.podujatia[ii].predstavenia[iii].hladisko.id == hladisko.id)
205                        c++;
206
207            content += "<a href='" + absoluteUri + "event/" + podujatie.id + (window.location.href.indexOf("iframe") != -1 ? "?iframe" : "") + "'>" + podujatie.nazov + " (" + c + ")</a><br/>";
208        }
209
210        content += "</div>";
211
212        infowindow = new google.maps.InfoWindow({
213            content: content
214        });
215        hladisko["infowindow"] = infowindow;
216    }
217
218    if (infoWindowOpened != null)
219        infoWindowOpened.close();
220
221    infowindow.open(map, marker);
222    infoWindowOpened = infowindow;
223}
224
225// Vyratava cislo, ktore sa ukaze v ikone clustra na mape
226// Rata ako pocet predstaveni pre hladiska ktore su v clastry
227function timeline_mapClustered_calculator(markers, numStyles) {
228    var index = 0;
229    var title = "";
230    var count = markers.length.toString();
231
232    var dv = count;
233    while (dv !== 0) {
234        dv = parseInt(dv / 10, 10);
235        index++;
236    }
237
238    var p = 0;
239    for (var i in markers) {
240        marker = markers[i];
241        p = p + marker.pocet;
242    }
243
244    index = Math.min(index, numStyles);
245    return {
246        text: p,
247        index: index,
248        title: title
249    };
250};
251
252
253function Gmap_center_H(id_selling) {
254    var selling = dic_selling[id_selling];
255    map.setCenter(new google.maps.LatLng(selling.LAT, selling.LON));
256    map.setZoom(16);
257}
258
259function createBoundsForMarkers(markers) {
260    var bounds = new google.maps.LatLngBounds();
261    $.each(markers, function () {
262        bounds.extend(this.getPosition());
263    });
264    return bounds;
265}
266
267function getBoundsZoomLevel(bounds, mapDim) {
268    var WORLD_DIM = { height: 256, width: 256 };
269    var ZOOM_MAX = 16;                                              // Viac sa to nepriblizi, aj keby bol len jeden marker
270
271    function latRad(lat) {
272        var sin = Math.sin(lat * Math.PI / 180);
273        var radX2 = Math.log((1 + sin) / (1 - sin)) / 2;
274        return Math.max(Math.min(radX2, Math.PI), -Math.PI) / 2;
275    }
276
277    function zoom(mapPx, worldPx, fraction) {
278        return Math.floor(Math.log(mapPx / worldPx / fraction) / Math.LN2);
279    }
280
281    var ne = bounds.getNorthEast();
282    var sw = bounds.getSouthWest();
283
284    var latFraction = (latRad(ne.lat()) - latRad(sw.lat())) / Math.PI;
285
286    var lngDiff = ne.lng() - sw.lng();
287    var lngFraction = ((lngDiff < 0) ? (lngDiff + 360) : lngDiff) / 360;
288
289    var latZoom = zoom(mapDim.height, WORLD_DIM.height, latFraction);
290    var lngZoom = zoom(mapDim.width, WORLD_DIM.width, lngFraction);
291
292    return Math.min(latZoom, lngZoom, ZOOM_MAX);
293}
294
295// Vstupom je pole obsahujuce znacky na mape
296// Funkcia vycentruje mapu tak, aby bolo vidiet vsetky puntiky
297function centruj(markers) {
298
299    // Zistime velkost mapy
300    var $mapDiv = $('#mapa-kamzazabavou');
301
302    var mapDim = {
303        height: $mapDiv.height(),
304        width: $mapDiv.width()
305    }
306
307    var bounds = createBoundsForMarkers(markers);
308    map.setCenter(bounds.getCenter());
309    map.setZoom(getBoundsZoomLevel(bounds, mapDim));
310}
311
312
313function timeline_map_filter() {
314
315    for (var i in zoznamMarkerov)
316        zoznamMarkerov[i].setMap(null);
317
318    markerClusterer.clearMarkers();
319    zoznamMarkerov = [];
320
321    var buff_hladiska = new Array();
322    for (var i in search_result) {
323        var predstavenie = search_result[i];
324        if (isnull(buff_hladiska[predstavenie.hladisko.id]))
325            buff_hladiska[predstavenie.hladisko.id] = predstavenie.hladisko;
326    }
327
328    for (var i in buff_hladiska)
329        if (!(isnull(buff_hladiska[i].marker)))
330            zoznamMarkerov.push(buff_hladiska[i].marker);
331
332    markerClusterer = new MarkerClusterer(map, zoznamMarkerov, {
333        maxZoom: 10,
334        gridSize: 40,
335        maxZoom: 14,
336        calculator: timeline_mapClustered_calculator
337    });
338
339    centruj(zoznamMarkerov);
340}
341
342var prvu_zmenu_vynechaj = true;                     // mapa generuje udalost aj hned po nacitani, tuto udalost vynechame
343var bound_change = false;                           // Vlajka ktoru nastavime na tru, ak sa pohlo mapov
344var bound_change_time = null;                       // Zapiseme si cas, kedy nastala udalost
345
346function timeline_map_bounds_changed() {
347
348    if (prvu_zmenu_vynechaj == true) {
349        prvu_zmenu_vynechaj = false;
350        return;
351    }
352
353    bound_change = true;
354    bound_change_time = new Date();
355}
356
357
358function check_bound_change() {
359    if (bound_change == true) {
360
361        if ((new Date()).getTime() - bound_change_time.getTime() > 500) {               // Musi aspon pol sekundu nehybat mapou
362
363            var bound = map.getBounds();
364            var geo = {
365                minLAT: bound.getSouthWest().lat(),
366                maxLAT: bound.getNorthEast().lat(),
367                minLON: bound.getSouthWest().lng(),
368                maxLON: bound.getNorthEast().lng()
369            };
370
371            search_param.setGeo(geo);
372
373            map_is_init2 = false;
374            Generate_timeline();
375            map_is_init2 = true;
376
377            bound_change = false;
378        }
379    }
380
381    setTimeout("check_bound_change();", 200);
382}
383
384check_bound_change();
385
386// end region

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.