PageSourceSearch

https://omilab.org/assets/plugins/google-map/gmap.js

js omilab.org collected 2026-10-04 00:29:02 UTC 11,400 bytes, 366 lines download raw bytes

1window.marker = null;
2var style = [{
3    "featureType": "road.highway",
4    "elementType": "geometry",
5    "stylers": [{
6        "saturation": -100
7    }, {
8        "lightness": -8
9    }, {
10        "gamma": 1.18
11    }]
12}, {
13    "featureType": "road.arterial",
14    "elementType": "geometry",
15    "stylers": [{
16        "saturation": -100
17    }, {
18        "gamma": 1
19    }, {
20        "lightness": -24
21    }]
22}, {
23    "featureType": "poi",
24    "elementType": "geometry",
25    "stylers": [{
26        "saturation": -100
27    }]
28}, {
29    "featureType": "administrative",
30    "stylers": [{
31        "saturation": -100
32    }]
33}, {
34    "featureType": "transit",
35    "stylers": [{
36        "saturation": -100
37    }]
38}, {
39    "featureType": "water",
40    "elementType": "geometry.fill",
41    "stylers": [{
42        "saturation": -100
43    }]
44}, {
45    "featureType": "road",
46    "stylers": [{
47        "saturation": -100
48    }]
49}, {
50    "featureType": "administrative",
51    "stylers": [{
52        "saturation": -100
53    }]
54}, {
55    "featureType": "landscape",
56    "stylers": [{
57        "saturation": -100
58    }]
59}, {
60    "featureType": "poi",
61    "stylers": [{
62        "saturation": -100
63    }]
64}, {}];
65var omilab = new google.maps.LatLng(52.505781, 13.360074);
66var globalCenter = new google.maps.LatLng(31.685533915165284, 13.184292750000001);
67var europeanCenter = new google.maps.LatLng(54.58938668789012, 8.98475650775822);
68var asiaCenter = new google.maps.LatLng(29.415088229292923, 131.9637255571753);
69var nAmericaCenter = new google.maps.LatLng(46.71856107889111, -92.29216655106005);
70var sAmericaCenter = new google.maps.LatLng(-23.189129803085933, -59.06256062796751);
71var africaCenter = new google.maps.LatLng(5.467223362496306, 20.421060872657684);
72var oceaniaCenter = new google.maps.LatLng(-24.143068397423683, 138.0408443054809);
73
74function initialize() {
75    var map;
76
77    var mapOptions = {
78        center: omilab,
79        mapTypeId: google.maps.MapTypeId.ROADMAP,
80        backgroundColor: "#000",
81        zoom: 17,
82        panControl: false,
83        zoomControl: true,
84        mapTypeControl: false,
85        scaleControl: false,
86        streetViewControl: false,
87        overviewMapControl: false,
88        zoomControlOptions: {
89            style: google.maps.ZoomControlStyle.LARGE
90        }
91    }
92    map = new google.maps.Map(document.getElementById('map_canvas'), mapOptions);
93    var mapType = new google.maps.StyledMapType(style, {
94        name: "Grayscale"
95    });
96    map.mapTypes.set('grey', mapType);
97    map.setMapTypeId('grey');
98    var marker_image = '/assets/plugins/google-map/images/marker.png';
99    var pinIcon = new google.maps.MarkerImage(marker_image, null, null, null, new google.maps.Size(62, 85));
100    marker = new google.maps.Marker({
101        position: omilab,
102        map: map,
103        icon: pinIcon,
104        title: 'OMILAB NPO'
105    });
106}
107var map = document.getElementById('map_canvas');
108if (map != null) {
109    /*google.maps.event.addDomListener(window, 'load', initialize);*/
110
111
112    window.addEventListener('load', initialize);
113}
114
115var cluster;
116// Initialize and add the map
117function loadNodesMap() {
118    var mapOptions = {
119        center: globalCenter,
120        mapTypeId: google.maps.MapTypeId.ROADMAP,
121        backgroundColor: "#000",
122        zoom: 3,
123        panControl: false,
124        zoomControl: true,
125        mapTypeControl: false,
126        scaleControl: false,
127        streetViewControl: false,
128        overviewMapControl: false,
129        zoomControlOptions: {
130            style: google.maps.ZoomControlStyle.LARGE
131        },
132        fullscreenControl: true,
133        fullscreenControlOptions: {
134            position: google.maps.ControlPosition.LEFT_TOP
135        }
136
137    }
138    const map = new google.maps.Map(document.getElementById("regions_div"), mapOptions);
139    var mapType = new google.maps.StyledMapType(style, {
140        name: "Grayscale"
141    });
142    map.mapTypes.set('grey', mapType);
143    map.setMapTypeId('grey');
144
145
146    var infowindow = new google.maps.InfoWindow({});
147    infowindow.setOptions({
148        disableAutoPan: false
149    });
150
151    google.maps.event.addListener(infowindow, 'closeclick', function () {
152        //console.log('closed window');
153    });
154
155    var iconBase = baseurl + '/assets/plugins/google-map/images/';
156
157    var icon_red = {
158        url: iconBase + "marker_red.png", // url
159        scaledSize: new google.maps.Size(27, 43), // scaled size
160        origin: new google.maps.Point(0, 0), // origin
161        anchor: new google.maps.Point(14, 43) // anchor
162    };
163
164    var icon_gray = {
165        url: iconBase + "marker_gray.png", // url
166        scaledSize: new google.maps.Size(27, 43), // scaled size
167        origin: new google.maps.Point(0, 0), // origin
168        anchor: new google.maps.Point(14, 43) // anchor
169    };
170
171    var icon_flag = {
172        url: "https://developers.google.com/maps/documentation/javascript/examples/full/images/beachflag.png", // url
173        scaledSize: new google.maps.Size(20, 32), // scaled size
174        origin: new google.maps.Point(0, 0), // origin
175        anchor: new google.maps.Point(0, 32) // anchor
176    };
177
178
179    var marker, i;
180    var markers = [];
181
182
183
184    $.loadScript(baseurl + '/nodes/node_list.js', function () {
185        //Stuff to do after someScript has loaded
186        /*console.log('nodes loaded, now printing...');
187        console.log(locations);*/
188        for (i = 0; i < locations.length; i++) {
189
190            var markerIcon = icon_red;
191            if (locations[i][4] == 'icon_flag') {
192                markerIcon = icon_flag
193            }
194            if (locations[i][4] == 'icon_red') {
195                markerIcon = icon_red
196            }
197            if (locations[i][4] == 'icon_gray') {
198                markerIcon = icon_gray
199            }
200
201            marker = new google.maps.Marker({
202                position: new google.maps.LatLng(locations[i][1], locations[i][2]),
203                map: map,
204                icon: markerIcon
205            });
206
207            markers.push(marker);
208
209            google.maps.event.addListener(marker, 'click', (function (marker, i) {
210                return function () {
211                    infowindow.setContent(locations[i][3]);
212                    map.setCenter(this.getPosition());
213                    if (window.location.href.includes('omilab_nodes')) {
214                        infowindow.open(map, marker);
215                    } else {
216                        $('#' + locations[i][5]).modal('show');
217                    }
218                }
219            })(marker, i));
220        }
221        const markerCluster = new MarkerClusterer(map, markers, {
222            imagePath: "../../assets/plugins/google-map/images/m",
223            gridSize: 50
224
225        });
226        cluster = markerCluster;
227    });
228
229
230
231
232    const centerControlDiv = document.createElement("div");
233    centerControlDiv.index = 1;
234    centerControlDiv.style.paddingTop = "30px";
235    centerControlDiv.style.paddingRight = "50px";
236    createCenterControl(centerControlDiv, map, omilab);
237    map.controls[google.maps.ControlPosition.TOP_RIGHT].push(centerControlDiv);
238
239
240}
241
242function createCenterControl(controlDiv, map, center) {
243
244    controlDiv.style.clear = "both";
245
246    const globalCenterUI = document.createElement("div");
247    globalCenterUI.id = "globalCenterUI";
248    globalCenterUI.title = "View Global OMiLAB Network";
249    controlDiv.appendChild(globalCenterUI);
250
251    const globalCenterText = document.createElement("div");
252    globalCenterText.id = "globalCenterText";
253    globalCenterText.innerHTML = "Global OMiLAB Network";
254    globalCenterUI.appendChild(globalCenterText);
255
256    globalCenterUI.addEventListener("click", () => {
257        map.setZoom(3);
258        cluster.setGridSize(50);
259        map.panTo(globalCenter);
260    });
261
262    const chapterDropDownUI = document.createElement("div");
263    chapterDropDownUI.id = "chapterDropDownUI";
264    chapterDropDownUI.title = "View OMILAB chapters";
265    chapterDropDownUI.classList.add("dropdown");
266    controlDiv.appendChild(chapterDropDownUI);
267
268    const chapterDropDownText = document.createElement("div");
269    chapterDropDownText.id = "chapterDropDownText";
270    chapterDropDownText.classList.add("dropbtn");
271    chapterDropDownText.innerHTML = "OMILAB Chapters";
272    chapterDropDownUI.appendChild(chapterDropDownText);
273
274    const chapterDropDownItemContainer = document.createElement("div");
275    chapterDropDownItemContainer.classList.add("dropdown-content");
276    chapterDropDownUI.appendChild(chapterDropDownItemContainer);
277
278    const europeItem = document.createElement("a");
279    europeItem.innerHTML = "Europe";
280    chapterDropDownItemContainer.appendChild(europeItem);
281    europeItem.addEventListener("click", () => {
282        map.setZoom(4);
283        map.panTo(europeanCenter);
284        cluster.setGridSize(20);
285    });
286
287    const asiaItem = document.createElement("a");
288    asiaItem.innerHTML = "Asia";
289    chapterDropDownItemContainer.appendChild(asiaItem);
290    asiaItem.addEventListener("click", () => {
291        map.setZoom(4);
292        map.panTo(asiaCenter);
293        cluster.setGridSize(20);
294    });
295    const nAmericaItem = document.createElement("a");
296    nAmericaItem.innerHTML = "North America";
297    chapterDropDownItemContainer.appendChild(nAmericaItem);
298    nAmericaItem.addEventListener("click", () => {
299        map.setZoom(4);
300        map.panTo(nAmericaCenter);
301        cluster.setGridSize(20);
302    });
303
304    const sAmericaItem = document.createElement("a");
305    sAmericaItem.innerHTML = "South America";
306    chapterDropDownItemContainer.appendChild(sAmericaItem);
307    sAmericaItem.addEventListener("click", () => {
308        map.setZoom(4);
309        map.panTo(sAmericaCenter);
310        cluster.setGridSize(20);
311    });
312
313    const africaItem = document.createElement("a");
314    africaItem.innerHTML = "Africa";
315    chapterDropDownItemContainer.appendChild(africaItem);
316    africaItem.addEventListener("click", () => {
317        map.setZoom(4);
318        map.panTo(africaCenter);
319        cluster.setGridSize(20);
320    });
321
322    const oceaniaItem = document.createElement("a");
323    oceaniaItem.innerHTML = "Oceania";
324    chapterDropDownItemContainer.appendChild(oceaniaItem);
325    oceaniaItem.addEventListener("click", () => {
326        map.setZoom(4);
327        map.panTo(oceaniaCenter);
328        cluster.setGridSize(20);
329    });
330
331
332
333    /*const debugReadCenterAndZoom = document.createElement("div");
334    debugReadCenterAndZoom.id = "debugReadCenterAndZoom";
335    debugReadCenterAndZoom.title = "Click to change the center of the map";
336    controlDiv.appendChild(debugReadCenterAndZoom);
337    
338    const debugReadCenterAndZoomText = document.createElement("div");
339    debugReadCenterAndZoomText.id = "debugReadCenterAndZoomText";
340    debugReadCenterAndZoomText.innerHTML = "Set Center";
341    debugReadCenterAndZoom.appendChild(debugReadCenterAndZoomText);
342
343    debugReadCenterAndZoomText.addEventListener("click", () => {
344        console.log('click on set center');
345        console.log(map.getCenter().lat());
346        console.log(map.getCenter().lng());
347        console.log(map.getZoom());
348    });*/
349
350}
351
352var regions = document.getElementById('regions_div');
353if (regions != null) {
354    /*google.maps.event.addDomListener(window, 'load', loadNodesMap);*/
355
356    window.addEventListener('load', loadNodesMap);
357}
358
359jQuery.loadScript = function (url, callback) {
360    jQuery.ajax({
361        url: url,
362        dataType: 'script',
363        success: callback,
364        async: true
365    });
366}

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.