PageSourceSearch

https://boligoen.dk/BoligExtra/Scripts/incomGoogleMapsFunctions.js?v=31

js boligoen.dk collected 2026-10-08 20:45:31 UTC 11,649 bytes, 309 lines download raw bytes

1var gMapsLoaded = false;
2var paramsForCallback = {};
3
4function continueGmapsInit() {
5    var elemId = paramsForCallback.elemId;
6    var department = paramsForCallback.department;
7    var method = paramsForCallback.method;
8    if (method === "initializeMapContinued") {
9        initializeMapContinued(elemId);
10    }
11    else if (method === "InitializeDepartmentMapContinued") {
12        InitializeDepartmentMapContinued(elemId, department);
13    }
14    else if (method === "InitializeSelectOnMapContinued") {
15        InitializeSelectOnMapContinued(elemId);
16    }
17}
18window.loadGoogleMaps = function () {
19    if (gMapsLoaded) return window.gMapsCallback();
20    var script_tag = document.createElement('script');
21    script_tag.setAttribute("type", "text/javascript");
22	script_tag.toggleAttribute('bex-mandatory', true);
23    script_tag.setAttribute("src", "https://maps.google.com/maps/api/js?key=AIzaSyBeV8lvDQ-mNbbLsyySczevB8hcrHQQZ9E");
24    (document.getElementsByTagName("head")[0] || document.documentElement).appendChild(script_tag);
25	setTimeout(() => {
26		gMapsLoaded = true;
27		continueGmapsInit();
28	}, 500);
29};
30
31
32var markers = [];
33var map = null;
34var AreaSelectMarkers = [];
35
36function resizeMap(elemId) {
37
38    id = "#" + elemId;
39    var Width = document.getElementById(elemId).clientWidth;
40    var height = Width * 0.85;
41    height = Math.round(height);
42
43    $(id).css("height", height + "px");
44}
45function resizeDepartmentMap(elemId) {
46    id = "#" + elemId;
47    var width = document.getElementById(elemId).clientWidth;
48    var height = width * 0.66;
49    height = Math.round(height);
50    $(id).css("height", height + "px");
51}
52function ClearSelectMarkers(markers) {
53    for (var i = 0; i < markers.length; i++) {
54        markers[i].setMap(null);
55    }
56}
57
58function initializeMapContinued(elemId) {
59    var latlng = new google.maps.LatLng(56.1561284, 8.9691532);
60    // Creating an object literal containing the properties we want to pass to the map  
61    var options = {
62        zoom: 17,
63        center: latlng,
64        mapTypeId: google.maps.MapTypeId.ROADMAP,
65        keyboardShortcuts: false,
66        scrollwheel: false
67    };
68    // Calling the constructor, thereby initializing the map
69    map = new google.maps.Map(document.getElementById(elemId), options);
70    LoadMapMarkers(elemId);
71    //FOLIA
72    setupFolia(map);
73}
74function InitializeMap(elemId) {
75    resizeMap(elemId);
76    paramsForCallback = { elemId: elemId, method: "initializeMapContinued" };
77    window.loadGoogleMaps();
78}
79
80function InitializeDepartmentMapContinued(elemId, depData) {
81    var latlng = new google.maps.LatLng(56.1561284, 8.9691532);
82    var options = {
83        zoom: 17,
84        center: latlng,
85        mapTypeId: google.maps.MapTypeId.ROADMAP,
86        keyboardShortcuts: false,
87        scrollwheel: false
88    };
89    // Calling the constructor, thereby initializing the map
90    map = new google.maps.Map(document.getElementById(elemId), options);
91    LoadDepartmentMapMarkers(depData);
92}
93function InitializeDepartmentMap(elemId,depData) {
94    resizeDepartmentMap(elemId);
95    paramsForCallback = { elemId: elemId, department: depData, method: "InitializeDepartmentMapContinued" };
96    window.loadGoogleMaps();
97    //FOLIA
98    setupFolia(map);
99}
100function InitializeSelectOnMapContinued(elemId) {
101    var latlng = new google.maps.LatLng(56.1561284, 8.9691532);
102    // Creating an object literal containing the properties we want to pass to the map  
103    var options = {
104        zoom: 17,
105        center: latlng,
106        mapTypeId: google.maps.MapTypeId.ROADMAP,
107        keyboardShortcuts: false,
108        scrollwheel: false
109    };
110    // Calling the constructor, thereby initializing the map
111    map = new google.maps.Map(document.getElementById(elemId), options);
112    LoadSelectOnMapMarkers();
113    //FOLIA
114    setupFolia(map);
115}
116function InitializeSelectOnMap(elemId) {
117    resizeMap(elemId);
118    paramsForCallback = { elemId: elemId, method: "InitializeSelectOnMapContinued" };
119    window.loadGoogleMaps();
120}
121
122function LoadSelectOnMapMarkers(popupLink) {
123    var markerKeys = [];
124    var m = 0;
125    var bounds = new google.maps.LatLngBounds();
126
127    var Data = {};
128    Data = AreasAndCoords;
129    var nullcoords = 0;
130    for (var i = 0; i < Data.length; i++) {    
131        if (Data[i].Coordinates !== null) {
132            for (var il = 0; il < Data[i].Coordinates.length; il++) {
133                if (Data[i].Coordinates[il] !== null) {
134                    if (Data[i].Coordinates[il].X !== 0 && Data[i].Coordinates[il].Y !== 0 && Data[i].Coordinates[il].X < 60 && Data[i].Coordinates[il].Y < 20) {
135                        AreaSelectMarkers[m] = new google.maps.Marker({
136                            position: new google.maps.LatLng(Data[i].Coordinates[il].X, Data[i].Coordinates[il].Y),
137                            map: map,
138                            title: Data[i].DepartmentAddresses[il].Address,
139                            icon: "/images/map_marker.png",
140                            category: Data[i].RegionCode
141                        });
142                        bounds.extend(new google.maps.LatLng(Data[i].Coordinates[il].X, Data[i].Coordinates[il].Y));
143                        AreaSelectMarkers[m].Key = Data[i].RegionText;
144                        m++;
145                    }
146                }
147                else {
148                    nullcoords++;
149                }
150            }
151        }
152    }
153    var blistener = google.maps.event.addListener(map, 'bounds_changed', function (event) {
154        if (this.getZoom() > 15) {
155            this.setZoom(15);
156        }
157        google.maps.event.removeListener(blistener);
158    });
159    map.fitBounds(bounds);
160    ClearSelectMarkers(AreaSelectMarkers);
161}
162
163function LoadMapMarkers(elemId) {
164    var id = "#" + elemId;
165    var m = 0;
166    var bounds = new google.maps.LatLngBounds();
167    var Data = [];
168    Data = Departments;
169    for (var i = 0; i < Data.length; i++) {
170        if (Data[i].MapData !== null) {
171            if (Data[i].MapData.X !== 0 && Data[i].MapData.Y !== 0 && Data[i].MapData.X < 60 && Data[i].MapData.Y < 20) {
172                markers[m] = new google.maps.Marker({
173                    position: new google.maps.LatLng(Data[i].MapData.X, Data[i].MapData.Y),
174                    map: map,
175                    title: Data[i].Name,
176                    icon: "/images/map_marker.png",
177                    cno: Data[i].CompanyNo,
178                    dno: Data[i].DepartmentNo
179                });
180                google.maps.event.addListener(markers[m], 'click', function () {
181                    var temp = findDepartment(Departments, this.cno, this.dno);
182                    removePopup();
183                    $(id).append(createBubble());
184                    $('#MapDepDiv').append('<a onclick="closeMapDepView($(this))">Luk</a>');
185
186                    $('#MapDepDiv').html($('#map-resultTMPL').render(temp));
187                });
188                bounds.extend(new google.maps.LatLng(Data[i].MapData.X, Data[i].MapData.Y));
189                markers[m].Key = Data[i].Name;
190                m++;
191            }
192        }
193    }
194    var blistener = google.maps.event.addListener((map), 'bounds_changed', function (event) {
195        if (this.getZoom() > 15) {
196            this.setZoom(15);
197        }
198        google.maps.event.removeListener(blistener);
199    });
200    map.fitBounds(bounds);
201}    
202
203function closeMapDepView(sender) {
204    sender.parent().remove();
205}
206
207function LoadDepartmentMapMarkers(depData) {
208    var m = 0;
209    var bounds = new google.maps.LatLngBounds();
210    var Data = {};
211    if(depData !== undefined){
212        Data = depData;
213    }
214    if (Data.Coordinates !== undefined && Data.Coordinates.length > 0) {
215        for (var ix = 0; ix < Data.Coordinates.length; ix++) {
216            var coordinate = Data.Coordinates[ix];
217            if (coordinate.X !== 0 && coordinate.Y !== 0 && coordinate.X < 60 && coordinate.Y < 20) {
218                markers[m] = new google.maps.Marker({
219                    position: new google.maps.LatLng(coordinate.X, coordinate.Y),
220                    map: map,
221                    title: coordinate.Name,
222                    icon: "/images/map_marker.png"
223                });
224
225                bounds.extend(new google.maps.LatLng(coordinate.X, coordinate.Y));
226                markers[m].Key = coordinate.Name + "_" + ix;
227                m++;
228            }
229        }
230    }
231    else if (Data.DepartmentAddresses !== undefined && Data.DepartmentAddresses !== null) {
232        for (d = 0; d < Data.DepartmentAddresses.length; d++) {
233            if(Data.DepartmentAddresses[d].MapData !== null){
234                if (Data.DepartmentAddresses[d].MapData.X !== 0 && Data.DepartmentAddresses[d].MapData.Y !== 0 && Data.DepartmentAddresses[d].MapData.X < 60 && Data.DepartmentAddresses[d].MapData.Y < 20) {
235                    markers[m] = new google.maps.Marker({
236                        position: new google.maps.LatLng(Data.DepartmentAddresses[d].MapData.X, Data.DepartmentAddresses[d].MapData.Y),
237                        map: map,
238                        title: Data.DepartmentAddresses[d].Address,
239                        icon: "/images/map_marker.png"                    
240                    });
241           
242                    bounds.extend(new google.maps.LatLng(Data.MapData.X, Data.MapData.Y));
243                    markers[m].Key = Data.DepartmentAddresses[d].Address;
244                    m++;
245                }
246            }
247        }
248    }
249    var blistener = google.maps.event.addListener((map), 'bounds_changed', function (event) {
250        if (this.getZoom() > 15) {
251            this.setZoom(15);
252        }
253        google.maps.event.removeListener(blistener);
254    });
255    map.fitBounds(bounds);
256}
257
258function LoadAvailTenFrontpageMapMarkers(depData) {
259    var markerKeys = [];
260    var m = 0;
261    var bounds = new google.maps.LatLngBounds();
262
263    var Data = {};
264    Data = depData;
265    if (Data.MapData !== null) {
266        if (Data.MapData.X !== 0 && Data.MapData.Y !== 0 && Data.MapData.X < 60 && Data.MapData.Y < 20) {
267            markers[m] = new google.maps.Marker({
268                position: new google.maps.LatLng(Data.MapData.X, Data.MapData.Y),
269                map: map,
270                title: Data.Name,
271                icon: "/images/map_marker.png",
272                cno: Data.CompanyNo,
273                dno: Data.DepartmentNo
274            });
275                
276            bounds.extend(new google.maps.LatLng(Data.MapData.X, Data.MapData.Y));
277            markers[m].Key = Data.Name;
278            m++;
279        }
280    }
281    var blistener = google.maps.event.addListener(map, 'bounds_changed', function (event) {
282        if (this.getZoom() > 15) {
283            this.setZoom(15);
284        }
285        google.maps.event.removeListener(blistener);
286    });
287    map.fitBounds(bounds);
288}
289function findDepartment(Departments, companyNo, departmentNo) {
290    for (i = 0; i < Departments.length; i++) {
291        var tempDep = Departments[i];
292        if (tempDep.CompanyNo === companyNo && tempDep.DepartmentNo === departmentNo) {
293            return tempDep;
294        }
295    }
296}
297function createBubble() {
298    var popdiv = document.createElement('div');
299    popdiv.id = "MapDepDiv";
300    
301    var t = $('#map_results').height()
302    
303    var d = document.getElementById("map_results");
304    
305    return popdiv;
306}
307function removePopup() {
308    $('#MapDepDiv').remove();
309}

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.