PageSourceSearch

https://www.eaglefireid.gov/GovBuilt.GIS/Scripts/EsriMap_AdvancedF…SiS_FSygmWxX7UBoETUSfcu5nJkn8sS17QeHbuLp5wA

js eaglefireid.gov collected 2026-10-10 01:35:59 UTC 26,992 bytes, 544 lines download raw bytes

1var EsriMap = {
2    Map: "",
3    MapView: "",
4    FeatureLayer: "",
5    DivID: "",
6    search: "",
7    Point: "",
8    Graphic: "",
9    WebStyleSymbol: "",
10    Locator: "",
11    GraphicsLayer: "",
12    isEsriMap: false,
13    MapMarker: "",
14    LatitudeField: "",
15    LongitudeField: "",
16    defaultMapZoom: "15",
17    EsriLayerType: "",
18    defaultFrontEndBaseMap: "",
19    defaultEsriLayerTypeLink: "",
20    EsriLayerURL: "",
21    Locate: "",
22    locateWidget: "",
23    EsriLayers: "",
24    EsriBaseMapId: "",
25    BasemapObj: "",
26    isAccessAdminPanel: false,
27    mapLayers: "",
28    SelectedLayerIndex: 0,
29    jsonMapLayers: [],
30    isMapAlreadyLoaded: false,
31    init: function (id) {
32        this.DivID = id;
33        $("#fillUserDetailsBtn").hide();
34        EsriMapLoadMap();
35    },
36    SearchFeatures: null,
37    MappingObj: null,
38    MappingHideDetailsObj: [],
39    MapMappingObj: null,
40    MappingjsonObj: [],
41    featureMapLayers: [],
42    IsDataGridFillFirst: true,
43    IsMultipleParcelForm: false,
44    additionalSearchSource: [],
45    isDisableGlobalEsriSearch: false,
46    selectedFeature: null,
47    selectedGeometry: null,
48    isPinOnMapDisplay: false,
49    useGlobalEsriAddress: false,
50    UseAddressButtonText: "Use Address",
51    fillJsonAddress: function (jsonDataObj) {
52        $('.EsriLoading').show();
53        $('.loading').show();
54        try {
55            var jsonObj = EsriMap.jsonMapLayers[EsriMap.SelectedLayerIndex].MapAPIKeyMapping;
56            EsriMap.MappingjsonObj = jsonObj;
57            var jsonDatagrid = [];
58            $.each(jsonObj, function (index, value) {
59                if (!jsonDatagrid.includes(value.DataGridAPIKey) && value.DataGridAPIKey !== "" && EsriGeoEngine.FormIo.submission.data.hasOwnProperty(value.DataGridAPIKey)) {
60                    if (EsriGeoEngine.FormIo.submission.data[value.DataGridAPIKey].length == 0 || (EsriGeoEngine.FormIo.submission.data[value.DataGridAPIKey][0]['DataGridFirstRowAlreadyFilled'] != null
61                        && EsriGeoEngine.FormIo.submission.data[value.DataGridAPIKey][0]['DataGridFirstRowAlreadyFilled'])) {
62                        var dataGrid = EsriGeoEngine.FormIo.getComponent(value.DataGridAPIKey);
63                        if (dataGrid != null) {
64                            dataGrid.addRow();
65                        }
66                    }
67                    jsonDatagrid.push(value.DataGridAPIKey);
68                }
69            });
70            $.each(jsonObj, function (index, value) {
71                if (value.DataGridAPIKey !== "" && EsriGeoEngine.FormIo.submission.data.hasOwnProperty(value.DataGridAPIKey)) {
72                    var valueEsri = EsriGeoEngine.GetValueCalculated(jsonDataObj, value.EsriId);
73                    EsriGeoEngine.datagridIndex = EsriGeoEngine.FormIo.submission.data[value.DataGridAPIKey].length - 1;
74                    EsriGeoEngine.FormIo.submission.data[value.DataGridAPIKey][EsriGeoEngine.datagridIndex]['DataGridFirstRowAlreadyFilled'] = true;
75                    if (value.ValueType != null && value.ValueType == "IsBoolean") {
76                        EsriGeoEngine.FormIo.submission.data[value.DataGridAPIKey][EsriGeoEngine.datagridIndex][value.AdvancedFormAPIKey] = valueEsri == value.MatchWith;
77                    } else {
78                        EsriGeoEngine.FormIo.submission.data[value.DataGridAPIKey][EsriGeoEngine.datagridIndex][value.AdvancedFormAPIKey] = valueEsri;
79                    }
80                } else if (EsriGeoEngine.FormIo.submission.data.hasOwnProperty(value.AdvancedFormAPIKey)) {
81                    var valueEsri = EsriGeoEngine.GetValueCalculated(jsonDataObj, value.EsriId);
82                    if (value.ValueType != null && value.ValueType == "IsBoolean" && (value.MatchWith == "" || valueEsri == value.MatchWith)) {
83                        EsriGeoEngine.FormIo.submission.data[value.AdvancedFormAPIKey] = true;
84                    } else {
85                        EsriGeoEngine.FormIo.submission.data[value.AdvancedFormAPIKey] = valueEsri;
86                    }
87                }
88            });
89            if (EsriMap.useGlobalEsriAddress == true && EsriMap.isPinOnMapDisplay == true) {
90                EsriGeoEngine.FormIo.submission.data["applicationLocation"] = EsriMap.selectedFeature.address;
91            }
92            var mapPrimaryKey = EsriMap.jsonMapLayers[EsriMap.SelectedLayerIndex].MapPrimaryKey;
93            EsriGeoEngine.FillInfoSearchValue = jsonDataObj[mapPrimaryKey];
94            EsriGeoEngine.FillbyMap(jsonDataObj, EsriMap.redrawForm);
95            EsriAddressDetailsGeolocation.fillAddressDetailsforGeolocation(jsonDataObj, jsonDataObj[EsriAddressDetailsGeolocation.MapAddressGeolocationServiceURLPrimaryKey]);
96            EsriAddressDetailsGeolocation.fillMailingAddressDetailsforGeolocation(jsonDataObj, jsonDataObj[EsriAddressDetailsGeolocation.MapMailingAddressGeolocationServiceURLPrimaryKey]);
97        } catch (e) {
98            console.log(e);
99            EsriMap.redrawForm();
100        }
101    },
102    addMapLayers: function () {
103        if (EsriMap.jsonMapLayers != null && EsriMap.jsonMapLayers.length > 0) {
104            var tokenPromises = EsriMap.jsonMapLayers.map(function (mapLayer) {
105                if (mapLayer.GisCitizenService != "" && mapLayer.GisCitizenService != null) {
106                    return generateToken($("#hdnEsriID").val(), mapLayer.GisCitizenService)
107                        .then(token => {
108                            registerToken(mapLayer.EsriLayer, token);
109                            return { token: token, mapLayer: mapLayer };
110                        })
111                        .catch(error => {
112                            console.log('Error generating token:', error);
113                            return null;
114                        });
115                } else {
116                    return Promise.resolve({ token: null, mapLayer: mapLayer });
117                }
118            });
119
120            Promise.all(tokenPromises).then(function (results) {
121                results.forEach(function (result, layerIndex) { // Added layerIndex here
122                    var mapLayer = result.mapLayer;
123                    var featureLayerObject = { url: mapLayer.EsriLayer, outFields: ["*"], returnGeometry: true };
124                    if (mapLayer.MapWhereCondition) {
125                        var whereCondition = mapLayer.MapWhereCondition.replaceAll('\\"', "'").replaceAll(/"/g, "'");
126                        featureLayerObject.definitionExpression = whereCondition;
127                    }
128
129                    var featureLayer = new EsriMap.FeatureLayer(featureLayerObject);
130                    var fieldInfos = [];
131                    var textInfos = [];
132                    if (mapLayer.MapAPIKeyMapping != "") {
133                        var jsonObj = mapLayer.MapAPIKeyMapping;
134                        $.each(jsonObj, function (index, value) {
135                            if (value.Title.includes("{") && value.Title.includes("}")) {
136                                textInfos.push({ type: "text", text: value.Title });
137                            } else {
138                                fieldInfos.push({ fieldName: value.EsriId, label: value.Title + '<input type="hidden" value="' + value.EsriId + '"/>', visible: true });
139                            }
140                        });
141                    }
142                    var popupContent = textInfos;
143                    popupContent.push({ type: "fields", fieldInfos: fieldInfos });
144
145                    if (EsriMap.DivID == "esriMapDiv") {
146                        featureLayer.popupTemplate = {
147                            title: "Parcel Details",
148                            actions: [{ id: "fill-detail", index: layerIndex, image: "/../AdvancedForms/Image/fa-imports.png", title: "Use Parcel" }],
149                            content: popupContent
150                        };
151                    }
152                    featureLayer.labelingInfo = {
153                        symbol: { type: 'text', color: 'black', font: { family: 'Arial', size: 8 } },
154                        labelPlacement: "above-center",
155                    };
156                    EsriMap.featureMapLayers.push(featureLayer);
157                    EsriMap.Map.layers.add(featureLayer);
158                });
159            });
160        }
161    },
162    redrawForm: function () {
163        EsriGeoEngine.datagridIndex += 1;
164        EsriGeoEngine.FormIo.everyComponent(function (component) {
165            $.each(EsriFillForm.MappingjsonObj, function (index, value) {
166                if (value.IsReadOnly && value.AdvancedFormAPIKey == component.key) {
167                    component.disabled = true;
168                }
169                if (value.AdvancedFormAPIKey == component.key) {
170                    component.component.autocomplete = "off";
171                }
172            });
173        });
174        EsriGeoEngine.FormIo.redraw();
175        EsriFillForm.FormDivShowHide(true);
176        $(".formio-component-esriDataUsed").hide();
177        $("#EsriPanel").collapse('toggle');
178        if (EsriMap.IsMultipleParcelForm == "False") {
179            $("#modalEsriMapAddress").modal('hide');
180            resetMap();
181        }
182        $('.EsriLoading').hide();
183        $('.loading').hide();
184        $("#fillUserDetailsBtn").show();
185        EsriGeoEngine.FormIo.triggerChange();
186    },
187    showMap: function (callback) {
188
189        $("#modalEsriMap").modal('show');
190        $("#modalEsriMap .modal-footer").show();
191        $("#btnFillAddress").unbind("click");
192        $("#btnFillAddress").one("click", function () {
193            EsriMap.isEsriMap = true;
194            var address = $("#popupAddress").val();
195            var longitude = $("#popupLongitude").val();
196            var latitude = $("#popupLatitude").val();
197            resetMap();
198            $("#btnFillAddress").unbind("click");
199            return callback(address, latitude, longitude);
200        });
201    },
202    showMapWithLocation: function (latitude, longitude, address, callback) {
203        $("#modalEsriMap").modal('show');
204        $("#modalEsriMap .modal-footer").show();
205        EsriMap.showPinOnMap(latitude, longitude, address);
206        $("#btnFillAddress").unbind("click");
207        $("#btnFillAddress").one("click", function () {
208            EsriMap.isEsriMap = true;
209            var address = $("#popupAddress").val();
210            var longitude = $("#popupLongitude").val();
211            var latitude = $("#popupLatitude").val();
212            $("#btnFillAddress").unbind("click");
213            callback(address, latitude, longitude);
214            resetMap();
215        });
216    },
217    showLocation: function (latitude, longitude, address) {
218        $("#modalEsriMap").modal('show');
219        $("#modalEsriMap .modal-footer").hide();
220        EsriMap.showPinOnMap(latitude, longitude, address);
221    },
222    showPinOnMap: function (latitude, longitude, address) {
223        if (latitude !== '' && longitude !== '') {
224            EsriMap.MapView.graphics = null;
225            var point = new EsriMap.Point({ longitude: longitude, latitude: latitude });
226            var pin = EsriMap.MapMarker;
227            var pointGraphic = new EsriMap.Graphic({
228                geometry: point,
229                symbol: { type: "picture-marker", style: "square", url: pin, width: 25, height: 30, angle: 0 },
230                popupTemplate: {
231                    title: "<b>" + latitude + "," + longitude + "</b>",
232                    content: address
233                }
234            });
235            if (EsriMap.MapView.graphics !== null) {
236                EsriMap.MapView.graphics.addMany([pointGraphic]);
237            }
238            EsriMap.MapView.center = point;
239            EsriMap.MapView.zoom = parseInt(EsriMap.defaultMapZoom);
240        }
241    },
242    setBaseMap: function (baseMap) {
243        EsriMap.EsriBaseMapId = baseMap;
244        EsriMap.Map.basemap = EsriMap.BasemapObj.fromId(EsriMap.EsriBaseMapId);
245    }
246};
247
248function EsriMapLoadMap() {
249    if (!EsriMap.isMapAlreadyLoaded) {
250        EsriMap.isMapAlreadyLoaded = true;
251        require([
252            "esri/Map",
253            "esri/views/MapView",
254            "esri/Basemap",
255            "esri/layers/ImageryLayer",
256            "esri/layers/TileLayer",
257            "esri/layers/FeatureLayer",
258            "esri/widgets/Search",
259            "esri/Graphic",
260            "esri/geometry/Point",
261            "esri/symbols/PictureMarkerSymbol",
262            "esri/widgets/Locate",
263            "esri/Basemap",
264            "esri/rest/locator"],
265            function (Map, MapView, Basemap, ImageryLayer, TileLayer, FeatureLayer, Search, Graphic, Point, PictureMarkerSymbol, Locate, Basemap, Locator) {
266                try {
267                    // Make objects accessible
268                    EsriMap.jsonMapLayers = EsriMap.mapLayers != null && EsriMap.mapLayers !== "" ? JSON.parse(EsriMap.mapLayers) : [];
269                    EsriMap.ImageryLayer = ImageryLayer;
270                    EsriMap.TileLayer = TileLayer;
271                    EsriMap.FeatureLayer = FeatureLayer;
272                    EsriMap.Locator = Locator;
273                    EsriMap.BasemapObj = Basemap;
274                    EsriMap.Point = Point;
275                    EsriMap.Graphic = Graphic;
276                    EsriMap.isAccessAdminPanel = isAccessAdminPanel;
277
278                    function LoadEsriMap() {
279                        // --- MAP INITIALIZATION ---
280                        EsriMap.Map = new Map({ basemap: EsriMap.EsriBaseMapId });
281
282                        // --- DEFAULT LAYERS ---
283                        if (EsriMap.EsriLayerType === "ImageryLayer" && EsriMap.defaultEsriLayerTypeLink != '') {
284                            var imageryLayer = new ImageryLayer({ url: EsriMap.defaultEsriLayerTypeLink });
285                            EsriMap.Map.layers.add(imageryLayer);
286                        }
287                        if (EsriMap.EsriLayerType === "TileLayer" && EsriMap.defaultEsriLayerTypeLink != '') {
288                            var tileLayer = new TileLayer({ url: EsriMap.defaultEsriLayerTypeLink });
289                            EsriMap.Map.layers.add(tileLayer);
290                        }
291                        if (EsriMap.EsriLayerType === "FeatureLayer" && EsriMap.defaultEsriLayerTypeLink != '') {
292                            var featureLayer1 = new FeatureLayer({ url: EsriMap.defaultEsriLayerTypeLink });
293                            EsriMap.Map.layers.add(featureLayer1);
294                        }
295
296                        var searchSources = [];
297                        if (EsriMap.additionalSearchSource != null && EsriMap.additionalSearchSource != "" && EsriMap.additionalSearchSource != undefined)
298                            searchSources = JSON.parse(EsriMap.additionalSearchSource);
299
300                        EsriMap.addMapLayers();
301                        EsriMap.MapView = new MapView({
302                            container: EsriMap.DivID, map: EsriMap.Map, center: [EsriMap.LongitudeField, EsriMap.LatitudeField], zoom: parseInt(EsriMap.defaultMapZoom),
303                            popup: { dockEnabled: true, dockOptions: { buttonEnabled: false, breakpoint: false, position: 'bottom-right' } }
304                        });
305
306                        EsriMap.MapView.when(() => {
307                            if (EsriMap.DivID === "esriMapDiv") {
308                                EsriMap.MapView.popup.watch("selectedFeature", (graphic) => {
309                                    if (graphic) {
310                                        var event = graphic;
311                                        var isVisible = true;
312                                        if (EsriMap.jsonMapLayers != null && EsriMap.jsonMapLayers != "" && EsriMap.jsonMapLayers.length > 0) {
313                                            var jsonHideObj = EsriMap.jsonMapLayers[EsriMap.SelectedLayerIndex].MapHideFillDetails;
314                                            if (jsonHideObj.length > 0) {
315                                                $.each(jsonHideObj, function (index, value) {
316                                                    if (event.attributes.hasOwnProperty(value.EsriId) && value.Value !== null && value.Value !== '') {
317                                                        var esriValue = event.attributes[value.
317EsriId];
318                                                        if (esriValue !== value.Value) {
319                                                            isVisible = false;
320                                                            return;
321                                                        }
322                                                    }
323                                                });
324                                                const graphicTemplate = graphic.getEffectivePopupTemplate();
325                                                if (graphicTemplate.actions.items.length > 0)
326                                                    graphicTemplate.actions.items[0].visible = isVisible;
327                                            }
328                                        }
329                                    }
330                                });
331                            }
332                            else {
333                                EsriMap.MapView.on("click", function (evt) {
334                                    EsriMap.search.clear();
335                                    EsriMap.MapView.popup.clear();
336                                    EsriMap.MapView.popup.close();
337
338                                    var longitude = Math.round(evt.mapPoint.longitude * 100000) / 100000;
339                                    var latitude = Math.round(evt.mapPoint.latitude * 100000) / 100000;
340                                    EsriMap.selectedGeometry = new Point({
341                                        longitude: longitude,
342                                        latitude: latitude
343                                    });
344
345                                    var url = "https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer";
346                                    var params = {
347                                        location: evt.mapPoint
348                                    };
349                                    EsriMap.Locator.locationToAddress(url, params).then(function (response) {
350                                        var address = response.address;
351                                        const geometry = encodeURIComponent(JSON.stringify({
352                                            x: longitude,
353                                            y: latitude,
354                                            spatialReference: { wkid: 4326 }
355                                        }));
356                                        var mapEsriLayer = JSON.parse(EsriGeoEngine.EsriMapMappingObj);
357                                        const queryUrl = mapEsriLayer[0].EsriLayer + "/query?geometry=" + geometry +
358                                            "&geometryType=esriGeometryPoint&spatialRel=esriSpatialRelIntersects&outFields=*&returnGeometry=true&resultRecordCount=1&f=json";
359                                        fetchArcGISData(queryUrl).then((result) => {
360                                            if (result == "Feature") {
361                                                showPopup(address, evt.mapPoint, true);
362                                            }
363                                            else {
364                                                showPopup(result, evt.mapPoint, false);
365                                            }
366                                        });
367                                    }, function (err) {
368                                        showPopup("No address found.", evt.mapPoint);
369                                    });
370                                });
371                            }
372
373                            EsriMap.MapView.popup.viewModel.on("trigger-action", (event) => {
374                                if (event.action.id === "fill-detail") {
375                                    const attributes = EsriMap.MapView.popup.viewModel.selectedFeature.attributes;
376                                    EsriGeoEngine.geometry1 = EsriMap.MapView.popup.viewModel.selectedFeature.geometry;
377                                    EsriMap.SelectedLayerIndex = event.action.index;
378                                    EsriMap.fillJsonAddress(attributes);
379                                }
380                                if (event.action.id == "use-address") {
381                                    EsriGeoEngine.geometry1 = EsriMap.selectedGeometry;
382                                    EsriMap.fillJsonAddress(EsriMap.selectedFeature.attributes);
383                                }
384                            });
385                        });
386
387                        var isDisabled = EsriMap.isDisableGlobalEsriSearch === "True" ? true : false;
388                        if (searchSources != null && searchSources != "" && searchSources != undefined) {
389                            const sources = searchSources.map(source => {
390                                return {
391                                    layer: new FeatureLayer({ url: source.SearchUrl }),
392                                    searchFields: [source.SearchKey],
393                                    displayField: source.SearchKey,
394                                    exactMatch: false,
395                                    outFields: [source.SearchKey],
396                                    name: source.SearchText
397                                };
398                            });
399                            EsriMap.search = new Search({
400                                view: EsriMap.MapView,
401                                popupEnabled: false,
402                                includeDefaultSources: !isDisabled,
403                                sources: sources
404                            });
405                        }
406                        else {
407                            EsriMap.search = new Search({
408                                view: EsriMap.MapView,
409                                popupEnabled: false
410                            });
411                        }
412
413                        EsriMap.WebStyleSymbol = new PictureMarkerSymbol();
414                        EsriMap.WebStyleSymbol.width = 20;
415                        EsriMap.WebStyleSymbol.angle = 0;
416                        EsriMap.WebStyleSymbol.height = 30;
417                        EsriMap.WebStyleSymbol.url = EsriMap.MapMarker;
418
419                        EsriMap.locateWidget = new Locate({
420                            view: EsriMap.MapView,   // Attaches the Locate button to the view
421                            graphic: new Graphic({
422                                symbol: EsriMap.WebStyleSymbol
423                            })
424                        });
425                        EsriMap.MapView.ui.add(EsriMap.locateWidget, "top-left");
426                        EsriMap.MapView.ui.add(EsriMap.search, "top-right");
427                    }
428
429                    // --- Register Base Map token if required login or service exists ---
430                    EsriMap.defaultAdminBaseMap
431                        ? RegisterBaseMapTokenAdmin(EsriMap, LoadEsriMap) // Admin
432                        : RegisterBaseMapTokenFE(EsriMap, "#esriMapDiv", LoadEsriMap); // Front End
433
434                } catch (err) {
435                    $("#" + EsriMap.DivID).html("<div class='alert alert-warning'>Please, Refresh the Page.</div>");
436                }
437            });
438    }
439}
440
441
442function resetMap() {
443    EsriMap.search.clear();
444    EsriMap.MapView.popup.clear();
445    EsriMap.MapView.popup.close();
446    EsriMap.MapView.graphics = null;
447    var point = new EsriMap.Point({ longitude: EsriMap.LongitudeField, latitude: EsriMap.LatitudeField });
448    EsriMap.MapView.center = point;
449    EsriMap.MapView.zoom = parseInt(EsriMap.defaultMapZoom);
450    $("#modalEsriMapAddress").modal('hide');
451}
452
453function SelectEsriLayers() {
454    var selectedLayers = $('#selectEsriLayer').val();
455    if ($("#selectEsriBaseMap").val() === 'BaseMap') {
456        selectedLayers.push($("#selectEsriBaseMap :selected").text());
457    }
458    var isvisible = false;
459    $.each(EsriMap.Map.layers.items, function (i, selecteditem) {
460        if (selecteditem.title !== null) {
461            $.each(selectedLayers, function (i, layer) {
462                if (selecteditem.id === layer) {
463                    isvisible = true;
464                }
465            });
466            EsriMap.Map.layers.items[i].visible = isvisible;
467        }
468        isvisible = false;
469    });
470}
471
472function GroupBy(xs, key) {
473    return xs.reduce(function (rv, x) {
474        (rv[x[key]] = rv[x[key]] || []).push(x);
475        return rv;
476    }, {});
477};
478
479async function fetchArcGISData(queryUrl) {
480    try {
481        const response = await fetch(queryUrl);
482        if (!response.ok) {
483            throw new Error("HTTP error! Status: ${response.status}");
484        }
485        const data = await response.json();
486        if (data.features && data.features.length > 0) {
487            EsriMap.selectedFeature = data.features[0];
488            return "Feature";
489        } else {
490            return "No Features Intersect with the Given Point.";
491        }
492    } catch (error) {
493        console.error("Error fetching data from ArcGIS:", error);
494    }
495}
496
497function showPopup(address, pt, isFeature) {
498    var longitude = Math.round(pt.longitude * 100000) / 100000;
499    var latitude = Math.round(pt.latitude * 100000) / 100000;
500
501    EsriMap.MapView.graphics = null;
502    var point = new EsriMap.Point({ longitude: longitude, latitude: latitude });
503    var pointGraphic = new EsriMap.Graphic({
504        geometry: point,
505        symbol: EsriMap.WebStyleSymbol
506    });
507    EsriMap.MapView.graphics.addMany([pointGraphic]);
508    if (isFeature) {
509        EsriMap.MapView.popup.open({
510            title: address,
511            actions: [{ id: "use-address", image: "/../AdvancedForms/Image/fa-imports.png", title: EsriMap.UseAddressButtonText ? EsriMap.UseAddressButtonText : "Use Address" }],
512            content: latitude + "," + longitude
513        });
514        EsriMap.selectedFeature["address"] = {
515            "formatted_address": address.toString(),
516            "geometry": {
517                "location": {
518                    "lat": latitude,
519                    "lng": longitude
520                },
521            },
522            "formattedPlace": address.toString()
523        };
524    }
525    else {
526        EsriMap.MapView.popup.clear();
527        EsriMap.MapView.popup.close();
528        EsriMap.MapView.popup.open({
529            title: address,
530            actions: null,
531            content: latitude + "," + longitude
532        });
533    }
534}
535
536$("#checkboxmapLayers input").change(function () {
537    var selectedCheckbox = $(this);
538    var selectedIndex = parseInt(selectedCheckbox[0].value);
539    if (selectedCheckbox[0].checked) {
540        EsriMap.Map.layers.add(EsriMap.featureMapLayers[selectedIndex]);
541    } else {
542        EsriMap.Map.layers.remove(EsriMap.featureMapLayers[selectedIndex]);
543    }
544});

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.