1// Wrapper function so that you can use the dollar sign ($) as jQuery 2(function ($) { 3 // Document ready function to wrap around all other functions 4 $(document).ready(function () { 5 //Add logo to Max Mega Menu ul 6 // $("#mega-menu-primary").append( 7 // '<li class="mega-menu-item mega-menu-item-999999"><div class="viz-logo-container"><a href="/home/"><img src="https://vf-gp-1.s3.us-east-2.amazonaws.com/berlingardens/wp-content/uploads/2022/07/26074251/Berlin-Gardens-Logo.png" alt="Berlin Gardens Logo"></img></a></div></li>' 8 // ); 9 10 $(".wp-block-cover").hover(function () { 11 var thisLink = $(this).find("a").attr("href"); 12 13 if (thisLink) { 14 $(this).css("cursor", "pointer"); 15 } 16 }); 17 18 $(".wp-block-cover").click(function () { 19 var thislink = $(this).find("a"); 20 21 if (thislink) { 22 var thisLinkSrc = $(thislink).attr("href"); 23 24 if (thisLinkSrc) { 25 window.location.href = thisLinkSrc; 26 } 27 } 28 }); 29 30 $(".ws_top_search").click(function () { 31 $(this).parent().parent().toggleClass("search_open"); 32 33 document.getElementById("vz_search").focus(); 34 }); 35 36 $(".get-quote-btn").click(function () { 37 $(".pop-up-wrapper").show(); 38 39 $("body").css("overflow", "hidden"); 40 }); 41 42 $(".popupCloseButton").click(function () { 43 $(".pop-up-wrapper").hide(); 44 45 $("body").removeAttr("style"); 46 }); 47 48 var product = $(".product_title.entry-title").html(), 49 prodName = $(".prodname"); 50 51 if (product) { 52 var inputProdName = $(".product-name input"); 53 54 $(inputProdName).val(product); 55 56 if (prodName) { 57 $(prodName).text(product); 58 } else { 59 $(".pop-up-content p.more-info").hide(); 60 } 61 } 62 63 $(".variations .variation-label").click(function () { 64 $(this).toggleClass("openLabel"); 65 $(this).next().toggleClass("open"); 66 67 var heightofSummary = $(".entry-summary").height() + 250; 68 69 $(".woocommerce div.product").css("min-height", heightofSummary); 70 }); 71 72 $(".toggle_close > h3").click(function () { 73 var toggleContent = $(this).parent(); 74 $(toggleContent).find(".toggle_content").toggle(); 75 $(toggleContent).toggleClass("toggle_open"); 76 }); 77 78 $(document).on("gform_confirmation_loaded", function (event, formId) { 79 if (formId == 1) { 80 // run code specific to form ID 1 81 gtag("event", "form_submission", { 82 event_category: "form", 83 event_label: "Message-Us", 84 }); 85 } else if (formId == 6) { 86 // run code specific to form ID 2 87 gtag("event", "form_submission", { 88 event_category: "form", 89 event_label: "favorites", 90 }); 91 } 92 93 setTimeout(function () { 94 $(".pop-up-wrapper").hide(); 95 $("body").removeAttr("style"); 96 }, 3000); 97 }); 98 99 $(".single_add_to_cart_button.button").click(function () { 100 gtag("event", "click", { 101 event_category: "quote", 102 event_label: "add-to-cart", 103 }); 104 }); 105 106 var initPhotoSwipeFromDOM = function (gallerySelector) { 107 // parse slide data (url, title, size ...) from DOM elements 108 // (children of gallerySelector) 109 var parseThumbnailElements = function (el) { 110 var thumbElements = el.childNodes, 111 numNodes = thumbElements.length, 112 items = [], 113 figureEl, 114 linkEl, 115 size, 116 item; 117 118 for (var i = 0; i < numNodes; i++) { 119 figureEl = thumbElements[i]; // <figure> element 120 121 // include only element nodes 122 if (figureEl.nodeType !== 1) { 123 continue; 124 } 125 126 linkEl = figureEl.children[0]; // <a> element 127 128 size = [1000, 1000]; 129 130 // create slide object 131 item = { 132 src: linkEl.getAttribute("href"), 133 w: parseInt(size[0], 10), 134 h: parseInt(size[1], 10), 135 }; 136 137 if (figureEl.children.length > 1) { 138 // <figcaption> content 139 item.title = figureEl.children[1].innerHTML; 140 } 141 142 if (linkEl.children.length > 0) { 143 // <img> thumbnail element, retrieving thumbnail url 144 item.msrc = linkEl.children[0].getAttribute("src"); 145 } 146 147 item.el = figureEl; // save link to element for getThumbBoundsFn 148 items.push(item); 149 } 150 151 return items; 152 }; 153 154 // find nearest parent element 155 var closest = function closest(el, fn) { 156 return el && (fn(el) ? el : closest(el.parentNode, fn)); 157 }; 158 159 // triggers when user clicks on thumbnail 160 var onThumbnailsClick = function (e) { 161 e = e || window.event; 162 e.preventDefault ? e.preventDefault() : (e.returnValue = false); 163 164 var eTarget = e.target || e.srcElement; 165 166 // find root element of slide 167 var clickedListItem = closest(eTarget, function (el) { 168 return el.tagName && el.tagName.toUpperCase() === "FIGURE"; 169 }); 170 171 if (!clickedListItem) { 172 return; 173 } 174 175 // find index of clicked item by looping through all child nodes 176 // alternatively, you may define index via data- attribute 177 var clickedGallery = clickedListItem.parentNode, 178 childNodes = clickedListItem.parentNode.childNodes, 179 numChildNodes = childNodes.length, 180 nodeIndex = 0, 181 index; 182 183 for (var i = 0; i < numChildNodes; i++) { 184 if (childNodes[i].nodeType !== 1) { 185 continue; 186 } 187 188 if (childNodes[i] === clickedListItem) { 189 index = nodeIndex; 190 break; 191 } 192 nodeIndex++; 193 } 194 195 if (index >= 0) {
196 // open PhotoSwipe if valid index found 197 openPhotoSwipe(index, clickedGallery); 198 } 199 return false; 200 }; 201 202 // parse picture index and gallery index from URL (#&pid=1&gid=2) 203 var photoswipeParseHash = function () { 204 var hash = window.location.hash.substring(1), 205 params = {}; 206 207 if (hash.length < 5) { 208 return params; 209 } 210 211 var vars = hash.split("&"); 212 for (var i = 0; i < vars.length; i++) { 213 if (!vars[i]) { 214 continue; 215 } 216 var pair = vars[i].split("="); 217 if (pair.length < 2) { 218 continue; 219 } 220 params[pair[0]] = pair[1]; 221 } 222 223 if (params.gid) { 224 params.gid = parseInt(params.gid, 10); 225 } 226 227 return params; 228 }; 229 230 var openPhotoSwipe = function ( 231 index, 232 galleryElement, 233 disableAnimation, 234 fromURL 235 ) { 236 var pswpElement = document.querySelectorAll(".pswp")[0], 237 gallery, 238 options, 239 items; 240 241 items = parseThumbnailElements(galleryElement); 242 243 // define options (if needed) 244 options = { 245 // define gallery index (for URL) 246 galleryUID: galleryElement.getAttribute("data-pswp-uid"), 247 248 getThumbBoundsFn: function (index) { 249 // See Options -> getThumbBoundsFn section of documentation for more info 250 var thumbnail = items[index].el.getElementsByTagName("img")[0], // find thumbnail 251 pageYScroll = 252 window.pageYOffset || document.documentElement.scrollTop, 253 rect = thumbnail.getBoundingClientRect(); 254 255 return { x: rect.left, y: rect.top + pageYScroll, w: rect.width }; 256 }, 257 }; 258 259 // PhotoSwipe opened from URL 260 if (fromURL) { 261 if (options.galleryPIDs) { 262 // parse real index when custom PIDs are used 263 // http://photoswipe.com/documentation/faq.html#custom-pid-in-url 264 for (var j = 0; j < items.length; j++) { 265 if (items[j].pid == index) { 266 options.index = j; 267 break; 268 } 269 } 270 } else { 271 // in URL indexes start from 1 272 options.index = parseInt(index, 10) - 1; 273 } 274 } else { 275 options.index = parseInt(index, 10); 276 } 277 278 // exit if index not found 279 if (isNaN(options.index)) { 280 return; 281 } 282 283 if (disableAnimation) { 284 options.showAnimationDuration = 0; 285 } 286 287 // Pass data to PhotoSwipe and initialize it 288 gallery = new PhotoSwipe( 289 pswpElement, 290 PhotoSwipeUI_Default, 291 items, 292 options 293 ); 294 gallery.init(); 295 }; 296 297 // loop through all gallery elements and bind events 298 var galleryElements = document.querySelectorAll(gallerySelector); 299 300 for (var i = 0, l = galleryElements.length; i < l; i++) { 301 galleryElements[i].setAttribute("data-pswp-uid", i + 1); 302 galleryElements[i].onclick = onThumbnailsClick; 303 } 304 305 // Parse URL and open gallery if it contains #&pid=3&gid=1 306 var hashData = photoswipeParseHash(); 307 if (hashData.pid && hashData.gid) { 308 openPhotoSwipe( 309 hashData.pid, 310 galleryElements[hashData.gid - 1], 311 true, 312 true 313 ); 314 } 315 }; 316 317 // execute above function 318 initPhotoSwipeFromDOM(".wp-block-gallery"); 319 320 //Hide download on individual category pages on dealer portal if user does not have access to the download 321 if ($(".col-12 .card .card-body .media .ml-3 button.btn-danger")) { 322 $(".col-12 .card .card-body .media .ml-3 button.btn-danger") 323 .closest(".col-12") 324 .hide(); 325 } 326 327 // Searchbar desktop 328 $("#vz_search").on("focus", function () { 329 // Store the original placeholder if it hasn't been stored yet 330 if (!$(this).data("original-placeholder")) { 331 $(this).data("original-placeholder", $(this).attr("placeholder")); 332 } 333 334 // Set placeholder to an empty string 335 $(this).attr("placeholder", " "); 336 }); 337 338 $("#vz_search").on("blur", function () { 339 // Restore the original placeholder from the data attribute 340 $(this).attr("placeholder", $(this).data("original-placeholder")); 341 }); 342 343 // Header main dropdowns 344 $(".furniture-trigger").on("mouseenter", function () { 345 if ($(".furniture-dropdown").is(":visible")) { 346 $(".furniture-dropdown").hide(); 347 } else { 348 $(".furniture-dropdown").show(); 349 } 350 }); 351 $(".furniture-trigger").on("mouseleave", function () { 352 if ($(".furniture-dropdown").is(":visible")) { 353 $(".furniture-dropdown").hide(); 354 } 355 }); 356 $(".structures-trigger").on("mouseenter", function () { 357 if ($(".structures-dropdown").is(":visible")) { 358 $(".structures-dropdown").hide(); 359 } else { 360 $(".structures-dropdown").show(); 361 } 362 }); 363 $(".structures-trigger").on("mouseleave", function () { 364 if ($(".structures-dropdown").is(":visible")) { 365 $(".structures-dropdown").hide(); 366 } 367 }); 368 $(".agora-trigger").on("mouseenter", function () { 369 if ($(".agora-dropdown").is(":visible")) { 370 $(".agora-dropdown").hide(); 371 } else { 372 $(".agora-dropdown").show(); 373 } 374 }); 375 $(".agora-trigger").on("mouseleave", function () { 376 if ($(".agora-dropdown").is(":visible")) { 377 $(".agora-dropdown").hide(); 378 } 379 }); 380 381 //Header Side Menus 382 $(".side-menu-trigger").on("mouseover", function () { 383 Triggername = $(this).data("trigger-name"); 384 Menuname = $(this).data("menu"); 385 $("." + Triggername + "-side-menu").show(); 386 $( 387 "." + Menuname + "-header-side-menu:not(." + Triggername + "-side-menu)" 388 ).hide(); 389 }); 390 391 //Open and close hamburger menu 392 $(".header-menu-trigger").click(function () { 393 $(".header-dropdown").toggleClass("hide"); 394 $(this).toggleClass("fa-bars"); 395 $(this).toggleClass("fa-x"); 396 }); 397 $(".hamburger").on("click", function () { 398 if ($(".hamitems").hasClass("open")) { 399 $(".hamitems").removeClass("open"); 400 } else { 401 $(".hamitems").addClass("open"); 402 } 403 }); 404 //Add class to change hamburger to x 405 $(".hamburger").on("click", function () { 406 if ($(".hamburger").hasClass("close-option")) { 407 $(".hamburger").removeClass("close-option"); 408 } else { 409 $(".hamburger").addClass("close-option"); 410 } 411 }); 412 413 //Help dropdown menu 414 $(".help-li").on("click", function () { 415 if ($(".help-li").hasClass("open-dropdown")) { 416 $(".help-li").removeClass("open-dropdown"); 417 $(".hamitems.open").removeClass("help-menu-open"); 418 } else { 419 $(".help-li").addClass("open-dropdown"); 420 $(".hamitems.open").addClass("help-menu-open"); 421 } 422 }); 423 424 $(".header-help-trigger").click(function () { 425 $(".help-menu").toggle(); 426 }); 427 428 //Instructions Dropdown 429 $(".see-inst").on("click", function () { 430 if ($(".inst-ul").hasClass("open")) { 431 $(".inst-ul").removeClass("open"); 432 $(".see-inst").removeClass("open"); 433 } else { 434 $(".inst-ul").addClass("open"); 435 $(".see-inst").addClass("open"); 436 } 437 }); 438 439 //Make sure Hamburger Menu is closed on page load 440 $(document).ready(function () { 441 $("#checkbox1").prop("checked", false); 442 }); 443 444 //Add new label for fabrics color page 445 $(document).ready(function () { 446 if ($(".new-fabric > a")) { 447 $(".new-fabric > a").append( 448 '<div class="new-text-background"><p class="new-text">NEW</p></div>' 449 ); 450 } 451 }); 452 453 // Add label for elements with the 'no-chaise-fabric' class 454 $(document).ready(function () { 455 if ($(".no-chaise-fabric")) { 456 $(".no-chaise-fabric").append( 457 '<div class="no-chaise-text-background"><p class="no-chaise-text">Not Available on Chaise Lounges</p></div>' 458 ); 459 } 460 }); 461 462 // Add class to anchor view products button 463 $("ul.products").attr("id", "products-anchor"); 464 465 //Add text for overlay of homepage video 466 $(document).ready(function () { 467 $(".home-vid").append( 468 '<div class="overlay-container-home"><h2 class="home-vid-header">TAKE LIFE OUTDOORS</h2><a class="home-vid-button" href="#home-cats">View Products</a></div>' 469 ); 470 }); 471 472 //Add icons to links on hover 473 $(document).ready(function () { 474 $(".img-hover-nordic").append(
475 '<img class="hover-menu-img nordic-png" src="https://vf-gp-1.s3.us-east-2.amazonaws.com/berlingardens/wp-content/uploads/2022/07/29165651/Berlin-Gardens-Website-Icons_Nordic-Outline-Icon.png">' 476 ); 477 }); 478 $(document).ready(function () { 479 $(".img-hover-mayhew").append( 480 '<img class="hover-menu-img mayhew-png" src="https://vf-gp-1.s3.us-east-2.amazonaws.com/berlingardens/wp-content/uploads/2022/07/29165635/Berlin-Gardens-Website-Icons_Mayhew-Outline-Icon.png">' 481 ); 482 }); 483 $(document).ready(function () { 484 $(".img-hover-terrace").append( 485 '<img class="hover-menu-img terrace-png" src="https://vf-gp-1.s3.us-east-2.amazonaws.com/berlingardens/wp-content/uploads/2022/07/29165404/Berlin-Gardens-Website-Icons_Classic-Terrace-Outline-Icon.png">' 486 ); 487 }); 488 $(document).ready(function () { 489 $(".img-hover-bristol").append( 490 '<img class="hover-menu-img bristol-png" src="https://vf-gp-1.s3.us-east-2.amazonaws.com/berlingardens/wp-content/uploads/2022/07/29165331/Berlin-Gardens-Website-Icons_Bristol-Outline-Icon.png">' 491 ); 492 }); 493 $(document).ready(function () { 494 $(".img-hover-comfo").append( 495 '<img class="hover-menu-img comfo-png" src="https://vf-gp-1.s3.us-east-2.amazonaws.com/berlingardens/wp-content/uploads/2022/07/29165421/Berlin-Gardens-Website-Icons_Comfo-Back-Outline-Icon.png">' 496 ); 497 }); 498 $(document).ready(function () { 499 $(".img-hover-cozi").append( 500 '<img class="hover-menu-img cozi-png" src="https://vf-gp-1.s3.us-east-2.amazonaws.com/berlingardens/wp-content/uploads/2022/07/29165438/Berlin-Gardens-Website-Icons_Cozi-Back-Outline-Icon.png">' 501 ); 502 }); 503 $(document).ready(function () { 504 $(".img-hover-casual").append( 505 '<img class="hover-menu-img casual-png" src="https://vf-gp-1.s3.us-east-2.amazonaws.com/berlingardens/wp-content/uploads/2022/07/29165347/Berlin-Gardens-Website-Icons_Casual-Back-Outline-Icon.png">' 506 ); 507 }); 508 $(document).ready(function () { 509 $(".img-hover-garden").append( 510 '<img class="hover-menu-img garden-png" src="https://vf-gp-1.s3.us-east-2.amazonaws.com/berlingardens/wp-content/uploads/2022/07/29165547/Berlin-Gardens-Website-Icons_Garden-Classic-Outline-Icon.png">' 511 ); 512 }); 513 $(document).ready(function () { 514 $(".img-hover-harbor").append( 515 '<img class="hover-menu-img harbor-png" src="https://vf-gp-1.s3.us-east-2.amazonaws.com/berlingardens/wp-content/uploads/2022/07/29165602/Berlin-Gardens-Website-Icons_Harbor-Outline-Icon.png">' 516 ); 517 }); 518 $(document).ready(function () { 519 $(".img-hover-homestead").append( 520 '<img class="hover-menu-img homestead-png" src="https://vf-gp-1.s3.us-east-2.amazonaws.com/berlingardens/wp-content/uploads/2022/07/29165618/Berlin-Gardens-Website-Icons_Homestead-Outline-Icon.png">' 521 ); 522 }); 523 $(document).ready(function () { 524 $(".img-hover-donoma").append( 525 '<img class="hover-menu-img donoma-png" src="https://vf-gp-1.s3.us-east-2.amazonaws.com/berlingardens/wp-content/uploads/2022/07/29165513/Berlin-Gardens-Website-Icons_Donoma-Fire-Table-Outline-Icon.png">' 526 ); 527 }); 528 $(document).ready(function () { 529 $(".img-hover-bar").append( 530 '<img class="hover-menu-img bar-png" src="https://vf-gp-1.s3.us-east-2.amazonaws.com/berlingardens/wp-content/uploads/2022/07/29165315/Berlin-Gardens-Website-Icons_Bar-Buffet-Outline-Icon.png">' 531 ); 532 }); 533 $(document).ready(function () { 534 $(".img-hover-acc").append( 535 '<img class="hover-menu-img acc-png" src="https://vf-gp-1.s3.us-east-2.amazonaws.com/berlingardens/wp-content/uploads/2022/07/29165456/Berlin-Gardens-Website-Icons_Cushions-and-Umbrellas-Outline-Icon.png">' 536 ); 537 }); 538 $(document).ready(function () { 539 $(".img-hover-picnic").append( 540 '<img class="hover-menu-img picnic-png" src="https://vf-gp-1.s3.us-east-2.amazonaws.com/berlingardens/wp-content/uploads/2022/07/29165740/Berlin-Gardens-Website-Icons_Picnic-Outline-Icon.png">' 541 ); 542 $(".img-hover-holland").append(
543 '<img class="hover-menu-img holland-png" src="https://cdn.berlingardensllc.com/wp-content/uploads/2023/09/Icon-Holland.png">' 544 ); 545 $(".img-hover-hartley").append( 546 '<img class="hover-menu-img hartley-png" src="https://cdn.berlingardensllc.com/wp-content/uploads/2023/09/Icon-Hartley.png" >' 547 ); 548 $(".img-hover-kinsley").append( 549 '<img class="hover-menu-img kinsley-png" src="https://cdn.berlingardensllc.com/wp-content/uploads/2023/09/Icon-Kinsley.png" >' 550 ); 551 $(".img-hover-parker").append( 552 '<img class="hover-menu-img parker-png" src="https://cdn.berlingardensllc.com/wp-content/uploads/2023/09/Icon-Parker.png" >' 553 ); 554 $(".img-hover-berkley").append( 555 '<img class="hover-menu-img berkley-png" src="https://cdn.berlingardensllc.com/wp-content/uploads/2023/09/Icon-Berkley.png" >' 556 ); 557 $(".img-hover-hudson").append( 558 '<img class="hover-menu-img hudson-png" src="https://cdn.berlingardensllc.com/wp-content/uploads/2023/09/Icon-Hudson.png" >' 559 ); 560 $(".img-hover-numa").append( 561 '<img class="hover-menu-img numa-png" src="https://cdn.berlingardensllc.com/wp-content/uploads/2023/09/Icon-Numa.png" >' 562 ); 563 $(".img-hover-camden").append( 564 '<img class="hover-menu-img camden-png" src="https://cdn.berlingardensllc.com/wp-content/uploads/2023/09/Icon-Camden.png" >' 565 ); 566 $(".img-hover-kids").append( 567 '<img class="hover-menu-img kids-png" src="https://cdn.berlingardensllc.com/wp-content/uploads/2023/09/Icon-Kids-Collection.png" >' 568 ); 569 $(".img-hover-rugs").append( 570 '<img class="hover-menu-img rugs-png" src="https://cdn.berlingardensllc.com/wp-content/uploads/2023/09/Icon-Rugs.png" >' 571 ); 572 }); 573 574 // Logout Confirmation 575 576 $(".log-out-li").click(function () { 577 $(".logout-wrapper").show(); 578 $("body").css("overflow", "hidden"); 579 }); 580 $(".dropdown-logout-trigger").click(function () { 581 $(".logout-wrapper").show(); 582 $("body").css("overflow", "hidden"); 583 }); 584 585 $(".return-button").click(function () { 586 $(".logout-wrapper").hide(); 587 $("body").removeAttr("style"); 588 }); 589 590 $(document).ready(function () { 591 $(".mobile-return a").attr("onClick", "history.back()"); 592 }); 593 594 $('a[href*="#"]'); 595 596 //Email Favorites 597 $(".entry-content").on("click", ".email-fav-button", function () { 598 $("#gform_wrapper_6").addClass("show"); 599 }); 600 601 //Smooth Scroll 602 603 // Select all links with hashes 604 $('a[href*="#"]') 605 // Remove links that don't actually link to anything 606 .not('[href="#"]') 607 .not('[href="#0"]') 608 .click(function (event) { 609 // On-page links 610 if ( 611 location.pathname.replace(/^\//, "") == 612 this.pathname.replace(/^\//, "") && 613 location.hostname == this.hostname 614 ) { 615 // Figure out element to scroll to 616 var target = $(this.hash); 617 target = target.length 618 ? target 619 : $("[name=" + this.hash.slice(1) + "]"); 620 // Does a scroll target exist? 621 if (target.length) { 622 // Only prevent default if animation is actually gonna happen 623 event.preventDefault(); 624 $("html, body").animate( 625 { 626 scrollTop: target.offset().top - 50, 627 }, 628 1000, 629 function () { 630 // Callback after animation 631 // Must change focus! 632 var $target = $(target); 633 $target.focus(); 634 if ($target.is(":focus")) { 635 // Checking if the target was focused 636 return false; 637 } else { 638 $target.attr("tabindex", "-1"); // Adding tabindex for elements not focusable 639 $target.focus(); // Set focus again 640 } 641 } 642 ); 643 } 644 } 645 }); 646 647 /* Start Tracking Acquisition for Form Submissions */ 648 649 /* Creating my variables to start the process. The url variable is getting the URL of the current page. The URLSearchParams is so we can get the query value below, later in the function. */ 650 651 var url = new URL(window.location.href), 652 searchParams1 = new URLSearchParams(url.search), 653 acqCookie = ""; 654 655 /* Storing the cookie value in a variable. See "getCookie" function below as well. (Copied from w3schools.com) */ 656 657 acqCookie = getCookie("acquisition"); 658 659 /* checking to see if the cookie of "acquisition" exists. if so, then fill in the value of the hidden field in Gravity forms with the value of the cookie. */ 660 661 /* if the cookie doesn't exist (the "else if"), then see if the url contains either of these two query values: "acquisition", or, "gclid". The double pipe is the "or" logical operator. What's especially cool is that even if the URL has multiple query strings, because of the URLSearchParams property we can find it, not matter where it is. No more regex searching through URLs. Makes our lives so much easier. Great documentation here: https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams */ 662 663 if (acqCookie != "") { 664 jQuery("div.acquisition input").val(acqCookie); 665 } else if ( 666 false !== searchParams1.has("acquisition") || 667 false !== searchParams1.has("gclid") 668 ) { 669 /* declaring variables, getting the value of both the acqustion and gclid query values. */ 670 671 var acq = searchParams1.get("acquisition"), 672 gclid = searchParams1.get("gclid"), 673 cookieValue = ""; 674 675 /* This is a shorthand if statement. It's checking to see if "acq" is null or not. If it's null, then "cookievalue" equals "gclid", if its not null then it equals "acq". */ 676 677 cookieValue = acq === null ? "Google_Ad_" + gclid : acq; 678 679 /* Finally taking the cookie value and creating a cookie with it. Note that I'm storing the cookie with a path of "/", which stores it at the root of the domain, which is important so it persists through the whole website. */ 680 681 document.cookie = "acquisition=" + cookieValue + ";path=/"; 682 683 /* There's a chance that visitors coming to the site land on the page that has a form and the value needs to be filled
683in before the cookie has time to be created, so, if that's the case, fill out the value of the hidden field directly with the query values. */ 684 685 jQuery("div.acquisition input").val(cookieValue); 686 } 687 688 /* End Tracking Acquisition for Form Submissions */ 689 690 $(".gf_login_form input[type=text]").attr( 691 "placeholder", 692 "Username or Email Address" 693 ); 694 695 $(".gf_login_form input[type=password]").attr("placeholder", "Password"); 696 697 $(".woocommerce-form-login #username").attr( 698 "placeholder", 699 "Username or Email Address" 700 ); 701 702 $(".woocommerce-form-login #password").attr("placeholder", "Password"); 703 704 $(".lost_reset_password #user_login").attr( 705 "placeholder", 706 "Username or Email Address" 707 ); 708 }); 709})(jQuery); 710 711function getCookie(cname) { 712 var name = cname + "="; 713 var ca = document.cookie.split(";"); 714 for (var i = 0; i < ca.length; i++) { 715 var c = ca[i]; 716 while (c.charAt(0) == " ") { 717 c = c.substring(1); 718 } 719 if (c.indexOf(name) == 0) { 720 return c.substring(name.length, c.length); 721 } 722 } 723 return ""; 724} 725 726// Retrieve a users location and store it a cookie to be submitted in hidden field on contact form 727document.addEventListener("DOMContentLoaded", function () { 728 var loggedIn = document.body.classList.contains("logged-in"); 729 var apiKey = "AIzaSyCgLTIae-bQHO-YEk-zIQ0KzkiQDiJJ2Hs"; 730 731 function setCookie(name, value, days = 90, sameSite = "Strict") { 732 let expires = ""; 733 if (days) { 734 const date = new Date(); 735 date.setTime(date.getTime() + days * 24 * 60 * 60 * 1000); 736 expires = "; expires=" + date.toUTCString(); 737 } 738 document.cookie = `${name}=${ 739 value || "" 740 }${expires}; path=/; SameSite=${sameSite}`; 741 } 742 743 function getCookie(name) { 744 const cookies = document.cookie.split("; "); 745 const cookieValue = cookies.find((cookie) => cookie.startsWith(name + "=")); 746 if (cookieValue) { 747 return cookieValue.split("=")[1]; 748 } 749 return null; 750 } 751 752 // Retrieve location in longitude/latitude format 753 function getLocation() { 754 return new Promise((resolve, reject) => { 755 if (navigator.geolocation) { 756 navigator.geolocation.getCurrentPosition( 757 (position) => resolve(position), 758 (error) => { 759 reject(error); 760 } 761 ); 762 } else { 763 reject(new Error("Geolocation not supported")); 764 } 765 }); 766 } 767 768 // Converts the longitude and latitude to city,state format 769 function reverseGeocode(latitude, longitude) { 770 return fetch( 771 `https://maps.googleapis.com/maps/api/geocode/json?latlng=${latitude},${longitude}&key=${apiKey}` 772 ) 773 .then((response) => response.json()) 774 .then((data) => { 775 if (data.results.length > 0) { 776 const addressComponents = data.results[0].address_components; 777 const city = 778 addressComponents.find((component) => 779 component.types.includes("locality") 780 )?.long_name || ""; 781 const state = 782 addressComponents.find((component) => 783 component.types.includes("administrative_area_level_1") 784 )?.short_name || ""; 785 return { city, state }; 786 } else { 787 throw new Error("No results found"); 788 } 789 }) 790 .catch((error) => { 791 // Fail silently; 792 }); 793 } 794 795 // Saves position in cookie and updates hidden field if contact page is visited directly. 796 function savePosition(position) { 797 const locationData = { 798 latitude: position.coords.latitude, 799 longitude: position.coords.longitude, 800 }; 801 802 reverseGeocode(locationData.latitude, locationData.longitude) 803 .then(({ city, state }) => { 804 const locationString = `${city}, ${state}`; 805 const base64 = btoa(locationString); 806 setCookie("userLoc", base64); 807 updateHiddenField(city, state); 808 }) 809 .catch((error) => { 810 // Fail silently 811 }); 812 } 813 814 // Inserts cookie into hidden field 815 function updateHiddenField(city, state) { 816 const inputElement = document.getElementById("input_1_8"); 817 if (inputElement) { 818 inputElement.value = `${city}, ${state}`; 819 } 820 } 821 822 // Handles decoding cookie and inputting it if contact page is not visited directly 823 function processCookie() { 824 const cookieValue = getCookie("userLoc"); 825 if (cookieValue) {
826 try { 827 const decodedString = atob(cookieValue); 828 document.getElementById("input_1_8").value = decodedString; 829 } catch (error) {} 830 } 831 } 832 833 // Handles placing cookie in hidden field if contact poge is visited indirectly. 834 if (this.body.classList.contains("page-id-79")) { 835 window.onload = processCookie; 836 } 837 838 function isCookieSet(name) { 839 return getCookie(name) !== null; 840 } 841 842 if (!loggedIn && !isCookieSet("userLoc")) { 843 getLocation() 844 .then(savePosition) 845 .catch((error) => { 846 /* Fail silently */ 847 }); 848 } else { 849 processCookie(); 850 } 851}); 852 853document.addEventListener("DOMContentLoaded", function () { 854 if (window.innerWidth > 599) return; // only run on <= 1024px (mobile/tablet) 855 856 const overlay = document.getElementById("modal-1"); 857 const menuItems = overlay.querySelectorAll( 858 ".wp-block-navigation-item__label" 859 ); 860 const burger = document.querySelector(".fabric-burger"); 861 862 menuItems.forEach((element) => { 863 element.addEventListener("click", (e) => { 864 e.stopPropagation(); 865 overlay.style.display = "none"; 866 }); 867 }); 868 869 burger.addEventListener("click", function (e) { 870 e.stopPropagation(); 871 overlay.style.display = "flex"; 872 }); 873 874 // Optional: re-check on resize 875 window.addEventListener("resize", () => { 876 if (window.innerWidth > 1024) { 877 overlay.style.display = ""; // reset for desktop 878 } 879 }); 880});
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.