PageSourceSearch

https://www.tenutadiarceno.com/sites/default/files/js/js_7c9TUpE6RIbqOXmO03JItOtSF_A5FIUTW7Ksbe6slAs.js

js tenutadiarceno.com collected 2026-09-26 13:44:27 UTC 6,665 bytes, 224 lines download raw bytes

1/* eslint-disable */
2(function($, Drupal) {
3  Drupal.behaviors.tdaJqueryScripts = {
4    attach: function(context, settings) {
5      /**
6       * Background video
7       */
8
9      const vidControl = document.getElementById('video-play-pause');
10      const rememberVideoState = $.cookie('TDAVideo');
11      const reduceMotionQuery = window.matchMedia(
12        '(prefers-reduced-motion: reduce)'
13      );
14      const backgroundMedia = document.getElementById('tda-hero-media');
15      const video = document.getElementById('tda-video');
16
17      /**
18       * Play video
19       * @returns {null} nothing to return
20       */
21      function playVid() {
22        const playPromise = video.play();
23        if (playPromise !== undefined) {
24          playPromise
25            .then(_ => {
26              /* Playing the video! */
27              // eslint-disable-next-line no-undef
28              //$.removeCookie('NielsonVideoTime', { path: '/' });
29            })
30            .catch(error => {
31              /* There was an error */
32            });
33        }
34
35        vidControl.innerHTML = "<i class='far fa-pause-circle'></i>";
36        vidControl.title = 'Pause background video';
37        // eslint-disable-next-line no-undef
38        $.cookie('TDAVideo', 'play', { path: '/' });
39      }
40
41      /**
42       * Pause video
43       * @returns {null} nothing to return
44       */
45      function pauseVid(type = null) {
46        video.pause();
47        //const currentTime = video.currentTime;
48        vidControl.innerHTML = "<i class='far fa-play-circle'></i>";
49        vidControl.title = 'Play background video';
50        // eslint-disable-next-line no-undef
51        if(type !== 'mm-pause') {
52          $.cookie('TDAVideo', 'paused', { path: '/' });
53        }
54        // eslint-disable-next-line no-undef
55        //$.cookie('TDAVideoTime', currentTime, { path: '/' });
56      }
57
58      vidControl.addEventListener('click', function () {
59        if (video.paused) {
60          playVid();
61        } else {
62          pauseVid();
63        }
64      });
65
66      /**
67       * Loads the video after the entire page is loaded
68       */
69
70      $(window).bind("load", function() {
71        $(function() {
72
73          // setTimeout(function() {
74          //   backgroundMedia.classList.add('loaded');
75          // }, 500);
76
77          $("video.lazy source").each(function() {
78            $('.video-play-pause').show();
79            var sourceFile = $(this).attr("data-src");
80            $(this).attr("src", sourceFile);
81
82            video.load();
83
84            // if($.cookie("TDAVideoTime")) {
85            //   //console.log("A cookie exists for the time, setting to", $.cookie("TDAVideoTime"));
86            //   video.currentTime = $.cookie("TDAVideoTime");
87            // }
88
89            if(reduceMotionQuery.matches) {
90              //console.log("Reduce motion is on");
91              pauseVid();
92            }
93
94            if(!reduceMotionQuery.matches && (rememberVideoState == undefined || rememberVideoState !== 'paused')) {
95              //console.log("Normal");
96              playVid();
97            }
98            if(rememberVideoState === 'paused') {
99              //console.log("Cookie was set to pause video");
100              pauseVid();
101            }
102
103            if(window.location.pathname === "/jfw-help") {
104              // On the JFW Help page, turn off video
105              pauseVid();
106            }
107
108            if(reduceMotionQuery.matches && rememberVideoState === 'play') {
109              //console.log("Reduce motion is on, but cookie was set to play video");
110              playVid();
111            }
112
113            $('.mobile-menu-button').click(function(){
114              if ($('body').hasClass('has-open-mobile-menu')) {
115                pauseVid('mm-pause');
116                document.addEventListener('keydown', function(e) {
117                  if(e.key === 'Escape') {
118                    if($.cookie('TDAVideo') !== 'paused') {
119                      playVid();
120                    }
121                  }
122                });
123              } else {
124                if($.cookie('TDAVideo') !== 'paused') {
125                  playVid();
126                }
127              }
128            });
129
130          });
131        });
132
133      });
134
135      // Slick Slider
136
137      $('.modal-mobile .field__items', context).once('slickVineyards').each(function () {
138        $('.modal-mobile .field__items').slick({
139          dots: false,
140          arrows: true,
141          slidesToShow: 1,
142          slidesToScroll: 1,
143        });
144      });
145
146      $('.timeline-picker .view__content', context).once('slickTimeline').each(function () {
147        $('.timeline-picker .view__content').slick({
148          dots: false,
149          arrows: true,
150          slidesToShow: 5,
151          slidesToScroll: 5,
152        });
153      });
154
155      $('.wine-teasers .view__content', context).once('slickWines').each(function () {
156        $('.wine-teasers .view__content').slick({
157          dots: false,
158          arrows: true,
159          slidesToShow: 1,
160          slidesToScroll: 1,
161          mobileFirst: true,
162          responsive: [
163            {
164              breakpoint: 640,
165              settings: 'unslick'
166            }
167          ]
168        });
169      });
170
171      $('.team-teasers .view__content', context).once('slickTeam').each(function () {
172        $('.team-teasers .view__content').slick({
173          dots: false,
174          arrows: true,
175          slidesToShow: 1,
176          slidesToScroll: 1,
177          mobileFirst: true,
178          responsive: [
179            {
180              breakpoint: 640,
181              settings: 'unslick'
182            }
183          ]
184        });
185
186        const width = $(window).width();
187        if(width > 640) {
188          $('.team-teasers .view__row').each(function(){
189            $(this).removeAttr('aria-hidden');
190          });
191        }
192      });
193
194      /* Smooth scroll timeline - MGB 10.02.2020 */
195
196      $('.timeline-picker', context).once('timelineScroll').each(function() {
197        let offset = 0;
198        // if (window.innerWidth <= 880) {
199        //   offset = 180;
200        // }
201        $('.scroll a').on('click', function(e){
202          $('html, body').animate({
203            'scrollTop': $($(this).attr('href')).offset().top-offset+'px'
204          }, 2000);
205        });
206      });
207
208      $('.news-acclaim-menu', context).once('newsScroll').each(function() {
209        let offset = 100;
210        // if (window.innerWidth <= 880) {
211        //   offset = 180;
212        // }
213        $('.scroll a').on('click', function(e){
214          $('html, body').animate({
215            'scrollTop': $($(this).attr('href')).offset().top-offset+'px'
216          }, 2000);
217        });
218      });
219
220    },
221  };
222})(jQuery, Drupal);
223/* eslint-enable */
224;

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.