PageSourceSearch

https://www.scientology.de/js-static/lrh-2023/main.js?_=

js scientology.de collected 2026-09-25 00:46:16 UTC 88,881 bytes, 2,160 lines download raw bytes

1var LRH2023 = (function () {
2    'use strict';
3
4    function LRH2023() {
5        // enforces new
6        if (!(this instanceof LRH2023)) {
7            var a = new LRH2023();
8            return a;
9        }
10    }
11
12    LRH2023.prototype.Init = function () {
13        var self = this;
14        self.controller = new ScrollMagic.Controller();
15
16        // anti bot protection
17        if (lazySizesConfig.disabled) {
18            return;
19        }
20
21        this.initLazyload();
22
23        setTimeout(function () {
24            // EventTracker.trackScroll();
25        }, 1000);
26
27        this.prepareMobileCaptions();
28        this.initSlideSpacing();
29        this.initControls();
30        this.fadeInBubble();
31        // this.initVideosModal('.show-on-the-road--playbutton-area');
32        this.initScrollPosition();
33
34        if (!globalGetParams.screencap) {
35            this.initMainMenu();
36            this.initNav();
37            // important to do first, so duplicate slides can be populated
38            this.initInlineCarousels();
39            if(!self.isIpod()) {
40                this.initSliderImages();
41                this.initVideoAutoplay();
42            }
43            this.initIntroAnimation();
44            // this.initEventIntroVideos();
45            this.initSourceBriefingRow();
46            this.initBackgroundParallax();
47            this.initScrollReveals();
48            this.initTopHeader();
49            this.initGrowingLines();
50            this.initFloats();
51            this.initEndTitles();
52        } else {
53
54            if(globalGetParams.screencap == "2") {
55                $('.swiper-wrapper').each(function () {
56                    $(this).addClass('d-block');
57                });
58            } else if(globalGetParams.screencap == "1") {
59                this.initInlineCarousels();
60            }
61
62            TweenMax.set('.show-on-the-road--top-logo,.show-on-the-road--top-logo-glow,.show-on-the-road--top-logo-glow,.show-on-the-road--top-subtitle,.show-on-the-road--top-explore,.show-on-road--top-arrow,.show-on-road--intro-date,.show-on-road--intro-text,.show-on-road--intro-quote', {opacity: 1, autoAlpha: 1});
63            $('.show-on-the-road-glow-line').each(function (index, element) {
64                $(element).addClass('show-on-the-road-glow-line__visible');
65            });
66            _.each($('.show-on-the-road-reveal-bg'), function (element, index) {
67                $(element).addClass('show-on-the-road-reveal-bg__screencap');
68            });
69
70            _.each($('.year-end-2023-videoautoplay'), function (element, index) {
71                var $el = $(element)
72                if($el.data('poster')) {
73                    $el.attr('poster', $el.data('poster'));
74                    TweenMax.set($el, {autoAlpha: 1});
75                    TweenMax.to( $el.closest('.year-end-2023-intro-new-year--wrapper').find('.show-on-the-road-intro-video-dim'), 1, {opacity: 0.7});
76                    TweenMax.to( $el.closest('.year-end-2023-intro-march13--wrapper').find('.show-on-the-road-intro-video-dim'), 1, {opacity: 0.7});
77                }
78            });
79
80
81            _.each($('.year-review-2023-source-briefing-row'), function (element, index) {
82                var $el = $(element);
83                var direction = parseInt($el.data("direction"));
84                var offset = parseInt($el.data("person-offset"));
85    
86                // var xOffset = $el.offset().left - $el.parent().offset().left;
87                var xOffset = $el.find('.year-review-2023-source-briefing-item__person').position().left - offset;
88
89                if(self.isMobile()) {
90                    if($el.find('.year-review-2023-source-briefing-item__person').width() + $el.find('.year-review-2023-source-briefing-item__person').offset().left > self.getWindowOuterWidth()) {
91                        xOffset = $el.offset().left + $el.find('.year-review-2023-source-briefing-item__person').position().left;
92                    }
93                }
94
95                TweenMax.set(element, {x: -xOffset});
96            });
97        }
98
99        if(globalGetParams.id) {
100            window.scrollTo(0, $("#" + globalGetParams.id).offset().top - 200 );
101        }
102
103        // important this is here
104        this.initVideos();
105
106        // 
107
108        if($('.show-codes-button').length) {
109            $('.show-codes-button:not(.copyversion)').click(function(event) {
110               $('.image-code').toggleClass('hidden');
111            });
112            $('.mag-image-lazyload__abs').each(function(index, el) {
113                // console.log( $(el).find('img').attr('data-src') );
114                if($(el).find('source').length > 0) {
115                    var src = $(el).find('source').attr('data-srcset');
116                    if(!src) {
117                        return;
118                    }
119                    // most are _XX9999.jpg
120                    var parts = src.match(/[-_](([0-9]+[a-zA-Z]+|[a-zA-Z]+[0-9]+)[0-9a-zA-Z]*)(-(inet|1))?(-r)?(_en)?.jpg/);
121                    if(parts===null) {
122                        // Some are DJI_0242
123                        parts = src.match(/[-_]([A-Z]+_[0-9]+).jpg/);
124                    }
125                    if(parts===null) {
126                        // Some are job-
127                        parts = src.match(/(job[-_][0-9]+)(-r)?(_en)?.jpg/);
128                    }
129                    if(parts && parts.length > 0) {
130                        var code = parts[1];
131                        $(el).append('<div class="image-code hidden">'+code+'</div>')
132                    }
133                    
134                    var $altsContainer = $(el).closest('.subm-alts');
135                    if($altsContainer.length > 0) {
136                        var alts = document.createElement("DIV");
137                        alts.classList.add("image-alts-wrapper")
138                        alts.classList.add("hidden")
139                        
140                        var alt = document.createElement("div");
141                        alt.innerHTML = "PROPOSED";
142                        alt.classList.add("image-alts-item", "image-alts-item__active");
143                        alt.setAttribute("data-value", "proposed");
144                        alts.append(alt);
145                        
146                        var index = 1;
147                        $altsContainer.find('.subm-alt-version').each(function () {
148                            var alt = document.createElement("div");
149                            alt.innerHTML = "ALT " + index;
150                            alt.classList.add("image-alts-item");
151                            alt.setAttribute("data-value", index);
152                            index ++;
153                            alts.append(alt);
154                        });
155                        $(el).append(alts)
156                    }
157
158                }
159            });
160            $('.image-alts-item').click(function(){
161                var value = $(this).attr('data-value');
162                var $altsContainer = $(this).closest('.subm-alts');
163                $altsContainer.find('.subm-alt-version').each(function () {
164                    $(this).removeClass('subm-alt-version__visible');
165                });
166                if(value == "proposed") {
167                    $altsContainer.children().first().removeClass('subm-proposed-version__hidden');
168                } else {
169                    $altsContainer.children().first().addClass('subm-proposed-version__hidden');
170                    var id = parseInt(value);
171                    $($altsContainer.children()[id]).addClass('subm-alt-version__visible');
172                }
173            });
174
175            loadjs(['/plugins/bootstrap/js/bootstrap.bundle.min.js?_='+cacheId], 'bootstrapjs', {async: false});
176            loadjs.ready('bootstrapjs', function() {
177                $('.image-code').tooltip({
178                    html: true,
179                    title: '<span class="icon-zoom-in"></span> VIEW FULL SCREEN',
180                    placement: 'bottom',
181                });
182            });
183
184            // load up photoswipe
185            loadjs('/plugins/photoswipe/photoswipe.min.js?_=' + new Date().getTime());
186            loadjs('/plugins/photoswipe/photoswipe-ui-default.min.js?_=' + new Date().getTime());
187
188            loadjs(['css!/plugins/photoswipe/photoswipe.css?_=' + cacheId, 'css!/plugins/photoswipe/default-skin/default-skin.css?_=' + cacheId]);
189
190            $('.pswp__container').html('<div class="pswp__item"></div><div class="pswp__item"></div><div class="pswp__item"></div>');
191
192            $(document).on('click', '.image-code', function(e){
193                e.stopPropagation();
194                e.stopImmediatePropagation();
195                e.preventDefault();
196
197                var $imageItem = $(this).closest('.mag-image-lazyload__abs');
198                var src = $imageItem.find('img')[0].currentSrc.replace(/@w=[0-9]*/, '');
199                // if(src[0] != "/") {
200                //     src = "/" + src;
201                // }
202                // photoswipe zoom in
203                // console.log('src',src);
204                if(src) {
205                    // var url = new URL(window.location.href);
206                    // url.pathname = src;
207                    var pswpElement = document.querySelectorAll('.pswp')[0];
208                    // build items array
209                    var items = [
210                        {
211                            // src: unescape(url.toString()),
212                            src: src,
213                            w: 0,
214                            h: 0,
215                        },
216                    ];
217
218                    // define options (if needed)
219                    var options = {
220                        index: 0,
221                        shareEl: false,
222                        history: false
223                    };
224                    var gallery = new PhotoSwipe( pswpElement, PhotoSwipeUI_Default, items, options);
225
226                    // dynamicly set W & H
227                    gallery.listen('gettingData', function (index, item) {
228                        if (item.w < 1 || item.h < 1) {
229                            var img = new Image();
230                            img.onload = function () {
231                                item.w = this.width;
232                                item.h = this.height;
233                                gallery.updateSize(true);
234                            };
235                            img.src = item.src;
236                        }
237                    });
238
239                    gallery.init();
240                }
241            });
242
243        }
244
245    }
246
247    LRH2023.prototype.initControls = function () {
248        var self = this;
249
250        $(document).keydown(function (e) {
251            var arrow = { left: 37, up: 38, right: 39, down: 40 };
252          
253            switch (e.which) {
254              case arrow.left:
255                for (var index = 0; index < self.swipers.length; index++) {
256                    var swiper = self.swipers[index];
257                    if(isInViewportVisible(swiper.$el)) {
258                        var index = swiper.$el.attr('data-swiper-index');
259                        self.swipers[parseInt(index)].slidePrev();
260                    }
261                }
262                break;
263              case arrow.up:
264                if (self.prevInset()) {
265                    e.preventDefault();
266                    e.stopPropagation();
267                    $('.year-review-2021-nav__up').addClass('year-review-2021-nav__up-pressed');
268                    setTimeout(function() {
269                        $('.year-review-2021-nav__up').removeClass('year-review-2021-nav__up-pressed');
270                    }, 1100);
271                    return;
272                }
273                break;
274              case arrow.right:
275                for (var index = 0; index < self.swipers.length; index++) {
276                    var swiper = self.swipers[index];
277                    if(isInViewportVisible(swiper.$el)) {
278                        var index = swiper.$el.attr('data-swiper-index');
279                        self.swipers[parseInt(index)].slideNext();
280                    }
281                }
282                break;
283              case arrow.down:
284                  if (self.nextInset()) {
285                      e.preventDefault();
286                      e.stopPropagation();
287                      $('.year-review-2021-nav__down').addClass('year-review-2021-nav__down__pressed');
288                      setTimeout(function() {
289                          $('.year-review-2021-nav__down').removeClass('year-review-2021-nav__down__pressed');
290                        }, 1100);
291                        return;
292                    }
293                    break;
294                case 32:
295                    for (var index in videojs.players) {
296                        if (Object.hasOwnProperty.call(videojs.players, index)) {
297                            var video = videojs.players[index];
298                            var $el = $(video.el());
299                            if(isInViewportVisible($el) && self.qualifiedAutoplay($el)) {
300                                var $wrapper = $el.closest('.show-on-the-road--playbutton-area');
301                                var videoPlaying = $wrapper.hasClass('show-on-the-road-videoautoplay__inline');
302                                if(!videoPlaying) {
303                                    $wrapper.click();
304                                } else if(video.paused()) {
305                                    video.play();
306                                } else {
307                                    video.pause();
308                                }
309                                
310                                e.preventDefault();
311                                e.stopPropagation();
312                            }
313                        }
314                    }
315                    break;
316            }
317          });
318    }
319
320    LRH2023.prototype.initIntroAnimation = function () {
321        var self = this;
322        var image1 = $('.show-on-the-road--top-logo img')[0];
323        var image2 = $('.show-on-the-road--top-logo-glow img')[0];
324
325        Splitting();
326        var tl = new TimelineMax();
327        tl.fromTo('.show-on-the-road--top-logo', 0.5, {scale: 2, autoAlpha: 0}, {scale: 1, autoAlpha: 1});
328        tl.fromTo('.show-on-the-road--top-logo-glow', 0.5, {autoAlpha: 0}, {autoAlpha: 1}, "-=0.1");
329        tl.to('.show-on-the-road--top-logo-glow', 1.3, {autoAlpha: 0.6});
330        tl.staggerFromTo('.show-on-the-road--top-subtitle, .show-on-the-road--top-explore, .show-on-road--top-arrow, .show-on-road--intro-date', 0.25, {y: 50, autoAlpha: 0}, {y: 0, autoAlpha: 1}, 0.2, "-=1");
331        tl.fromTo('.show-on-road--intro-text, .show-on-road--intro-quote', 0.25, {autoAlpha: 0}, {autoAlpha: 1}, "-=0.1");
332
333        var triggerHook = 0.75;
334        if(self.isMobile()) {
335            triggerHook = 0.6;
336        }
337        var offset = 100;
338        if(self.isMobile()) {
339            offset = 50;
340        }
341
342        $('.show-on-road--intro-text, .show-on-road--intro-quote').each(function () {
343            var tl = new TimelineMax();
344            tl.staggerFromTo(this.querySelectorAll('.word'), 0.1, {
345                'will-change': 'opacity',
346                opacity: 0.1
347            }, {
348                ease: 'none',
349                opacity: 1,
350            }, 0.01);
351            
352            // var duration = this.getAttribute("data-duration") || "30%";
353
354            new ScrollMagic.Scene({ triggerElement: this, triggerHook: triggerHook, reverse: true, offset: offset, duration: 0 })
355            .setTween(tl)
356            .addTo(self.controller);
357        });
358
359        var notOnPauseTween  = TweenMax.staggerFromTo(document.querySelectorAll('.show-on-road-not-on-pause .word'), 0.25, {
360            autoAlpha: 0,
361            scale: 5,
362        }, 
363        {
364            autoAlpha: 1,
365            scale: 1,
366        }, 0.2);
367
368    
369        new ScrollMagic.Scene({ triggerElement: '.show-on-road-not-on-pause-trigger', triggerHook: triggerHook, reverse: true, offset: 0, duration: 0 })
370        .setTween(notOnPauseTween)
371        .addTo(self.controller);
372
373        self.addResizeCallback(function(){
374            $('.show-on-road-not-on-pause').css('font-size', "");
375            $('.show-on-road-not-on-pause').autoTextSize(30, 180, false);
376        });
377    }
378
379    LRH2023.prototype.initSourceBriefingRow = function () {
380        var self = this;
381
382        _.each($('.year-review-2023-source-briefing-row'), function (element, index) {
383            var $el = $(element);
384            var direction = parseInt($el.data("direction"));
385            var offset = parseInt($el.data("person-offset"));
386
387            self.addResizeCallback(function(){
388                TweenMax.set(element, {x: 0});
389
390                var xOffset = $el.find('.year-review-2023-source-briefing-item__person').position().left - offset;
391
392                if(self.isMobile()) {
393                    xOffset = $el.offset().left + $el.find('.year-review-2023-source-briefing-item__person').position().left;
394                    var rowWidth =  $el.children().last().position().left + $el.children().last().width();
395                    var visibleRowWidth = $el.find('.year-review-2023-source-briefing-item__person').offset().left - xOffset + (rowWidth - $el.find('.year-review-2023-source-briefing-item__person').position().left);
396                    if(visibleRowWidth < self.getWindowOuterWidth()) {
397                        xOffset = xOffset - (self.getWindowOuterWidth() - visibleRowWidth);
398                    } else {
399                        xOffset -= 25;
400                    }
401                } else if( self.getWindowOuterWidth() < 1200) {
402                    if($el.find('.year-review-2023-source-briefing-item__person').width() + $el.find('.year-review-2023-source-briefing-item__person').offset().left - xOffset > self.getWindowOuterWidth()) {
403                        xOffset = $el.find('.year-review-2023-source-briefing-item__person').position().left;
404                    } else if($el.find('.year-review-2023-source-briefing-item__person').offset().left - xOffset < 0 || 
405                    $el.find('.year-review-2023-source-briefing-item__person').position().left + $el.find('.year-review-2023-source-briefing-item__person').width() - xOffset + $el.parent().width()
406                    ) {
407                        xOffset = $el.find('.year-review-2023-source-briefing-item__person').position().left;
408                    }
409                }
410
411                var tween = TweenMax.fromTo(element, 1.5, {x: 0, autoAlpha: 0}, {x: -xOffset, autoAlpha: 1})
412                if(direction < 0) {
413                    tween = TweenMax.fromTo(element, 1.5, {x: -xOffset - 200, autoAlpha: 0}, {x: -xOffset, autoAlpha: 1})
414                }
415                
416                self.addResizeScene(
417                    new ScrollMagic.Scene({
418                        triggerElement: element,
419                        triggerHook: 'onEnter',
420                        offset: 100,
421                    })
422                    .setTween(tween)
423                    .addTo(self.controller)
424                );
425            });
426        });
427    }
428
429    LRH2023.prototype.fadeInBubble = function () {
430
431        // new ScrollMagic.Scene({ triggerElement: '.year-end-2021--ideal-churches', triggerHook: 0.5, reverse: false })
432        //     .on("start", function (event) {
433        $('.enlightenment-launcher-container').addClass('enlightenment-launcher-container__opened');
434        TweenLite.from($('.enlightenment-launcher-container'), 0.75, { width: 24, ease: Power4.easeInOut });
435        TweenLite.to($('.enlightenment-launcher-container'), 0.75, { opacity: 1, clearProps: 'width', ease: Power4.easeInOut });
436
437        setTimeout(function () {
438            $('.enlightenment-launcher-container').removeClass('enlightenment-launcher-container__opened');
439        }, 10000);
440            // })
441            // .addTo(this.controller);
442    }
443
444    LRH2023.prototype.initLazyload = function () {
445        //add simple support for background images:
446        document.addEventListener('lazybeforeunveil', function (e) {
447            var bg = e.target.getAttribute('data-bg');
448            if (bg) {
449                e.target.style.backgroundImage = 'url(' + bg + ')';
450            }
451        });
452        setTimeout(function(){
453            $('[data-bg]').each(function () {
454                if ($(this).hasClass('lazyloaded')) {
455                    var bg = this.getAttribute('data-bg');
456                    if (bg) {
457                        this.style.backgroundImage = 'url(' + bg + ')';
458                    }
459                }
460            });
461        }, 500);
462        $('[data-src]').each(function () {
463            var $el = $(this);
464            if (!$el.hasClass('lazyload')) {
465                $el.attr('data-srcset', $el.attr('data-src') + " 1x, " + $el.attr('data-src2x') + " 2x" );
466                $el.addClass('lazyload');
467            }
468        });
469
470        var self = this;
471        self.resizeEvents = [];
472        self.resizeScenes = [];
473        $(window).resize(function () {
474            self.updateCache();
475            self.resizeDynamicScenes();
476        });
477
478        $(document).ready(function () {
479            self.updateCache();
480        });
481    }
482
483    LRH2023.prototype.initBackgroundParallax = function () {
484        var self = this;
485        self.addResizeCallback(function(){
486            $('.show-on-the-road-section-bg, .show-on-the-road-parallax-bg').each(function () {
487                // var bgTween = TweenMax.to(this, 1, { backgroundPosition: "50% -" + Math.round(self.getWindowHeight() * 0.2) + "px" });
488                var bgTween = TweenMax.fromTo(this, 1, { backgroundPosition: '50% 0%'}, {backgroundPosition: '50% 100%'});
489                self.addResizeScene(
490                    new ScrollMagic.Scene({ triggerElement: this, triggerHook: 0.5, reverse: true, duration: "200%" })
491                    .setTween(bgTween)
492                    .addTo(self.controller)
493                );
494            });
495        });
496    }
497
498    LRH2023.prototype.initScrollReveals = function () {
499        var self = this;
500        // $('.show-on-the-road-reveal-wrapper').each(function () {
501        //     var $el = $(this);
502
503        //     self.addResizeCallback(function(){
504        //         var $bg = $el.find('.show-on-the-road-reveal-bg');
505        //         // $bg.css('height', $bg.parent().outerHeight() + 'px' );
506        //         // $bg.css('height', self.getWindowHeight() * 1.1 + 'px' );
507        //         // var bgTween = TweenMax.fromTo($bg[0], 1, { backgroundPosition: '50% 0%'}, {backgroundPosition: '50% 10%'});
508        //         var $container = $el.find('.show-on-the-road-reveal-bg-container');
509        //         if($container.length == 0) {
510        //             return;
511        //         }
512        //         return;
513        //         var bgTween = TweenMax.fromTo($el.find('.show-on-the-road-reveal-bg-container')[0], 1, { y: 0}, {y: -self.getWindowHeight() * 0.1});
514        //         // self.addResizeScene(
515        //         //     new ScrollMagic.Scene({ triggerElement: $el.find('.show-on-the-road-reveal--trigger')[0], triggerHook: "onEnter", reverse: true, duration:  })
516        //         //     .setPin( $el.find('.show-on-the-road-reveal-bg')[0], {
517        //         //         pushFollowers: false,
518        //         //     })
519        //         //     .addTo(self.controller)
520        //         // );
521        //         self.addResizeScene(
522        //             new ScrollMagic.Scene({ triggerElement: $el.find('.show-on-the-road-reveal--trigger')[0], triggerHook: 0.5, reverse: true, duration: "100%" })
523        //             .setTween(bgTween)
524        //             .addTo(self.controller)
525        //         );
526        //     });
527        // });
528    }
529
530    // LRH2023.prototype.initModalOpener = function () {
531    //     var self = this;
532    //     $(document).on('click', '.show-on-the-road--playbutton-area', function(event) {
533
534    //         var videoId = $(this).data('id');
535    //         if($('.modal-full-viewport.visible').length == 0) {
536    //             $('.year-end-2022--playbutton-area[data-videoid='+videoId+']').click();
537    //         } else {
538    //             trackEvent("Video", "Play", videoId);
539
540    //             self.currentVideoId = videoId;
541    
542    //             var src = $('[data-videosrc][data-videoid="'+ videoId +'"]').data('videosrc');
543    //             var videoposter = $('[data-videoposter][data-videoid="'+ videoId +'"]').data('videoposter');
544    
545    //             if(window.videojs) {
546    //                 var playerFound = false;
547    //                 for (var player in videojs.players) {
548    //                     if (videojs.players.hasOwnProperty(player) && videojs.players[player]) {
549    //                         if($(videojs.players[player].el_).closest('.modal-full-viewport').length > 0) {
550    //                             videojs.players[player].src(src);
551    //                             // self.addCaptionsIfNeeded(videojs.players[player], videoId);
552    //                             playerFound = true;
553    //                         }
554    //                     }
555    //                 }
556    //                 if(!playerFound) {
557    //                     var options = jQuery.extend({}, videoOptions);
558    //                     options.controls = true;
559    //                     options.poster = videoposter;
560    //                     options.sources = src;
561    //                     $('.modal-scntv-video--inited').remove();
562
563    //                     self.initModalVideo($('.modal-full-viewport.visible'), options);
564    //                 }
565    //             }
566    //         }
567            
568    //     });
569    // }
570
571    LRH2023.prototype.initVideoAutoplay = function () {
572        var self = this;
573        _.each($('.show-on-the-road--playbutton-area'), function (el, index) {
574            var $el = $(el);
575
576            var videoId = $el.data('videoid');
577
578            var options = jQuery.extend({}, videoOptions);
579            options.preload = "none";
580            options.controls = false;
581            options.autoplay = false;
582            options.sources = $el.data('videosrc');
583            options.loop = true;
584            var videos = $el.find('.video-js');
585            if (videos.length == 0) {
586                return;
587            }
588            var video = videos[0];
589            videojs(videos[0], options).ready(function () {
590                var tween;
591
592                var player = this;
593
594                // first scroll
595                // new ScrollMagic.Scene({ triggerElement: $el[0], triggerHook: 0.5, reverse: true })
596                //     .on("start", function (event) {
597                //         // video started playing by user interaction
598                //         if (!video.muted) {
599                //             return;
600                //         }
601                //         player.one('play', function () {
602                //             tween && tween.pause();
603                //             tween = new TimelineMax();
604                //             tween.to($el.find('.year-end-2022-videoautoplay'), 0.5, { autoAlpha: 1, ease: Power4.easeOut });
605                //             tween.to($el.find('.mag-image-lazyload'), 0.25, {autoAlpha: 0});
606                //         });
607                //         if (!$el.hasClass('year-end-2022-videoautoplay__inline')) {
608                //             var vid = player.el().querySelector('video');
609                //             if (vid.currentTime < 3 && $(window).width() < 768) {
610                //                 player.src(player.currentSources());
611                //             }
612                //             vid.controls = false;
613                //             player.play();
614                //         }
615                //         trackEvent("Video", "Visible", videoId);
616                //     })
617                //     .on("leave", function (event) {
618                //         // video started playing by user interaction
619                //         if (!video.muted) {
620                //             return;
621                //         }
622                //         if (event.state == "BEFORE" && event.scrollDirection == "REVERSE") {
623                //             tween && tween.pause();
624                //             tween = new TimelineMax();
625                //             tween.to($el.find('.year-end-2022-videoautoplay'), 0.5, { autoAlpha: 0, ease: Power4.easeOut });
626                //             tween.to($el.find('.mag-image-lazyload'), 0.25, {autoAlpha: 1});
627                //             video.pause();
628                //             window.history && history.replaceState(null, null, ' ');
629                //         }
630                //     })
631                //     .addTo(self.controller);
632
633                // on scroll in or scroll out
634                new ScrollMagic.Scene({ triggerElement: $el[0], triggerHook: "onEnter", reverse: true, offset: 0, duration: self.getWindowHeight() * 2 })
635                    .on("start", function (event) {
636                        // video started playing by user interaction
637                        if (!video.muted) {
638                            return;
639                        }
640                        player.one('play', function () {
641                            tween && tween.pause();
642                            tween = new TimelineMax();
643                            tween.to($el.find('.year-end-2022-videoautoplay'), 0.5, { autoAlpha: 1, ease: Power4.easeOut });
644                            tween.to($el.find('.mag-image-lazyload'), 0.25, {autoAlpha: 0});
645                        });
646                        video.controls = false;
647                        if(!self.qualifiedAutoplay($el)) {
648                            return;
649                        }
650                        player.src(options.sources);
651                        player.play();
652                        trackEvent("Video", "Visible", videoId);
653                    })
654                    .on("leave", function (event) {
655                        // video started playing by user interaction
656                        if (!video.muted) {
657                            return;
658                        }
659                        // if (event.state == "BEFORE" && event.scrollDirection == "REVERSE") {
660                        video.pause();
661                        window.history && history.replaceState(null, null, ' ');
662                        tween && tween.pause();
663                        tween = new TimelineMax();
664                        tween.to($el.find('.year-end-2022-videoautoplay'), 0.5, { autoAlpha: 0, ease: Power4.easeOut });
665                        tween.to($el.find('.mag-image-lazyload'), 0.25, {autoAlpha: 1});
666                        // } 
667                    })
668                    .on("end", function (event) {
669                        // video started playing by user interaction
670                        if (!video.muted) {
671                            return;
672                        }
673                        // scroll back
674                        if (event.state == "DURING" && event.scrollDirection == "REVERSE") {
675                            player.one('play', function () {
676                                tween && tween.pause();
677                                tween = new TimelineMax();
678                                tween.to($el.find('.year-end-2022-videoautoplay'), 0.5, { autoAlpha: 1, ease: Power4.easeOut });
679                                tween.to($el.find('.mag-image-lazyload'), 0.25, {autoAlpha: 0});
680                            });
681                            video.controls = false;
682                            if(!self.qualifiedAutoplay($el)) {
683                                return;
684                            }
685                            player.play();
686                        }
687                    })
688                    // .addIndicators() // add indicators (requires plugin)
689                    .addTo(self.controller);
690            });
691
692        });
693    }
694
695    LRH2023.prototype.qualifiedAutoplay = function ($el) {
696        var $slide = $el.closest('.swiper-slide');
697        if($slide.length == 0) {
698            return true;
699        }
700        return $slide.hasClass('swiper-slide-active');
701    }
702
703    LRH2023.prototype.initVideos = function (selector) {
704        var self = this;
705        $('.show-on-the-road--playbutton-area').click(function(){
706            var $el = $(this);
707            var videoElId = $el.find('.video-js').attr('id');
708            var video = videojs.players[videoElId];
709
710            var scntvlink = $el.data('scntv');
711            if(scntvlink) {
712                // $('.modal-scntv-video').clone().removeClass("d-none").prependTo($(this)).addClass('modal-scntv-video--inited');
713                // var src = $('.modal-scntv-video--inited iframe').attr('data-src').replace(/YOUTUBE_ID/g, $el.data('youtube'));
714                // $('.modal-scntv-video--inited').removeClass('d-none');
715                // var src = $('.modal-scntv-video--inited iframe').data('src').replace("URL", scntvlink);
716                // $('.modal-scntv-video--inited iframe').attr('src', src);
717                // return;
718            }
719
720            if(!video) {
721                return;
722            }
723
724            var videoId = $(this).data('videoid');
725            if(!video.controls()) {
726                for (var player in videojs.players) {
727                    if (videojs.players.hasOwnProperty(player) && videojs.players[player]) {
728                        try {
729                            videojs.players[player].pause();
730                        } catch (error) {
731                        }
732                    }
733                }
734
735                video.controls(true);
736                video.muted(false);
737                video.currentTime(0);
738                video.loop(false);
739                video.poster( $el.data('videoposter') );
740                $el.addClass('show-on-the-road-videoautoplay__inline');
741                EventTracker.trackVideo(video);
742                video.one('timeupdate', function(){
743                    // self.addCaptionsIfNeeded(video, videoId);
744                });
745                video.play();
746                trackEvent("Video", "Play", videoId);
747            } else if(video.paused()) {
748                trackEvent("Video", "Play", videoId);
749            }
750        });
751    }
752
753
754    LRH2023.prototype.initVideosModal = function (selector) {
755        var self = this;
756        
757        $('.year-review-2022--back').click(function(){
758            $('.modal-full-viewport .close').click();
759        });
760
761        $('.year-review-2021--primary-menu-watch').click(function(){
762            $('[data-videoid="church-of-scientology-in-los-angeles-you-have-seen-us-video"]').click();
763        });
764
765        $(selector).click(function(){
766            var $modal = $('.modal-full-viewport').first()
767            $modal.addClass('visible');
768
769            for (var player in videojs.players) {
770                if (videojs.players.hasOwnProperty(player) && videojs.players[player]) {
771                    try {
772                        videojs.players[player].pause();
773                    } catch (error) {
774                    }
775                    if($(videojs.players[player].el_).closest('.modal-full-viewport').length > 0) {
776                        videojs.players[player].dispose();
777                    }
778                }
779            }
780
781            var videoId = $(this).data('videoid');
782            self.currentVideoId = videoId;
783    
784            TweenMax.from($modal, 0.75, {scale: 0.9, autoAlpha: 0, ease: Power4.easeOut});
785
786            // self.initModalCarousel();
787
788            if($(this).attr('id')) {
789                window.history.replaceState( {} , '', '#' + $(this).attr('id') );
790                trackEvent("Video", "Play", $(this).attr('id'));
791            }
792
793            var $el = $(this);
794
795            var showyoutube = false;
796            var scntvlink = $el.data('scntv');
797
798            if($el.data('youtube')) {
799                showyoutube = true;
800            }
801
802            $('.modal-youtube-embed--inited').remove();
803
804            if(scntvlink) {
805                $modal.find('.modal-scntv-video').clone().removeClass("d-none").prependTo($modal.find('.modal-video-wrapper')).addClass('modal-scntv-video--inited');
806                var src = $('.modal-scntv-video--inited iframe').attr('data-src').replace(/YOUTUBE_ID/g, $el.data('youtube'));
807                $('.modal-scntv-video--inited').removeClass('d-none');
808                var src = $('.modal-scntv-video--inited iframe').data('src').replace("URL", scntvlink);
809                $('.modal-scntv-video--inited iframe').attr('src', src);
810                return;
811            } else if(showyoutube) {
812                $modal.find('.modal-youtube-embed').clone().prependTo($modal.find('.modal-video-wrapper')).addClass('modal-youtube-embed--inited');
813                var src = $('.modal-youtube-embed--inited iframe').attr('data-src').replace(/YOUTUBE_ID/g, $el.data('youtube'));
814                $('.modal-youtube-embed--inited').removeClass('d-none');
815                $('.modal-youtube-embed--inited iframe').attr('src', src);
816                return;
817            }
818            // https://www.youtube.com/watch?v=FiW5kejelns
819
820            $('.year-review-2022--primary-menu-bg, .banner-wrapper, .external-links').hide();
821            // $('.year-review-2021-nav').removeClass('year-review-2022-nav__visible');
822    
823                
824            var options = jQuery.extend({}, videoOptions);
825            options.controls = true;
826            options.poster = $(this).data('videoposter');
827            options.sources = $(this).data('videosrc');
828
829            self.initModalVideo($modal, options, videoId);
830
831            // var url = new URL(window.location.href);
832            // url.search = "?shareanchor=" + $(this).attr('id');
833            // url.hash = "";
834            // var link = url.href;
835            // var title = $('[href="#'+$(this).attr('id')+'"]').first().text().trim();
836            // self.updateSharingButtons(title, link)
837        });
838
839
840        window.onpopstate = function(event) {
841            if($('.modal-full-viewport').hasClass('visible')) {
842                history.replaceState({}, '');
843                event.preventDefault();
844                event.stopPropagation();
845                $('.modal-full-viewport .close').click();
846            }
847        }
848
849        $('.modal-video-wrapper-up-next--button__cancel').click(function() {
850            $('.modal-video-wrapper-up-next-wrapper').addClass('d-none');
851            self.upNextInterval && clearInterval(self.upNextInterval);
852        });
853
854        $('.modal-video-wrapper-up-next--button__play').click(function() {
855            var currentVideo = $('.modal-full-viewport .swiper-slide__modal-video[data-id="'+self.currentVideoId+'"]');
856            var $next = currentVideo.next(); 
857            if($next.length == 0) {
858                $next = $('.swiper-slide__modal-video').first();
859            }
860            $next.click();
861            self.upNextInterval && clearInterval(self.upNextInterval);
862        });
863        
864        $('.modal-full-viewport .close, .modal-full-viewport .year-review-2021--back__underlined').click(function () {
865            $('.show-codes-button').removeClass('d-none');
866            TweenMax.to($('.modal-full-viewport'), 0.75, {scale: 0.9, autoAlpha: 0, clearProps:'all', ease: Power4.easeOut, onComplete: function(){
867                $('.modal-full-viewport').removeClass('visible');
868            }});
869            $('.modal-video-wrapper-up-next--button__cancel').click();
870            window.history.replaceState( {} , '', '');
871            if(window.videojs) {
872                for (var player in videojs.players) {
873                    if (videojs.players.hasOwnProperty(player) && videojs.players[player]) {
874                        try {
875                            videojs.players[player].pause();
876                        } catch (error) {
877                        }
878                        if($(videojs.players[player].el_).closest('.modal-full-viewport').length > 0) {
879                            videojs.players[player].dispose();
880                        }
881                    }
882                }
883            }
884            _.each(self.videoPlayers, function (player) {
885                player && player.dispose();
886            });
887            self.videoPlayers = [];
888            $('.modal-youtube-embed--inited').remove();
889            $('.modal-scntv-video--inited').remove();
890            VideoPlayerHotkeys.player = null;
891            $('.year-review-2022--primary-menu-bg, .banner-wrapper, .external-links').show();
892            // $('.year-review-2021-nav').addClass('year-review-2022-nav__visible');
893
894            _.each($('.year-end-2022--playbutton-area'), function (el, index) {
895                var $el = $(el);
896                if(isFullyVisible($el) && $el.find('video').muted) {
897                    $el.find('video')[0].play();
898                }
899            });
900
901            history.replaceState(null, null, "#");
902        });
903    }
904
905    LRH2023.prototype.initModalVideo = function ($modal, options, videoId) {
906        $modal.find('.modal-player__model').clone().prependTo($modal.find('.modal-video-wrapper')).removeClass('d-none').removeClass('modal-player__model');
907        var videoEl = $('[data-videosrc][data-videoid="' + videoId + '"]');
908        var self = this;
909        videojs($modal.find('.video-js')[0], options).ready(function () {
910            if (VideoPlayerHotkeys) {
911                VideoPlayerHotkeys.player = this;
912            }
913            EventTracker.trackVideo(this);
914            this.on('play', function () {
915                $('.modal-video-wrapper-up-next-wrapper').addClass('d-none');
916            });
917            this.play();
918            self.videoPlayers = self.videoPlayers || [];
919            self.videoPlayers.push(this);
920
921            var player = this;
922
923
924            this.on("ended", function () {
925                player.poster('');
926                var currentVideo = $('.modal-full-viewport .swiper-slide__modal-video[data-id="' + self.currentVideoId + '"]');
927                var $next = currentVideo.next();
928                if ($next.length == 0) {
929                    $next = $('.swiper-slide__modal-video').first();
930                }
931                $('.modal-video-wrapper-up-next-wrapper').removeClass('d-none');
932                $('.modal-video-wrapper-up-next-wrapper .modal-video-wrapper-up-next--title').html($next.find('.swiper-slide__modal-video--title').html());
933                $('.modal-video-wrapper-up-next-wrapper img').attr('srcset', $next.find('source').attr('srcset'));
934                $('.modal-video-wrapper-up-next-wrapper img').attr('data-srcset', $next.find('source').attr('data-srcset'));
935                $('.modal-video-wrapper-up-next-wrapper img').addClass('lazyload');
936                self.setUpNext($next);
937            });
938        });
939    }
940
941    LRH2023.prototype.initInlineCarousels = function () {
942        var self = this;
943        self.swipers = [];
944        var swiperIndex = 0;
945        $('.show-on-the-road-videos-swiper').each(function () {
946            var $el = $(this);
947            if ($el.hasClass('swiper-container-initialized')) {
948                return;
949            }
950            var inited = new Date().getTime();
951
952            var swiper = new Swiper($el[0], {
953                // paginationClickable: true,
954                pagination: {
955                    el: $el.find('.swiper-pagination')[0],
956                    clickable: true
957                },
958                spaceBetween: 0,
959                roundLengths: true,
960                simulateTouch: false,
961                centerInsufficientSlides: true,
962                slidesPerView: 1,
963                navigation: {
964                    nextEl: $el.find('.slide-right-arrow')[0],
965                    prevEl: $el.find('.slide-left-arrow')[0],
966                },
967                on: {
968                    init: function(){
969                        var tweenScroll = TweenMax.fromTo($el.find('.swiper-slide-active'), 3, {autoAlpha: 0, x: self.getWindowOuterWidth() / 2}, {autoAlpha: 1, x: 0, ease: Power4.easeOut});
970                        new ScrollMagic.Scene({
971                            triggerElement: $el.closest('.show-on-the-road-slideshow-wrapper')[0],
972                            triggerHook: 'onEnter',
973                            reverse: false,
974                            duration: 0,
975                        })
976                        .setTween(tweenScroll)
977                        .addTo(self.controller);
978            
979                    },
980                    slideChange: function() {
981                        var $wrapper = $el.closest('.show-on-the-road-slideshow-wrapper');
982                        $wrapper.find('.show-on-the-road-reveal-bg__slide-visible').removeClass('show-on-the-road-reveal-bg__slide-visible');
983                        $($wrapper.find('.show-on-the-road-reveal-bg__slide')[this.realIndex]).addClass('show-on-the-road-reveal-bg__slide-visible');
984
985
986                        var tooEarly = new Date().getTime() - inited < 2000;
987                        if(tooEarly) {
988                            return;
989                        }
990                        
991                        for (var index = 0; index < this.slides.length; index++) {
992                            this.slides[index].querySelector('video') && this.slides[index].querySelector('video').pause();
993                        }
994                        if(isInViewportVisible($(this.slides[ this.activeIndex ]))) {
995                            var video = this.slides[ this.activeIndex ].querySelector('video');
996                            if (video && video.muted) {
997                                video.play();
998                            }
999                        }
1000                    }
1001                }
1002            });
1003            self.swipers.push(swiper);
1004            $el.attr('data-swiper-index', swiperIndex);
1005            swiperIndex++;
1006        });
1007
1008        $('.show-on-the-road-bd-game-swiper').each(function () {
1009            var $el = $(this);
1010            if ($el.hasClass('swiper-container-initialized')) {
1011                return;
1012            }
1013            var swiper = new Swiper($el[0], {
1014                pagination: {
1015                    el: $el.find('.swiper-pagination')[0],
1016                    clickable: true
1017                },
1018                // autoHeight: true,
1019                // breakpoints: {
1020                //     768: {
1021                //         autoHeight: false
1022                //     }
1023                // },
1024                spaceBetween: 0,
1025                roundLengths: true,
1026                simulateTouch: false,
1027                centerInsufficientSlides: true,
1028                slidesPerView: 1,
1029                navigation: {
1030                    nextEl: $el.find('.slide-right-arrow')[0],
1031                    prevEl: $el.find('.slide-left-arrow')[0],
1032                },
1033                on: {
1034                    init: function(){
1035                        var tweenScroll = TweenMax.fromTo($el.find('.swiper-slide-active'), 3, {autoAlpha: 0, x: self.getWindowOuterWidth() / 2}, {autoAlpha: 1, x: 0, ease: Power4.easeOut});
1036                        new ScrollMagic.Scene({
1037                            triggerElement: $el.closest('.show-on-the-road-slideshow-wrapper')[0],
1038                            triggerHook: 'onEnter',
1039                            reverse: false,
1040                            duration: 0,
1041                        })
1042                        .setTween(tweenScroll)
1043                        .addTo(self.controller);
1044                        
1045                        self.addResizeCallback(function(){
1046                            var windowWidth = $(window).width();
1047                            $el.find('slide img').each(function (index, img) {
1048                                if($(img).closest('.overlay-item').length > 0) {
1049                                    return;
1050                                }
1051                                if(windowWidth > 860) {
1052                                    var width = parseInt($(img).data('width'));
1053                                    $(img).parent().css( "width",  Math.floor(width/860 * 1000) + "px" );
1054                                }
1055                            });
1056                        });
1057                    },
1058                },
1059            });
1060            self.swipers.push(swiper);
1061            $el.attr('data-swiper-index', swiperIndex);
1062
1063
1064        });
1065    }
1066
1067    LRH2023.prototype.initEventIntroVideos = function () {
1068        var self = this;
1069        var introNewYearInited = false;
1070
1071        self.addResizeCallback(function(){
1072            var duration = "100%";
1073            if(self.isMobile()) {
1074                duration = "60%";
1075            }
1076            self.addResizeScene(
1077                new ScrollMagic.Scene({
1078                    triggerElement: '.year-end-2023-intro-new-year--trigger',
1079                    triggerHook: 'onLeave',
1080                    offset: -100,
1081                    duration: duration,
1082                })
1083                .setPin('.year-end-2023-intro-new-year--wrapper', {
1084                    pushFollowers: false,
1085                })
1086                .addTo(self.controller)
1087            );
1088        });
1089
1090        new ScrollMagic.Scene({
1091            triggerElement: '.year-end-2023-intro-new-year--trigger',
1092            triggerHook: 'onEnter',
1093            duration: "100%",
1094        })
1095        .on("start", function (event) {
1096            if(introNewYearInited) {
1097                document.querySelector('.year-end-2023-intro-new-year video').currentTime = 0;
1098                document.querySelector('.year-end-2023-intro-new-year video').play();
1099                return;
1100            }
1101            introNewYearInited = true;
1102            var src = "https://d1en0cs4s0ez90.cloudfront.net/hls/scientology/en/year-in-review-2023/new-years-2022-stage";
1103            videojs($('.year-end-2023-intro-new-year video')[0], { controls: false, muted: true, autoplay: true, loop: false }).ready(function () {
1104                this.src([
1105                    // doesnt play in firefox
1106                    // { src: src + '-av1.mkv', type: 'video/mp4; codecs="av01.0.05M.08,opus"' },
1107                    { src: src + '.webm', type: 'video/webm; codecs="vp9"' },
1108                    { src: src + '-h265.mp4', type: 'video/mp4; codecs="hvc1"' },
1109                    { src: src + '.mp4?1', type: 'video/mp4; codecs="avc1"' }
1110                ]);
1111                var player = this;
1112                player.el().querySelector('video').addEventListener("error", (event) => {
1113                    player.src([
1114                        { src: src + '.mp4?1', type: 'video/mp4; codecs="avc1"' }
1115                    ]);
1116                    player.play();
1117                  }, { once: true });
1118                TweenMax.to(this.el_, 0.5, {autoAlpha: 1, ease: Power4.easeOut});
1119            });
1120        })
1121        .addTo(self.controller);
1122
1123        var tweenIntroFadeout = TweenMax.to('.year-end-2023-intro-new-year--wrapper .show-on-the-road-intro-video-dim', 1, {opacity: 0.7});
1124        new ScrollMagic.Scene({
1125            triggerElement: '.year-end-2023-intro-new-year--fade-trigger',
1126            triggerHook: 'onLeave',
1127            duration: 0,
1128        })
1129        .setTween(tweenIntroFadeout)
1130        .addTo(self.controller);
1131        // 
1132
1133        self.addResizeCallback(function(){
1134            var duration = "100%";
1135            if(self.isMobile()) {
1136                duration = "60%";
1137            }
1138            self.addResizeScene(
1139                new ScrollMagic.Scene({
1140                    triggerElement: '.year-end-2023-intro-march13--trigger',
1141                    triggerHook: 'onLeave',
1142                    offset: -100,
1143                    duration: duration,
1144                })
1145                .setPin('.year-end-2023-intro-march13--wrapper', {
1146                    pushFollowers: false,
1147                })
1148                .addTo(self.controller)
1149            );
1150        });
1151
1152        var tweenIntroFadeout2 = TweenMax.to('.year-end-2023-intro-march13--wrapper .show-on-the-road-intro-video-dim', 1, {opacity: 0.7});
1153        new ScrollMagic.Scene({
1154            triggerElement: '.year-end-2023-intro-march13--fade-trigger',
1155            triggerHook: 'onLeave',
1156            duration: 0,
1157        })
1158        .setTween(tweenIntroFadeout2)
1159        .addTo(self.controller);
1160
1161        var introMarch13 = false;
1162        new ScrollMagic.Scene({
1163            triggerElement: '.year-end-2023-intro-march13',
1164            triggerHook: 'onEnter',
1165            duration: "100%",
1166        })
1167        .on("start", function (event) {
1168            if(introMarch13) {
1169                document.querySelector('.year-end-2023-intro-march13 video').currentTime = 0;
1170                document.querySelector('.year-end-2023-intro-march13 video').play();
1171                return;
1172            }
1173            introMarch13 = true;
1174            var src = "https://d1en0cs4s0ez90.cloudfront.net/hls/scientology/en/year-in-review-2023/march13-stage";
1175            videojs($('.year-end-2023-intro-march13 video')[0], { controls: false, muted: true, autoplay: true, loop: false }).ready(function () {
1176                this.src([
1177                    // doesnt play in firefox
1178                    // { src: src + '-av1.mkv', type: 'video/mp4; codecs="av01.0.05M.08,opus"' },
1179                    { src: src + '.webm', type: 'video/webm; codecs="vp9"' },
1180                    { src: src + '-h265.mp4', type: 'video/mp4; codecs="hvc1"' },
1181                    { src: src + '.mp4?1', type: 'video/mp4; codecs="avc1"' }
1182                ]);
1183                var player = this;
1184                player.el().querySelector('video').addEventListener("error", (event) => {
1185                    player.src([
1186                        { src: src + '.mp4?1', type: 'video/mp4; codecs="avc1"' }
1187                    ]);
1188                    player.play();
1189                  }, { once: true })
1190                TweenMax.to(this.el_, 0.5, {autoAlpha: 1, ease: Power4.easeOut});
1191            });
1192        })
1193        .addTo(self.controller);   
1194
1195        // 
1196
1197
1198        var tweenIntroFadeout3 = TweenMax.to('.year-end-2023-intro-march13-21--wrapper .show-on-the-road-intro-video-dim', 1, {opacity: 0.7});
1199        new ScrollMagic.Scene({
1200            triggerElement: '.year-end-2023-intro-march13-21--fade-trigger',
1201            triggerHook: 'onLeave',
1202            duration: 0,
1203        })
1204        .setTween(tweenIntroFadeout3)
1205        .addTo(self.controller);
1206
1207        var introMarch13_2021 = false;
1208        new ScrollMagic.Scene({
1209            triggerElement: '.year-end-2023-intro-march13-21',
1210            triggerHook: 'onEnter',
1211            duration: "100%",
1212        })
1213        .on("start", function (event) {
1214            if(introMarch13_2021) {
1215                document.querySelector('.year-end-2023-intro-march13-21 video').currentTime = 0;
1216                document.querySelector('.year-end-2023-intro-march13-21 video').play();
1217                return;
1218            }
1219            introMarch13_2021 = true;
1220            var src = "https://d1en0cs4s0ez90.cloudfront.net/hls/scientology/en/year-in-review-2023/lrh-2021-stage";
1221            videojs($('.year-end-2023-intro-march13-21 video')[0], { controls: false, muted: true, autoplay: true, loop: false }).ready(function () {
1222                this.src([
1223                    { src: src + '.webm', type: 'video/webm; codecs="vp9"' },
1224                    { src: src + '-h265.mp4', type: 'video/mp4; codecs="hvc1"' },
1225                    { src: src + '.mp4?1', type: 'video/mp4; codecs="avc1"' }
1226                ]);
1227                var player = this;
1228                player.el().querySelector('video').addEventListener("error", (event) => {
1229                    player.src([
1230                        { src: src + '.mp4?1', type: 'video/mp4; codecs="avc1"' }
1231                    ]);
1232                    player.play();
1233                  }, { once: true })
1234                TweenMax.to(this.el_, 0.5, {autoAlpha: 1, ease: Power4.easeOut});
1235            });
1236        })
1237        .addTo(self.controller);   
1238
1239        self.addResizeCallback(function(){
1240            var duration = "80%";
1241            if(self.isMobile()) {
1242                duration = "60%";
1243            }
1244            self.addResizeScene(
1245                new ScrollMagic.Scene({
1246                    triggerElement: '.year-end-2023-intro-march13-21--trigger',
1247                    triggerHook: 'onLeave',
1248                    offset: -100,
1249                    duration: duration,
1250                })
1251                .setPin('.year-end-2023-intro-march13-21--wrapper', {
1252                    pushFollowers: false,
1253                })
1254                .addTo(self.controller)
1255            );
1256        });
1257    }
1258
1259    LRH2023.prototype.initMainMenu = function () {
1260        var self = this;
1261        var anchors = [];
1262        var lastHashId = "";
1263        self.startAnchorLoad = new Date().getTime();
1264        $('.show-on-the-road--menuitem, .show-on-the-road--primary-menu-logo').each(function (index) {
1265            var $link = $(this).find('a');
1266            if($(this)[0].tagName == "A") {
1267                $link = $(this);
1268            }
1269            var id = $link.attr('href').replace('#', '');
1270            var $el = $('#' + id);
1271            if($el.length == 0) {
1272                return;
1273            }
1274            var triggerElement = $el[0];
1275            anchors.push(id);
1276
1277            self.activeShareImageIndex = 0;
1278
1279            // $(window).scroll(function(){
1280            //     // special case for beginning
1281            //     if(self.activeShareImageIndex != 0 && $(window).scrollTop() < 700 && !self.videoSelected()) {
1282            //         self.updateUrlHash(anchors[0]);
1283            //     }
1284            // })
1285
1286            new ScrollMagic.Scene({ triggerElement: triggerElement, triggerHook: 0.5, reverse: true, duration: 0 })
1287                .on("start", function (event) {
1288                    var id = $el.attr('id');
1289                    var $parent = $('.show-on-the-road--menuitem [href="#' + id + '"]').parent();
1290                    if($parent.hasClass('show-on-the-road--menuitem')) {
1291                        $('.show-on-the-road--menuitem__active').removeClass('show-on-the-road--menuitem__active');
1292                        $parent.addClass('show-on-the-road--menuitem__active');
1293                        $('.year-review-2021--mobile-menuitem-link[href="#' + id + '"]').addClass('show-on-the-road--menuitem__active');
1294                        // self.updateMobileMenu();
1295                    }
1296
1297                    // if(!self.videoSelected()) {
1298                    //     self.updateUrlHash(id);
1299                    //     lastHashId = id;
1300                    // }
1301                    history.replaceState(null, null, window.location.pathname);
1302                })
1303
1304                .on("leave", function (event) {
1305                    if (event.state == "BEFORE" && event.scrollDirection == "REVERSE") {
1306                        var id = $el.attr('id');
1307                        var $parent = $('.show-on-the-road--menuitem [href="#' + id + '"]').parent()
1308                        var $prev = $parent.prev();
1309                        $('.show-on-the-road--menuitem__active').removeClass('show-on-the-road--menuitem__active');
1310                        if($prev.length > 0 && $prev.hasClass('show-on-the-road--menuitem')) {
1311                            $prev.addClass('show-on-the-road--menuitem__active');
1312                            // self.updateMobileMenu();
1313                            $('.year-review-2021--mobile-menuitem-link[href="#' + id + '"]').parent().prev().find('a').addClass('show-on-the-road--menuitem__active');
1314                        }
1315                        // if(!self.videoSelected() && index > 0) {
1316                        //     self.updateUrlHash(anchors[index-1]);
1317                        //     return;
1318                        // }
1319                    }
1320
1321                    history.replaceState(null, null, window.location.pathname);
1322
1323                    // if(!self.videoSelected()) {
1324                    //     self.updateUrlHash(id);
1325                    // }
1326                })
1327                // .addIndicators() // add indicators (requires plugin)
1328                .addTo(self.controller);
1329        });
1330        // if(self.videoSelected()) {
1331        //     self.updateUrlHash(window.location.hash.replace("#", ""));
1332        // } else if(lastHashId) {
1333        //     self.updateUrlHash(lastHashId);
1334        // }
1335
1336        $('.year-review-2021--mobile-menuitem').click(function(){
1337            $('.year-review-2021-mobile-menu').removeClass('year-review-2021-mobile-menu__visible');
1338        });
1339
1340        $('.show-on-the-road--menuitem-link__mobile-overlay').click(function(event){
1341            if($(window).width() > 992) {
1342                return;
1343            }
1344
1345            event.preventDefault();
1346            event.stopPropagation();
1347
1348            trackEvent("Menu", "Opened");
1349
1350            $('.year-review-2021-mobile-menu').toggleClass('year-review-2021-mobile-menu__visible');
1351        });
1352
1353        $('.year-review-2021-mobile-menu--close').click(function(){
1354            $('.year-review-2021-mobile-menu').removeClass('year-review-2021-mobile-menu__visible');
1355        });
1356    }
1357
1358
1359    LRH2023.prototype.initScrollPosition = function () {
1360        var self = this;
1361        self.calculateSectionSize();
1362        var halfScreen = $(window).height() * 0.5;
1363        $(window).resize(function(){
1364            self.calculateSectionSize();
1365            halfScreen = $(window).height() * 0.5;
1366        });
1367
1368        $(window).scroll(function(){
1369            var scrollTop = window.scrollY + halfScreen;
1370            var activeSection = self.sections[ self.sections.length - 1 ];
1371            var foundSection = false;
1372            for (var index = 0; index < self.sections.length; index++) {
1373                var section = self.sections[index];
1374                if(section.start <= scrollTop && scrollTop < section.end) {
1375                    foundSection = true;
1376                    activeSection = self.sections[ index ];
1377                    break;
1378                }
1379            }
1380
1381            if(!foundSection) {
1382                TweenMax.set('.show-on-the-road--primary-menu__progress', {scaleX: 0});
1383                return;
1384            }
1385
1386            var activeSectionProgress = (scrollTop - activeSection.start) / (activeSection.end - activeSection.start);
1387            var totalProgress;
1388            var totalProgressW = 0;
1389            if(self.isMobile()) {
1390                totalProgress = activeSectionProgress;
1391            } else {
1392                for (var index = 0; index < self.sections.length; index++) {
1393                    var section = self.sections[index];
1394                    if(section.start < activeSection.start) {
1395                        totalProgressW += section.width;
1396                    }
1397                }
1398
1399                totalProgressW += activeSectionProgress * activeSection.width;
1400                totalProgress = totalProgressW / $('.show-on-the-road--primary-menu').width();
1401            }
1402            if(totalProgress > 1) {
1403                totalProgress = 1;
1404            }
1405            
1406            TweenMax.set('.show-on-the-road--primary-menu__progress', {scaleX: totalProgress});
1407        });
1408    }
1409
1410    LRH2023.prototype.fadeInBubble = function () {
1411
1412        // new ScrollMagic.Scene({ triggerElement: '.year-end-2021--ideal-churches', triggerHook: 0.5, reverse: false })
1413        //     .on("start", function (event) {
1414        $('.enlightenment-launcher-container').addClass('enlightenment-launcher-container__opened');
1415        TweenLite.from($('.enlightenment-launcher-container'), 0.75, { width: 24, ease: Power4.easeInOut });
1416        TweenLite.to($('.enlightenment-launcher-container'), 0.75, { opacity: 1, clearProps: 'width', ease: Power4.easeInOut });
1417
1418        setTimeout(function () {
1419            $('.enlightenment-launcher-container').removeClass('enlightenment-launcher-container__opened');
1420        }, 10000);
1421            // })
1422            // .addTo(this.controller);
1423    }
1424
1425
1426    LRH2023.prototype.calculateSectionSize = function () {
1427        var sections = [];
1428        var start = 0;
1429        var isMobile = this.isMobile();
1430        $('.show-on-the-road--menuitem').each(function (index) {
1431            var $el = $(this);
1432            var margin = parseInt($el.css("paddingRight").replace('px', '')) * 2;
1433            if(isNaN(margin)) {
1434                margin = 0;
1435            }
1436            var width = $el.width() + margin;
1437            // length = $($el.find('a').attr('href')).offset().top;
1438            var end = 0;
1439            if($el.next().length > 0 && $el.next().find('a').length > 0) {
1440                end = $($el.next().find('a').attr('href')).offset().top;
1441            } else {
1442                end = $('.end-of-article').offset().top;
1443            }
1444            if(isMobile) {
1445                width = $(window).width();
1446            }
1447            if(start == 0) {
1448                start = $($el.find('a').attr('href')).offset().top;
1449            }
1450            sections.push({
1451                start: start,
1452                end: end,
1453                width: width,
1454            });
1455            start = end;
1456        });
1457        this.sections = sections;
1458    }
1459
1460
1461    LRH2023.prototype.initGrowingLines = function () {
1462        var self = this;
1463
1464        $('.show-on-the-road-glow-line').each(function () {
1465            // var $el = $(this);
1466            var tween = TweenMax.from(this, 0.7, { height: 0 });
1467            new ScrollMagic.Scene({ triggerElement: this, triggerHook: "onEnter", reverse: true, offset: 100, duration: 0 })
1468                .setTween(tween)
1469                .setClassToggle(this, 'show-on-the-road-glow-line__visible')
1470                .addTo(self.controller);
1471        });
1472
1473        $('.slideshow-vertical-line--inner').each(function () {
1474            var $el = $(this);
1475            var tween = TweenMax.from(this, 0.7, { scaleY: 0 });
1476            new ScrollMagic.Scene({ triggerElement: this, triggerHook: 1, reverse: true, offset: 80, duration: 0 })
1477                .setTween(tween)
1478                .setClassToggle(this, 'visible')
1479                // .addIndicators() // add indicators (requires plugin)
1480                .addTo(self.controller);
1481        });
1482    }
1483
1484    LRH2023.prototype.updateCache = function () {
1485        window.LRH2023.cachedPageHeight = $(document).height();
1486        window.LRH2023.cachedWindowHeight = $(window).height();
1487        window.LRH2023.cachedOuterWindowWidth = $(window).outerWidth();
1488        window.LRH2023.cachedOuterWindowHeight = $(window).outerHeight();
1489    }
1490
1491    LRH2023.prototype.addResizeCallback = function (callback) {
1492        this.resizeEvents.push(callback);
1493        callback();
1494    }
1495
1496    LRH2023.prototype.addResizeScene = function (resizeScenes) {
1497        this.resizeScenes.push(resizeScenes);
1498    }
1499
1500    LRH2023.prototype.resizeDynamicScenes = function () {
1501        var self = this;
1502
1503        if(self.resizedFinished) {
1504            clearTimeout(self.resizedFinished);
1505        }
1506
1507        if(self.lastResizedWidth != $(window).width() || self.lastResizedHeight != $(window).height()) {
1508            self.lastResizedWidth = $(window).width();
1509            self.lastResizedHeight = $(window).height()
1510        } else {
1511            return;
1512        }
1513
1514        self.resizedFinished = setTimeout(function(){
1515            for (var index = 0; index < self.resizeScenes.length; index++) {
1516                var scene = self.resizeScenes[index];
1517                scene.progress(0);
1518                scene.destroy(true);
1519            }
1520
1521            self.resizeScenes = [];
1522
1523            for (var index = 0; index < self.resizeEvents.length; index++) {
1524                self.resizeEvents[index]();
1525            }
1526        }, 500);
1527    }
1528    
1529    LRH2023.prototype.initNav = function () {
1530        var self = this;
1531
1532        // new ScrollMagic.Scene({ triggerElement: ".year-review-2022--top-wrapper", triggerHook: "onLeave", reverse: true })
1533        //     .setClassToggle('.year-review-2021-nav', 'year-review-2022-nav__visible')
1534        //     .addTo(self.controller);
1535
1536        $('.year-review-2021-nav').addClass('year-review-2022-nav__visible');
1537
1538
1539        $('.year-review-2021-nav__up').click(function () {
1540            window.history.replaceState({}, '', "#");
1541            if (self.prevInset()) {
1542                return;
1543            }
1544
1545            if (typeof self.activeStepIndex == "undefined") {
1546                var index = 0;
1547            } else {
1548                var index = self.activeStepIndex - 1;
1549            }
1550            if (self.scrollToIndex > -1) {
1551                index = self.scrollToIndex - 1;
1552            }
1553
1554            var duration = $(this).data('duration');
1555
1556            var $lastInset = self.getLastInsetFor(index);
1557            if ($lastInset) {
1558                self.scrollToElement($lastInset, duration);
1559            } else {
1560                // self.jumpToOrg(index);
1561                self.lastScrollAnimation = TweenMax.to(window, 2, {
1562                    scrollTo: {
1563                        y: 0,
1564                    },
1565                });
1566            }
1567
1568        });
1569
1570        $('.year-review-2021-nav__down, .show-on-road--bounce').click(function () {
1571            self.scrollToElement($('.year-review-2023-arrow-stop-point'))
1572        });
1573
1574        $('.year-review-2021-nav__down').click(function () {
1575            window.history.replaceState({}, '', "#");
1576            if (self.nextInset()) {
1577                return;
1578            }
1579            if (typeof self.activeStepIndex == "undefined") {
1580                var index = 0;
1581            } else {
1582                var index = self.activeStepIndex + 1;
1583            }
1584            if (self.scrollToIndex > -1) {
1585                index = self.scrollToIndex + 1;
1586            }
1587        });
1588    }
1589
1590    LRH2023.prototype.prevInset = function () {
1591        var self = this;
1592        var $insets = $('.year-review-2023-step');
1593        if ($insets.length == 0) {
1594            return false;
1595        }
1596        
1597        var activeInsetIndex = -1;
1598        var scrollTop = $(window).scrollTop();
1599        var windowHeight = $(window).height();
1600        var $activeInset;
1601
1602        $insets.each(function (index, inset) {
1603            var $inset = $(inset);
1604            var alignBottom = $inset.data('align-bottom');
1605            var offset = 200;
1606            if($inset.data("offset")) {
1607                offset = parseInt($inset.data("offset"));
1608            }
1609            // if(alignBottom) {
1610            //     if ($inset.offset().top + offset < scrollTop + windowHeight) {
1611            //         $activeInset = $inset;
1612            //         activeInsetIndex = index;
1613            //     }
1614            // }
1615            // if ($inset.offset().top + offset < scrollTop) {
1616            //     $activeInset = $inset;
1617            //     activeInsetIndex = index;
1618            // }
1619
1620            if (self.getScrollPosition($inset) + 70 < scrollTop) {
1621                $activeInset = $inset;
1622                activeInsetIndex = index;
1623            }
1624        });
1625
1626        console.log('$activeInset',$activeInset);
1627
1628        var $target;
1629
1630        // did not scroll past first inset, go to it
1631        if (activeInsetIndex == -1) {
1632            // $target = $($insets[0]);
1633            return false;
1634        } else if (activeInsetIndex == 0) {
1635            $target = $('.year-review-2023-step').first();
1636        } else if (activeInsetIndex - 1 < 0) {
1637            return false;
1638        } else {
1639            $target = $($insets[activeInsetIndex]);
1640        }
1641
1642        var duration = $target.data('duration');
1643
1644        self.scrollToElement($target, duration);
1645
1646        return true;
1647    }
1648
1649    LRH2023.prototype.nextInset = function () {
1650        var self = this;
1651        var $insets = $('.year-review-2023-step');
1652        if ($insets.length == 0) {
1653            return false;
1654        }
1655        var $activeInset;
1656        var activeInsetIndex = 0;
1657        var scrollTop = $(window).scrollTop();
1658
1659        var windowHeight = $(window).height();
1660
1661        
1662        $insets.each(function (index, inset) {
1663            if($activeInset) {
1664                return;
1665            }
1666            var $inset = $(inset);
1667            var offset = 200;
1668        
1669            var alignBottom = $inset.data('align-bottom');
1670            if(typeof $inset.data('offset') != "undefined") {
1671                offset = parseInt($inset.data('offset'));
1672            }
1673
1674            if (self.getScrollPosition($inset) - 10 > scrollTop) {
1675                $activeInset = $inset;
1676                activeInsetIndex = index;
1677            }
1678        });
1679
1680        var $target;
1681
1682        // did not scroll past first inset, go to it
1683        if (!$activeInset) {
1684            if(window.scrollY > 2000) {
1685                return;
1686            }
1687            $target = $($insets[0]);
1688        } else {
1689            $target = $activeInset;
1690        }
1691
1692        var duration = $target.data('duration');
1693        self.scrollToElement($target, duration);
1694
1695        return true;
1696    }
1697
1698    LRH2023.prototype.initSliderImages = function () {
1699        var self = this;
1700        $('.show-on-the-road--carousel-images').each(function () {
1701            var $row = $(this);
1702            var startX = parseInt($row.data('start-x'));
1703            var endX = parseInt($row.data('end-x'));
1704
1705            if(self.isMobile() && !self.isIphone()) {
1706                this.scrollLeft = startX;
1707                $row.addClass('show-on-the-road--carousel-images__mobile');
1708                return;
1709            }
1710
1711            var itemWidth = $row.children().first().width() + 18;
1712
1713            var rowWidth = $row.children().length * itemWidth;
1714
1715            var directionLeft = endX < startX
1716            if(directionLeft) {
1717                var distance = startX - endX;
1718                if(rowWidth < $(window).width()) {
1719                    endX = ($(window).width() - rowWidth) / 2;
1720                    startX = endX + distance;
1721                }
1722            } else {
1723                var distance = endX - startX;
1724                if(rowWidth < $(window).width()) {
1725                    endX = $(window).width() - ($(window).width() - rowWidth) / 2 - rowWidth;
1726                    startX = endX - distance;
1727                }
1728            }
1729
1730            // if(self.isMobile()) {
1731            //     if(directionLeft) {
1732            //         endX = (endX - startX) * 0.25;
1733            //     } else {
1734            //         endX = (startX - endX) * 0.25;
1735            //     }
1736            // }
1737
1738            var element = this;
1739            self.addResizeCallback(function(){
1740                var tween = TweenMax.fromTo(element, 0.7, { x: startX }, { x: endX, ease:Linear.easeNone });
1741                self.addResizeScene(
1742                    new ScrollMagic.Scene({ triggerElement: element, triggerHook: 'onEnter', reverse: true, duration: self.getWindowHeight() * 1.5 })
1743                    .setTween(tween)
1744                    // .addIndicators() // add indicators (requires plugin)
1745                    .addTo(self.controller)
1746                );
1747            });
1748
1749        });
1750    }
1751
1752    LRH2023.prototype.scrollToElement = function (el, duration) {
1753        var self = this;
1754        if (self.lastScrollAnimation) {
1755            self.lastScrollAnimation.pause();
1756        }
1757
1758        var id = el.attr('id');
1759        var alignBottom = el.data('align-bottom');
1760        var dur = 2;
1761        var ease = Power4.easeInOut;
1762
1763        if(duration) {
1764            dur = duration / 1000;
1765        }
1766
1767        var scrollingDown = el.offset().top - window.scrollY > 0;
1768
1769        var topSpace = 66;
1770        var bottomAligner = 20;
1771        if(typeof el.data("top") != "undefined") {
1772            topSpace = parseInt(el.data("top"));
1773            bottomAligner = parseInt(el.data("top"));
1774        }
1775
1776        if(typeof el.data("ease") != "undefined") {
1777            ease = Power4.easeOut;
1778        }
1779
1780        if(typeof el.data("easein") != "undefined") {
1781            ease = Power4.easeInOut;
1782        }
1783
1784
1785       if(alignBottom) {
1786            self.lastScrollAnimation = TweenMax.to(window, dur, {
1787                scrollTo: {
1788                    y: el.offset().top + bottomAligner - $(window).height(),
1789                },
1790                ease: ease,
1791            });
1792        } else {
1793            self.lastScrollAnimation = TweenMax.to(window, dur, {
1794                scrollTo: {
1795                    y: el.offset().top - topSpace,
1796                },
1797                ease: ease,
1798            });
1799        }
1800    }
1801
1802    LRH2023.prototype.isQualifyedStopPoint = function (el) {
1803        var nextScrollY = this.getScrollPosition(el);
1804        console.log('window.scrollY + 10',window.scrollY + 10, nextScrollY);
1805        return window.scrollY + 10 < nextScrollY;
1806    }
1807
1808    LRH2023.prototype.getScrollPosition = function (el) {
1809        var self = this;
1810        if (self.lastScrollAnimation) {
1811            self.lastScrollAnimation.pause();
1812        }
1813
1814        var id = el.attr('id');
1815        var alignBottom = el.data('align-bottom');
1816        var ease = Power4.easeInOut;
1817
1818        var scrollingDown = el.offset().top - window.scrollY > 0;
1819
1820        var topSpace = 66;
1821        var bottomAligner = 20;
1822        if(typeof el.data("top") != "undefined") {
1823            topSpace = parseInt(el.data("top"));
1824            bottomAligner = parseInt(el.data("top"));
1825        }
1826
1827        if(typeof el.data("ease") != "undefined") {
1828            ease = Power4.easeOut;
1829        }
1830
1831        if(typeof el.data("easein") != "undefined") {
1832            ease = Power4.easeInOut;
1833        }
1834
1835
1836        if(alignBottom) {
1837            return el.offset().top + bottomAligner - $(window).height();
1838        }
1839        return el.offset().top - topSpace;
1840    }
1841
1842    LRH2023.prototype.prepareMobileCaptions = function () {
1843        $('.inline-slideshow-slide-container').each(function () {
1844            var $el = $(this);
1845            var $items = $el.find('slide > .text-item, .overlay-item > .floater-texter');
1846            for (var index = 0; index < $items.length; index++) {
1847                var $item = $($items[index]);
1848                var newElement = document.createElement("DIV");
1849                newElement.classList.add('inline-slideshow-slide--mobile-caption');
1850                newElement.innerHTML = $item.html();
1851                if($item.hasClass('text-item')) {
1852                    newElement.classList.add('inline-slideshow-slide--mobile-caption__text-item');
1853                }
1854                if($item.hasClass('floater-texter')) {
1855                    newElement.classList.add('inline-slideshow-slide--mobile-caption__floater');
1856                }
1857                $el.append(newElement);
1858            }
1859        });
1860    }
1861
1862    LRH2023.prototype.initSlideSpacing = function () {
1863        var self = this;
1864        self.addResizeCallback(function(){
1865            var isMobile = self.isMobile();
1866            $('.inline-slideshow-slide-container').each(function () {
1867                var $el = $(this);
1868                var $slide = $el.find('slide');
1869                if(!self.isMobile()) {
1870                    $el.find('.inline-slideshow-slide').css('height', '');
1871                    return;
1872                }
1873    
1874                var topMostY = 999;
1875                var bottomMostY = 0;
1876                $slide.find('> .item').each(function () {
1877                    if(isMobile && $(this).hasClass('text-item')) {
1878                        return;
1879                    }
1880                    if(!$(this).is(':visible')) {
1881                        return;
1882                    }
1883                    var top = $(this).position().top;
1884                    if(top < topMostY) {
1885                        topMostY = top;;
1886                    }
1887                    var bottom = $(this).position().top + $(this).height();
1888                    if(bottom > bottomMostY) {
1889                        bottomMostY = bottom;
1890                    }
1891                });
1892    
1893                var newHeight = bottomMostY - topMostY;
1894    
1895                $el.find('.inline-slideshow-slide').css('height', newHeight + 'px');
1896                $slide.css('margin-top', -topMostY + 'px');
1897            });
1898        });
1899    }
1900
1901    LRH2023.prototype.initTopHeader = function () {
1902        var self = this;
1903        new ScrollMagic.Scene({
1904            triggerElement: '.lrh-2023-parallax-container',
1905            triggerHook: 'onLeave',
1906            duration: '100%'
1907          })
1908          .setTween(TweenMax.fromTo('.layer1', 1, { y: '-50%' }, { y: '50%' }))
1909          .addTo(self.controller);
1910          
1911          new ScrollMagic.Scene({
1912            triggerElement: '.lrh-2023-parallax-container',
1913            triggerHook: 'onLeave',
1914            duration: '100%'
1915          })
1916          .setTween(TweenMax.fromTo('.layer2', 1, { y: '-30%' }, { y: '30%' }))
1917          .addTo(self.controller);
1918          
1919          new ScrollMagic.Scene({
1920            triggerElement: '.lrh-2023-parallax-container',
1921            triggerHook: 'onLeave',
1922            duration: '100%'
1923          })
1924          .setTween(TweenMax.fromTo('.layer3', 1, { y: '20%' }, { y: '10%' }))
1925          .addTo(self.controller);
1926    }
1927
1928    LRH2023.prototype.initFloats = function () {
1929        var self = this;
1930
1931        $('slide .item, .slideshow-floater').each(function () {
1932            var $el = $(this);
1933            var triggerElement = this;
1934
1935            var tween = TweenMax.from(this, 0.5, { y: 50, offset: 200, autoAlpha: 0, ease: Power4.easeOut });
1936            new ScrollMagic.Scene({ triggerElement: triggerElement, triggerHook: 1, reverse: true, duration: 0 })
1937                .setTween(tween)
1938                .setClassToggle(this, 'visible')
1939                // .addIndicators() // add indicators (requires plugin)
1940                .addTo(self.controller);
1941        });
1942
1943        $('.show-on-the-road--float-bottom').each(function () {
1944            var $el = $(this);
1945            var yOffset = 50;
1946            var xOffset = 0;
1947            var offset = 100;
1948            var duration = 0.5;
1949            var delay = 0;
1950            var triggerElement = this;
1951
1952            if (typeof $el.data('trigger') != "undefined") {
1953                triggerElement = $el.data('trigger');
1954            }
1955            if (typeof $el.data('yoffset') != "undefined") {
1956                yOffset = $el.data('yoffset');
1957            }
1958            if (typeof $el.data('xoffset') != "undefined") {
1959                xOffset = $el.data('xoffset');
1960            }
1961            if (typeof $el.data('offset') != "undefined") {
1962                offset = $el.data('offset');
1963            }
1964            if (typeof $el.data('duration') != "undefined") {
1965                duration = $el.data('duration');
1966            }
1967            if (typeof $el.data('delay') != "undefined") {
1968                delay = $el.data('delay');
1969            }
1970
1971            var tween = TweenMax.from(this, duration, { delay: delay, y: yOffset, x: xOffset, autoAlpha: 0, ease: Power4.easeOut });
1972            new ScrollMagic.Scene({ triggerElement: triggerElement, triggerHook: 1, reverse: true, offset: offset, duration: 0 })
1973                .setTween(tween)
1974                .setClassToggle(this, 'visible')
1975                // .addIndicators() // add indicators (requires plugin)
1976                .addTo(self.controller);
1977        });
1978    }
1979
1980    LRH2023.prototype.initEndTitles = function () {
1981        var self = this;
1982
1983        var tl = new TimelineMax();
1984        tl.staggerFromTo(document.querySelectorAll('.show-on-the-road-end-subtitle__first .char'), 0.25, {
1985            'will-change': 'opacity',
1986            opacity: 0.1
1987        }, {
1988            ease: 'none',
1989            opacity: 1,
1990        }, 0.01);
1991
1992        new ScrollMagic.Scene({ triggerElement: '.show-on-the-road-end-subtitle__first', triggerHook: 1, offset: 100, reverse: true, duration: 0 })
1993        .setTween(tl)
1994        .addTo(self.controller);
1995
1996        var elements = $('.show-on-the-road-end-container');
1997        _.each(elements, function (element, index) {
1998
1999            if($(element).hasClass('show-on-the-road-end-container__first')) {
2000                return;
2001            }
2002
2003            var duration = "40%";
2004            if(index + 1 == elements.length) {
2005                duration = "70%";
2006            }
2007
2008            var tl = new TimelineMax();
2009            tl.from($(element).find('.show-on-the-road-end-subtitle'), 0.4, { autoAlpha: 0 } );
2010            tl.from($(element).find('.show-on-the-road-end-title'), 0.6, { autoAlpha: 0, scale: 8 }, 0.2 );
2011            tl.from($(element).find('.show-on-the-road-end-image-1'), 0.4, { autoAlpha: 0, scale: 1.2 } );
2012            tl.from($(element).find('.show-on-the-road-end-image-2'), 0.4, { autoAlpha: 0 }, "-=0.2" );
2013
2014            new ScrollMagic.Scene({ triggerElement: element, triggerHook: 0.8, duration: duration})
2015            .setTween(tl)
2016            .addTo(self.controller);
2017        });
2018    }
2019
2020
2021    LRH2023.prototype.getPageHeight = function () {
2022        // called from ScrollMagic
2023        var self = window.LRH2023 || this;
2024        if (!self.cachedPageHeight) {
2025            self.cachedPageHeight = $(document).height();
2026        }
2027        return self.cachedPageHeight;
2028    }
2029
2030    LRH2023.prototype.getWindowHeight = function () {
2031        // called from ScrollMagic
2032        var self = window.LRH2023 || this;
2033        if (!self.cachedWindowHeight) {
2034            self.cachedWindowHeight = $(window).height();
2035        }
2036        return self.cachedWindowHeight;
2037    }
2038
2039    LRH2023.prototype.getWindowOuterWidth = function () {
2040        // called from ScrollMagic
2041        var self = window.LRH2023 || this;
2042        if (!self.cachedOuterWindowWidth) {
2043            self.cachedOuterWindowWidth = $(window).outerWidth();
2044        }
2045        return self.cachedOuterWindowWidth;
2046    }
2047
2048    LRH2023.prototype.isMobile = function () {
2049        return $(window).width() < 767;
2050    }
2051
2052    LRH2023.prototype.isAndroid = function () {
2053        var ua = navigator.userAgent.toLowerCase();
2054        var isAndroid = ua.indexOf("android") > -1;
2055        return isAndroid;
2056    }
2057
2058    LRH2023.prototype.isIpod = function () {
2059        var ua = navigator.userAgent.toLowerCase();
2060        var isIpod = ua.indexOf("ipod") > -1;
2061        return isIpod;
2062    }
2063
2064    LRH2023.prototype.isIphone = function () {
2065        var ua = navigator.userAgent.toLowerCase();
2066        var isIpod = ua.indexOf("iphone") > -1;
2067        return isIpod;
2068    }
2069
2070    $.fn.getTextWidth = function() {
2071        var spanText = $("BODY #spanCalculateTextWidth");
2072    
2073        if (spanText.length <= 0) {
2074          spanText = $("<span id='spanCalculateTextWidth' style='filter: alpha(0);'></span>");
2075          spanText.appendTo("BODY");
2076        }
2077    
2078        var valu = this.val();
2079        if (!valu) valu = this.text();
2080    
2081        spanText.text(valu);
2082    
2083        spanText.css({
2084          "fontSize": this.css('fontSize'),
2085          "fontWeight": this.css('fontWeight'),
2086          "fontFamily": this.css('fontFamily'),
2087          "position": "absolute",
2088          "top": 0,
2089          "opacity": 0,
2090          "left": -2000
2091        });
2092    
2093        return spanText.outerWidth() + parseInt(this.css('paddingLeft')) + 'px';
2094      };
2095    
2096      $.fn.getTextHeight = function(width) {
2097        var spanText = $("BODY #spanCalculateTextHeight");
2098    
2099        if (spanText.length <= 0) {
2100          spanText = $("<span id='spanCalculateTextHeight'></span>");
2101          spanText.appendTo("BODY");
2102        }
2103    
2104        var valu = this.val();
2105        if (!valu) valu = this.text();
2106    
2107        spanText.text(valu);
2108    
2109        spanText.css({
2110          "fontSize": this.css('fontSize'),
2111          "fontWeight": this.css('fontWeight'),
2112          "fontFamily": this.css('fontFamily'),
2113          "top": 0,
2114          "left": -1 * parseInt(width) + 'px',
2115          "position": 'absolute',
2116          "display": "inline-block",
2117          "width": width
2118        });
2119    
2120        return spanText.innerHeight() + 'px';
2121      };
2122    
2123      /**
2124       * Adjust the font-size of the text so it fits the container.
2125       *
2126       * @param minSize     Minimum font size?
2127       * @param maxSize     Maximum font size?
2128       * @param truncate    Truncate text after sizing to make sure it fits?
2129       */
2130      $.fn.autoTextSize = function(minSize, maxSize, truncate) {
2131        var _self = this,
2132            _width = _self.innerWidth(),
2133            _textWidth = parseInt(_self.getTextWidth()),
2134            _fontSize = parseInt(_self.css('font-size'));
2135    
2136        while (_width < _textWidth || (maxSize && _fontSize > parseInt(maxSize))) {
2137          if (minSize && _fontSize <= parseInt(minSize)) break;
2138    
2139          _fontSize--;
2140          _self.css('font-size', _fontSize + 'px');
2141    
2142          _textWidth = parseInt(_self.getTextWidth());
2143        }
2144
2145        while (_width > _textWidth + 10 || (maxSize && _fontSize > parseInt(maxSize))) {
2146          if (maxSize && _fontSize >= parseInt(maxSize)) break;
2147    
2148          _fontSize++;
2149          _self.css('font-size', _fontSize + 'px');
2150    
2151          _textWidth = parseInt(_self.getTextWidth());
2152        }
2153    
2154        if (truncate) _self.autoTruncateText();
2155      };
2156
2157
2158    return LRH2023;
2159}())();
2160

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.