PageSourceSearch

https://www.clearandbrilliant.com/Assets/PhysicianFinder/Templates/Clearandbrilliant/js/locations.min.js

js clearandbrilliant.com collected 2026-09-28 09:31:11 UTC 18,665 bytes, 439 lines download raw bytes

1
2var markersArray = [];
3var new_markersArray = [];
4var pagination_results = [];
5var curr_page = undefined;
6var currentPos = {};
7var currentLat = 0;
8var currentLan = 0;
9var cnt = 0;
10var radius = 25;
11var Map;
12var map = null;
13
14function hideKeyboard() {
15    document.activeElement.blur();
16    $("input").blur();
17};
18
19function initialize() {
20    // ✅ Create a session token for this autocomplete session
21    let sessionToken = new google.maps.places.AutocompleteSessionToken();
22
23    // Get the input element
24    const input = document.getElementById('locator_zip');
25
26    // Create the autocomplete object with the session token
27    const autocomplete = new google.maps.places.Autocomplete(input, {
28        fields: ['place_id', 'geometry', 'name', 'formatted_address'],
29        sessionToken: sessionToken // ✅ attach the token here
30    });
31
32    // When a user selects a prediction
33    autocomplete.addListener('place_changed', function () {
34        //const place = autocomplete.getPlace();
35
36        //if (!place.geometry) {
37        //    $('#details').html('No details available for that input.');
38        //    return;
39        //}
40        validateZipCode();
41        sessionToken = new google.maps.places.AutocompleteSessionToken();
42        autocomplete.setOptions({ sessionToken: sessionToken });
43    });
44}
45
46
47google.maps.event.addDomListener(window, 'load', initialize);
48$(function () {
49    $("#findaHealthcarePopup").on('show.bs.modal', function () {
50
51
52        if (navigator.geolocation) {
53            navigator.geolocation.getCurrentPosition(
54                // Success function
55                showPosition,
56                // Error function
57                errorlocation,
58                // Options. See MDN for details.
59                {
60                    enableHighAccuracy: true,
61                    timeout: 5000,
62                    maximumAge: 0
63                });
64        } else {
65            x.innerHTML = "Geolocation is not supported by this browser.";
66        }
67
68
69        function showPosition(position) {
70
71            var Pos = new google.maps.LatLng(position.coords.latitude, position.coords.longitude);
72            currentPos = { lat: position.coords.latitude, lng: position.coords.longitude };
73            const geocoder = new google.maps.Geocoder();
74            geocoder
75                .geocode({ location: Pos })
76                .then((response) => {
77                    if (response.results[0]) {
78                        var add = response.results[0].formatted_address;
79                        var value = add.split(",");
80
81                        count = value.length;
82                        country = value[count - 1];
83                        state = value[count - 2];
84                        city = value[count - 3];
85                        $('#locator_zip').val(city + ', ' + state + ', ' + country);
86                        initalizationMap()
87                        validateZipCode();
88                    }
89                });
90
91        }
92
93        function errorlocation(error) {
94            $.getJSON('https://geolocation-db.com/json/')
95                .done(function (location) {
96                    currentPos = { lat: location.latitude, lng: location.longitude };
97                    var Pos = new google.maps.LatLng(location.latitude, location.longitude);
98                    const geocoder = new google.maps.Geocoder();
99                    geocoder
100                        .geocode({ location: Pos })
101                        .then((response) => {
102                            if (response.results[0]) {
103                                var add = response.results[0].formatted_address;
104                                var value = add.split(",");
105
106                                count = value.length;
107                                country = value[count - 1];
108                                state = value[count - 2];
109                                city = value[count - 3];
110                                $('#locator_zip').val(city + ', ' + state + ', ' + country);
111                                initalizationMap()
112                                validateZipCode();
113                            }
114                        });
115                });
116        }
117
118        if (map == null)
119            initalizationMap();
120        var defaultPosition = { lat: 37.0902, lng: -95.7129 }; //centre of US
121
122
123    });
124});
125
126async function initalizationMap() {
127    const { Map } = await google.maps.importLibrary("maps");
128    if (currentPos == {} || currentPos == null)
129        currentPos = { lat: 37.0902, lng: -95.7129 };
130
131    map = new Map(document.getElementById("locator_map"), {
132        center: currentPos,
133        zoom: 10,
134        mapId: "4504f8b37365c3d0",
135    });
136    google.maps.event.addListener(map, 'zoom_changed', function (event) {
137        var bounds = map.getBounds();
138
139        var center = bounds.getCenter();
140        var ne = bounds.getNorthEast();
141
142        // r = radius of the earth in statute miles
143        var r = 3963.0;
144
145        // Convert lat or lng from decimal degrees into radians (divide by 57.2958)
146        var lat1 = center.lat() / 57.2958;
147        var lon1 = center.lng() / 57.2958;
148        var lat2 = ne.lat() / 57.2958;
149        var lon2 = ne.lng() / 57.2958;
150
151        // distance = circle radius from center to Northeast corner of bounds
152        var dist = r * Math.acos(Math.sin(lat1) * Math.sin(lat2) +
153            Math.cos(lat1) * Math.cos(lat2) * Math.cos(lon2 - lon1));
154        radius = Math.round(dist);
155        validateZipCode();
156
157
158    });
159}
160
161$(document).ready(function () {
162
163
164    $("#thermage").change(function () {
165        validateZipCode();
166    });
167    $("#clearb").change(function () {
168        validateZipCode();
169    });
170    $("#fraxel").change(function () {
171        validateZipCode();
172    });
173    $("#vaser").change(function () {
174        validateZipCode();
175    });
176    $('#location_list').on('click', 'strong', function (e) {
177        map.panTo(new google.maps.LatLng($(this).data('lat'), $(this).data('lng')));
178        map.setZoom(10);
179    });
180    $('.button-search').on('click', function (e) {
181        validateZipCode();
182    })
183    $('#locator_zip').keyup(function (e) {
184        var key = e.key || e.keyCode;
185        if (key === 'Enter' || key === 'Ent' || key === 13) {
186            validateZipCode();
187        }
188    });
189
190});
191
192
193
194async function initMap() {
195
196
197
198
199
200    var pagination_pages = document.getElementsByClassName("page-link");
201    var page_size = 10;
202
203    var originIcon = '/Assets/PhysicianFinder/Templates/Clearandbrilliant/Images/origin.png';
204    var directionIcon = '/Assets/PhysicianFinder/Templates/Clearandbrilliant/Images/directions-icon.png';
205    var nextone = 0;
206    var current_page = 0;
207    var start_coords = {};
208    var filterchcked = false;
209    var thremage = false;
210    var cb = true;
211    var vaser = false;
212    var fraxel = false;
213
214    //if ($('#thermage').is(":checked")) {
215    //    thremage = true;
216    //    filterchcked = true;
217    //}
218    //if ($('#clearb').is(":checked")) {
219    //    cb = true;
220    //    filterchcked = true;
221    //}
222    //if ($('#fraxel').is(":checked")) {
223    //    fraxel = true;
224    //    filterchcked = true;
225    //}
226    //if ($('#vaser').is(":checked")) {
227    //    vaser = true;
228    //    filterchcked = true;
229    //}
230    //if (!filterchcked) {
231    //    thremage = false;
232    //    cb = false;
233    //    vaser = false;
234    //    fraxel = false;
235    //}
236
237    var pinColor = "#599CAB";
238
239    // Pick your pin (hole or no hole)
240    var pinSVGHole = "M12,11.5A2.5,2.5 0 0,1 9.5,9A2.5,2.5 0 0,1 12,6.5A2.5,2.5 0 0,1 14.5,9A2.5,2.5 0 0,1 12,11.5M12,2A7,7 0 0,0 5,9C5,14.25 12,22 12,22C12,22 19,14.25 19,9A7,7 0 0,0 12,2Z";
241    var pinSVGFilled = "M 12,2 C 8.1340068,2 5,5.1340068 5,9 c 0,5.25 7,13 7,13 0,0 7,-7.75 7,-13 0,-3.8659932 -3.134007,-7 -7,-7 z";
242    var labelOriginFilled = new google.maps.Point(12, 9);
243
244
245    var markerImage = {  // https://developers.google.com/maps/documentation/javascript/reference/marker#MarkerLabel
246        path: pinSVGHole,
247        anchor: new google.maps.Point(12, 17),
248        fillOpacity: 1,
249        fillColor: pinColor,
250        strokeWeight: 1,
251        strokeColor: "black",
252        scale: 2,
253        labelOrigin: labelOriginFilled
254    };
255
256
257    var csrfToken = $('input[name="BHIT_WebopsPermit"]').val();
258
259    if ($('#locator_zip').val()) {
260        $.ajax({
261            type: "POST",
262            url: "/graphql",
263            headers: {
264                'X-Custom-CSRF': csrfToken // Include CSRF token
265            },
266            data: JSON.stringify({
267                query: '{soltalocatorapi(address:"' + $('#locator_zip').val() + '",radius:' + radius + ',thermage:' + thremage + ', cb:' + cb + ', vaser:' + vaser + ',fraxel:' + fraxel + '){lat,lng,locations{ name,address_1,address_2,lat,lng,city,state,zip,user_1_text,distance,phone,user_2_text,user_3_text,user_4_text,user_5_text,user_6_text,user_7_text,user_9_text,user_10_text,category_tag}}}'
268            }),
269            dataType: 'JSON',
270            success: function (result) {
271                $('#location_list').html('');
272                var errormessage = '<li data-id="0" class="poi-item"><div class="poi_wrapper"> <div class="poi_box"><div class="row"><div class="col"><div class="heading-wrap"><h2>No result found nearby, please zoom out in Map or search for another location</h2></div></div></div> </li>';
273                if (result.data.soltalocatorapi.locations === null) {
274                    $('#map_page_navigation').hide();
275                    $('#location_list').append(errormessage);
276
277
278                } else if (result.data.soltalocatorapi.locations.length < 1) {
279                    $('#map_page_navigation').hide();
280                    $('#location_list').append(errormessage);
281                } else {
282                    $('#map_page_navigation').show();
283                }
284                hideKeyboard();
285                start_coords = { lat: result.data.soltalocatorapi.lat, lng: result.data.soltalocatorapi.lng };
286                currentPos = { lat: result.data.soltalocatorapi.lat, lng: result.data.soltalocatorapi.lng };
287                currentLat = result.data.soltalocatorapi.lat;
288                currentLan = result.data.soltalocatorapi.lng;
289                zoom = 10;
290
291
292                setMapOnAll(map);
293                markersArray = [];
294                map.setCenter(start_coords);
295
296                //map = new google.maps.Map($('#locator_map')[0], {
297                //    zoom: 0, center: start_coords
298                //});
299
300
301
302                pagination_results = [];
303
304                cnt = result.data.soltalocatorapi.locations.length;
305
306
307
308                $('.location_numbers').text(result.data.soltalocatorapi.locations.length);
309
310
311                //var marker = new google.maps.Marker({
312                //    map: map,
313                //    position: { lat: result.data.soltalocatorapi.lat, lng: result.data.soltalocatorapi.lng },
314                //    icon: originIcon
315                //});
316
317
318
319                $.each(result.data.soltalocatorapi.locations, function (n, loc) {
320
321                    pagination_results.push(loc);
322
323                    var soltalist = '<li data-id="0" class="poi-item"><div class="poi_wrapper"> <div class="poi_box">';
324
325                    soltalist += '<div class="row"><div class="col"><div class="heading-wrap"><h2>' + loc.name + '</h2></div><div class="address-hours"><div class="address-wrap"><div class="address">' + loc.address_1 + '</div>';
326                    soltalist += '<div class="city-state-zip">' + loc.city + ', ' + loc.state + ', ' + loc.zip + '</div><div class="phone"><a  href="tel:' + loc.phone + '">' + loc.phone + '</a></div></div></div></div></div>';
327                    if (loc.user_10_text != '' && loc.user_10_text != null && loc.user_9_text != '' && loc.user_9_text != '') {
328                        if (loc.user_10_text == 'EM' || loc.user_10_text == 'Email')
329                            soltalist += '<div class="row"><div class="col"><div class="address-hours"><div class="address-wrap"><div class="phone">Contact Method: Email</div><div class="phone">EmailID: <a target="_blank"  href="mailto:' + loc.user_9_text + '">' + loc.user_9_text + '</a></div></div></div></div></div>';
330                    }
331                    var locationlogo = '<div class="filter-imgs">';
332                    if (loc.user_5_text == "1")
333                        locationlogo += '<span><img src="/Assets/PhysicianFinder/Templates/Clearandbrilliant/Images/cbt_logo.png" alt="Clear Brilliant Laser"> </span>';
334                    if (loc.user_6_text == "1")
335                        locationlogo += ' <span><img src="/Assets/PhysicianFinder/Templates/Clearandbrilliant/Images/fraxel-logo.webp" alt="Fraxel"></span>';
336                    if (loc.user_7_text == "1")
337                        locationlogo += '<span><img src="/Assets/PhysicianFinder/Templates/Clearandbrilliant/Images/vaser-logo.webp" alt="Vaser"></span>';
338                    if (loc.user_2_text == "1" || loc.user_4_text == "1")
339                        locationlogo += '<span><img src="/Assets/PhysicianFinder/Templates/Clearandbrilliant/Images/flx-logo.png" alt="Thermage"></span>';
340                    if (loc.user_3_text == "1")
341                        locationlogo += '<span><img src="/Assets/PhysicianFinder/Templates/Clearandbrilliant/Images/flx-logo-poi.png" alt="Thermage flx"></span>';
342
343                    locationlogo += '  </div >';
344
345
346
347                    var distinction = '';
348                    if (loc.category_tag != '' && loc.category_tag != null) {
349                        distinction = '<div class="dist showhidedisDiamond"><p>Distinction:</p><p class="showDiaDiamond">';
350                        if (loc.category_tag == 'Diamond')
351                            distinction += '<img src="/Assets/PhysicianFinder/Templates/Clearandbrilliant/Images/diamond-01.png" alt="Diamnond">';
352                        if (loc.category_tag == 'Ruby')
353                            distinction += ' <img src="/Assets/PhysicianFinder/Templates/Clearandbrilliant/Images/ruby-01.png" alt="Ruby">';
354                        distinction += ' </p></div>';
355                    }
356
357                    var direction = '<div class="cta_wrapper"><a target="_blank" href="https://maps.google.com/?q=' + loc.address_1 + ', ' + loc.city + ', ' + loc.state + ' ' + loc.zip + '" class="directions_btn btn">Directions</a></div >';
358
359
360                    soltalist = soltalist + locationlogo + distinction + direction + ' </div></div> </li> ';
361
362
363
364
365                    var siliqlist = '<div id="physicianList">' + '<div id="fields">' + '<p class="orange resultsTitle">' + loc.name + '</p>' + '<p class="miles d-md-none"><span class="orange">' + Number(loc.distance).toFixed(2) + ' miles' + '</span></p>' + '<p>' + loc.user_1_text + '</p>' + '<p>' + loc.address_1 + ', ' + loc.city + ', ' + loc.state + ' ' + loc.zip + '</p>' + '<p class="phone"><a class="open_call" href="tel:' + loc.phone + '">' + loc.phone + '</p></a>' + '</div>' + '<div id="directions">' + '<p class="miles d-none d-md-block"><span class="orange">' + Number(loc.distance).toFixed(2) + ' miles' + '</span></p>' + '<a class="redirect" href="https://maps.google.com/?q=' + loc.address_1 + ', ' + loc.city + ', ' + loc.state + ' ' + loc.zip + '" target="_blank">' + '<img src="' + directionIcon + '" alt="" width="60">' + '<p class="orange">Directions</p>' + '</a>' + '</div>' + '</div>';
366
367
368                    new_markersArray[nextone] = siliqlist;
369                    var marker_content = '<div class="marker-popup"><b>' + loc.name + "</b><br>" + loc.address_1 + ', ' + loc.address_2 + '<br>' + loc.city + ', ' + loc.state + ' ' + loc.zip + '</br> <a  href="tel:' + loc.phone + '">' + loc.phone + '</a></br>' + locationlogo + '<a class="map-direction" target="_blank" href="https://maps.google.com/?q=' + loc.address_1 + ', ' + loc.city + ', ' + loc.state + ' ' + loc.zip + '" target="_blank">' + 'Get Directions' + '</a></div>';
370
371                    $('#location_list').append(soltalist);
372                    var label = String(n + 1);
373                    var coord = new google.maps.LatLng(loc.lat, loc.lng);
374                    // bounds.extend(coord);
375
376
377
378
379
380                    marker = new google.maps.Marker({
381                        position: { lat: loc.lat, lng: loc.lng },
382                        map: map,
383                        title: loc.practice,
384                        icon: markerImage,
385                        //label: { text: label, color: '#fff', fontSize: '16px' }
386                    });
387
388                    markersArray[nextone] = marker;
389
390
391                    markersArray[nextone].infowindow = new google.maps.InfoWindow({
392                        content: marker_content
393                    })
394
395                    google.maps.event.addListener(markersArray[nextone], 'click', function () {
396                        for (var k = 1; k < markersArray.length; k++) {
397                            markersArray[k].infowindow.close();
398                        }
399                        this.infowindow.open(map, this);
400                    });
401
402                    nextone++;
403                });
404                //map.fitBounds(bounds);
405                //map.zoom(12);
406            }
407        });
408    }
409    else {
410        start_coords = { lat: 37.0902, lng: -95.7129 }; //centre of US
411
412        const map = new Map(document.getElementById("locator_map"), {
413            center: start_coords,
414            zoom: 10,
415            mapId: "4504f8b37365c3d0",
416        });
417
418
419    }
420}
421function setMapOnAll(map) {
422    for (let i = 0; i < markersArray.length; i++) {
423        markersArray[i].setMap(map);
424    }
425}
426function printList(e) {
427    e.preventDefault();
428    var w = window.open('', 'Print', 'menubar=yes,location=yes,resizable=yes,scrollbars=yes,width=600,height=800,status=yes');
429    var html = $(".locations_holder").html();
430
431    $(w.document.body).html(html);
432    var path = window.location.protocol + '//' + window.location.host + '/Locator/Print.css';
433    $(w.document.head).append('<link rel="stylesheet" type="text/css" media="print,screen" href="' + path + '" />');
434    var title = 'Locations near ' + $('#locator_zip').val();
435    var h1 = $('<h1 />').text(title);
436    $(w.document.body).prepend(h1);
437
438    w.focus();
439}

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.