PageSourceSearch

https://www.kerktijden.nl/appjs/Abroad.js?v=vG0KUtWEOlmo8888YTtuYkdI5tCdZW5381u95_-qUxw

js kerktijden.nl collected 2026-10-02 02:53:10 UTC 21,595 bytes, 455 lines download raw bytes

1"use strict";
2var __extends = (this && this.__extends) || (function () {
3    var extendStatics = function (d, b) {
4        extendStatics = Object.setPrototypeOf ||
5            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6            function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7        return extendStatics(d, b);
8    };
9    return function (d, b) {
10        if (typeof b !== "function" && b !== null)
11            throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12        extendStatics(d, b);
13        function __() { this.constructor = d; }
14        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15    };
16})();
17var Abroad = /** @class */ (function (_super) {
18    __extends(Abroad, _super);
19    function Abroad() {
20        var _this = _super.call(this) || this;
21        _this._communities = [];
22        _this._communitiesDutch = [];
23        _this._communityQueryResult = { query: "", visibleCount: 30, items: [] };
24        _this._communityQueryResultFilter = { dutchServices: true, foreignServices: true };
25        _this._loading = false;
26        return _this;
27    }
28    Abroad.prototype.BindMap = function () {
29        var _this = this;
30        this._favoriteCommunities = this.GetCommunities();
31        var map = this.setMapExtended();
32        this._map = map;
33        // buitenlandse gemeenten met een nederlandse dienst
34        var method = this.ApiHost + "/api/community/getcommunitiesabroad";
35        $.ajax({
36            url: method,
37            method: "GET",
38            success: function (response) {
39                _this._communitiesDutch = response;
40                var markerIcon = L.icon({
41                    iconUrl: '/images/map-marker-green.svg',
42                    //iconSize: [44, 60],
43                    //iconAnchor: [22, 60],
44                    iconSize: [31, 42],
45                    iconAnchor: [16, 42],
46                    popupAnchor: [-3, -76]
47                });
48                _this.addMarkerGroups(map, markerIcon, true, _this._communitiesDutch);
49                _this.BindMapExtended(map);
50            }
51        });
52    };
53    Abroad.prototype.BindMapExtended = function (map) {
54        var _this = this;
55        this.initScrollDown();
56        var west = map.getBounds().getNorthWest();
57        var east = map.getBounds().getSouthEast();
58        var method = this.ApiHost + "/api/community/GetCommunitiesAbroadInBox";
59        $.ajax({
60            url: method,
61            data: { latLonStart: "".concat(west.lat, ",").concat(west.lng), latLonEnd: "".concat(east.lat, ",").concat(east.lng) },
62            method: "GET",
63            success: function (response) {
64                for (var _i = 0, response_1 = response; _i < response_1.length; _i++) {
65                    var c = response_1[_i];
66                    var islistedDutch = _this._communitiesDutch.filter(function (p) { return p.locations[0].geoLocation.position.latitude == c.locations[0].geoLocation.position.latitude; }).length > 0;
67                    var islisted = _this._communities.filter(function (p) { return p.locations[0].geoLocation.position.latitude == c.locations[0].geoLocation.position.latitude; }).length > 0;
68                    if (!islisted && !islistedDutch)
69                        _this._communities.push(c);
70                }
71                var markerIcon = L.icon({
72                    iconUrl: '/images/map-marker-orange.svg',
73                    iconSize: [31, 42],
74                    iconAnchor: [16, 42],
75                    //iconSize: [44, 60],
76                    //iconAnchor: [22, 60],
77                    popupAnchor: [-3, -76]
78                });
79                _this.addMarkerGroups(map, markerIcon, false, _this._communities);
80            }
81        });
82    };
83    Abroad.prototype.bindFilter = function () {
84        var _this = this;
85        var app_searchresult_filter = Vue.createApp({
86            data: function () { return _this._communityQueryResultFilter; },
87            methods: {},
88            watch: {
89                dutchServices: function (val) {
90                    _this.updateMapExtended(_this._map);
91                },
92                foreignServices: function (val) {
93                    _this.updateMapExtended(_this._map);
94                }
95            }
96        });
97        var filter = this.VueComplete(app_searchresult_filter, "#searchresult-filter", null, false);
98        this._communityQueryResultFilter = filter.$data;
99    };
100    Abroad.prototype.BindQuery = function (query) {
101        var _this = this;
102        var app_searchresult_list = Vue.createApp({
103            data: function () { return _this._communityQueryResult; },
104            methods: {
105                HasTimes: function (details) {
106                    if (details.defaultGatheringTimes == null)
107                        return false;
108                    if (details.defaultGatheringTimes.length == 0)
109                        return false;
110                    return details.defaultGatheringTimes[0].times.length > 0;
111                },
112                GetMapsLink: function (details) {
113                    var _a;
114                    var coordinates = details.locations[0].geoLocation.position;
115                    return "https://www.google.com/maps/dir//".concat(details.locations[0].street, "+").concat((_a = details.locations[0].number) !== null && _a !== void 0 ? _a : "", "/@").concat(coordinates.latitude, ",").concat(coordinates.longitude, ",20z/");
116                }
117            }
118        });
119        this.vm_searchresult_list = this.VueComplete(app_searchresult_list, "#search-results", null, false);
120        this._communityQueryResult = this.vm_searchresult_list.$data;
121        var ll = new URLSearchParams(window.location.search).get("ll");
122        this.bindFilter();
123        if (query != '') {
124            var method = this.ApiHost + "/api/search/AutocompleteCommunityAbroad";
125            this._query = query;
126            this._communityQueryResult.query = query;
127            $.ajax({
128                url: method,
129                data: { query: query },
130                success: function (response) {
131                    if (response == null)
132                        return;
133                    _this._communityQueryResult.items = [];
134                    var firstCommunity = JSON.parse(JSON.stringify(response.length > 0 ? response[0] : null));
135                    for (var _i = 0, response_2 = response; _i < response_2.length; _i++) {
136                        var community = response_2[_i];
137                        if (community.id == "0")
138                            continue;
139                        _this._communityQueryResult.items.push(community);
140                    }
141                    if (firstCommunity != null)
142                        _this.zoomToCommunity(firstCommunity);
143                    else {
144                        _this.getQueryLocation(_this._query);
145                    }
146                }
147            });
148        }
149        if (ll) {
150            var lat = ll.split('~')[0];
151            var lon = ll.split('~')[1];
152            var latlng = new L.LatLng(lat, lon);
153            this._map.setView(latlng, 10);
154        }
155    };
156    Abroad.prototype.getQueryLocation = function (query) {
157        var _this = this;
158        var method = this.ApiHost + "/api/search/FindGeoLocationsOther";
159        $.ajax({
160            url: method,
161            method: "GET",
162            data: { query: query },
163            success: function (response) {
164                if (response != null && response[0].latitude != null) {
165                    var lat = parseFloat(response[0].latitude);
166                    var lon = parseFloat(response[0].longitude);
167                    _this._map.setView([lat, lon], 11);
168                }
169                //this._map.setView([42.03499, 5.626363], 7);
170            }
171        });
172    };
173    Abroad.prototype.zoomToCommunity = function (community) {
174        //var map = this.setMapExtended();  
175        if (community == null)
176            return;
177        var c = JSON.parse(JSON.stringify(community));
178        this._communityQueryResult.items.splice(0, this._communityQueryResult.items.length);
179        var latlng = L.latLng(c.locations[0].geoLocation.position.latitude, c.locations[0].geoLocation.position.longitude);
180        this._map.setView(latlng, 10);
181    };
182    Abroad.prototype.setMapExtended = function () {
183        var _this = this;
184        var mymap = L.map('map', {
185            worldCopyJump: true,
186            dragging: !L.Browser.mobile,
187            tap: !L.Browser.mobile,
188            scrollWheelZoom: false
189        }).setView([51.03499, 5.626363], 4);
190        var mapSource = "https://tile.openstreetmap.org/{z}/{x}/{y}.png";
191        L.tileLayer(mapSource, {
192            attribution: 'Map data &copy; <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors, <a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, Imagery © <a href="https://www.mapbox.com/">Mapbox</a>',
193            maxZoom: 20,
194            id: 'mapbox/streets-v11',
195            //tileSize: 256,
196            //zoomOffset: -1,
197        }).addTo(mymap);
198        mymap.on("moveend", function (e) {
199            _this.updateMapExtended(mymap);
200        });
201        mymap.on("zoomend", function (e) {
202            _this.updateMapExtended(mymap);
203        });
204        return mymap;
205    };
206    Abroad.prototype.updateMapExtended = function (map) {
207        var _this = this;
208        if (this._loading)
209            return;
210        this._loading = true;
211        var west = map.getBounds().getNorthWest();
212        var east = map.getBounds().getSouthEast();
213        var method = this.ApiHost + "/api/community/GetCommunitiesAbroadInBox";
214        $.ajax({
215            url: method,
216            data: { latLonStart: "".concat(west.lat, ",").concat(west.lng), latLonEnd: "".concat(east.lat, ",").concat(east.lng) },
217            method: "GET",
218            success: function (response) {
219                _this._communities = [];
220                for (var _i = 0, response_3 = response; _i < response_3.length; _i++) {
221                    var c = response_3[_i];
222                    var islistedDutch = _this._communitiesDutch.filter(function (p) { return p.locations[0].geoLocation.position.latitude == c.locations[0].geoLocation.position.latitude; }).length > 0;
223                    if (!islistedDutch)
224                        _this._communities.push(c);
225                }
226                var markerIcon = L.icon({
227                    iconUrl: '/images/map-marker-orange.svg',
228                    iconSize: [31, 42],
229                    iconAnchor: [16, 42],
230                    //iconSize: [44, 60],
231                    //iconAnchor: [22, 60],
232                    popupAnchor: [-3, -76]
233                });
234                _this.addMarkerGroups(map, markerIcon, true, _this._communities);
235                _this._loading = false;
236            }
237        });
238    };
239    Abroad.prototype.initScrollDown = function () {
240        var top = $(".section-search-abroad-info").position().top;
241        var mapTop = $("#map").position().top;
242        // ===== Scroll Down For Map ==== 
243        $("body").append("<a href='javascript:' id='scroll-down'><i></i></a>");
244        $('#scroll-down').fadeIn(200);
245        $("main").scroll(function () {
246            if ($(this).scrollTop() >= top) { // If page is scrolled more than top
247                $('#scroll-down').fadeOut(200); // fade out the arrow
248            }
249            else {
250                $('#scroll-down').fadeIn(200); // else fade in the arrow
251            }
252        });
253        $(window).scroll(function () {
254            if ($(this).scrollTop() >= top) { // If page is scrolled more than top
255                $('#scroll-down').fadeOut(200); // fade out the arrow
256            }
257            else {
258                $('#scroll-down').fadeIn(200); // else fade in the arrow
259            }
260        });
261        $('#scroll-down').click(function () {
262            if ($(document).scrollTop() < mapTop - 1) {
263                $('body,html,main').animate({
264                    scrollTop: mapTop // Scroll to Maps
265                }, 500);
266            }
267            else {
268                $('body,html,main').animate({
269                    scrollTop: top // Scroll to below Maps
270                }, 500);
271            }
272        });
273    };
274    Abroad.prototype.setMap = function () {
275        var mymap = L.map('map', {
276            scrollWheelZoom: false
277        }
277).setView([52.03499, 5.626363], 7);
278        L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
279            attribution: 'Map data &copy; <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors, <a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, Imagery © <a href="https://www.mapbox.com/">Mapbox</a>',
280            maxZoom: 20,
281            id: 'mapbox/streets-v11',
282            tileSize: 512,
283            zoomOffset: -1,
284        }).addTo(mymap);
285        var markerIcon = L.icon({
286            iconUrl: '/images/map-marker-green.svg',
287            iconSize: [31, 42],
288            iconAnchor: [16, 42],
289            //iconSize: [44, 60],
290            //iconAnchor: [22, 60],
291            popupAnchor: [-3, -76]
292        });
293        this.addMarkers(mymap, markerIcon);
294    };
295    Abroad.prototype.setSearchResultList = function () {
296        var west = this._map.getBounds().getNorthWest();
297        var east = this._map.getBounds().getSouthEast();
298        this._communityQueryResult.items.splice(0, this._communityQueryResult.items.length);
299        for (var _i = 0, _a = this._communities; _i < _a.length; _i++) {
300            var c = _a[_i];
301            var lat = c.locations[0].geoLocation.position.latitude;
302            var lng = c.locations[0].geoLocation.position.longitude;
303            if (lat < west.lat && lat > east.lat && lng > west.lng && lng < east.lng) {
304                this._communityQueryResult.items.push(c);
305            }
306        }
307        for (var _b = 0, _c = this._communitiesDutch; _b < _c.length; _b++) {
308            var c = _c[_b];
309            var lat = c.locations[0].geoLocation.position.latitude;
310            var lng = c.locations[0].geoLocation.position.longitude;
311            if (lat < west.lat && lat > east.lat && lng > west.lng && lng < east.lng) {
312                this._communityQueryResult.items.push(c);
313            }
314        }
315    };
316    Abroad.prototype.addMarkerGroups = function (map, markerIcon, clear, list) {
317        var _this = this;
318        // voeg lijst toe aan zoekresultaat
319        if (this._markers != null && clear) {
320            this._markers.clearLayers();
321            this.clearAndPopulateMap(map);
322        }
323        if (this._markers == null) {
324            this._markers = L.markerClusterGroup({ maxClusterRadius: 65 });
325        }
326        if (this._communityQueryResultFilter.dutchServices == false) {
327            list = list.filter(function (p) { return p.id.startsWith("F"); });
328        }
329        if (this._communityQueryResultFilter.foreignServices == false) {
330            list = list.filter(function (p) { return p.id.startsWith("F") == false; });
331        }
332        for (var _i = 0, list_1 = list; _i < list_1.length; _i++) {
333            var community = list_1[_i];
334            var coordinates = community.locations[0].geoLocation.position;
335            var marker = L.marker([coordinates.latitude, coordinates.longitude], { icon: markerIcon })
336                .bindTooltip(community.name, { permanent: false, direction: 'top', offset: L.point(0, -55) });
337            var popup = L.DomUtil.create('div', 'infoWindow');
338            popup.innerHTML = "<div id='info'><p id='title'>".concat(community.name, "</p><p>").concat(community.locations[0].country, "</p></div>");
339            popup["communityId"] = community.id;
340            marker.bindPopup(popup);
341            map.on('popupopen', function (e) {
342                var communityId = e.popup._content["communityId"];
343                var marker = e.popup._source;
344                marker.closePopup();
345                _this.showCommunityDetails(communityId);
346            });
347            if (community.isDenomination) {
348                if (community.isDenomination) {
349                    /*
350                    // Geen kerkgenootschappen op de kaart
351                    var icon = this.getMarkerIconDenomination(community.shortName);
352                    marker = L.marker([coordinates.latitude, coordinates.longitude], { icon: icon })
353                        .bindTooltip(community.name, { permanent: false, direction: 'top' })
354                        .addTo(map);
355                    marker.bindPopup(popup);
356                    */
357                }
358            }
359            else
360                this._markers.addLayer(marker);
361        }
362        map.addLayer(this._markers);
363        this.setSearchResultList();
364    };
365    Abroad.prototype.getMarkerIconDenomination = function (denomination) {
366        var className = "map-marker-".concat(denomination.toLowerCase());
367        var imageData = "data:image/svg+xml,<svg width='60px' height='60px' viewBox='-2 -2 123 123' xmlns='http://www.w3.org/2000/svg'><circle cx='60' cy='60' r='60' stroke='white' stroke-width='3' fill='%23CC7412'/> <text fill='white' style='font-size:30px;font-family:arial' x='50%' y='52%' dominant-baseline='middle' text-anchor='middle'>".concat(denomination, "</text></svg>");
368        var markerIcon = L.icon({
369            iconUrl: imageData,
370            iconSize: [60, 60],
371            iconAnchor: [30, 30],
372            popupAnchor: [-3, -76],
373            className: className,
374        });
375        return markerIcon;
376    };
377    Abroad.prototype.clearAndPopulateMap = function (map) {
378        map.removeLayer(this._markers);
379        var markerIcon = L.icon({
380            iconUrl: '/images/map-marker-green.svg',
381            iconSize: [31, 42],
382            iconAnchor: [16, 42],
383            popupAnchor: [-3, -76]
384        });
385        this.addMarkerGroups(map, markerIcon, false, this._communitiesDutch);
386    };
387    Abroad.prototype.addMarkers = function (map, markerIcon) {
388        var _this = this;
389        var markers = [];
390        for (var _i = 0, _a = this._communities; _i < _a.length; _i++) {
391            var community = _a[_i];
392            var coordinates = community.locations[0].geoLocation.position;
393            var marker = L.marker([coordinates.latitude, coordinates.longitude], { icon: markerIcon }).addTo(map);
394            var popup = L.DomUtil.create('div', 'infoWindow');
395            popup.innerHTML = "<div id='info'><p id='title'>".concat(community.name, "</p><p>").concat(community.locations[0].country, "</p></div>");
396            popup["communityId"] = community.id;
397            marker.bindPopup(popup);
398            markers.push(marker);
399            map.on('popupopen', function (e) {
400                var communityId = e.popup._content["communityId"];
401                var marker = e.popup._source;
402                marker.closePopup();
403                _this.showCommunityDetails(communityId);
404            });
405        }
406        var group = new L.featureGroup(markers);
407    };
408    Abroad.prototype.showCommunityDetails = function (communityId) {
409        var _this = this;
410        var community = this._communities.filter(function (p) { return p.id == communityId; })[0];
411        if (community == null) {
412            community = this._communitiesDutch.filter(function (p) { return p.id == communityId; })[0];
413        }
414        if (community == null)
415            return;
416        community.favorite = this._favoriteCommunities.filter(function (p) { return p.CommunityId == communityId; }).length > 0;
417        community.favoriteSaved = false;
418        if (this._vueDetails == null) {
419            this._vueDetails = Vue.createApp({
420                data: function () { return { details: community }; },
421                methods: {
422                    HasTimes: function (details) {
423                        if (details.defaultGatheringTimes == null)
424                            return false;
425                        if (details.defaultGatheringTimes.length == 0)
426                            return false;
427                        return details.defaultGatheringTimes[0].times.length > 0;
428                    },
429                    GetMapsLink: function (details) {
430                        var _a;
431                        var coordinates = details.locations[0].geoLocation.position;
432                        return "https://www.google.com/maps/dir//".concat(details.locations[0].street, "+").concat((_a = details.locations[0].number) !== null && _a !== void 0 ? _a : "", "/@").concat(coordinates.latitude, ",").concat(coordinates.longitude, ",20z/");
433                    },
434                    SaveAsFavorite: function (details) {
435                        _this.StoreCommunity(details.name, "", details.id);
436                        details.favorite = true;
437                        details.favoriteSaved = true;
438                    },
439                    RemoveAsFavorite: function (details) {
440                        _this.RemoveCommunity(details.name, "", details.id);
441                        details.favorite = false;
442                    }
443                }
444            });
445            this._vm_details = this.VueComplete(this._vueDetails, "#communitydetails", null, false);
446            this._selectedCommunity = this._vm_details.$data;
447        }
448        else {
449            this._selectedCommunity.details = community;
450        }
451        $("#communitydetails").modal("show");
452    };
453    return Abroad;
454}(BaseUI));
455//# sourceMappingURL=Abroad.js.map

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.