1var previousScroll = 0; 2var scrollDirection; 3var scrollAdjustment 4var scrollingDown = false 5var deviceHeight = 0 6var isMobile 7var isTablet 8var isIOS 9var categoryCoords = [] 10var ignoreScrollCalculations = false; 11 12(function ($) { 13 14 if(isIOS){ 15 setTimeout(function(){ 16 deviceHeight = ((500 / $(window).width()) * $(window).height()) - 50 17 },1000) 18 } else { 19 deviceHeight = (500 / $(window).width()) * $(window).height() 20 } 21 22 var modalParams = getParameters('book') 23 24 switch(modalParams){ 25 case 'restaurant': 26 openModal('restaurant') 27 break; 28 case 'spa': 29 openModal('enquiry') 30 break; 31 } 32 33 $('.container.with-sidebar .right .package-list > li, .container.with-sidebar .main-column.vouchers .categories>li').each(function() { 34 categoryCoords.push({'id': $(this).attr('id'), 'scrollTop': $(this).offset().top}); 35 }); 36 37 $('.loader').removeClass('visible') 38 39 setTimeout(function(){ 40 $('.loader').remove() 41 },1000) 42 43 isMobile = false; 44 isTablet = false; 45 isIOS = navigator.userAgent.match(/(iPod|iPhone|iPad)/); 46 47 if(isIOS){ 48 setTimeout(function(){ 49 deviceHeight = ((500 / $(window).width()) * $(window).height()) - 50 50 },1000) 51 } else { 52 deviceHeight = (500 / $(window).width()) * $(window).height() 53 } 54 55 if ($(window).width() <= 500) { 56 isMobile = true; 57 } 58 59 if($(window).width() <= 1400) { 60 isTablet = true; 61 } 62 63 if($(window).width() <= 1400) { 64 isRegTablet = true; 65 } 66 67 if (isMobile) { 68 if ($('main>div:first-child').length) { 69 if ($('main>div:first-child').hasClass('hero-container')) { 70 $('body').addClass('fixed-header'); 71 } 72 } 73 } 74 75 /********** 76 HEADER 77 ***********/ 78 $('.open-main-menu').click(function () { 79 $('.main-menu-container').addClass('visible'); 80 }); 81 82 $('.close-main-menu').click(function () { 83 $('.main-menu-container').removeClass('visible'); 84 }); 85 86 $('.menu li').hover(function(){ 87 var thisSubMenu = $(this).children('.sub-menu'); 88 89 if(thisSubMenu.length){ 90 thisSubMenu.slideDown('fast') 91 } 92 }, function(){ 93 var thisSubMenu = $(this).children('.sub-menu'); 94 95 if(thisSubMenu.length){ 96 thisSubMenu.slideUp('fast') 97 } 98 }); 99 100 //open current menu on mobile 101
102 if(isMobile) { 103 setTimeout(function(){ 104 var menuToOpen = $('.current_page_parent > a').click() 105 }, 10) 106 } 107 108 var miniCartPollInterval = null 109 110 $('.open-cart').click(function (e) { 111 e.stopPropagation(); 112 console.log('clicked'); 113 $('.mini-cart').toggleClass('visible'); 114 $('span.cart').toggleClass('active'); 115 116 miniCartPollInterval = setInterval(function(){ 117 assessMiniCartTotal() 118 },500) 119 }); 120 121 $('body').on('click', '.mini-cart', function (e) { 122 e.stopPropagation(); 123 }); 124 125 $('body').click(function () { 126 if ($('.mini-cart').is(':visible')) { 127 $('.mini-cart').removeClass('visible'); 128 $('span.cart').removeClass('active'); 129 130 clearInterval(miniCartPollInterval) 131 assessMiniCartTotal() 132 } 133 }); 134 135 if ($('.current_page_parent').length > 1) { 136 $('.current_page_parent').each(function (key, value) { 137 if (key != 0) { 138 $(this).removeClass('current_page_parent') 139 } 140 }) 141 } 142 143 // get the menu decoration to sit correctly in the corner. 144 145 if($(window).width() >= 1100) { 146 var spaceOutsideMargin = ($(window).width() - 1170) / 2; 147 $('.main-menu-container .right .decoration').css('right', '-' + (spaceOutsideMargin + 0.5) + 'px'); 148 } 149 150 /********** 151 SUB NAV 152 ***********/ 153 154 $('.menu-item-has-children > a').click(function(e){ 155 156 if($(this).parent().hasClass('open')) { 157 e.preventDefault(); 158 $(this).next().slideUp('fast') 159 $(this).parent().removeClass('open'); 160 } else { 161 $('.main-menu-container .sub-menu:visible').slideUp('fast') 162 $('.main-menu-container .open').removeClass('open') 163 164 e.preventDefault(); 165 $(this).parent().addClass('open'); 166 $(this).next().slideDown('fast'); 167 } 168 }); 169 170 if ($('.current-menu-parent').length && !$('.header-sub-nav').length) { 171 var subMenuContents = $('#menu-header .current_page_parent .sub-menu').html(); 172 $('header').append('<div class="header-sub-nav"><ul>' + subMenuContents + '</ul></div>'); 173 }else if($('.header-sub-nav').hasClass('single-post')){ 174 var subMenuContents = $('#menu-header .current_page_parent .sub-menu').html() 175 176 var isAllasJournal = $('.single-post-container').data('is-allas-journal') 177 var selectedItemIndex = isAllasJournal ? 1 : 0 178 179 $('header').append('<div class="header-sub-nav"><ul>' + subMenuContents + '</ul></div>'); 180 181 $('.header-sub-nav li').eq(selectedItemIndex).addClass('current-menu-item') 182 } 183 184 /********** 185 UTILITIES/TEXT 186 ***********/ 187 188 if($(window).width() <= 800) { 189 $('.truncator').each(function () { 190 var lines = parseInt($(this).data('lines')); 191 192 var height = lines * 27; 193 194 $(this).dotdotdot({ 195 height: height 196 }) 197 198 }); 199 } 200 201 $('.truncate').each(function () { 202 203 var lines = parseInt($(this).data('lines')); 204 205 var height = lines * 27; 206 207 //$(this).parent().attr('data-init-height',height) 208 209 210 if ($(this).outerHeight() < height) { 211 var parentElement; 212 213 if ($(this).closest('.column-two').length) { 214 parentElement = $(this).closest('.column-two') 215 }else if($(this).closest('.overlay-content').length){ 216 parentElement = $(this).closest('.overlay-content') 217 } else if ($(this).closest('.slider-woverlay').length) { 218 parentElement = $(this).closest('.slider-woverlay') 219 }else if($(this).closest('.entry-summary').length){ 220 parentElement = $(this).closest('.entry-summary') 221 } 222 223 if(typeof parentElement != 'undefined') { 224 parentElement.find('.swap-truncate').remove() 225 } 226 227 } 228 229 $(this).dotdotdot({ 230 height: height 231 }) 232 233 }) 234 235 $('.swap-truncate').click(function () { 236 var thisSlider = $(this).closest('.slick-slider'); 237 238 var thisButton = $(this) 239 var thisGroup = $(this).closest('.column-two, .overlay-content, .entry-summary'); 240 241 if(isTablet || isMobile ) { 242 $(this).toggleClass('active'); 243 } 244 245 var interval = setInterval(function() { 246 thisSlider.slick('setPosition'); 247 }, 5); 248 249 setTimeout(function(){ 250 clearInterval(interval); 251 thisSlider.slick('setPosition'); 252 },800); 253 254 255 if (thisGroup.hasClass('open')) { 256 thisGroup.removeClass('open') 257 258 thisButton.html('Show more') 259 260 thisGroup.find('.truncate-container').css('height',thisGroup.find('.truncate-container').attr('data-init-height')+'px'); 261 262 setTimeout(function(){ 263 thisGroup.find('.original').hide(); 264 thisGroup.find('.truncate').show(); 265 },400); 266 267 } else { 268 thisGroup.find('.truncate-container').attr('data-init-height',thisGroup.find('.truncate').outerHeight()); 269 thisGroup.find('.truncate-container').css('height',thisGroup.find('.truncate-container').attr('data-init-height')+'px'); 270 271 thisGroup.addClass('open') 272 $(this).html('Show less'); 273 274 thisGroup.find('.original').show(); 275 thisGroup.find('.truncate').hide(); 276 277 setTimeout(function(){ 278 var newHeight = thisGroup.find('.original').outerHeight(); 279 thisGroup.find('.truncate-container').css('height',newHeight+'px'); 280 },1); 281 } 282 283 setTimeout(function () { 284 if (thisButton.closest('.slick-slider').length) { 285 thisButton.closest('.slick-slider').slick('setPosition') 286 } 287 }, 1) 288 }) 289 290 setTimeout(function(){ 291 $('.slick-dots').each(function(){ 292 if($(this).find('li').length == 1){ 293 $(this).remove() 294 } 295 }) 296 },10) 297 298 /********** 299 BOOK NOW PAGE 300 ***********/ 301 302 $('a[href="#open-restaurant-modal"]').click(function(e) { 303 e.preventDefault()
304 openModal('restaurant') 305 }) 306 307 $('a[href="#open-spa-modal"]').click(function(e) { 308 e.preventDefault() 309 openModal('enquiry') 310 $('.enquiry.modal select[name="purpose"]').val('The Spa at Lake House').trigger('change') 311 }) 312 313 /* 314 $('.header-link a.book-now').click(function(){ 315 window.location.href = 'https://lakehouse.com.au/book-now' 316 }) 317 */ 318 319 /********** 320 COLUMN GRID 321 ***********/ 322 323 if (isMobile || $(window).width() <= 1100) { 324 $('.mobile-slider').slick({ 325 slidesToShow: 1, 326 slidesToScroll: 1, 327 arrows: false, 328 dots: true, 329 adaptiveHeight: true 330 }); 331 } 332 333 if (!isMobile && $(window).width() > 1100 && $('.column-grid.slider').length) { 334 console.log('found') 335 $('.column-grid.slider').on('init', function () { 336 var totalSlides = $(this).find('.slick-slide').length 337 338 var windowWidth = $(window).width() 339 var slidesToShow = 4 340 341 if (windowWidth <= 800) { 342 slidesToShow = 3 343 } else if (windowWidth <= 500) { 344 slidesToShow = 3 345 } 346 347 if (totalSlides <= slidesToShow) { 348 $(this).find('.slick-dots').hide() 349 } 350 }).slick({ 351 arrows: false, 352 dots: true, 353 slidesToShow: 4, 354 slidesToScroll: 4, 355 responsive: [ 356 { 357 breakpoint: 800, 358 settings: { 359 slidesToShow: 3, 360 slidesToScroll: 3, 361 infinite: true, 362 dots: true 363 } 364 }, 365 { 366 breakpoint: 500, 367 settings: { 368 slidesToShow: 3, 369 slidesToScroll: 3, 370 infinite: true, 371 dots: true 372 } 373 }, 374 ] 375 }); 376 377 } 378 379 /********** 380 GALLERY TEXT 381 ***********/ 382 383 $('.gallery-text .main-slider').slick({ 384 arrows: false, 385 dots: false, 386 fade: true, 387 speed: 700, 388 autoplay: true, 389 autoplaySpeed: 4000 390 }); 391 392 $('.gallery-text .thumbnails li:first-child').addClass('active'); 393 394 $('.gallery-text .main-slider').on('beforeChange', function (a, b, oldIndex, newIndex) { 395 396 oldIndex = oldIndex + 1 397 newIndex = newIndex + 1 398 399 var thisThumbs = $(this).next(); 400 401 if(!$(this).closest('.gallery-text').find('.slider').length) { 402 403 thisThumbs.find('li:nth-child(' + oldIndex + ')').removeClass('active') 404 405 thisThumbs.find('li:nth-child(' + newIndex + ')').addClass('active') 406 } 407 408 console.log('main slider index is '+newIndex) 409 410 }) 411 412 $('.gallery-text .thumbnails li').click(function () { 413 console.log('clicked') 414 var thisGallery = $(this).closest('.gallery-text'); 415 var thisIndex 416 if($(this).closest('.gallery-text').find('.slider').length) { 417 thisIndex = $(this).data('slick-index') 418 } else { 419 thisIndex = $(this).index() 420 } 421 thisGallery.find('.thumbnails li').removeClass('active'); 422 $(this).addClass('active'); 423 thisGallery.find('.main-slider').slick('slickGoTo', thisIndex); 424 }); 425 426 $('.gallery-text').each(function(){ 427 $(this).find('.thumbnails').each(function(){ 428 if($(this).find('li').length > 3) { 429 $(this).addClass('slider'); 430 $(this).slick({ 431 slidesToShow: 3, 432 slidesToScroll: 1, 433 nextArrow: '<button type="button" class="slick-next"><i class="fa fa-chevron-right" aria-hidden="true"></i></button>', 434 prevArrow: '<button type="button" class="slick-prev"><i class="fa fa-chevron-left" aria-hidden="true"></i></button>', 435 }) 436 } 437 }) 438 }) 439 440 /********** 441 MOBILE PACKAGES 442 ***********/ 443 444 if(isMobile ) { 445 $(".two-column p").html(function (i, html) { 446 return html.replace(/ /g, ''); 447 }); 448 } 449 450 451 /********** 452 SIDEBAR 453 ***********/ 454 if(!$('.woocommerce').length) { 455 $('.sidebar-column .links li:nth-child(1) a').addClass('active'); 456 } 457 458 $('.sidebar .links li').click(function () { 459 var thisTarget = $(this).data('target'); 460 $('.sidebar .links li a').removeClass('active'); 461 $(this).find('a').addClass('active'); 462 $('html, body').animate({ 463 scrollTop: $(thisTarget).offset().top - $('header').height() 464 }, 1000); 465 466 }); 467 468 $('.sidebar .package-list .toggle').click(function () { 469 $(this).parent().find('.content').slideToggle(); 470 $(this).parent().toggleClass('open'); 471 }); 472 473 /********** 474 PRODUCT GRID 475 ***********/ 476 $('.shop-products .overlay .add_to_cart_button').addClass('transparent'); 477 478 /********** 479 SCROLLING 480 ***********/ 481 scrollScripts(); 482 483 $(window).scroll(function () { 484 scrollScripts(); 485 }); 486 487 /********** 488 CONTACT 489 ***********/ 490 491 if(!isIOS){ 492 $('.wpcf7-form select').select2(); 493 } 494 495 $('.enquiry .wpcf7, .showover .wpcf7').on('wpcf7submit', function(e){ 496 var successAlertHtml = $('body').data('success-html') 497 498 successAlertHtml = '<div class="success-alert"><div>'+successAlertHtml+'</div></div>' 499 var modalSelector = null 500 501 if($(this).closest('.enquiry').length){ 502 modalSelector = '.enquiry.modal' 503 }else if($(this).closest('.showover').length){ 504 modalSelector = '.showover.modal' 505 } 506 507 $(modalSelector).prepend(successAlertHtml) 508 509 setTimeout(function(){ 510 $(modalSelector+' .success-alert').addClass('visible') 511 },1) 512 }) 513 514 /********** 515 ALL MODALS 516 ***********/ 517 518 $('.modal.enquiry select[name="purpose"]').change(function(){ 519 var thisPurpose = $(this).val() 520 521 console.log('value of this selector') 522 console.log(thisPurpose) 523 524 if(thisPurpose == 'The Spa at Lake House'){ 525 $('.modal.enquiry .spa-only').slideDown('fast') 526 }else{
527 $('.modal.enquiry .spa-only').slideUp('fast') 528 } 529 }) 530 531 $('.modal-container .modal').click(function (e) { 532 e.stopPropagation(); 533 }); 534 535 if(isMobile ) { 536 $('.modal-container .modal:not(.press):not(.showover)').css('min-height',deviceHeight+'px'); 537 } 538 539 function closeModal(type){ 540 $('.'+type+'.modal').removeClass('visible') 541 542 if (type == 'general') { 543 Cookies.set('generalSeen', 'true', {expires: 3}); 544 } 545 546 $('.modal-container .spa-only').hide() 547 548 setTimeout(function(){ 549 $('.'+type+'.modal-container').fadeOut('fast') 550 551 $('.modal .success-alert').remove() 552 553 var style = $('body').attr('style') 554 555 if(style){ 556 style = style.replace('top: ', '') 557 var offset = style.replace('px !important', '') 558 559 var invertedOffset = parseInt(offset) * -1 560 561 $('body').attr('style',null) 562 $('body').removeClass('modal-opened') 563 564 $(window).scrollTop(invertedOffset) 565 } 566 },100) 567 } 568 569 function openModal(type){ 570 $('.'+type+'.modal-container').fadeIn('fast', function(){ 571 $(this).scrollTop(0) 572 $('.'+type+'.modal').addClass('visible') 573 574 var offset = $(window).scrollTop(); 575 $('body').attr('style','top: '+(offset * -1)+'px !important') 576 577 $('body').addClass('modal-opened') 578 579 console.log('opened') 580 581 }) 582 } 583 584 $('input.date-picker').datepicker() 585 586 /********** 587 GENERAL MODAL 588 ***********/ 589 590 if($('.general.modal-container.on').length && !modalParams) { 591 console.log('a') 592 if (typeof(Cookies.get('generalSeen')) == 'undefined'){ 593 594 console.log('b') 595 setTimeout(function(){ 596 openModal('general') 597 },2000); 598 } else{ 599 console.log('c') 600 } 601 } 602 603 $('.modal.general .button').click(function(){ 604 Cookies.set('generalSeen', 'true', {expires: 3}); 605 }) 606 607 $('.general.close-modal, .general.modal-container').click(function(e){ 608 closeModal('general') 609 }); 610 611 $('.restaurant.close-modal, .restaurant.modal-container').click(function(e){ 612 closeModal('restaurant') 613 }); 614 615 $('.enquiry.close-modal, .enquiry.modal-container').click(function(e){ 616 closeModal('enquiry') 617 }); 618 619 $('.press.close-modal, .press.modal-container').click(function(e){ 620 closeModal('press') 621 }); 622 623 $('.showover.close-modal, .showover.modal-container').click(function(e){ 624 closeModal('showover') 625 }); 626 627 /********** 628 RESTAURANT MODAL 629 ***********/ 630 631 $('.open-restaurant-modal').click(function () { 632 openModal('restaurant') 633 }); 634 635 /********** 636 ENQUIRY MODAL 637 ***********/ 638 639 $('.open-enquiry-modal').click(function () { 640 var thisType = $(this).data('type') 641 642 if(thisType){ 643 $('.enquiry.modal select[name="purpose"]').val(thisType).trigger('change') 644 } 645 646 closeModal('general') 647 648 // closeModal hides the .spa-only 649 if(thisType == 'The Spa at Lake House'){ 650 $('.modal-container .spa-only').show() 651 } 652 653 openModal('enquiry') 654 }); 655 656 /********** 657 SHOWOVER MODAL 658 ***********/ 659 660 $('.open-showover-modal').click(function () { 661 openModal('showover') 662 }); 663 664 /********** 665 PRESS MODAL 666 ***********/ 667 668 $('.column-grid.press li').click(function () { 669 670 var thisImage = $(this).data('image'); 671 var thisTitle = $(this).data('title'); 672 var thisSubtitle = $(this).data('subtitle'); 673 var thisCopy = $(this).data('copy'); 674 675 $('.press.modal').find('.image').attr('src', thisImage); 676 $('.press.modal').find('.title span').html(thisTitle); 677 $('.press.modal').find('.subtitle').html(thisSubtitle); 678 $('.press.modal').find('.copy').html(thisCopy); 679 680 openModal('press') 681 }); 682 683 if(getParameters('award-slug')) { 684 var awardSlug = getParameters('award-slug'); 685 686 $('li[data-article-slug="'+awardSlug+'"]').click() 687 } 688 689 /*************** 690 SUBSCRIBE 691 ***************/ 692 693 $('.subscribe .button').click(function (e) { 694 e.preventDefault(); 695 696 var thisForm = $(this).closest('form'); 697 698 thisForm.submit(); 699 }); 700 701 $('.subscribe form').submit(function (e) { 702 e.preventDefault(); 703 var thisForm = $(this); 704 var thisEmail = thisForm.find('input[type="email"]').val(); 705 var thisFirst = thisForm.find('input#mce-FNAME').val(); 706 var thisLast = thisForm.find('input#mce-LNAME').val(); 707 var thisSub = $(this).find('.form-sub'); 708 var re = /\S+@\S+\.\S+/; 709 710 if (re.test(thisEmail) && thisFirst.length != 0 && thisLast.length != 0) { 711 $.ajax({ 712 type: thisForm.attr('method'), 713 url: thisForm.attr('action'), 714 data: thisForm.serialize(), 715 cache: false, 716 dataType: 'json', 717 contentType: "application/json; charset=utf-8", 718 error: function (err) { console.log(err); }, 719 success: function (data) { 720 if (data.result != "success") { 721 thisSub.slideUp('fast', function () { 722 thisSub.find('span').html("You appear to be already signed up."); 723 thisSub.addClass('form-error'); 724 thisSub.slideDown('fast'); 725 thisSub.find('i').addClass('fa fa-times'); 726 }); 727 } else { 728 thisSub.slideUp('fast', function () { 729 thisSub.find('span').html("Success! Please check your email to confirm."); 730 thisSub.addClass('form-success'); 731 thisSub.slideDown('fast'); 732 thisSub.find('i').addClass('fa fa-check'); 733 }); 734 thisForm.find('input').val(''); 735 } 736 } 737 }); 738 } else { 739 thisSub.slideUp('fast', function () { 740 thisSub.find('span').html("Please fill in all the fields and enter a valid email address."); 741 thisSub.addClass('form-error'); 742 thisSub.slideDown('fast'); 743 thisSub.find('i').addClass('fa fa-times'); 744 }); 745 } 746 747 setTimeout(function () { 748 thisSub.slideUp('fast', function () { 749 thisSub.html(thisSub.data('init')); 750 thisSub.removeClass('form-error').removeClass('form-success'); 751 thisSub.find('i').removeClass('fa fa-times').removeClass('fa fa-check'); 752 }); 753 }, 3500); 754 755 }); 756 757 /*************** 758 WHATS ON MOBILE SLIDER 759 ***************/ 760 761 if (isMobile ) { 762 763 doSlider('.whats-on.component .blog-grid>div>ul',{items: 1, loop: true}) 764 765 } 766 767 if (isMobile ) { 768 769 $('.slider').on('beforeChange', function (a, b, oldIndex, newIndex) { 770 771 oldIndex = oldIndex + 1 772 newIndex = newIndex + 1 773 774 var thisThumbs = $(this).find('.thumbnails'); 775 776 thisThumbs.find('li:nth-child(' + oldIndex + ')').removeClass('active') 777 778 thisThumbs.find('li:nth-child(' + newIndex + ')').addClass('active') 779 780 }) 781 782 } 783
784 /*************** 785 LOAD MORE POSTS 786 ***************/ 787 788 $('.load-more-posts').click(function () { 789 790 $(this).html('Loading...'); 791 792 var thisOffset = $(this).data('offset'); 793 var thisCategory = $(this).data('category'); 794 var thisPostsPerPage = $(this).data('postsperpage'); 795 796 var thisGrid = $(this).closest('.blog-grid').find('.container ul'); 797 var thisTotal = thisGrid.data('posts'); 798 var thisCurrentAmount = thisGrid.find('li').length; 799 var thisButton = thisGrid.closest('.blog-grid').find('.load-more-posts'); 800 801 $.get('/ajax-post-loader?offset=' + thisOffset + '&category=' + thisCategory, function (newRows) { 802 803 thisGrid.append(newRows); 804 805 thisButton.data('offset', thisOffset + thisPostsPerPage); 806 807 if (thisCurrentAmount >= thisTotal) { 808 thisButton.html('No more posts to show'); 809 thisButton.css('pointer-events', 'none'); 810 } else { 811 thisButton.html('Load More'); 812 } 813 814 }) 815 816 }); 817 818 var adjustment = $('.header-sub-nav').height() + 30 819 820 var jump = function (e, href) { 821 if (e) { 822 e.preventDefault(); 823 var target = href 824 } else { 825 var target = location.hash 826 } 827 828 $('html,body').animate({ 829 scrollTop: $(target).offset().top 830 }, 1000, function () { 831 location.hash = target; 832 }); 833 } 834 835 $('a[href^=#]').bind("click", function(e){ 836 // WC seems to trigger a click on description by itself... 837 if(!$(this).attr('href') == '#tab-description'){ 838 var href = $(this).attr('href') 839 840 jump(e, href); 841 } 842 }); 843 844 if (location.hash) { 845 setTimeout(function () { 846 var activeLink = location.hash; 847 console.log('active link is '+activeLink) 848 $('.sidebar-column .active').removeClass('active'); 849 $('.sidebar-column li[data-target="'+activeLink+'"]').addClass('active'); 850 $('html, body').scrollTop(0); 851 jump(); 852 }, 300); 853 } 854 855 if($('.vouchers').length) { 856 $('.sidebar-column .links li a').click(function(e) { 857 var target = $(this).parent().data('target') 858 859 if(!$(target).length){ 860 return 861 } 862 863 e.preventDefault(); 864 865 ignoreScrollCalculations = true 866 867 $('.sidebar-column .links li .active').removeClass('active') 868 $(this).addClass('active') 869 870 $('html,body').animate({ 871 scrollTop: $(target).offset().top - 75 872 }, 1000, function(){ 873 ignoreScrollCalculations = false 874 }); 875 setTimeout(function () { 876 $('.header-sub-nav').addClass('hidden'); 877 }, 300); 878 }); 879 } 880 881 /********** 882 INSTA FEED 883 ***********/ 884 885 if ($('#instafetch').length) { 886 var instagramToken = $('.instagram-feed').data('token'); 887 888 instafetch.init({ 889 accessToken: instagramToken, 890 target: 'instafetch', 891 numOfPics: 20, 892 caption: false 893 }); 894 895 if (isMobile != true) { 896 897 new Dragdealer('instagram-scroller', { 898 animationCallback: function (x, y) { 899 var totalWidthOfContent = 0; 900 901 $('#instafetch>article').each(function (key, value) { 902 totalWidthOfContent += $(value).outerWidth(true); 903 }); 904 905 var widthOutsideWrapper = totalWidthOfContent - $('#instafetch').width(); 906 907 var widthToTranslate = x * widthOutsideWrapper; 908 909 $('#instafetch').css('transform', 'translateX(-' + widthToTranslate + 'px)'); 910 } 911 }); 912 913 } 914 } 915 916 if (navigator.appName == 'Microsoft Internet Explorer' || !!(navigator.userAgent.match(/Trident/) || navigator.userAgent.match(/rv:11/)) || (typeof $.browser !== "undefined" && $.browser.msie == 1)) 917 { 918 $('.with-sidebar>div.sidebar-column').stickybits(); 919 } 920 921 var screenWidth = $(window).width() 922 923 var sidesWidth = ((screenWidth / 2) + 1) 924 925 $('.sides').css({ 926 'width': sidesWidth+'px', 927 'background-size': sidesWidth+'px auto' 928 }) 929 930 $(window).resize(function() { 931 var screenWidth = $(window).width() 932 933 var sidesWidth = ((screenWidth / 2) + 1) 934 935 $('.sides').css({ 936 'width': sidesWidth+'px', 937 'background-size': sidesWidth+'px auto' 938 }) 939 940 }); 941 942 /********** 943 INSTA FEED 944 ***********/ 945 946 $("#map").on('click', function () { 947 var url = 'https://www.google.com/maps/search/?api=1&query=238 Dairy Flat Road Daylesford'; 948 window.open(url, '_blank'); 949 }); 950 951 952 953})(jQuery); 954 955function validateEmail(email) { 956 var re = /\S+@\S+\.\S+/; 957 return re.test(email); 958} 959 960function getParameters(name, url) { 961 if (!url) { 962 url = window.location.href; 963 } 964 name = name.replace(/[\[\]]/g, "\\$&"); 965 var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"), 966 results = regex.exec(url); 967 if (!results) return null; 968 if (!results[2]) return ''; 969 return decodeURIComponent(results[2].replace(/\+/g, " ")); 970} 971 972function isScrolledIntoView(elem) { 973 var docViewTop = jQuery(window).scrollTop(); 974 var docViewBottom = docViewTop + jQuery(window).height(); 975 976 var elemTop = jQuery(elem).offset().top; 977 var elemBottom = elemTop + jQuery(elem).height(); 978 979 return (elemTop + 200) < docViewBottom 980} 981 982var initialTawkStyles = '' 983 984function scrollScripts() { 985 var $ = jQuery 986 987 var scrollTop = $(window).scrollTop() 988 989 if(isMobile) { 990 991 if($('#tawkchat-container').length) { 992 console.log('exists') 993 994 /* 995 996 var lastComponentTop = $('.instagram-feed').offset().top 997 998 if ( $(window).scrollTop() >= lastComponentTop ) { 999 var hiddenTawkStyles = 'border: 0px none !important; padding: 0px !important; z-index: 999999999 !important; overflow: visible !important; min-width: 0px !important; min-height: 0px !important; max-width: none !important; max-height: none !important; width: auto !important; height: auto !important; position: fixed !important; display: none !important; margin: 0px !important; bottom: 0px !important; top: auto !important; right: 0px !important; left: auto !important;' 1000 $('#tawk-container').removeAttr('style') 1001 setTimeout(function(){ 1002 $('#tawkchat-container').attr('style',hiddenTawkStyles) 1003 }, 300) 1004 } else { 1005 var visibleTawkStyles = 'border: 0px none !important; padding: 0px !important; z-index: 999999999 !important; overflow: visible !important; min-width: 0px !important; min-height: 0px !important; max-width: none !important; max-height: none !important; width: auto !important; height: auto !important; position: fixed !important; display: block !important; margin: 0px !important; bottom: 0px !important; top: auto !important; right: 0px !important; left: auto !important;' 1006 $('#tawk-container').removeAttr('style') 1007 setTimeout(function(){ 1008 $('#tawk-container').attr('style',visibleTawkStyles) 1009 }, 300) 1010 } 1011 */ 1012 1013 } 1014 1015 } 1016 1017 if (scrollTop <= previousScroll) { 1018 scrollAdjustment = 75 1019 $('.header-sub-nav').removeClass('hidden'); 1020 $('.with-sidebar>div.sidebar-column').css('top','120px'); 1021 1022 scrollDirection = 1; 1023 } else { 1024 scrollAdjustment = 75 1025 1026 $('.header-sub-nav').addClass('hidden'); 1027 1028 $('.with-sidebar>div.sidebar-column').css('top','75px'); 1029 1030 scrollDirection = 0; 1031 } 1032 1033 previousScroll = $(this).scrollTop(); 1034 1035 $('.grid').each(function () { 1036 if (isScrolledIntoView($(this)) && !$(this).hasClass('scrolled')) { 1037 $(this).addClass('scrolled'); 1038 } 1039 }); 1040 1041 if($('.sidebar-column').length && categoryCoords.length && !ignoreScrollCalculations) { 1042 var midPoint = ( ($(window).scrollTop()) + ($(window).height()/2) ); 1043 var currentActiveCategory = $('.sidebar-column .links li .active').parent().data('target'); 1044 var newActiveCategory; 1045 1046 $(categoryCoords).each(function(index, value){ 1047 var isCurrentlyActive = false 1048 1049 if($('.vouchers').length){ 1050 isCurrentlyActive = ($(window).scrollTop() + 80) >= $(this)[0].scrollTop 1051 }else{ 1052 isCurrentlyActive = (midPoint > $(this)[0].scrollTop) && (!categoryCoords[index + 1] || midPoint < categoryCoords[index + 1].scrollTop) 1053 } 1054 1055 if(isCurrentlyActive) { 1056 newActiveCategory = categoryCoords[index].id; 1057 1058 if(currentActiveCategory != newActiveCategory) { 1059 $('.sidebar-column .links li .active').removeClass('active'); 1060 $('.sidebar-column .links li[data-target="#'+newActiveCategory+'"]').find('a').addClass('active'); 1061 } 1062 } 1063 }); 1064 } 1065 1066 1067 if(isMobile){ 1068 if (scrollTop >= deviceHeight) { 1069 $('header').addClass('normal'); 1070 } else { 1071 $('header').removeClass('normal'); 1072 } 1073 } 1074 1075 if($('iframe.ibe').length){ 1076 /* history.pushState({}, '', '/hotel-booking') 1077 1078 setTimeout(function(){ 1079 history.pushState({}, '', '/hotel-booking') 1080 },2) 1081 1082 var hotelLoadedInterval = setInterval(function(){ 1083 var iframe = $('iframe.ibe') 1084 1085 if(iframe.length){ 1086 if(iframe.height() > 200){ 1087 clearInterval(hotelLoadedInterval) 1088 1089 history.pushState({}, '', '/hotel-booking') 1090 } 1091 } 1092 },500) 1093 1094 $(window).on('popstate', function(e){ 1095 var prevUrlDiv = $('div[data-prev-url]') 1096 1097 if(prevUrlDiv.length){ 1098 var newUrl = prevUrlDiv.data('prev-url') 1099 1100 console.log(newUrl) 1101 1102 window.location.href = newUrl 1103 } 1104 }) */ 1105 } 1106} 1107
1108function assessMiniCartTotal(){ 1109 var $ = jQuery 1110 1111 var newCount = $('.mini-cart h4').attr('data-count') 1112 var currentCount = $.trim($('.header-link.cart .item-count').text()) 1113 1114 if(newCount != currentCount){ 1115 $('.header-link.cart .item-count').html(newCount) 1116 } 1117} 1118 1119function doSlider(selector, options) { 1120 var $ = jQuery 1121 1122 setTimeout(function(){ 1123 $(selector).addClass('owl-carousel owl-theme') 1124 }, 1 ) 1125 1126 setTimeout(function(){ 1127 $(selector).owlCarousel(options); 1128 }, 100) 1129}
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.