1'use strict'; 2var Club_Location_Public = new function () { 3 4 var $$ = this; 5 6 $$.geoWatchId = null; 7 $$.geoPrevPosition = { latitude: 0, longitude: 0 }; 8 $$.currentLotionIndex = 0; 9 $$.totalLotions = 0; 10 11 $$.initPublic = function () { 12 $$.registerStateClubSearch(); 13 $$.getClosestLocations(); 14 $$.assignRandomShopUrl(); 15 $$.hideYourClubOutClick(); 16 17 /** 18 * Geo Location disabled on 26th Oct 2021 and Callback added to display no geo response 19 */ 20 //$$.maybeGeoLocation(); 21 $$.displayNoGeoResponse(); 22 23 $$.checkFollowGETParams(); 24 25 $$.registerClubLocationAccordion(); 26 27 $$.registerClubLocationLotions(); 28 29 $$.registerClubLocationEquipmentPopop(); 30 31 $$.registerClubLocationEquipmentAccordion(); 32 33 $$.registerClubLocationMainNavLocations(); 34 35 $$.updateClosestLocationFields(); 36 37 $$.registerCouponsPrint(); 38 39 $$.registerClubLocationGridDetailsGPS(); 40 41 $$.registerClubLocationGridMapGPS(); 42 43 $$.registerClubLocationJobsGPS(); 44 45 $$.registerDatePicker(); 46 47 $$.checkAgeGate(); 48 49 $$.registerShopDropdown(); 50 51 $$.registerFeedback(); 52 } 53 54 $$.submitFeedback = function () { 55 var val = jQuery('.cl-feedback-ratings .rating-option > input:checked').val(); 56 var positive_rating = parseInt(jQuery('.cl-feedback-ratings').data('positive-rating')); 57 58 if (val >= positive_rating) { 59 jQuery('.cl-feedback-experience').hide(); 60 jQuery('.cl-positive-feedback').show(); 61 } else { 62 jQuery('.cl-feedback-experience').hide(); 63 jQuery('.cl-feedback-form').show(); 64 jQuery('#feedback-rating').val(val); 65 } 66 } 67 68 $$.registerFeedback = function () { 69 70 if (jQuery('.cl-feedback-ratings').length <= 0) { 71 return; 72 } 73 74 jQuery('.cl-feedback-ratings > .rating-option > input').on('click', function () { 75 jQuery('#cl-feedback-button').prop('disabled', false); 76 }); 77 var wpcf7Elm = document.querySelector('.cl-feedback-form .wpcf7'); 78 79 wpcf7Elm.addEventListener('wpcf7mailsent', function (event) { 80 jQuery('.cl-feedback-experience').hide(); 81 jQuery('.cl-positive-feedback').hide(); 82 jQuery('.cl-feedback-form').hide(); 83 jQuery('.cl-feedback-thankyou').show(); 84 }, false); 85 } 86 87 $$.registerShopDropdown = function () { 88 jQuery(document).on('click', '.cl-shop-dropdown', function (event) { 89 event.preventDefault(); 90 let a = jQuery(this); 91 a.parent().find('.cln-delivery-partner-list').toggle(); 92 }); 93 94 jQuery(document).on('click', function (e) { 95 if (jQuery(e.target).parents(".cl-shop-dropdown-wrap").length === 0) { 96 jQuery('.cln-delivery-partner-list').hide(); 97 } 98 }); 99 } 100 101 $$.checkAgeGate = function () { 102 if (jQuery('#cl-age-gate-html').length <= 0) { 103 return; 104 } 105 106 var age_gate_valid = parseFloat($$.getCookie('cl_age_gate_valid')); 107 108 if (age_gate_valid == 1) { 109 return; 110 } 111 112 var age_gate_exclude = clubLocationObject.age_gate_exclude; 113 114 var age_gate_exclude_arr = []; 115 116 if (typeof age_gate_exclude === 'string') { 117 age_gate_exclude_arr = age_gate_exclude.split("\n"); 118 } 119 120 if (jQuery.inArray(window.location.href, age_gate_exclude_arr) > -1) { 121 return; 122 } 123 124 const currentURLWithoutDomain = window.location.pathname + window.location.search; 125 126 if (jQuery.inArray(currentURLWithoutDomain, age_gate_exclude_arr) > -1) { 127 return; 128 } 129 130 jQuery('body').addClass('cl-age-gate-body-disable'); 131 jQuery('body').prepend(jQuery('#cl-age-gate-html').html()); 132 133 var maxDate = new Date(); 134 maxDate.setFullYear(maxDate.getFullYear() - parseInt(clubLocationObject.age_gate_age)); 135 136 var picker = mobiscroll.datepicker('body', { 137 controls: ['date'], 138 max: maxDate, 139 touchUi: true, 140 theme: 'ios', 141 themeVariant: 'auto', 142 display: 'bottom', 143 maxWidth: 1000, 144 responsive: { 145 xsmall: { 146 controls: ['date'], 147 display: 'bottom', 148 touchUi: true 149 }, 150 small: { 151 controls: ['date'], 152 display: 'bottom', 153 touchUi: true, 154 }, 155 custom: { // Custom breakpoint 156 breakpoint: 1000, 157 controls: ['date'], 158 display: 'center', 159 touchUi: true 160 } 161 }, 162 showOnClick: false, 163 showOnFocus: false, 164 onChange: function (event, inst) { 165 var selectedDate = inst.getVal(); 166 jQuery('#age-gate-month').val((selectedDate.getMonth() + 1)); 167 jQuery('#age-gate-day').val(selectedDate.getDate()); 168 jQuery('#age-gate-year').val(selectedDate.getFullYear()); 169 }, 170 }); 171 172 jQuery('.age-gate-dob').click(function () { 173 picker.open(); 174 return false;
175 }); 176 } 177 178 $$.ageGateSubmit = function () { 179 180 jQuery('.cl-under-age-text').hide(); 181 182 var month = parseInt(jQuery('#age-gate-month').val()); 183 var day = parseInt(jQuery('#age-gate-day').val()); 184 var year = parseInt(jQuery('#age-gate-year').val()); 185 186 if (month < 10) { 187 month = '0' + month; 188 } 189 190 if (day < 10) { 191 day = '0' + day; 192 } 193 194 const dob = new Date(`${year}-${month}-${day}`); 195 196 if (isNaN(dob.getTime())) { 197 jQuery('#age-gate-error').show(); 198 jQuery('#age-gate-error').html('Invalid Date'); 199 return false; 200 } 201 202 var currentDate = new Date(); 203 204 var age = currentDate.getFullYear() - dob.getFullYear(); 205 206 if (currentDate.getMonth() < dob.getMonth() || (currentDate.getMonth() === dob.getMonth() && currentDate.getDate() < dob.getDate())) { 207 age--; 208 } 209 210 var min_age = parseFloat(clubLocationObject.age_gate_age); 211 212 if (age < min_age) { 213 jQuery('#age-gate-invalid').show(); 214 return false; 215 } 216 217 $$.ageGateYes(); 218 219 return false; 220 } 221 222 $$.ageGateYes = function () { 223 224 const month = parseInt(jQuery('#age-gate-month').val()); 225 const day = parseInt(jQuery('#age-gate-day').val()); 226 const year = parseInt(jQuery('#age-gate-year').val()); 227 228 const dob = `${year}-${month}-${day}`; 229 230 $$.setCookie('cl_age_gate_valid', 1); 231 $$.setCookie('cl_age_gate_birthday', dob); 232 233 var code = clubLocationObject.location_code; 234 235 var customUTMParameters = { 236 utm_source: code + '_age_gate', 237 utm_medium: 'age_gate', 238 utm_campaign: 'age_gate_verification', 239 }; 240 241 var currentURL = window.location.href; 242 243 var newURL = currentURL; 244 245 for (var param in customUTMParameters) { 246 if (customUTMParameters.hasOwnProperty(param)) { 247 newURL = $$.updateQueryStringParameter(newURL, param, customUTMParameters[param]); 248 } 249 } 250 251 window.location.href = newURL; 252 } 253 254 $$.updateQueryStringParameter = function (uri, key, value) { 255 var re = new RegExp("([?&])" + key + "=.*?(&|$)", "i"); 256 var separator = uri.indexOf('?') !== -1 ? "&" : "?"; 257 if (uri.match(re)) { 258 return uri.replace(re, '$1' + key + "=" + value + '$2'); 259 } else { 260 return uri + separator + key + "=" + value; 261 } 262 } 263 264 $$.ageGateNo = function () { 265 jQuery('#age-gate-invalid').show(); 266 } 267 268 $$.ageGateValid = function (field) { 269 270 } 271 272 $$.registerDatePicker = function () { 273 274 if (jQuery('.cl_datepicker').length <= 0) { 275 return; 276 } 277 278 jQuery('.cl_datepicker').each(function () { 279 var ip = jQuery(this); 280 281 var minDate = ip.data('mindate'); 282 var maxDate = ip.data('maxdate'); 283 284 ip.datepicker({ 285 changeYear: true, 286 changeMonth: true, 287 minDate: minDate, 288 maxDate: maxDate, 289 dateFormat: 'mm/dd/yy', 290 yearRange: 'c-80:c+0' 291 }); 292 }); 293 } 294 295 $$.registerClubLocationJobsGPS = function () { 296 if (jQuery('.ae-locations-jobs.gps').length <= 0) { 297 return; 298 } 299 300 jQuery.geolocation.get({ win: $$.registerClubLocationJobsGPSAccepted, fail: $$.registerClubLocationJobsGPSFailed }); 301 } 302 303 $$.registerClubLocationJobsGPSAccepted = function (position) { 304 305 var lat = 0; 306 var long = 0; 307 308 if (position != null) { 309 lat = position.coords.latitude ?? 0; 310 long = position.coords.longitude ?? 0; 311 } 312 313 var data = jQuery('.ae-locations-jobs.gps').data('attr'); 314 315 data.action = 'clublocationajax'; 316 data.clAction = 'grid_jobs_gps'; 317 data.lat = lat; 318 data.long = long; 319 320 $$.requestAjax(data, $$.registerClubLocationJobsGPSAcceptedCallback); 321 } 322 323 $$.registerClubLocationJobsGPSAcceptedCallback = function (response) { 324 var html = (response != '') ? jQuery(response).html() : ''; 325 jQuery('.ae-locations-jobs.gps').html(html); 326 } 327 328 $$.registerClubLocationJobsGPSFailed = function () { 329 var data = jQuery('.ae-locations-jobs.gps').data('attr'); 330 331 data.action = 'clublocationajax'; 332 data.clAction = 'grid_jobs_gps'; 333 data.gps_failed = '1'; 334 data.lat = 0; 335 data.long = 0; 336 337 $$.requestAjax(data, $$.registerClubLocationJobsGPSAcceptedCallback); 338 } 339 340 $$.registerClubLocationGridMapGPS = function () { 341 if (jQuery('.ae-new-location-gps.gps').length <= 0) { 342 return; 343 } 344 345 jQuery.geolocation.get({ win: $$.registerClubLocationGridMapGPSAccepted, fail: $$.registerClubLocationGridMapGPSFailed }); 346 } 347 348 $$.registerClubLocationGridMapGPSAccepted = function (position) { 349 350 if (position == null) { 351 return $$.registerClubLocationGridMapGPSFailed(); 352 } 353 354 var lat = position.coords.latitude; 355 var long = position.coords.longitude; 356 357 var data = jQuery('.ae-new-location-states').data('attr'); 358 359 data.action = 'clublocationajax'; 360 data.clAction = 'grid_map_details'; 361 data.lat = lat; 362 data.long = long; 363 364 $$.requestAjax(data, $$.registerClubLocationGridMapGPSAcceptedCallback); 365 } 366 367 $$.registerClubLocationGridMapGPSAcceptedCallback = function (response) { 368 var html = (response != '') ? jQuery(response).find('.ae-new-location-gps').html() : ''; 369 jQuery('.ae-new-location-gps.gps').html(html); 370 } 371 372 $$.registerClubLocationGridMapGPSFailed = function () { 373 var wrap = jQuery('.ae-new-location-gps.gps'); 374 var data = jQuery('.ae-new-location-states').data('attr'); 375 376 var html = '<div class="ae-main-club-location-no-store-found">'; 377 378 html += '<h4 class="ae-main-no-store-heading">'; 379 html += '<span>' + atob(data.no_locations) + '</span>'; 380 html += '</h4>'; 381 html += '<div class="ae-main-no-store-main">'; 382 html += '<h2>' + atob(data.cta_heading) + '</h2>'; 383 html += '<p>' + atob(data.cta_text) + '</p>'; 384 html += '<a href="' + atob(data.cta_button_link) + '" class="ae-main-no-store-btn">' + atob(data.cta_button_label) + '</a>'; 385 html += '</div>'; 386 html += '</div>'; 387 388 wrap.html(html); 389 } 390 391 $$.registerClubLocationGridDetailsGPS = function () { 392 393 if (jQuery('.club-location-grid-details-wrappr.gps').length <= 0) { 394 return; 395 } 396 397 jQuery.geolocation.get({ win: $$.clubLocationGridDetailsGPSAccepted, fail: $$.clubLocationGridDetailsGPSFailed }); 398 } 399 400 $$.clubLocationGridDetailsGPSAccepted = function (position) { 401 402 if (position == null) { 403 return $$.clubLocationGridDetailsGPSFailed(); 404 } 405 406 var lat = position.coords.latitude; 407 var long = position.coords.longitude; 408 409 var data = jQuery('.club-location-grid-details-wrappr.gps').data('attr'); 410 411 data.action = 'clublocationajax'; 412 data.clAction = 'grid_details'; 413 data.lat = lat; 414 data.long = long; 415 416 $$.requestAjax(data, $$.clubLocationGridDetailsGPSAcceptedCallback); 417 } 418 419 $$.clubLocationGridDetailsGPSAcceptedCallback = function (response) { 420 var html = (response != '') ? jQuery(response).html() : ''; 421 jQuery('.club-location-grid-details-wrappr.gps').html(html); 422 } 423 424 $$.clubLocationGridDetailsGPSFailed = function () { 425 var wrap = jQuery('.club-location-grid-details-wrappr.gps'); 426 var data = wrap.data('attr'); 427 428 if (data.no_gps_hide == '1') { 429 wrap.html(''); 430 return; 431 } 432 433 if (data.no_gps_message != '') { 434 wrap.append(atob(data.no_gps_message)); 435 } 436 437 if (data.no_gps_finder == '1') { 438 wrap.append($$.getLocationFinderHTML(data.finder_results_page)); 439 } 440 } 441 442 $$.getLocationFinderHTML = function (url) { 443 444 var html = '<div class="location-grid-details-finder-form">'; 445 html += '<div class="zipcode-form">'; 446 html += '<form method="get" action="' + url + '">'; 447 html += '<input type="text" required="" name="zipcode" placeholder="ZIP CODE" title="Zip code field"> '; 448 html += '<input value="Go!" type="submit" title="Submit button">'; 449 html += '</form>'; 450 html += '</div>'; 451 html += '</div>'; 452 return html; 453 } 454 455 $$.registerCouponsPrint = function () { 456 if (jQuery('.clc-print-button').length <= 0) { 457 return; 458 } 459 460 jQuery('.clc-print-button').on('click', function () { 461 jQuery(this).parent().printThis({ 462 importCSS: true, 463 importStyle: true, 464 }); 465 }); 466 } 467 468 $$.updateClosestLocationFields = function () { 469
470 if (jQuery('.club-location-closest').length <= 0) { 471 return; 472 } 473 474 jQuery.geolocation.get({ win: $$.closestGPSRequestAccepted, fail: $$.closestGPSRequestDeclined }); 475 } 476 477 $$.closestGPSRequestAccepted = function (position) { 478 479 if (position == null) { 480 return; 481 } 482 483 var lat = position.coords.latitude; 484 var long = position.coords.longitude; 485 486 var data = {}; 487 data.action = 'clublocationajax'; 488 data.clAction = 'closestgpslocation'; 489 data.lat = lat; 490 data.long = long; 491 492 $$.requestAjax(data, $$.closestGPSLocationFound); 493 } 494 495 $$.closestGPSLocationFound = function (response) { 496 if (response.status == false) { 497 return; 498 } 499 500 for (var k in response.data) { 501 var val = response.data[k]; 502 if (jQuery('.club-location-closest.__' + k).length <= 0 || typeof val !== 'string') { 503 continue; 504 } 505 var ele = jQuery('.club-location-closest.__' + k); 506 ele.show(); 507 var prep = (ele.data('prepend')) ? ele.data('prepend') : ''; 508 var append = (ele.data('append')) ? ele.data('append') : ''; 509 var field_value = prep + val + append; 510 var attr = ele.attr('data-attr'); 511 if (ele.attr('data-attr')) { 512 ele.attr(attr, field_value); 513 continue; 514 } 515 ele.html(field_value); 516 } 517 } 518 519 $$.closestGPSRequestDeclined = function () { 520 jQuery('.club-location-closest').each(function () { 521 var ele = jQuery(this); 522 ele.html(ele.attr('data-default')); 523 }); 524 } 525 526 $$.getMainNavUTMSource = function () { 527 528 var utm_source = $$.getUrlParameter('utm_source'); 529 530 if (utm_source != false) { 531 return utm_source; 532 } 533 534 var utm_source_cookie = $$.getCookie('utm_source'); 535 536 if (utm_source_cookie != null) { 537 return utm_source_cookie; 538 } 539 540 return ''; 541 } 542 543 $$.registerClubLocationMainNavLocations = function () { 544 545 if (jQuery('.club-location-nav-states').length <= 0) { 546 return; 547 } 548 549 var utm_source = $$.getMainNavUTMSource(); 550 551 if (clubLocationObject.location_code == '' && utm_source == '') { 552 jQuery.geolocation.get({ win: $$.setDefaultStateLocationMainNav }); 553 } 554 555 jQuery('.club-location-nav-states > li > a').on('click', function () { 556 var state = jQuery(this).data('state'); 557 jQuery('.club-location-nav-locations > li').hide(); 558 jQuery('.club-location-nav-locations > li[data-state="' + state + '"]').show(); 559 jQuery('.club-location-nav-state-selected').html(state); 560 jQuery('.club-location-state-mobile .sub-menu').removeClass('active'); 561 562 var locationa = jQuery('.club-location-nav-locations > li[data-state="' + state + '"]:first > a'); 563 564 jQuery('.club-location-nav-location-website').attr('href', locationa.data('website')); 565 jQuery('.club-location-nav-location-selected').html(locationa.data('name')); 566 }); 567 568 jQuery('.club-location-nav-locations > li > a').on('click', function (event) { 569 event.preventDefault(); 570 var a = jQuery(this); 571 jQuery('.club-location-nav-location-website').attr('href', a.data('website')); 572 jQuery('.club-location-nav-location-selected').html(a.data('name')); 573 jQuery('.club-location-state-mobile .sub-menu').removeClass('active'); 574 }); 575 576 jQuery('.club-location-state-mobile .club-location-nav-select > a').on('click', function () { 577 578 var hasClass = jQuery(this).parent().find('.sub-menu').hasClass('active'); 579 580 jQuery('.club-location-state-mobile .sub-menu').removeClass('active'); 581 582 if (!hasClass) { 583 jQuery(this).parent().find('.sub-menu').addClass('active'); 584 } 585 }); 586 587 jQuery(document).on('click', function (e) { 588 if (jQuery(e.target).parents(".club-location-state-mobile").length === 0) { 589 jQuery('.club-location-state-mobile .sub-menu').removeClass('active'); 590 } 591 }); 592 593 if (utm_source != '') { 594 if (jQuery('.club-location-nav-locations > li[data-code="' + utm_source + '"]').length > 0) { 595 var foundLi = jQuery('.club-location-nav-locations > li[data-code="' + utm_source + '"]'); 596 var stateFound = foundLi.attr('data-state'); 597 jQuery('.club-location-nav-states a[data-state="' + stateFound + '"]').trigger('click'); 598 foundLi.find('a').trigger('click'); 599 $$.setCookie('utm_source', utm_source); 600 } 601 } 602 } 603 604 $$.setDefaultStateLocationMainNav = function (position) { 605 606 if (position == null) { 607 return; 608 } 609 610 var lat = position.coords.latitude; 611 var long = position.coords.longitude; 612 613 var closestLi = ''; 614 var closest = 99999999; 615 616 jQuery('.club-location-nav-locations > li').each(function () { 617 618 var li = jQuery(this); 619 620 var lat1 = li.find('a').data('lat'); 621 var long1 = li.find('a').data('long'); 622 623 var distance = $$.distance(lat, long, lat1, long1, 'K'); 624 625 if (distance < closest) { 626 closest = distance; 627 closestLi = li; 628 } 629 }); 630 631 var stateFound = closestLi.attr('data-state'); 632 633 jQuery('.club-location-nav-states a[data-state="' + stateFound + '"]').trigger('click'); 634 closestLi.find('a').trigger('click'); 635 } 636 637 $$.distance = function (lat1, lon1, lat2, lon2, unit) { 638 var radlat1 = Math.PI * lat1 / 180 639 var radlat2 = Math.PI * lat2 / 180 640 var theta = lon1 - lon2 641 var radtheta = Math.PI * theta / 180
642 var dist = Math.sin(radlat1) * Math.sin(radlat2) + Math.cos(radlat1) * Math.cos(radlat2) * Math.cos(radtheta); 643 if (dist > 1) { 644 dist = 1; 645 } 646 dist = Math.acos(dist) 647 dist = dist * 180 / Math.PI 648 dist = dist * 60 * 1.1515 649 if (unit == "K") { dist = dist * 1.609344 } 650 if (unit == "N") { dist = dist * 0.8684 } 651 return dist 652 } 653 654 $$.registerClubLocationLotions = function () { 655 656 var total_lotions = jQuery('.lotion-popup-button').length; 657 658 $$.totalLotions = total_lotions; 659 660 if (total_lotions <= 0) { 661 return; 662 } 663 664 jQuery('.lotion-popup-button').on('click', function () { 665 var a = jQuery(this); 666 var index = a.attr('data-index'); 667 $$.currentLotionIndex = index; 668 669 $$.displayLotionPopupdata(index); 670 671 var popupTop = a.parent().position().top + 50; 672 673 jQuery('.lotion-popup-box').css('top', popupTop); 674 jQuery('.lotion-popup').fadeIn(); 675 jQuery('.lotion-popup .lp-close').focus(); 676 }); 677 678 jQuery('.lotion-popup .lp-nav-left').on('click', function () { 679 680 $$.currentLotionIndex--; 681 682 if ($$.currentLotionIndex < 1) { 683 $$.currentLotionIndex = $$.totalLotions; 684 } 685 686 $$.displayLotionPopupdata($$.currentLotionIndex); 687 688 }); 689 690 jQuery('.lotion-popup .lp-nav-right').on('click', function () { 691 692 $$.currentLotionIndex++; 693 694 if ($$.currentLotionIndex > $$.totalLotions) { 695 $$.currentLotionIndex = 1; 696 } 697 698 $$.displayLotionPopupdata($$.currentLotionIndex); 699 700 }); 701 702 jQuery(document).on('keyup', function (event) { 703 704 if (jQuery('.lotion-popup').is(':hidden')) { 705 return; 706 } 707 708 var keyCode = event.keyCode; 709 710 if (keyCode == 27) { 711 /**Escape */ 712 jQuery('.lotion-popup .lp-close').click(); 713 } else if (keyCode == 37) { 714 /**Left Arrow */ 715 jQuery('.lotion-popup .lp-nav-left').click(); 716 } else if (keyCode == 39) { 717 /**Right Arrow */ 718 jQuery('.lotion-popup .lp-nav-right').click(); 719 } 720 }); 721 722 jQuery('.lotion-popup .lp-close').on('click', function () { 723 jQuery('.lotion-popup').fadeOut(); 724 }); 725 726 jQuery('.lotion-popup .lp-nav-right').on('keydown', function (e) { 727 728 var isTabPressed = (e.keyCode === 9); 729 730 if (!isTabPressed) { 731 return; 732 } 733 734 if (e.shiftKey) /* shift + tab */ { 735 return; 736 } else /* tab */ { 737 jQuery('.lotion-popup .lp-close').focus(); 738 e.preventDefault(); 739 } 740 741 }); 742 743 jQuery('.lotion-popup .lp-close').on('keydown', function (e) { 744 745 var isTabPressed = (e.keyCode === 9); 746 747 if (!isTabPressed) { 748 return; 749 } 750 751 if (e.shiftKey) /* shift + tab */ { 752 jQuery('.lotion-popup .lp-nav-right').focus(); 753 e.preventDefault(); 754 } else /* tab */ { 755 return; 756 } 757 758 }); 759 760 jQuery(document).on('click', function (e) { 761 if (jQuery(e.target).parents(".lotion-popup-box").length === 0 && jQuery(e.target).parents(".lotion-col").length === 0) { 762 jQuery('.lotion-popup').fadeOut(); 763 } 764 }); 765 } 766 767 $$.displayLotionPopupdata = function (index) { 768 769 var lotionData = jQuery('#lotion-' + index).data('lotion'); 770 771 var total_lotions = jQuery('.lotion-popup-button').length; 772 773 var image_alt = lotionData.lotion_name + ' ' + lotionData.lotion_excerpt + ' ' + lotionData.lotion_description; 774 775 jQuery('.lotion-popup .lp-count').html('Lotion ' + index + ' of ' + total_lotions); 776 777 jQuery('.lotion-popup .lp-name').html(lotionData.lotion_name); 778 779 jQuery('.lotion-popup .img-box').html('<img src="' + clubLocationObject.portal_url + 'lotions/' + lotionData.lotion_image + '" alt="' + image_alt + '" />'); 780 781 jQuery('.lotion-popup .lp-excerpt').html(lotionData.lotion_excerpt); 782 783 jQuery('.lotion-popup .lp-description').html(lotionData.lotion_description); 784 } 785 786 $$.registerClubLocationAccordion = function () { 787 788 if (jQuery('.club-location-accordion').length == 0) { 789 return; 790 } 791 792 if (jQuery('.club-location-accordion').hasClass('club-location-accordion-first-item-open')) { 793 if (jQuery('.club-location-accordion > .club-location-accordion-item:eq(0)').length) { 794 795 var temp = jQuery('.club-location-accordion > .club-location-accordion-item:eq(0)'); 796 797 while (true) { 798 799 temp.addClass('active'); 800 801 temp.find('> .club-location-accordion-content').slideDown(); 802 803 if (temp.find('> .club-location-accordion-content > .club-location-accordion-item:eq(0)').length) { 804 temp = temp.find('> .club-location-accordion-content > .club-location-accordion-item:eq(0)'); 805 } else { 806 break; 807 } 808 } 809 } 810 } 811 812 if (jQuery('.club-location-accordion-country:eq(0)').length && false) { 813 jQuery('.club-location-accordion-country:eq(0)').addClass('active'); 814 jQuery('.club-location-accordion-country:eq(0) > .club-location-accordion-content:eq(0)').slideDown(); 815 } 816 817 if (jQuery('.club-location-accordion-state:eq(0)').length && false) { 818 jQuery('.club-location-accordion-state:eq(0)').addClass('active'); 819 jQuery('.club-location-accordion-state:eq(0) > .club-location-accordion-content:eq(0)').slideDown(); 820 } 821 822 jQuery('.club-location-accordion-header').on('click', function () { 823 if (jQuery(this).parent().hasClass('active')) { 824 jQuery(this).parent().removeClass('active'); 825 jQuery(this).parent().find('> .club-location-accordion-content').slideUp(); 826 } else { 827 jQuery(this).parent().addClass('active'); 828 jQuery(this).parent().find('> .club-location-accordion-content').slideDown(); 829 } 830 }); 831 } 832 833 $$.registerClubLocationEquipmentAccordion = function () { 834 835 if (jQuery('.cle-accordion').length == 0) { 836 return; 837 } 838 839 if (jQuery('.cle-accordion-item:eq(0)').length) { 840 jQuery('.cle-accordion-item:eq(0)').addClass('active'); 841 jQuery('.cle-accordion-item:eq(0) > .cle-accordion-content:eq(0)').slideDown(); 842 } 843 844 jQuery('.cle-accordion-header').on('click', function () { 845 if (jQuery(this).parent().hasClass('active')) { 846 jQuery(this).parent().removeClass('active'); 847 jQuery(this).parent().find('> .cle-accordion-content').slideUp(); 848 } else { 849 jQuery(this).parent().addClass('active'); 850 jQuery(this).parent().find('> .cle-accordion-content').slideDown(); 851 } 852 }); 853 } 854 855 $$.registerClubLocationEquipmentPopop = function () { 856 857 var total_equipment = jQuery('.cle-location-button').length; 858 859 if (total_equipment <= 0) { 860 return; 861 } 862 863 jQuery('.cle-location-button').on('click', function () { 864 865 var a = jQuery(this); 866 867 var name = a.attr('data-name'); 868 869 $$.displayEquipmentPopupdata(name); 870 871 var popupTop = a.parent().position().top + 50; 872 873 jQuery('.cle-popup-box').css('top', popupTop); 874 jQuery('.cle-popup').fadeIn(); 875 jQuery('.cle-popup .cle-p-close-btn').focus(); 876 }); 877 878 jQuery(document).on('keyup', function (event) { 879 880 if (jQuery('.cle-popup').is(':hidden')) { 881 return; 882 } 883 884 var keyCode = event.keyCode; 885 886 if (keyCode == 27) { 887 /**Escape */ 888 jQuery('.cle-popup .cle-p-close-btn').click(); 889 } 890 }); 891 892 jQuery('.cle-popup .cle-p-close-btn').on('click', function () { 893 jQuery('.cle-popup').fadeOut(); 894 }); 895 896 jQuery(document).on('click', function (e) { 897 if (jQuery(e.target).parents(".cle-popup-box").length === 0 && jQuery(e.target).parents(".cle-box").length === 0) { 898 jQuery('.cle-popup').fadeOut(); 899 } 900 }); 901 } 902 903 $$.displayEquipmentPopupdata = function (name) { 904 905 var equipment = jQuery('.cle-list').data('equipment'); 906 907 jQuery('.cle-h-line').html('AVAILABLE AT THESE LOCATIONS'); 908 909 var html = ''; 910 911 for (var k in equipment) { 912 913 var row = equipment[k]; 914 915 if (row.equipment_type_name != name) { 916 continue; 917 } 918 919 html += '<div class="cle-pl-col">'; 920 html += '<div class="cle-pl-box">'; 921 html += '<span class="cle-pl-name">' + row.location_name + '</span>'; 922 html += '<span class="cle-pl-unit">' + row.quantity + ' Unit(s)</span>';
923 html += '<p class="cle-pl-address">' + row.location_address_line1 + ' ' + row.location_address_line2 + '<br />'; 924 html += row.location_city + ', ' + row.location_state + ' ' + row.location_post_code + '</p>'; 925 html += '<a href="' + row.location_website + '" target="_blank" class="cle-pl-website">Website</a>'; 926 html += '</div>'; 927 html += '</div>'; 928 } 929 930 jQuery('.cle-pl-row').html(html); 931 } 932 933 $$.checkFollowGETParams = function () { 934 935 if (Number(clubLocationObject.enable_follow_get) != 1) { 936 return; 937 } 938 939 if (clubLocationObject.follow_get_params == '') { 940 return; 941 } 942 943 if (clubLocationObject.follow_allowed_domains == '') { 944 return; 945 } 946 947 var allowedDomains = clubLocationObject.follow_allowed_domains.split(','); 948 949 var follow_get_params = clubLocationObject.follow_get_params.split(','); 950 951 for (var k in follow_get_params) { 952 953 var utm_param = $$.getUrlParameter(follow_get_params[k]); 954 955 if (utm_param == false) { 956 continue; 957 } 958 959 jQuery('a').each(function () { 960 961 var a = jQuery(this); 962 963 var href = a.attr('href'); 964 965 if (jQuery.inArray($$.getDomain(href), allowedDomains) < 0) { 966 return; 967 } 968 969 var hashPart = href.split('#'); 970 971 if (hashPart.length > 1) { 972 href = hashPart[0]; 973 } 974 975 var hrefArr = href.split('?'); 976 977 var urlParams = $$.getParamsAsObject(href); 978 979 if (typeof hrefArr[1] == 'undefined') { 980 urlParams = {}; 981 } 982 983 urlParams[follow_get_params[k]] = utm_param; 984 985 var newHrefParms = decodeURIComponent(jQuery.param(urlParams)); 986 987 var newHref = hrefArr[0] + '?' + newHrefParms; 988 989 if (hashPart.length > 1) { 990 newHref += '#' + hashPart[1]; 991 } 992 993 a.attr('href', newHref); 994 }); 995 996 } 997 } 998 999 $$.getDomain = function (data) { 1000 var a = document.createElement('a'); 1001 a.href = data; 1002 if (a.hostname == '') { 1003 return ''; 1004 } 1005 var hrefR = a.hostname.split('.').reverse(); 1006 if (hrefR.length == 1) { 1007 return hrefR[0]; 1008 } 1009 return hrefR[1] + '.' + hrefR[0]; 1010 } 1011 1012 $$.getParamsAsObject = function (query) { 1013 1014 query = query.substring(query.indexOf('?') + 1); 1015 1016 var re = /([^&=]+)=?([^&]*)/g; 1017 var decodeRE = /\+/g; 1018 1019 var decode = function (str) { 1020 return decodeURIComponent(str.replace(decodeRE, " ")); 1021 }; 1022 1023 var params = {}, e; 1024 while (e = re.exec(query)) { 1025 var k = decode(e[1]), v = decode(e[2]); 1026 if (k.substring(k.length - 2) === '[]') { 1027 k = k.substring(0, k.length - 2); 1028 (params[k] || (params[k] = [])).push(v); 1029 } 1030 else params[k] = v; 1031 } 1032 1033 var assign = function (obj, keyPath, value) { 1034 var lastKeyIndex = keyPath.length - 1; 1035 for (var i = 0; i < lastKeyIndex; ++i) { 1036 var key = keyPath[i]; 1037 if (!(key in obj)) 1038 obj[key] = {} 1039 obj = obj[key]; 1040 } 1041 obj[keyPath[lastKeyIndex]] = value; 1042 } 1043 1044 for (var prop in params) { 1045 var structure = prop.split('['); 1046 if (structure.length > 1) { 1047 var levels = []; 1048 structure.forEach(function (item, i) { 1049 var key = item.replace(/[?[\]\\ ]/g, ''); 1050 levels.push(key); 1051 }); 1052 assign(params, levels, params[prop]); 1053 delete (params[prop]); 1054 } 1055 } 1056 return params; 1057 } 1058 1059 $$.displayNoGeoResponse = function () { 1060 $$.getYourClubLocationByPositionCallback('<div class="club-location-your-club-dropdown" data-totalclubs="0" data-club=""></div>'); 1061 } 1062 1063 $$.assignRandomShopUrl = function () { 1064 if (jQuery('.club-location-random-shop').length <= 0) { 1065 return; 1066 } 1067 jQuery('.club-location-random-shop').each(function () { 1068 var random_url = $$.randomProperty(clubLocationObject.paid_shop_urls); 1069 jQuery(this).attr('href', random_url); 1070 }); 1071 } 1072 1073 $$.randomProperty = function (obj) { 1074 var keys = Object.keys(obj); 1075 return obj[keys[keys.length * Math.random() << 0]]; 1076 }; 1077 1078 $$.registerStateClubSearch = function () { 1079 if (jQuery('.club-location-search-form-wrapper').length == 0) { 1080 return; 1081 } 1082 1083 jQuery('.club-location-search-form-wrapper .club-location-keyword').on('keyup', function () { 1084 $$.searchStateClubs(); 1085 }); 1086 1087 jQuery('.club-location-search-form-wrapper .club-location-sort').on('click', function () { 1088 $$.searchStateClubs(); 1089 }); 1090 } 1091 1092 $$.searchStateClubs = function () { 1093 var kw = jQuery('.club-location-search-form-wrapper .club-location-keyword').val().toUpperCase(); 1094 var sort = jQuery('input[name="club-location-sort"]:checked').val(); 1095 var wrapper = jQuery('.club-location-filter-results'); 1096 wrapper.find('>.x-clear').remove(); 1097 wrapper.find('>div').removeClass('last'); 1098 1099 var allFiles = wrapper.find('>div'); 1100 1101 allFiles.sort(function (a, b) { 1102 var A = jQuery(a).find('.club-location-name-filter').text().toUpperCase(); 1103 var B = jQuery(b).find('.club-location-name-filter').text().toUpperCase(); 1104 if (sort == 'asc') { 1105 return (A < B) ? -1 : (A > B) ? 1 : 0; 1106 } else { 1107 return (A < B) ? 1 : (A > B) ? -1 : 0; 1108 } 1109 }).appendTo(wrapper); 1110 1111 var allFiles = wrapper.find('>div'); 1112 1113 var matchingFiles; 1114 1115 allFiles.hide(); 1116 1117 if (kw == '') { 1118 matchingFiles = allFiles; 1119 } else { 1120 var matchingFiles = allFiles.filter(function (i, li) { 1121 var listItemText = jQuery(li).text().toUpperCase(); 1122 return ~listItemText.indexOf(kw); 1123 }); 1124 } 1125 1126 matchingFiles.show(); 1127 1128 for (var k in matchingFiles) { 1129 if ((k + 1) % 3 == 0 && k > 0) { 1130 matchingFiles.eq(k).addClass('last'); 1131 matchingFiles.eq(k).after('<hr class="x-clear">'); 1132 } 1133 } 1134 } 1135 1136 $$.getClosestLocations = function () { 1137 if (jQuery('#club-locations-closest').length == 0) { 1138 return; 1139 } 1140 1141 $$.promptFetchClosestLocations(); 1142 } 1143 1144 $$.promptFetchClosestLocations = function () { 1145 jQuery.geolocation.get({ win: $$.getClosestLocationsByPosition, fail: $$.showGetClosestLocationsButton }); 1146 } 1147 1148 $$.showGetClosestLocationsButton = function (error) { 1149 jQuery('#club-locations-closest').html('<span class="x-alert x-alert-danger x-alert-block">Please enable location services to view closest locations</span>'); 1150 } 1151 1152 $$.getClosestLocationsByPosition = function (position) { 1153 var data = {}; 1154 data.action = 'clublocationajax'; 1155 data.clAction = 'closestLocations'; 1156 data.lat = position.coords.latitude; 1157 data.long = position.coords.longitude; 1158 data.short_attr = jQuery.parseJSON(jQuery('#short_attrs').val()); 1159 1160 jQuery('#club-locations-closest').html('<span class="x-alert x-alert-success x-alert-block">Fetching closest locations...</span>'); 1161 1162 $$.requestAjax(data, $$.getClosestLocationsByPositionCallback); 1163 } 1164 1165 $$.getClosestLocationsByPositionCallback = function (response) { 1166 jQuery('#club-locations-closest').html(response); 1167 } 1168 1169 $$.hideYourClubOutClick = function () { 1170 jQuery(document).on('click', function (e) { 1171 if (jQuery('#club-location-your-club-info').find('.club-location-your-club-dropdown').length > 0 && jQuery(e.target).parents("#club-location-your-club-wrapper").length === 0) { 1172 jQuery('#club-location-your-club-info').hide(); 1173 } 1174 }); 1175 } 1176 1177 $$.maybeGeoLocation = function () { 1178 if (jQuery('#club-location-your-club-wrapper').length) { 1179 $$.getCoords().then(position => $$.maybeGeoLocationPosition(position)); 1180 } 1181 } 1182 1183 $$.maybeGeoLocationPosition = function (position) { 1184 if (position == null) { 1185 position = {}; 1186 position.coords = {}; 1187 position.coords.latitude = null; 1188 position.coords.longitude = null; 1189 } 1190 1191 $$.getYourClubLocationByPosition(position); 1192 } 1193 1194 $$.checkYourClubGeo = function () { 1195 if (jQuery('#club-location-your-club-info').is(':hidden')) { 1196 jQuery('#club-location-your-club-info').show(); 1197 } else { 1198 jQuery('#club-location-your-club-info').hide(); 1199 } 1200 } 1201 1202 $$.getGeoLocation = function () { 1203 if ($$.geoWatchId != null) { 1204 jQuery.geolocation.stopAll(); 1205 $$.geoWatchId = null; 1206 $$.geoPrevPosition.latitude = 0; 1207 $$.geoPrevPosition.longitude = 0; 1208 } 1209 $$.geoWatchId = jQuery.geolocation.watch({ win: $$.getGeoLocationUpdated }); 1210 } 1211 1212 $$.getGeoLocationUpdated = function (position) { 1213 1214 if (position.coords.latitude === $$.geoPrevPosition.latitude && position.coords.longitude === $$.geoPrevPosition.longitude) { 1215 return; 1216 } 1217 1218 $$.deleteCookie('club_location_geo'); 1219 1220 $$.geoPrevPosition.latitude = position.coords.latitude; 1221 $$.geoPrevPosition.longitude = position.coords.longitude; 1222 1223 $$.getYourClubLocationByPosition(position); 1224 } 1225 1226 $$.getIPLocation = function () { 1227 var obj = {}; 1228 obj.latitude = null; 1229 obj.longitude = null; 1230 1231 $$.deleteCookie('club_location_geo'); 1232 1233 if ($$.geoWatchId != null) { 1234 jQuery.geolocation.stopAll(); 1235 $$.geoWatchId = null; 1236 $$.geoPrevPosition.latitude = 0; 1237 $$.geoPrevPosition.longitude = 0; 1238 } 1239 1240 /** 1241 * Server will ignore lat long if club_location_geo is set 1242 */ 1243 var position = {}; 1244 position.coords = obj; 1245 $$.getYourClubLocationByPosition(position); 1246 } 1247 1248 $$.makeDefaultClub = function (latitude, longitude) { 1249
1250 var club_location_geo = latitude + ':' + longitude; 1251 $$.setCookie('club_location_geo', club_location_geo, 1); 1252 1253 if ($$.geoWatchId != null) { 1254 jQuery.geolocation.stopAll(); 1255 $$.geoWatchId = null; 1256 $$.geoPrevPosition.latitude = 0; 1257 $$.geoPrevPosition.longitude = 0; 1258 } 1259 1260 /** 1261 * Server will ignore lat long if club_location_geo is set 1262 */ 1263 var position = {}; 1264 position.coords = {}; 1265 position.coords.latitude = latitude; 1266 position.coords.longitude = longitude; 1267 $$.getYourClubLocationByPosition(position); 1268 } 1269 1270 $$.getCoords = function () { 1271 return new Promise((resolve, reject) => 1272 navigator.permissions ? 1273 navigator.permissions.query({ 1274 name: 'geolocation' 1275 }).then(permission => 1276 permission.state === "granted" 1277 ? navigator.geolocation.getCurrentPosition(pos => resolve(pos)) 1278 : resolve(null) 1279 ) : 1280 resolve(null) 1281 ) 1282 } 1283 1284 $$.getYourClubLocationByPosition = function (position) { 1285 if (position == null) { 1286 return; 1287 } 1288 var data = (jQuery('#club-location-your-club-wrapper').data('shortcodeattr')) ? jQuery('#club-location-your-club-wrapper').data('shortcodeattr') : {}; 1289 data.action = 'clublocationajax'; 1290 data.clAction = 'yourClubLocations'; 1291 data.lat = position.coords.latitude; 1292 data.long = position.coords.longitude; 1293 1294 jQuery('#club-location-current-club').html('Fetching closest store...'); 1295 1296 $$.requestAjax(data, $$.getYourClubLocationByPositionCallback); 1297 } 1298 1299 $$.getYourClubLocationByPositionCallback = function (response) { 1300 jQuery('#club-location-your-club-info').html(response); 1301 1302 var totalClubs = parseInt(jQuery('.club-location-your-club-dropdown').data('totalclubs')); 1303 1304 if (totalClubs <= 0) { 1305 jQuery('#club-location-your-club-info').html(''); 1306 jQuery('#club-location-current-club').html(''); 1307 jQuery('.your_store_shop_link').attr('href', 'https://www.adameve.com/?sc=FCAFFL&ac=storelink&cm_mmc=affiliate-_-franchise-_-Publisher-_-no+location+found+shop+online&utm_source=franchise&utm_campaign=no+location+found&utm_term=fcaff&utm_medium=affiliate'); 1308 jQuery('.your_store_shop_link').html('SHOP ADAMEVE.COM'); 1309 jQuery('.your_store_hour_link').hide(); 1310 1311 jQuery('#club-location-your-club-button').html('SHOP ADAMEVE.COM'); 1312 jQuery('#club-location-your-club-button').removeAttr('onclick'); 1313 jQuery('#club-location-your-club-button').attr('href', 'https://www.adameve.com/?sc=FCAFFL&ac=storelink&cm_mmc=affiliate-_-franchise-_-Publisher-_-no+location+found+shop+online&utm_source=franchise&utm_campaign=no+location+found&utm_term=fcaff&utm_medium=affiliate'); 1314 return; 1315 } 1316 1317 jQuery('#club-location-your-club-button').html('Your Store'); 1318 jQuery('#club-location-your-club-button').attr('onclick', 'Club_Location_Public.checkYourClubGeo();'); 1319 jQuery('#club-location-your-club-button').attr('href', 'javascript: void(0);'); 1320 1321 var clubData = jQuery('.club-location-your-club-dropdown').data('club'); 1322 1323 if (!clubData) { 1324 return; 1325 } 1326 1327 var city = clubData.location_city.replace('\\', ''); 1328 var state = clubData.location_state; 1329 var zip = clubData.location_post_code; 1330 var shop_url = clubData.location_shop_online_url + '&utm_content=AEFC_Directory_' + clubData.location_code + '_' + state + '_' + clubData.location_name; 1331 var store_hour_url = $$.trailingslashit(clubData.location_store_hours_url); 1332 1333 if (jQuery('.your_store_shop_link').length > 0) { 1334 jQuery('.your_store_shop_link').html('SHOP ONLINE NOW'); 1335 jQuery('.your_store_shop_link').attr('href', shop_url); 1336 } 1337 1338 if (jQuery('.your_store_hour_link').length > 0) { 1339 jQuery('.your_store_hour_link').attr('href', store_hour_url); 1340 } 1341 1342 jQuery('#club-location-current-club').html('<strong>' + city + '</strong> (' + state + ' ' + zip + ')'); 1343 jQuery('#club-location-current-club').fadeIn(); 1344 1345 if (jQuery('.ae-main-collection-link').length) { 1346 jQuery('.ae-main-collection-link').each(function () { 1347 var collection_link = jQuery(this); 1348 if (!collection_link.attr('data-destination')) { 1349 return; 1350 } 1351 if (collection_link.attr('data-destination') == '') { 1352 return; 1353 } 1354 var destination_link = collection_link.attr('data-destination'); 1355 var href = shop_url + destination_link; 1356 1357 if (collection_link.attr('data-utm')) { 1358 href += '&' + collection_link.attr('data-utm'); 1359 } 1360 1361 collection_link.attr('href', href); 1362 }); 1363 } 1364 1365 $$.applySocialLinks(clubData); 1366 } 1367 1368 $$.applySocialLinks = function (clubData) { 1369 1370 if (jQuery('footer .x-social-global').length == 0) { 1371 return; 1372 } 1373 1374 var html = ''; 1375 1376 if (!clubData.social_profiles) { 1377 return; 1378 } 1379 1380 if (!clubData.social_profiles.fk_location_id) { 1381 return; 1382 } 1383 1384 if (clubData.social_profiles.location_facebook_url != '') { 1385 html += '<a href="' + clubData.social_profiles.location_facebook_url + '" class="facebook" title="Facebook" target="_blank"><i class="x-icon-facebook-square" data-x-icon-b="" aria-hidden="true"></i></a>'; 1386 } 1387 1388 if (clubData.social_profiles.location_foursquare_url != '') { 1389 html += '<a href="' + clubData.social_profiles.location_foursquare_url + '" class="foursquare" title="Foursquare" target="_blank"><i class="x-icon-foursquare" data-x-icon-b="" aria-hidden="true"></i></a>'; 1390 } 1391 1392 if (clubData.social_profiles.location_instagram_url != '') { 1393 html += '<a href="' + clubData.social_profiles.location_instagram_url + '" class="instagram" title="Instagram" target="_blank"><i class="x-icon-instagram" data-x-icon-b="" aria-hidden="true"></i></a>'; 1394 } 1395 1396 if (clubData.social_profiles.location_linkedin_url != '') { 1397 html += '<a href="' + clubData.social_profiles.location_linkedin_url + '" class="linkedin" title="LinkedIn" target="_blank"><i class="x-icon-linkedin-square" data-x-icon-b="" aria-hidden="true"></i></a>'; 1398 } 1399 1400 if (clubData.social_profiles.location_pinterest_url != '') { 1401 html += '<a href="' + clubData.social_profiles.location_pinterest_url + '" class="pinterest" title="Pinterest" target="_blank"><i class="x-icon-pinterest-square" data-x-icon-b="" aria-hidden="true"></i></a>'; 1402 } 1403 1404 if (clubData.social_profiles.location_twitter_url != '') { 1405 html += '<a href="' + clubData.social_profiles.location_twitter_url + '" class="twitter" title="Twitter" target="_blank"><i class="x-icon-twitter-square" data-x-icon-b="" aria-hidden="true"></i></a>'; 1406 } 1407 1408 if (clubData.social_profiles.location_xing_url != '') { 1409 html += '<a href="' + clubData.social_profiles.location_xing_url + '" class="xing" title="XING" target="_blank"><i class="x-icon-xing-square" data-x-icon-b="" aria-hidden="true"></i></a>'; 1410 } 1411 1412 if (clubData.social_profiles.location_youtube_url != '') { 1413 html += '<a href="' + clubData.social_profiles.location_youtube_url + '" class="youtube" title="YouTube" target="_blank"><i class="x-icon-youtube-square" data-x-icon-b="" aria-hidden="true"></i></a>'; 1414 } 1415 1416 if (clubData.location_gmb) { 1417 if (clubData.location_gmb != '') { 1418 html += '<a href="' + clubData.location_gmb + '" class="google-plus" title="Google+" target="_blank"><i class="x-icon-google-plus-square" data-x-icon-b="" aria-hidden="true"></i></a>'; 1419 } 1420 } 1421 1422 jQuery('footer .x-social-global').html(html); 1423 } 1424 1425 $$.trailingslashit = function (url) { 1426 var lastChar = url.substr(-1); 1427 if (lastChar != '/') { 1428 url = url + '/'; 1429 } 1430 return url; 1431 } 1432 1433 $$.getUrlParameter = function (sParam) { 1434 var sPageURL = window.location.search.substring(1), 1435 sURLVariables = sPageURL.split('&'), 1436 sParameterName, 1437 i; 1438 1439 for (i = 0; i < sURLVariables.length; i++) { 1440 sParameterName = sURLVariables[i].split('='); 1441 1442 if (sParameterName[0] === sParam) { 1443 return sParameterName[1] === undefined ? true : decodeURIComponent(sParameterName[1]); 1444 } 1445 } 1446 return false;
1447 }; 1448 1449 $$.setCookie = function (cname, cvalue, exdays) { 1450 var d = new Date(); 1451 d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000)); 1452 var expires = "expires=" + d.toUTCString(); 1453 document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/"; 1454 } 1455 1456 $$.getCookie = function (name) { 1457 var nameEQ = encodeURIComponent(name) + "="; 1458 var ca = document.cookie.split(';'); 1459 for (var i = 0; i < ca.length; i++) { 1460 var c = ca[i]; 1461 while (c.charAt(0) === ' ') 1462 c = c.substring(1, c.length); 1463 if (c.indexOf(nameEQ) === 0) 1464 return decodeURIComponent(c.substring(nameEQ.length, c.length)); 1465 } 1466 return null; 1467 } 1468 1469 $$.deleteCookie = function (name) { 1470 $$.setCookie(name, "", -1); 1471 } 1472 1473 $$.requestAjax = function (data, callback) { 1474 jQuery.post(clubLocationObject.ajax_url, data, function (response) { 1475 callback(response); 1476 }); 1477 } 1478 1479 $$.requestAjaxFile = function (data, callback) { 1480 jQuery.ajax({ 1481 url: clubLocationObject.ajax_url, 1482 type: 'POST', 1483 data: data, 1484 async: false, 1485 cache: false, 1486 contentType: false, 1487 enctype: 'multipart/form-data', 1488 processData: false, 1489 success: function (response) { 1490 callback(response); 1491 } 1492 }); 1493 } 1494 1495 jQuery(document).ready(function () { 1496 Club_Location_Public.initPublic(); 1497 }); 1498};
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.