PageSourceSearch

https://www.livewayfarer.com/wp-content/themes/client-theme/includes/js/global.js?ver=6.9.10

js livewayfarer.com collected 2026-10-06 21:28:31 UTC 32,229 bytes, 1,135 lines download raw bytes

1
2/***************************
3KEN (NEAL) BURNS
4****************************/
5
6var new_effect;
7var old_effect;
8
9function random_effect() {
10	return Math.floor(Math.random() * 4) + 1;
11}
12
13$(function() {
14
15  new_effect = random_effect();
16
17
18  setTimeout(function() {
19    $('#slider.ken-burns .slide.first').addClass('scale');
20    $('#slider.ken-burns .slide.first').addClass('fx' + new_effect);
21  }, 200);
22
23	$('#slider.ken-burns').on('cycle-before', function(event, optionHash, outgoingSlideEl, incomingSlideEl, forwardFlag) {
24
25		old_effect = new_effect;
26		new_effect = random_effect();
27
28    if(new_effect == old_effect) {
29      new_effect = random_effect();
30    }
31
32		$(incomingSlideEl).addClass('scale');
33		$(incomingSlideEl).addClass('fx' + new_effect);
34	});
35
36	$('#slider.ken-burns').on('cycle-after', function(event, optionHash, outgoingSlideEl, incomingSlideEl, forwardFlag) {
37		$(outgoingSlideEl).removeClass('scale');
38		$(outgoingSlideEl).removeClass('fx' + old_effect);
39	});
40});
41
42
43
44// PROMO BAR //
45
46(function () {
47  var $topPromoBar = $ ('.top-promo-bar');
48  var $topPromoBarClose = $ ('.top-promo-bar #hamburger-menu-item');
49  var $sliderHeight = $('#slider').outerHeight();
50  var $navmenu = $ ('.off-canvas-menu');
51  var $promoheight = $('.top-promo-bar').outerHeight();
52  var $headerheight = $('#header-content').outerHeight();
53
54  if ($topPromoBar.length > 0) {
55    $ (window).on ('load', function () {
56      if(!window.sessionStorage.getItem('top-bar-promo-closed')) {
57      $topPromoBar.addClass ('active');
58      $('body').addClass ('promo-active');
59      // console.log($topPromoBar.innerHeight());
60
61      //$topPromoBar.css({display:'block',marginTop:-$topPromoBar.innerHeight()});
62      $topPromoBar.slideDown (function () {
63        //parallax();
64
65        if ($('body').hasClass('home')) {
66          console.log('SH = ' + $sliderHeight);
67          console.log('PH = ' + $('.top-promo-bar').outerHeight());
68          console.log('HH = ' + $headerheight);
69          $ ('#slider').animate ({height: $sliderHeight - $('.top-promo-bar').outerHeight(),},300);
70        }
71
72        $('#slider').find('.slide.parallax-rev').animate({ 'marginTop': $topPromoBar.outerHeight() / 3 * -1 }, 300);
73
74        var slideroffset =
75
76        $topPromoBarClose.css ({
77          opacity: 1,
78        });
79      });
80
81      }
82
83    });
84
85    $topPromoBarClose.on ('click', function () {
86      var $navmenu = $ ('.off-canvas-menu');
87      // $navmenu.css('margin-top', 0);
88      window.sessionStorage.setItem('top-bar-promo-closed', true);
89      $('body').removeClass ('promo-active');
90      $topPromoBar.removeClass ('active');
91      $topPromoBarClose.css ({
92        opacity: 0,
93      });
94      $topPromoBar.slideUp (function () {
95
96        // Reset slider for parallax-rev
97        // $('#slider').css({
98        // '-webkit-transform' : 'translateY(0)',
99        // '-moz-transform'    : 'translateY(0)',
100        // '-ms-transform'     : 'translateY(0)',
101        // '-o-transform'      : 'translateY(0)',
102        // 'transform'         : 'translateY(0)',
103        // });
104
105        $ ('#slider').animate ({
106            height: $sliderHeight,
107          },
108          300
109        );
110        $ ('#slider div.slide.parallax-rev').animate ({
111            marginTop: 0,
112          },
113          300
114        );
115      });
116    });
117
118    $ (window).on ('scroll', function () {
119      var topofslider = $('#slider').offset().top;
120      if ($ (window).scrollTop () >= topofslider - 50) {
121        $ ('body').addClass ('fixed-nav');
122      } else {
123        $ ('body').removeClass ('fixed-nav');
124      }
125    });
126  } else {
127    $ ('body').addClass ('fixed-nav');
128  }
129}) ();
130
131/***************************
132HIDE/SHOW HEADER
133****************************/
134
135(function(){
136
137  var doc = document.documentElement;
138  var w = window;
139
140  var prevScroll = w.scrollY || doc.scrollTop;
141  var curScroll;
142  var direction = 0;
143  var prevDirection = 0;
144
145  var header = document.getElementById('header');
146  var slider = document.getElementById('slider');
147  var headerHeight = $ (header).height();
148  var sliderHeight = $ (slider).height();
149
150  var checkScroll = function() {
151
152    /*
153    ** Find the direction of scroll
154    ** 0 - initial, 1 - up, 2 - down
155    */
156
157    console.log('checkscroll');
158
159    curScroll = w.scrollY || doc.scrollTop;
160    if (curScroll > prevScroll) {
161      //scrolled up
162      direction = 2;
163    } else if (curScroll < prevScroll) {
164      //scrolled down
165      direction = 1;
166    }
167
168    if (direction !== prevDirection && !$('.mobile-nav-toggle').hasClass("open")) {
169      toggleHeader(direction, curScroll);
170    }
171
172    prevScroll = curScroll;
173
174    // console.log($ (this).scrollTop ());
175
176     // if ($ (this).scrollTop () === 0) {
177     //   header.classList.add('top');
178     // } else {
179     //   header.classList.remove('top');
180     // }
181
182     if ($ (this).scrollTop () > sliderHeight / 2) {
183       $('body').addClass('gosmall');
184     } else {
185       $('body').removeClass('gosmall');
186     }
187  };
188
189  var toggleHeader = function(direction, curScroll) {
190    if (direction === 2 && curScroll > sliderHeight / 2) {
191        $('body').addClass('hide-header');
192        prevDirection = direction;
193    }
194    else if (direction === 1) {
195      $('body').removeClass('hide-header');
196      prevDirection = direction;
197    }
198  };
199
200  window.addEventListener('load', checkScroll);
201  window.addEventListener('scroll', checkScroll);
202
203})();
204
205// Hide Loader
206$('#slider').on( 'cycle-initialized', function(event, optionHash, outgoingSlideEl, incomingSlideEl, forwardFlag) {
207    $('#slider-loader').hide();
208});
209
210$('#top-video iframe').load(function(){
211    $('#video-loader').hide();
212});
213
214
215/*******************
216TOP NAV SCROLL
217*******************/
218
219// $(window).on("load scroll",function(e){
220//   var sliderHeight = $ ('#slider').height();
221//   if ($ (this).scrollTop () > sliderHeight / 2) {
222//     $('body').addClass('gosmall');
223//     // $('header').addClass('gosmall');
224//     // $('#slider-grad-top').addClass('gosmall');
225//   } else {
226//     $('body').removeClass('gosmall');
227//     // $('header').removeClass('gosmall');
228//     // $('#slider-grad-top').removeClass('gosmall');
229//   }
230// });
231
232
233/*******************
234POPUP
235*******************/
236$("#fullpopup #btn-x, #fullpopupbg").click(function(){
237    	$("#fullpopup").fadeOut(500);
238});
239
240$(".ada-skip-to-content").keydown(function(event) {
241   $("#fullpopup").fadeOut(500);
242});
243
244$( document ).ready(function() {
245	if ($("body").hasClass("home")) {
246	   $("#fullpopup").delay(500).fadeIn(500);
247  }
248
249  // $('.plax-full').parallax({
250  //   speed: -0.2,
251  //   sliderSelector: '>.full-image',
252  // });
253
254}); // end doc ready
255
256/***************************
257OFF CANVAS MENU ANIMATIONS
258****************************/
259
260(function () {
261  var $openMenuToggle = $ ('.mobile-nav-toggle');
262  var $hamburger = $ ('#hamburger');
263  var $navholder = $ ('#nav-holder');
264  var $navmenu = $ ('.off-canvas-menu');
265  var $navcontainer = $ ('.off-canvas-nav-container');
266  var $menubg = $ ('.menubg');
267  var offCanvasMenu = document.getElementsByClassName ('off-canvas-menu');
268  var menuItemsList = $ ('#main-nav > li');
269  var $closeMenuToggle = $ ('.close-menu');
270  //var $logoContainer = $ ('.logo');
271
272  //var whiteLogo = document.querySelectorAll ('.logo .logo-white');
273  //var colorLogo = document.querySelectorAll ('.logo .logo-color');
274   $navmenu.css('right','100%');
275
276  var patternbg = document.querySelectorAll ('.pattern-bg-right');
277
278  var showMenuItems = function (e) {
279    menuItemsList.each (function (index, listItem) {
280      TweenLite.to (listItem, 0.25, {
281        top: 0,
282        opacity: 1,
283        delay: index * 0.03,
284        //onComplete: showSocialIcons,
285      });
286    });
287  };
288
289  var hideMenuItems = function (e) {
290    menuItemsList.each (function (index, listItem) {
291      TweenLite.to (listItem, 0, {
292        top: 30,
293        opacity: 0,
294        // delay: index * 0.03,
295        //onComplete: hideSocialIcons,
296      });
297    });
298  };
299
300  // var showSocialIcons = function (e) {
301  //   TweenLite.to (socialNav, 0.25, {opacity: 1});
302  // };
303  //
304  // var hideSocialIcons = function (e) {
305  //   TweenLite.to (socialNav, 0.25, {opacity: 0});
306  // };
307
308  var toggleMenu = function (e) {
309    if (!$hamburger.hasClass ('open')) {
310      // TweenLite.to (offCanvasMenu, 0.35, {right: 0});
311      var $promoheight = $('.top-promo-bar').outerHeight();
312      // if ($("body").hasClass("promo-active") && !$("body").hasClass("fixed-nav")) {
313      //   $navmenu.css('margin-top', $promoheight / 2 + 40);
314      // } else {
315      //   $navmenu.css('margin-top', 0);
316      // }
317      $('body').addClass('menu-open');
318      $hamburger.addClass ('open');
319      $menubg.addClass ('open');
320      $openMenuToggle.addClass ('open');
321      $navholder.addClass ('open');
322      setTimeout (function () {
323        //$navcontainer.show();
324        $navmenu.css('right',0);
325        showMenuItems ();
326      }, 350);
327    } else {
328      $('body').removeClass('menu-open');
329      $hamburger.removeClass ('open');
330      $menubg.removeClass ('open');
331      $openMenuToggle.removeClass ('open');
332      $navholder.removeClass ('open');
333      hideMenuItems ();
334      setTimeout (function () {
335        // TweenLite.to (offCanvasMenu, 0.35, {right: -500});
336        //$navcontainer.hide();
337        $navmenu.css('right','100%');
338      }, 450);
339    }
340  };
341
342  // Add Class to Body if Mouse is being used
343  document.body.addEventListener('mousedown', function() {
344    document.body.classList.add('using-mouse');
345  });
346
347  $ (document.body).keyup (function (e) {
348    //Close Menu on esc click
349    if (e.keyCode == 27 && $hamburger.hasClass ('open')) {
350      toggleMenu();
351    }
352
353    if (e.keyCode == 9) {
354      console.log('popup');
355  		$("#fullpopup").fadeOut(500);
356
357      document.body.classList.remove('using-mouse');
358
359      if (!$(".off-canvas-menu .off-canvas-nav-container #main-nav li a").is(":focus") && $hamburger.hasClass ('open')) {
360        toggleMenu();
361      }
362    }
363
364  });
365
366
367
368  // $ ('.off-canvas-menu, header').click (function (e) {
369  //   e.stopPropagation ();
370  // });
371
372  $openMenuToggle.on ('click keypress', toggleMenu);
373  $closeMenuToggle.on ('click', hideMenuItems);
374}) ();
375
376jQuery(function() {
377  var menuid = $('.mobile-select ul').attr('id');
378  console.log('menuid: ' + menuid);
379  jQuery("<select id='" + menuid + "-select' class='select' />").appendTo(".mobile-select");
380  jQuery(".mobile-select ul a").each(function() {
381   var el = jQuery(this);
382
383   jQuery("<option />", {
384       "value"   : el.attr("href"),
385       "text"    : el.text()
386   }).appendTo(".mobile-select select");
387  });
388  $( "<div class='select__arrow'></div>" ).appendTo( ".mobile-select" );
389  jQuery(".mobile-select select").change(function() {
390    window.location = jQuery(this).find("option:selected").val();
391  });
392  var menuitems = $('.mobile-select ul li');
393
394  menuitems.each(function(index,menuitem) {
395    if($(menuitem).hasClass('active')) {
396      $('.mobile-select select.select option')[index].setAttribute('selected','selected');
397    }
398  });
399
400});
401
402
403
404function isInViewport(node) {
405  var rect = node.getBoundingClientRect();
406  return (
407    (rect.height > 0 || rect.width > 0) &&
408    rect.bottom >= 0 &&
409    rect.right >= 0 &&
410    rect.top <= (window.innerHeight || document.documentElement.clientHeight) &&
411    rect.left <= (window.innerWidth || document.documentElement.clientWidth)
412  );
413}
414
415// $(window).scroll(function() {
416//   var scrolled = $(window).scrollTop();
417//   $('.parallax-test').each(function(index, element) {
418//     var initY = $(this).offset().top;
419//     var height = $(this).height();
420//     var endY  = initY + $(this).height();
421//
422//     // Check if the element is in the viewport.
423//     var visible = isInViewport(this);
424//     if(visible) {
425//       var diff = scrolled - initY;
426//       var ratio = Math.round((diff / height) * 100);
427//       $(this).css('background-position','center ' + parseInt(-(ratio * 1.5)) + 'px');
428//     }
429//   });
430// });
431
432
433
434/*******************
435PARALLAX
436*******************/
437
438function parallax() {
439  var winWidth = $ (window).width ();
440  if (winWidth > 768) {
441    var scrolled = $ (window).scrollTop ();
442
443    $('.parallax').each(function(index, element) {
444      var initY = $(this).offset().top;
445      var height = $(this).height();
446      var endY  = initY + $(this).height();
447
448      // Check if the element is in the viewport.
449      var visible = isInViewport(this);
450      if(visible) {
451        $(this).addClass('in-view');
452        var diff = scrolled - initY;
453        var ratio = Math.round((diff / height) * 100);
454        if($(this).hasClass('fixedbg')) {
455          $(this).css('background-position','center ' + parseInt(-(ratio * 1.5)) + 'px');
456        } else {
457          $ (this).css ('margin-top', parseInt(-(ratio * 1.5)) + 'px');
458        }
459      } else {
460        $(this).removeClass('in-view');
461      }
462    });
463
464    $('.parallax-rev').each(function(index, element) {
465      var initY = $(this).offset().top;
466      var height = $(this).height();
467      var endY  = initY + $(this).height();
468
469      // Check if the element is in the viewport.
470      var visible = isInViewport(this);
471      if(visible) {
472        $(this).addClass('in-view');
473        var diff = scrolled - initY;
474        var ratio = Math.round((diff / height) * 100);
475
476        if($(this).hasClass('fixedbg')) {
477          $(this).css('background-position','center ' + parseInt((ratio * 1.5)) + 'px');
478        } else {
479          $ (this).css ('margin-top', parseInt((ratio * 1.5)) + 'px');
480        }
481
482      } else {
483        $(this).removeClass('in-view');
484      }
485    });
486
487    // $ ('.parallax').css ('margin-top', -(scrolled * 0.10) + 'px');
488    // $ ('.parallax-rev').css ('top', (scrolled * 0.20) + 'px');
489    // $ ('.parallax-bg').css (
490    //   'background-position',
491    //   'center -' + scrolled * 0.25 + 'px'
492    // );
493    // $ ('.parallax-left').css ('margin-left', '-' + scrolled * 0.25 + 'px');
494    // $ ('.parallax-left h1').css ('margin-left', scrolled * 0.25 + 'px');
495    // $ ('.parallax-right').css ('margin-left', scrolled * 0.25 + 'px');
496    // $ ('.parallax-right h1').css ('margin-left', '-' + scrolled * 0.25 + 'px');
497    // for parallax-right add to .slide >>> width: calc(100% + 225px); left: -225px!important;
498
499  } else {
500    // $ ('.parallax').css ('margin-top', 0);
501    // $ ('.parallax-rev').css ('margin-top', 0);
502    // $ ('.parallax-bg').css ('background-position', 'center');
503    // $ ('.parallax-left').css ('margin-left', 0);
504    // $ ('.parallax-left h1').css ('margin-left', 0);
505    // $ ('.parallax-right').css ('margin-left', '0');
506    // $ ('.parallax-right').css ('left', '0');
507  }
508}
509
510/*******************
511SCROLL
512*******************/
513
514function goToByScroll (id) {
515  $ ('html,body').animate ({scrollTop: $ ('#' + id).offset ().top}, 1000);
516}
517
518$ ('a.scrollto').click (function (event) {
519  event.preventDefault ();
520  id = $ (this).attr ('href').replace (new RegExp ('#', 'g'), '');
521  goToByScroll (id);
522});
523
524checkScroll = function () {
525
526  // var snipeHeight = $ ('#headertop').height ();
527  // if ($ (this).scrollTop () > snipeHeight) {
528  //   $ ('#main-nav').addClass ('gosmall');
529  // } else {
530  //   $ ('.gosmall').removeClass ('gosmall');
531  // }
532
533  /*******************
534  UP LINK
535  *******************/
536
537  var isOnDiv = false;
538  $('#uplink').mouseenter(function(){isOnDiv=true;});
539  $('#uplink').mouseleave(function(){isOnDiv=false;});
540  clearTimeout($.data(this, 'scrollTimer'));
541  $.data(this, 'scrollTimer', setTimeout(function() {
542    if(isOnDiv===false) {
543      $('#uplink').removeClass('up');
544    } else {
545      $("#uplink").mouseout(function(){
546        setTimeout(function() {
547          $("#uplink").removeClass('up');
548        }, 800);
549      });
550    }
551  }, 4000));
552
553};
554
555$(window).bind('mousewheel', function(event) {
556  var sliderHeight = $ ('#slider').height ();
557  var scrollPos = $(window).scrollTop();
558  if (event.originalEvent.wheelDelta >= 0 && scrollPos >= sliderHeight / 2) {
559      $('#uplink').addClass('up');
560  } else {
561      $('#uplink').removeClass('up');
562  }
563});
564
565$ ('#uplink').click (function (event) {
566  event.preventDefault ();
567  goToByScroll('top');
568  $(this).removeClass('up');
569});
570
571/*******************
572SCROLL REVEAL OBJECTS
573*******************/
574var fadein = {
575  origin: 'bottom',
576  distance: '0',
577  duration: 700,
578  delay: 200,
579  rotate: {x: 0, y: 0, z: 0},
580  opacity: 0,
581  scale: 1,
582  easing: 'ease-out',
583  mobile: false,
584  reset: false,
585  useDelay: 'always',
586  viewFactor: 0,
587  viewOffset: {top: 0, right: 0, bottom: 0, left: 0},
588  afterReveal: function (domEl) {},
589  afterReset: function (domEl) {},
590};
591
592var fromright = {
593  origin: 'right',
594  distance: '50px',
595  duration: 800,
596  delay: 100,
597  rotate: {x: 0, y: 0, z: 0},
598  opacity: 0,
599  scale: 1,
600  easing: 'ease-out',
601  mobile: false,
602  reset: false,
603  useDelay: 'always',
604  viewFactor: 0.1,
605  viewOffset: {top: 0, right: 0, bottom: 0, left: 0},
606  afterReveal: function (domEl) {},
607  afterReset: function (domEl) {},
608};
609
610var fromleft = {
611  origin: 'left',
612  distance: '50px',
613  duration: 800,
614  delay: 100,
615  rotate: {x: 0, y: 0, z: 0},
616  opacity: 0,
617  scale: 1,
618  easing: 'ease-out',
619  mobile: false,
620  reset: false,
621  useDelay: 'always',
622  viewFactor: 0.1,
623  viewOffset: {top: 0, right: 0, bottom: 0, left: 0},
624  afterReveal: function (domEl) {},
625  afterReset: function (domEl) {},
626};
627
628var fromtop = {
629  origin: 'top',
630  distance: '50px',
631  duration: 800,
632  delay: 200,
633  rotate: {x: 0, y: 0, z: 0},
634  opacity: 0,
635  scale: 1,
636  easing: 'ease-out',
637  mobile: false,
638  reset: false,
639  useDelay: 'always',
640  viewFactor: 0.1,
641  viewOffset: {top: 0, right: 0, bottom: 0, left: 0},
642  afterReveal: function (domEl) {},
643  afterReset: function (domEl) {},
644};
645
646var frombottom = {
647  origin: 'bottom',
648  distance: '50px',
649  duration: 800,
650  delay: 200,
651  rotate: {x: 0, y: 0, z: 0},
652  opacity: 0,
653  scale: 1,
654  easing: 'ease-out',
655  mobile: false,
656  reset: false,
657  useDelay: 'always',
658  viewFactor: 0.1,
659  viewOffset: {top: 0, right: 0, bottom: 0, left: 0},
660  afterReveal: function (domEl) {},
661  afterReset: function (domEl) {},
662};
663
664var frombottomquick = {
665  origin: 'bottom',
666  distance: '30px',
667  duration: 300,
668  delay: 200,
669  rotate: {x: 0, y: 0, z: 0},
670  opacity: 0,
671  scale: 1,
672  easing: 'ease-out',
673  mobile: false,
674  reset: false,
675  useDelay: 'always',
676  viewFactor: 0.1,
677  viewOffset: {top: 0, right: 0, bottom: 0, left: 0},
678  afterReveal: function (domEl) {},
679  afterReset: function (domEl) {},
680};
681
682var smalltobig = {
683  origin: null,
684  distance: '',
685  duration: 500,
686  delay: 200,
687  rotate: {x: 0, y: 0, z: 0},
688  opacity: 0,
689  scale: 0.9,
690  easing: 'ease-out',
691  mobile: false,
692  reset: false,
693  useDelay: 'always',
694  viewFactor: 0.1,
695  viewOffset: {top: 0, right: 0, bottom: 0, left: 0},
696  afterReveal: function (domEl) {},
697  afterReset: function (domEl) {},
698};
699
700var bigtosmall = {
701  origin: null,
702  distance: '',
703  duration: 500,
704  delay: 200,
705  rotate: {x: 0, y: 0, z: 0},
706  opacity: 0,
707  scale: 0.9,
708  easing: 'ease-out',
709  mobile: false,
710  reset: false,
711  useDelay: 'always',
712  viewFactor: 0.1,
713  viewOffset: {top: 0, right: 0, bottom: 0, left: 0},
714  afterReveal: function (domEl) {},
715  afterReset: function (domEl) {},
716};
717
718var fadeSequence = {
719  origin: 'center',
720  distance: '0',
721  duration: 800,
722  delay: 0,
723  opacity: 0,
724  scale: 1,
725  easing: 'ease-out',
726  mobile: false,
727  reset: false,
728  viewFactor: 0.2,
729};
730
731initSR = function() {
732  ScrollReveal().reveal('.fadein', fadein);
733  ScrollReveal().reveal('.from-bottom', frombottom);
734  ScrollReveal().reveal('.from-bottom-quick', frombottomquick);
735  ScrollReveal().reveal('.from-top', fromtop);
736  ScrollReveal().reveal('.from-left', fromleft);
737  ScrollReveal().reveal('.from-right', fromright);
738  ScrollReveal().reveal('.small-to-big', smalltobig);
739  //Make sure you have the latest scroll reveal to use the sequence feature
740  ScrollReveal().reveal('.fade-sequence-2', fadeSequence, 400);
741  ScrollReveal().reveal('.fade-sequence-fast', fadeSequence, 150);
742  ScrollReveal().reveal('.gallery-box', fadeSequence, 400);
743};
744
745$ (document).ready (function () {
746  // Run Parallax if fullscreen if not on Iphone/IPad
747  var deviceAgent = navigator.userAgent.toLowerCase ();
748  var agentID = deviceAgent.match (/(iphone|ipod|ipad)/);
749
750  checkScroll ();
751
752  $ (window).scroll (function (e) {
753    checkScroll ();
754    if (!agentID) {
755      parallax ();
756    } else {
757    }
758  });
759
760  if (!agentID) {
761    initSR();
762  }
763
764}); // end doc ready
765
766$(window).on('resize orientationchange', function(){
767  var $topPromoBar = $ ('.top-promo-bar');
768  var $promoheight = $('.top-promo-bar').outerHeight();
769  var $headerheight = $('#header-content').outerHeight();
770  var $headerpromoheight = $promoheight + $headerheight;
771  var $sliderheight = $('#slider').outerHeight();
772  var $navmenu = $ ('.off-canvas-menu');
773
774  $navmenu.css('height', '100vh' - $promoheight - '100px');
775
776  // if ($("body").hasClass("promo-active") && !$("body").hasClass("fixed-nav") ) {
777  //   // $navmenu.css('margin-top', $promoheight / 2 + 20);
778  //   $navmenu.css('margin-top', $promoheight + '100px');
779  // } else {
780  //   $navmenu.css('margin-top', 0);
781  // }
782
783  // $('#slider').css('height', $sliderheight + $promoheight / 2);
784  $('#slider').find('.slide.parallax-rev').css({ 'margin-top': $promoheight / 3 * -1 }, 300);
785
786  console.log('headerpromoheight: ' + $headerpromoheight);
787  if ($('body').hasClass('home') && !$('body').hasClass('with-video')) {
788    $('#slider').css('height','calc(100vh - ' + $headerpromoheight + 'px)');
789  }
790});
791
792      /* Responsive SrcSet */
793
794      var ResponsiveBackgroundImage = function (element) {
795        var element = element;
796        var img = element.querySelector ('img');
797        var src = '';
798        var revealClasses = [
799          'from-left',
800          'from-right',
801          'from-top',
802          'small-to-big',
803          'from-left-fast',
804          'from-right-fast',
805          'news-fase',
806          'fade-sequence-2',
807          'fade-sequence-fast',
808          'galley-box',
809        ];
810
811        var body = document.body;
812        var html = document.documentElement;
813        var height = Math.max (
814          body.scrollHeight,
815          body.offsetHeight,
816          html.clientHeight,
817          html.scrollHeight,
818          html.offsetHeight
819        );
820
821        var update = function () {
822          var src = typeof img.currentSrc !== 'undefined' ? img.currentSrc : img.src;
823          if (src) {
824            element.style.backgroundImage = 'url("' + src + '")';
825          }
826        };
827
828  var checkIfScrollRevealElement = function (element, classes) {
829    for (i = 0; i < classes.length; i++) {
830      if (element.classList.contains (classes[i])) {
831        return true;
832      }
833    }
834  };
835
836  if (checkIfScrollRevealElement) {
837    var fired = 0;
838    window.addEventListener ('scroll', function () {
839      if (fired <= height) {
840        update ();
841        fired++;
842      }
843    });
844  }
845
846  img.addEventListener ('load', function () {
847    update ();
848  });
849
850  if (img.complete) {
851    update ();
852  }
853};
854
855// var elements = document.querySelectorAll ('.responsive-background-image');
856// for (var i = 0; i < elements.length; i++) {
857// new ResponsiveBackgroundImage (elements[i]);
858// }
859
860var callSrcset = function(parent) {
861  console.log('srcset called');
862  var elements = document.querySelectorAll (parent + ' .responsive-background-image');
863  for (var i = 0; i < elements.length; i++) {
864    new ResponsiveBackgroundImage (elements[i]);
865  }
866};
867
868callSrcset('body');
869
870/* FORM VALIDATION */
871
872
873var ValidationForm = function (options) {
874  console.log (options);
875
876  var $submitBtn = $ (options.submitButtonID);
877  var $form = $ (options.formID);
878  var $requiredFields = $ (options.formID + ' [required]');
879  var $errorChecking = $ (options.formID + ' ' + options.errorMessageDIV);
880  var checkBoxClassName = options.checkBoxClassName || 'cbcheck';
881  var checkBoxGroupName = options.checkBoxGroupName || 'interestedin[]';
882  var checkBoxGroupName2 = options.checkBoxGroupName2 || 'interestedin[]';
883  var checkBoxGroupName3 = options.checkBoxGroupName3 || 'interestedin[]';
884  var radioBtnGroupName = options.radioBtnGroupName || 'bedrooms[]';
885  var formActionURL = options.formActionURL;
886  var googleAnalyticsCode = options.googleAnalyticsCode || null;
887
888  console.log (googleAnalyticsCode);
889
890  var successMessage = {
891    title: options.successMessage.title || 'Success',
892    copy: options.successMessage.copy || 'Your message has been received',
893  };
894  var processingMessage = {
895    title: options.processingMessage.title || 'Processing',
896    copy: options.processingMessage.copy || 'Please wait.',
897  };
898
899  var init = function () {
900    bindValidationEvents ();
901  };
902
903  var bindValidationEvents = function () {
904    $submitBtn.on ('click', submitForm);
905  };
906
907  var submitForm = function (event) {
908    event.preventDefault ();
909
910    if (validate ()) {
911      // Set the height of the interest list
912      var iheight = $form.outerHeight ();
913      $form.css ('height', iheight + 'px');
914
915      // Processing
916      $form.fadeOut (1000, function () {
917        $ (this).empty ();
918        $ (this).html (buildProcessingMessage ());
919        $ (this).fadeIn ();
920      });
921
922      $ ('html,body').animate (
923        {scrollTop: $form.offset ().top - 100},
924        1000,
925        function () {
926          var pheight = $ ('#process').outerHeight ();
927          //$form.animate ({height: pheight}, 1000);
928        }
929      );
930
931      var dataString = $form.serialize ();
932      console.log (dataString);
933
934      postForm (dataString);
935    }
936  };
937
938  var validate = function () {
939    $ ('.required-highlight').removeClass ('required-highlight');
940
941    // j is the check number
942    var j = 0;
943
944    // checkbox check
945    var cbCheck = $ (
946      options.formID + ' input[name="' + checkBoxGroupName + '"]:checked'
947    ).length;
948
949    var cbCheck2 = $ (
950      options.formID + ' input[name="' + checkBoxGroupName2 + '"]:checked'
951    ).length;
952
953    var cbCheck3 = $ (
954      options.formID + ' input[name="' + checkBoxGroupName3 + '"]:checked'
955    ).length;
956
957    console.log (
958      $(options.formID + ' input[name="' + checkBoxGroupName + '"]:checked')
959    );
960
961    // radio button check
962    var radioCheck = $ (
963      options.formID + ' input[name="' + radioBtnGroupName + '"]:checked'
964    ).length;
965
966    // Loop Over each required field.
967    // Returns false if field is not valid
968    // Will only show main error once and then highlght
969    // the rest of the required fields
970    var errorArray = [];
971    var $firstrequired = '';
972    $requiredFields.each (function (index, field) {
973      var $field = $ (field);
974      if (!checkField ($field, cbCheck, cbCheck2, cbCheck3, radioCheck)) {
975        if (j === 0) {
976          console.log ('error');
977          showError();
978          j++;
979        }
980
981         if ($field.attr('name') == 'interestedin[]') {
982           var $errorfieldlabel = 'Interested In*';
983         } else if ($field.attr('name') == 'requests[]') {
984           var $errorfieldlabel = 'REQUEST TYPE / YOU WANT TO*';
985         } else if ($field.attr('name') == 'caresident[]') {
986           var $errorfieldlabel = 'CALIFORNIA RESIDENT*';
987         } else if ($field.attr('name') == 'attestation[]') {
988           var $errorfieldlabel = 'ATTESTATION*';
989         } else {
990           var $errorfieldlabel = $($field).parent().find('label').text();
991         }
992
993        if (!errorArray.includes($errorfieldlabel)) {
994            errorArray.push($errorfieldlabel);
995        }
996
997        $errorChecking.empty().html('<p><i class="fas fa-exclamation-circle" aria-hidden="true"></i>&nbsp; <span role="alert">Please enter the required fields below.<br/>' + errorArray.join("<br/>") + '</span></p>').slideDown (500);
998
999        $field.parent().addClass ('required-highlight');
1000
1001        if($firstrequired != 'set') {
1002          $field.addClass ('firstrequired');
1003          $firstrequired = 'set';
1004        }
1005
1006        $('.firstrequired').focus();
1007
1008      }
1009    });
1010    // Send the form
1011    if (j === 0) {
1012      console.log ('passed, send form');
1013      return true;
1014    }
1015  };
1016
1017  var checkField = function ($field, cbCheck, cbCheck2, cbCheck3, radioCheck) {
1018    var fieldValue = $.trim ($field.val ());
1019
1020    // Text
1021    if ($field.is ('input:text') && !fieldValue) {
1022      return false;
1023    }
1024
1025    // Number
1026    if ($field.attr ('type') === 'number' && !fieldValue) {
1027      return false;
1028    } else if ($field.attr ('type') === 'email' && !isEmail (fieldValue)) {
1029      // Email
1030      return false;
1031    } else if ($field.is ('input:radio')) {
1032      // Radio
1033      if (radioCheck === 0 && $field.is (':not(:checked)')) {
1034        return false;
1035      } else {
1036        return true;
1037      }
1038    } else if ($field.is ('input:checkbox.cbcheck')) {
1039      // Checkboxes
1040      if ($field.is (':not(:checked)') && cbCheck === 0) {
1041        return false;
1042      } else {
1043        return true;
1044      }
1045    } else if ($field.is ('input:checkbox.cbcheck2')) {
1046      // Checkboxes
1047      if ($field.is (':not(:checked)') && cbCheck2 === 0) {
1048        return false;
1049      } else {
1050        return true;
1051      }
1052    } else if ($field.is ('input:checkbox.cbcheck3')) {
1053      // Checkboxes
1054      if ($field.is (':not(:checked)') && cbCheck3 === 0) {
1055        return false;
1056      } else {
1057        return true;
1058      }
1059
1060    } else if ($field.is ('select') && !fieldValue) {
1061      // Select
1062      return false;
1063    } else if (true) {
1064      return true;
1065    }
1066  };
1067
1068  var showError = function () {
1069    // $errorChecking.empty().html('<p><i class="fas fa-exclamation-circle" aria-hidden="true"></i>&nbsp; <span role="alert">Please enter the required fields below.' + errorArray + '</span></p>').slideDown (500);
1070    // $($errorChecking).focus();
1071    // $('div.required-highlight').addClass('YES');
1072    $ ('html,body').animate ({scrollTop: $form.offset ().top - 100}, 1000);
1073  };
1074
1075
1076  var postForm = function (dataString) {
1077    console.log ('postForm');
1078    $.ajax ({
1079      type: 'POST',
1080      url: formActionURL,
1081      data: dataString,
1082      success: function () {
1083        $form.fadeOut (function () {
1084          $ (this).empty ();
1085          $ (this).html (buildSuccessMessage ());
1086          $form[0].reset ();
1087          $form.fadeIn ();
1088          if (googleAnalyticsCode !== null) {
1089            /*ga (
1090              'send',
1091              'event',
1092              googleAnalyticsCode.category,
1093              googleAnalyticsCode.action,
1094              googleAnalyticsCode.label
1095            );*/
1096            // gtag ('event', googleAnalyticsCode.action, {
1097            //   event_category: googleAnalyticsCode.category,
1098            //   event_label: googleAnalyticsCode.label,
1099            // });
1100            gtag("event", "interest_list_submission");
1101            console.log ('what?');
1102          }
1103        });
1104      },
1105    });
1106  };
1107
1108  var isEmail = function (email) {
1109    var pattern = /^([a-z\d!#$%&'*+\-\/=?^_`{|}~\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+(\.[a-z\d!#$%&'*+\-\/=?^_`{|}~\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+)*|"((([ \t]*\r\n)?[ \t]+)?([\x01-\x08\x0b\x0c\x0e-\x1f\x7f\x21\x23-\x5b\x5d-\x7e\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]|\\[\x01-\x09\x0b\x0c\x0d-\x7f\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))*(([ \t]*\r\n)?[ \t]+)?")@(([a-z\d\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]|[a-z\d\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF][a-z\d\-._~\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]*[a-z\d\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])\.)+([a-z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]|[a-z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF][a-z\d\-._~\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]*[a-z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])\.?$/i;
1110    return pattern.test (email);
1111  };
1112
1113  var buildProcessingMessage = function () {
1114    var processingMessageEl = '<div id="process" role="alert">';
1115    processingMessageEl += '<h4>' + processingMessage.title + '</h4>';
1116    processingMessageEl += '<p>' + processingMessage.copy + '</p>';
1117    processingMessageEl += '</div>';
1118    return processingMessageEl;
1119  };
1120
1121  var buildSuccessMessage = function () {
1122    var successMessageEl = '<div id="success" role="alert">';
1123    successMessageEl += '<h4>' + successMessage.title + '</h4>';
1124    successMessageEl += '<p>' + successMessage.copy + '</p>';
1125    successMessageEl += '</div>';
1126    return successMessageEl;
1127  };
1128
1129  return {
1130    init: init,
1131    bindValidationEvents: bindValidationEvents,
1132    submitForm: submitForm,
1133    validate: validate,
1134  };
1135};

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.