').appendTo($slider), $captionRight = $('.caption-right-92106'), ssTitle = ''.trim(), ssDescription = ''.trim(), usingSSTitle = (ssTitle + ssDescription).length, animate = { up: 'animate__animated animate__fadeInUp', left: 'animate__animated animate__slideInLeft', right: 'animate__animated animate__slideInRight', none: 'animate__none' }, getCaption = function($figcaption){ return { video: $figcaption.data('isvideo') || false, title: $figcaption.data('title') || '', description: $figcaption.data('description') || '', byline: $figcaption.data('byline') || '' } }, firstCaption = getCaption($scope.find('figcaption').eq(0)), getCaptionHTML = function(animation, caption) { return ['
', caption.video ? '' : '' , caption.title ? '
' : '' , caption.description ? '
'+caption.description+'
' : '' , caption.byline ? '
'+caption.byline+'
' : '', '
'].join(''); }, populateCaption = function($slide, $clones, animation){ let ani = animation || animate.up; //default up let caption = getCaption($slide.find('figcaption').eq(0)); if(usingSSTitle){ //use the slide area. right area static $slide.find('figcaption').html(getCaptionHTML(ani, caption)); if($clones) $clones.find('figcaption').html(getCaptionHTML(ani, caption)); } else { //use the caption right area let rightAni = window.innerWidth > 991 ? animate.up : ani; //always animate up for desktop for right caption. otherwise use slide direction $captionRight.html(getCaptionHTML(rightAni, caption)); } }, populateSlideCount = function (currentSlide, count) { $slider.find('.flex-control-nav').css('display','none'); $slideCount.html(currentSlide + '/' + count); };; //initial state let initialAnimation = window.innerWidth > 991 ? animate.up : animate.none; //no animatin for initial state on mobile if (usingSSTitle){ $captionRight.html(getCaptionHTML(initialAnimation, {title: ssTitle, description: ssDescription})).addClass('static-caption'); populateCaption($scope.find('li:eq(0)'), null); } else { populateCaption($scope.find('li:eq(0)'), null, initialAnimation); } if (6 > 1) { let animationLoop = window.navigator.userAgent.match(/(MSIE|Trident)/) ? false : true; $slider.flexslider({ slideshowSpeed: 5000, slideshow: true, animationLoop: animationLoop, animation: "slide", controlNav: true, directionNav: true, touch: true, start: function(slider){ if (!showControlNav) populateSlideCount(slider.animatingTo + 1, 6); }, before: function(slider){ let $slide = slider.find('li:not(.clone):eq('+slider.animatingTo +')'); let $clones = slider.find('.clone'); let animation = slider.direction === 'next' ? animate.right : animate.left; populateCaption($slide, $clones, animation); }, after: function(slider){ if (!showControlNav) populateSlideCount(slider.animatingTo + 1, 6); } }); } initDVIDSBackground92106(); initPortraitImages92106(); $(window).load(function () { //flexslider often does a bad calc on the slide width the first try $(window).trigger('resize'); });});function initPortraitImages92106(){ $('#focal-point-side-by-side-hero-wrap-92106').find('figure img').each(function(){ handlePortraits($(this)); function handlePortraits($this){ let img = new Image(); let src = $this[0].src; let $blur = '
'; img.onload = function() { if(this.height > this.width){ $this.closest('picture').addClass('portrait').append($blur); } } img.src = src; } });}/* DVIDS background video */function initDVIDSBackground92106(){ $('#focal-point-side-by-side-hero-wrap-92106').find('.dvids-video-background video').each(function(){ let $this = $(this); const data = $this.data('video'); let sources = ''; let lastIndex = data.results.files.length-1; const bgVideoStart = $this.attr('data-start'); const bgVideoEnd = $this.attr('data-end'); var watchCurrentTime; $this[0].onloadeddata = function(){ $this.closest('picture').find('img, .bg-image-fallback').fadeOut(); }; $this[0].addEventListener('loadedmetadata', function(event) { event.target.currentTime = bgVideoStart; }, false); $this[0].addEventListener('canplay', function (event) { event.target.play(); if(watchCurrentTime) clearInterval(watchCurrentTime); watchCurrentTime = setInterval(function (){ const videoDuration = event.target.duration const videoCurrentTime = event.target.currentTime; const timeDifference = videoDuration - videoCurrentTime; if(videoCurrentTime > bgVideoEnd || event.target.paused){ event.target.currentTime = bgVideoStart; if(event.target.paused) event.target.play(); //IE11 will pause after a half a sec or so if this is in a carousel due to other manipulation so force play return; } }, 1000); }); $this[0].addEventListener('loadedmetadata', function(event) { try { event.target.currentTime = bgVideoStart; } catch (err) { return; } }, false); sources += '