PageSourceSearch

https://artsandculturecentre.com/gfw/Common/Widgets/googleMapsWidget.js?_=7.92.0

js artsandculturecentre.com collected 2026-10-02 08:14:42 UTC 3,538 bytes, 97 lines download raw bytes

1/*
2 *  The following widget(s) extend the WidgetMaster object defined in widgetParent.js
3 */
4
5/*
6 *  Google Maps Widget
7 *
8 */
9
10function gMapWidget(widgetId, widgetParams, articleContext) {
11    WidgetMaster.call(this, widgetId, widgetParams, articleContext);
12}
13
14gMapWidget.prototype = Object.create(WidgetMaster.prototype);
15gMapWidget.prototype.constructor = gMapWidget;
16
17gMapWidget.prototype.render = function () {
18    var defaults = {
19      width:  700,
20      height: Math.floor(700 / 1.618 - 100)  // dividing default width by golden ratio minus 100px
21    };
22
23    var widgetDiv = document.getElementById(this.widgetId);
24    var wrapperContainer;
25    let googleMapsAPIKey;
26
27    
28    if (widgetDiv) {
29        
30        if (typeof this.widgetParams["googleMapsAPIKey"] !== 'undefined' && !!this.widgetParams["googleMapsAPIKey"]) {
31            googleMapsAPIKey = this.widgetParams["googleMapsAPIKey"];
32        } else {
33            console.warn("Google Maps API key not found in widget... If the API Key it's configured, regenerate the widget.");
34            return;
35        }
36
37        wrapperContainer = this.renderWrapperContainer(widgetDiv); //wrapperContainer added for [AVT-4216]
38
39        if (this.widgetParams["latitude"] != "" && this.widgetParams["longitude"] != "") {
40
41            var make_mapLink = this.widgetParams["link"];
42
43            var mapScale = "1";
44
45            if (this.widgetParams["scale"] != "") {
46                mapScale = this.widgetParams["scale"];
47            }
48
49            var mapImage_src = "https://maps.googleapis.com/maps/api/staticmap?markers=|";
50            mapImage_src += this.widgetParams["latitude"];
51            mapImage_src += ","
52            mapImage_src += this.widgetParams["longitude"];
53            mapImage_src += "&zoom=";
54            mapImage_src += this.widgetParams["zoom"];
55            mapImage_src += "&size=";
56            mapImage_src += this.widgetParams["width"] || defaults.width;
57            mapImage_src += "x";
58            mapImage_src += this.widgetParams["height"] || defaults.height;
59            mapImage_src += "&sensor=false"
60            mapImage_src += "&scale="
61            mapImage_src += mapScale;
62            mapImage_src += "&center="
63            mapImage_src += this.widgetParams["latitude"];
64            mapImage_src += ","
65            mapImage_src += this.widgetParams["longitude"];
66
67            if (!!googleMapsAPIKey) {
68                mapImage_src += "&key=" + encodeURIComponent(googleMapsAPIKey);
69            }
70
71
72            var mapLink_src = "http://maps.google.com/maps?q=";
73            mapLink_src += this.widgetParams["latitude"];
74            mapLink_src += ",";
75            mapLink_src += this.widgetParams["longitude"];
76
77            var mapImage = document.createElement("img");
78            mapImage.setAttribute("src", mapImage_src);
79
80            if (!this.widgetParams["width"]) {
81              mapImage.setAttribute("style", "display: block; width: 100%; max-width: 100%;");
82            }
83
84            wrapperContainer.appendChild(mapImage);
85
86            if (make_mapLink != "" && make_mapLink == "true") {
87                var mapLink = document.createElement("a");
88                mapLink.setAttribute("href", mapLink_src);
89                mapLink.setAttribute("class", "get-directions btn btn-link");
90                mapLink.setAttribute("target", "_blank");
91                mapLink.innerHTML = this.widgetParams["get directions label"] || "get directions";
92
93                wrapperContainer.appendChild(mapLink);
94            }
95        }
96    }
97};

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.