{"version":3,"names":[],"mappings":"","sources":["locations.js"],"sourcesContent":["if ($('#map').length) {\r\n /* Custom Scrollbar */\r\n $('.scrollbar-light').scrollbar();\r\n\r\n /*\r\n Categories:\r\n FCS = California Coast Branches\r\n ESC = Shared Branches\r\n ATMSF = ATM Surcharge Free\r\n ATMDP = ATM Accept Deposits\r\n */\r\n\r\n window.onload = function () {\r\n\r\n //Global Variables\r\n var extmap,\r\n latLng,\r\n //userpin,\r\n lat = 33.1347205, //Default\r\n long = -117.1050825, //Default\r\n markers = [],\r\n bounds,\r\n mapCenterLat = 33.1347205,\r\n mapCenterLng = -117.1049967,\r\n hours,\r\n setHours,\r\n zoomLevel = 11,\r\n locFilters = 'FCS ESC ATMSF ATMDP',\r\n infoWindow = new google.maps.InfoWindow();\r\n\r\n //Browser GeoLocation on Page Load\r\n function onPositionReceived(position) {\r\n lat = position.coords['latitude'];\r\n long = position.coords['longitude'];\r\n console.log(\"user position: \" + lat, long);\r\n\r\n latLng = new google.maps.LatLng(lat, long);\r\n\r\n extmap.setCenter(latLng);\r\n\r\n //Update Map Bounds and Map Center\r\n userLocMapBounds(extmap);\r\n\r\n locFilters = 'FCS ESC ATMSF ATMDP';\r\n\r\n //Locations Data\r\n getData();\r\n }\r\n\r\n //Autocomplete location\r\n var input = document.getElementById('enterCurrentLoc');\r\n var autocomplete = new google.maps.places.Autocomplete(input);\r\n\r\n // Check to see if the browser supports the GeoLocation API.\r\n if (navigator.geolocation) {\r\n // Get user location\r\n navigator.geolocation.getCurrentPosition(onPositionReceived);\r\n } else {\r\n // Print out a message to the user.\r\n console.log('Your browser does not support GeoLocation');\r\n }\r\n\r\n //Map Bounds\r\n function userLocMapBounds(extmap) {\r\n //Map Bounds\r\n bounds = extmap.getBounds();\r\n\r\n //Map Center\r\n mapCenterLat = extmap.getCenter().lat();\r\n mapCenterLng = extmap.getCenter().lng();\r\n }\r\n\r\n //Google Init Map\r\n function initMap(latLng) {\r\n // Set map options\r\n var mapOptions = {\r\n zoom: zoomLevel,\r\n center: {\r\n lat: lat,\r\n lng: long\r\n },\r\n disableDefaultUI: true,\r\n zoomControl: true,\r\n panControl: true,\r\n streetViewControl: false,\r\n rotateControl: true\r\n };\r\n\r\n // Create the map\r\n extmap = new google.maps.Map(document.getElementById('map'), mapOptions);\r\n\r\n //Locations Data\r\n getData();\r\n\r\n //Panning map bounds\r\n mapBounds();\r\n\r\n //WCGA Map Updates\r\n google.maps.event.addListenerOnce(extmap, 'tilesloaded', function () {\r\n setTimeout(function () {\r\n $('.gm-style > div').removeAttr('tabindex');\r\n }, 2000);\r\n $('.gm-style').find('iframe').attr('title', 'Google Interactive Map');\r\n });\r\n\r\n }\r\n initMap();\r\n\r\n //Get Map Bounds on Drag\r\n function mapBounds() {\r\n //Find the new map bounds only when panning / zooming stopped\r\n google.maps.event.addListener(extmap, 'dragend', function () {\r\n //Map Bounds & Center\r\n userLocMapBounds(extmap);\r\n\r\n //Delete all markers\r\n deleteMarkers();\r\n\r\n //Get new data\r\n getData();\r\n });\r\n }\r\n\r\n //Get Data\r\n function getData() {\r\n\r\n let URL = 'https://mobileapi.locatorsearch.com/LocatorSearchAPI.asmx/FindLocations?UserName=39514221&Password=39514221-D8C2-4684-84D9-D5F66E308913&AddressLine=&City=&State=&PostalCode=&Country=&Latitude=' + mapCenterLat + '&Longitude=' + mapCenterLng + '&Type=' + locFilters + '&Offset=25';\r\n\r\n $.ajax({\r\n type: \"get\",\r\n url: URL,\r\n dataType: \"xml\",\r\n success: function (data) {\r\n /* handle data here */\r\n $(\".loc-list \").empty();\r\n\r\n console.log(data);\r\n\r\n $(data).find('locations location').each(function () {\r\n let locID = $(this).find('attribute[key=\"LocationID\"]').text();\r\n let iconType = $(this).find('attribute[key=\"MapIcon\"]').text();\r\n let locType = $(this).find('attribute[key=\"LocationType\"]').text();\r\n let locTitle = $(this).find('attribute[key=\"LocationName\"]').text();\r\n let surcharge = $(this).find('attribute[key=\"SurchargeFree\"]').text();\r\n let deposit = $(this).find('attribute[key=\"AcceptDeposit\"]').text();\r\n let locAddress = $(this).find('address street').text();\r\n let locCity = $(this).find('address city').text();\r\n let locState = $(this).find('address state').text();\r\n let locZip = $(this).find('address zip').text();\r\n let locDistance = $(this).attr('distance');\r\n\r\n // Get Lat/Lng for each location\r\n let latitude = $(this).find('attribute[key=\"Latitude\"]').text();\r\n let longitude = $(this).find('attribute[key=\"Longitude\"]').text();\r\n latLng = new google.maps.LatLng(latitude, longitude);\r\n\r\n if (iconType == '1.png') {\r\n if (deposit == 'Deposit Taking') {\r\n iconType = '1.png';\r\n } else {\r\n iconType = '2.png';\r\n }\r\n }\r\n\r\n var marker = new google.maps.Marker({\r\n position: latLng, //set coords\r\n title: locTitle, //set title\r\n icon: \"/Static/dist/images/\" + iconType, //set the custom marker\r\n category: locType,\r\n id: locID,\r\n });\r\n\r\n //Set markers to the map\r\n marker.setMap(extmap);\r\n ;\r\n //Add markers to markers array so we can keep track\r\n markers.push(marker);\r\n\r\n (function (marker, data) {\r\n google.maps.event.addListener(marker, \"click\", function (e) {\r\n var mkpos = marker.getPosition();\r\n infoWindow.setContent('
' + locAddress + '
' + locCity + ' ' + locState + ' ' + locZip + '