1"use strict"; 2 3jQuery(document).ready(function ($) { 4 var $section = $('.hero-section'); 5 var $videos = $('video', $section); 6 var fields = { 7 'desktop': '.field--name-field-hero-media-desktop', 8 'mobile': '.field--name-field-hero-media-mobile' 9 }; 10 $section.addClass('loaded'); 11 var heroVideoItemHome = localStorage.getItem('heroVideoItemHome') ? localStorage.getItem('heroVideoItemHome') : '0'; 12 13 for (var type in fields) { 14 var $items = $(fields[type], $section).children('.field--item'); 15 var quantity = $items.length; 16 17 if ($videos.length) { 18 if (quantity === 4) { 19 $section.addClass('hero-' + type + '-' + heroVideoItemHome); 20 21 if (heroVideoItemHome === '0') { 22 localStorage.setItem('heroVideoItemHome', '1'); 23 } else { 24 localStorage.setItem('heroVideoItemHome', '0'); 25 } 26 } else { 27 $section.addClass('hero-' + type + '-0'); 28 } 29 } else if (!$videos.length) { 30 if (quantity === 2) { 31 if (heroVideoItemHome === '0') { 32 $section.addClass('hero-' + type + '-3'); 33 localStorage.setItem('heroVideoItemHome', '1'); 34 } else { 35 $section.addClass('hero-' + type + '-4'); 36 localStorage.setItem('heroVideoItemHome', '0'); 37 } 38 } else { 39 $section.addClass('hero-' + type + '-2'); 40 } 41 } 42 } 43 44 if ($videos.length) { 45 $videos.each(function (index, video) { 46 if ($(video).is(":visible")) { 47 video.play(); 48 $(video).on('ended', function () { 49 $section.addClass('video-ended'); 50 }); 51 } 52 }); 53 } else { 54 $section.addClass('video-ended'); 55 } 56});
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.