PageSourceSearch

https://exeter-airport.co.uk/content/themes/exeter-airport/js/main.js?ver=1.2.37

js exeter-airport.co.uk collected 2026-10-02 04:22:05 UTC 13,470 bytes, 484 lines download raw bytes

1jQuery(document).ready(function($) {
2  $(document).foundation();
3
4  var animationEnd = 'webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend';
5
6  // Update time every minute
7
8  function addZero(i) {
9    if (i < 10) {
10      i = "0" + i;
11    }
12    return i;
13  }
14
15  function getTime() {
16    var now = new Date();
17    var h = addZero( now.getHours() );
18    var m = addZero( now.getMinutes() );
19    var time = h + ':' + m;
20    $('.hero .time').html(time);
21  }
22  setInterval(getTime, 1000*60);
23
24  // Modal Behaviour
25
26  $('.modal-open').click(function(e) {
27    e.preventDefault();
28    var target = $(this).data('target');
29    $(target).addClass('animated slideInDown').show().one(animationEnd, function() {
30      $(this).removeClass('animated slideInDown');
31    });
32  });
33
34  $('.modal .close-button').click(function(e) {
35    e.preventDefault();
36    $(this).parent('.modal').addClass('animated slideOutDown').one(animationEnd, function() {
37      $(this).hide().removeClass('animated slideOutDown');
38    });
39  });
40
41  // Initialise Datepickers
42
43  $.datepicker.setDefaults({
44    dateFormat: "dd/mm/yy",
45    dayNamesMin: [ "S", "M", "T", "W", "T", "F", "S" ],
46    minDate: "d",
47    maxDate: "+18m",
48    prevText: "",
49    nextText: "",
50    // onSelect: function(dateText) {
51    //             $(this).value(dateText);
52    //           }
53  });
54
55  if ( $( ".date-input" ).length ) {
56    $('.date-input').datepicker();
57	$('.date-input').attr('autocomplete', 'off');
58  }
59
60  if ( $( ".date-input-past" ).length ) {
61    $('.date-input-past').datepicker({
62      minDate: '-10Y'
63    });
64  }
65
66  /**
67   *  Destinations Grid
68   */
69
70  $('#destinations-map-label').click(function() {
71    $('.destination-filters').addClass('invisible');
72  });
73  $('#destinations-list-label, #destinations-grid-label').click(function() {
74    $('.destination-filters').removeClass('invisible');
75  });
76
77  // Seasonal Filter
78
79  $('.destination-filters').on('click', 'a', function(event) {
80    event.preventDefault();
81    if ( $(this).parent('li').hasClass('is-active')) {
82      //
83    } else {
84      $('.destination-filters li').removeClass('is-active');
85      $(this).parent('li').addClass('is-active');
86    }
87
88    if ( $(this).hasClass('destination-filters-summer') ) {
89      $('#destinations-list li, #destinations-grid .destination').removeClass('hide');
90      $('#destinations-list li.winter, #destinations-grid .destination.winter').addClass('hide');
91
92    } else if ( $(this).hasClass('destination-filters-winter') ) {
93      $('#destinations-list li, #destinations-grid .destination').removeClass('hide');
94      $('#destinations-list li.summer, #destinations-grid .destination.summer').addClass('hide');
95
96    } else {
97      $('#destinations-list li, #destinations-grid .destination').removeClass('hide');
98    }
99  });
100
101  // At the Airport dropdown
102
103  $('#menu-item-50 a').hover(function(){
104    $('#dropdown-at-the-airport').stop().fadeIn(400);
105  }, function(){
106    setTimeout(function(){
107      $('#dropdown-at-the-airport:not(:hover)').stop().fadeOut(400);
108      $('#dropdown-at-the-airport').on('mouseleave', function(){
109        $('#dropdown-at-the-airport').stop().fadeOut(400);
110      });
111    },500);
112  });
113
114  $('#menu-item-50 a').click(function(e){
115    e.preventDefault();
116    $('#dropdown-at-the-airport').fadeIn(400);
117  });
118
119  $('#dropdown-at-the-airport .close-button').click(function(){
120    $('#dropdown-at-the-airport').stop().fadeOut(400);
121  });
122
123  // To and from the Airport dropdown
124
125  $('#menu-item-25 a').hover(function(){
126    $('#dropdown-to-and-from').stop().fadeIn(400);
127  }, function(){
128      setTimeout(function(){
129        $('#dropdown-to-and-from:not(:hover)').stop().fadeOut(400);
130        $('#dropdown-to-and-from').on('mouseleave', function(){
131          $('#dropdown-to-and-from').stop().fadeOut(400);
132        });
133      },500);
134  });
135
136  $('#menu-item-25 a').click(function(e){
137    e.preventDefault();
138    $('#dropdown-at-the-airport').fadeIn(400);
139  });
140
141  $('#dropdown-to-and-from .close-button').click(function(){
142    $('#dropdown-to-and-from').stop().fadeOut(400);
143  });
144
145
146  // Arrivals & Departures;
147
148  $('.widget-arrivals-departures-button').on('click', function(e){
149    e.preventDefault();
150    if ( $(this).hasClass('is-active') ) {
151      // do nothing, biatch!
152    } else {
153      $('.widget-arrivals-departures-button, .widget-arrivals-departures-content').toggleClass('is-active');
154    }
155  });
156
157  // Toggle Main Menu
158
159  $('#menu-toggle').click(function() {
160    $('#site-navigation').addClass('animated slideInDown').show().one(animationEnd, function(){
161      $('#site-navigation').removeClass('animated slideInDown');
162    });
163  });
164  $('#site-navigation .close-button').click(function(){
165    $('#site-navigation').addClass('animated slideOutUp').one(animationEnd, function(){
166      $('#site-navigation').removeClass('animated slideOutUp').hide();
167    });
168  });
169
170  // Search Form functionality on mobile
171
172  $('#search-toggle').click(function() {
173    $('.search-form').addClass('animated slideInDown search-form-mobile').show().one(animationEnd, function(){
174      $('.search-form').removeClass('animated slideInDown');
175      setTimeout(function(){
176        $('.search-field').focus();
177      }, 300);
178    });
179  });
180
181  $(document).on("click", ".search-form-mobile .search-reset", function(){
182    if ( $('.search-field').val().length === 0 ) {
183      $('.search-form').addClass('animated slideOutUp').one(animationEnd, function(){
184        $('.search-form').removeClass('animated slideOutUp').hide();
185      });
186    } else {
187      $('.search-field').val('');
188    }
189  });
190
191  // Home
192
193  if ( $('body').hasClass('home') ) {
194
195    // Initialise Main Carousel
196    $('.hero-carousel').slick({
197      arrows: false,
198      autoplay: true,
199      dots: true,
200      pauseOnHover: false,
201      speed: 2000,
202    });
203  }
204  if ( $('.inspiration-carousel').length ) {
205
206    // Initialise Inspiration carousel
207    $('.inspiration-carousel').slick({
208      arrows: false,
209      autoplay: true,
210      dots: true,
211      pauseOnHover: false,
212      speed: 2000,
213    });
214  }
215
216  // Car Parking
217
218  if ( $('body').hasClass('page-id-8') ) {
219    
220    $('#rollup-pricing-buttons a').click(function(e){
221      e.preventDefault();
222      var target = '.table-rollup-pricing ' + $(this).attr('href');
223      $('.table-rollup-pricing th, .table-rollup-pricing td').removeClass('is-active');
224      $(target).addClass('is-active');
225    });
226    
227    if(window.location.hash === '#contact') {      
228      
229      var offset = $('.car-parking-pricing-table').offset().top + $('.car-parking-pricing-table').height();
230        $('html, body').animate({
231          scrollTop: offset
232        }, 300);
233      
234      setTimeout(function(){
235        $('.accordion').foundation('down', $('.accordion-item:first-child .accordion-content'),true );  
236      }, 600);
237      
238    }
239
240  }
241
242  // Passenger Information - select correct tab on page load based on hash
243
244  if ( $('body').hasClass('page-id-29') ) {
245    if (window.location.hash) {
246      $('#passenger-information-tabs .tabs-title a').each(function() {
247        var hash = '#' + $(this).attr('href').split('#')[1];
248        if (hash === window.location.hash) {
249          $(this).click();
250        }
251      });
252    }
253
254    $('#dropdown-at-the-airport .passenger-information a').click(function() {
255      var selectTab = '#' + $(this).attr('href').split('#')[1] + '-label';
256      $(selectTab).click();
257    });
258
259    // Change the tabs when clicking footer links if already on the page
260
261    $('.footer-widgets a').click(function() {
262      var selectTab = '#' + $(this).attr('href').split('#')[1] + '-label';
263      $(selectTab).click();
264    });
265  }
266
267  // Flights and Holidays
268
269  if ( $('body').hasClass('page-id-10') ) {
270
271    if (window.location.hash) {
272      $('#destinations-tabs .tabs-title a').each(function() {
273        var hash = '#' + $(this).attr('href').split('#')[1];
274        if (hash === window.location.hash) {
275          $(this).click();
276          $('html, body').animate({
277              scrollTop: $(".where-can-i-fly-to").offset().top
278          }, 300);
279        }
280      });
281    }
282
283  }
284
285  // Single Destinations
286
287  if ( $('body').hasClass('single-destination') ) {
288
289    // Outbound link tracking for Google Analytics
290
291    $('.operators-grid .centered-grid-item .button').click(function() {
292      ga('send', 'event', {
293        eventCategory: 'Destination Page Builder',
294        eventAction: $(this).data('action'),
295        eventLabel: $(this).data('label'),
296        transport: 'beacon'
297      });
298    });
299  }
300
301  // To and from the airport - select correct tab on page load based on hash
302
303  if ( $('body').hasClass('page-id-12') ) {
304    if (window.location.hash) {
305      $('#to-from-airport-tabs .tabs-title a').each(function() {
306        var hash = '#' + $(this).attr('href').split('#')[1];
307        if (hash === window.location.hash) {
308          $(this).click();
309        }
310      });
311    }
312    $('#dropdown-to-and-from a').click(function() {
313      var selectTab = '#' + $(this).attr('href').split('#')[1] + '-label';
314      $(selectTab).click();
315    });
316
317    // Move Car Rental search to accordion on small screens
318    if (Foundation.MediaQuery.current === 'small') {
319      $('#rc-connect-container').prependTo('.car-rental-search');
320    }
321  }
322
323  // Widget Accordion - go to Flights & Holidays page instead of opening tab
324
325  $('.widget-accordion .flights-holidays').click(function(e){
326    e.preventDefault();
327    window.location = $('.widget-accordion .flights-holidays').data('target');
328  });
329
330  // Masonry on Shop & Eat
331
332  if ( $('body').hasClass('page-id-31') ) {
333    $(window).on("load", function() {
334      $('.shop-eat-grid').masonry({
335        itemSelector: '.grid-column',
336      });
337      $('[data-tabs]').on('change.zf.tabs', function() {
338        $('.shop-eat-grid').masonry({
339          itemSelector: '.grid-column',
340        });
341      });
342    });
343  }
344
345  /**
346   *  Minor Alerts
347   */
348
349  var alertArr = $(".minor-alerts .marquee .alert");
350  var visibleAlert = 0;
351
352  // loop through array of alerts
353  function loopAlerts(){
354    if(visibleAlert < alertArr.length ) {
355      animateAlert(visibleAlert);
356      visibleAlert++;
357    } else {
358      visibleAlert = 0;
359      animateAlert(visibleAlert);
360      visibleAlert++;
361    }
362  }
363
364  // alert slideInDown > wait 3s > slideOutDown
365  function animateAlert(visibleAlert){
366
367    var alert = alertArr[visibleAlert];
368
369    $(alert).addClass('slideInDown').removeClass('hide').one(animationEnd, function(){
370      $('.minor-alerts .marquee .alert').removeClass('slideInDown slideOutDown');
371      setTimeout(function(){
372        $(alert).addClass('slideOutDown').one(animationEnd, function(){
373          $(alert).addClass('hide').removeClass('slideOutDown slideInDown');
374          setTimeout(loopAlerts(),3000);
375        });
376      }, 3000);
377    });
378  }
379
380  // initialise Minor Alerts
381
382  if ( alertArr.length === 1) {
383    $('.minor-alerts .marquee .alert').removeClass('hide');
384  } else if ( alertArr.length > 1) {
385    loopAlerts();
386  }
387
388  /**
389   *  Major Alerts
390   */
391
392  // Set Cookie
393  function setCookie(cname, cvalue, exdays) {
394    var d = new Date();
395    d.setTime(d.getTime() + (exdays*24*60*60*1000));
396    var expires = "expires="+d.toUTCString();
397    document.cookie = cname + "=" + cvalue + "; " + expires + "; path=/";
398  }
399
400  // Retrieve Cookie Value
401  function getCookie(cname) {
402    var name = cname + "=";
403    var ca = document.cookie.split(';');
404    for (var i = 0; i < ca.length; i++) {
405      var c = ca[i];
406      while (c.charAt(0) === ' ') {
407        c = c.substring(1);
408      }
409      if (c.indexOf(name) === 0) {
410        return c.substring(name.length,c.length);
411      }
412    }
413    return "";
414  }
415
416
417  // Show Major Alert if not set or data-updated is more recent than cookie value
418  var cookie = getCookie('rca_major_alert');
419
420  if ( $('#major-alert').data('updated') !== Number(cookie) ) {
421    $('#major-alert').show();
422    setCookie('rca_major_alert', $('#major-alert').data('updated') , 1);
423  }
424
425  // Close Major Alert
426  $('#major-alert .close-button, #major-alert .dismiss-button').click(function(){
427    $('#major-alert').removeClass('slideInDown').addClass('slideOutDown');
428  });
429
430   // Generic 'open' & 'close' functions 
431
432  $('*[data-open]').click(function(e) {
433    e.preventDefault();
434    var target = $(this).data('open');
435    $(target).fadeIn();
436  });
437
438   $('*[data-close]').click(function(e) {
439    e.preventDefault();
440    var target = $(this).data('close');
441    $(target).fadeOut();
442  });
443
444  // Newsletter Sign-up
445
446  $.fn.isVisible = function() {
447    var rect = this[0].getBoundingClientRect();
448    return (
449        (rect.height > 0 || rect.width > 0) &&
450        rect.bottom >= 0 &&
451        rect.right >= 0 &&
452        rect.top <= (window.innerHeight || document.documentElement.clientHeight) &&
453        rect.left <= (window.innerWidth || document.documentElement.clientWidth)
454    );
455  };
456
457  function doCheck() {
458    var elementToDetect = $('#colophon');
459
460    if (localStorage.getItem('ext_newsletter')) {
461      // do nothing
462    } else {
463      if (elementToDetect.isVisible()) {
464        $('.newsletter-signup-trigger').fadeOut('slow');
465      } else {
466        $('.newsletter-signup-trigger').fadeIn('slow');
467      }
468    }
469  }
470
471  doCheck();
472
473  $(window).scroll(function(){
474    doCheck();
475  });
476
477  $('.newsletter-signup-trigger .close-button').click(function(e) {
478    e.preventDefault();
479    var target = $(this).data('close');
480    $(target).fadeOut();
481    localStorage.setItem("ext_newsletter", "subscribed");
482  });
483
484});

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.