PageSourceSearch

https://www.themargohotel.com/wp-content/themes/pro-theme-berlin/js/main.js?ver=1.0.1

js themargohotel.com collected 2026-10-08 07:33:03 UTC 32,029 bytes, 906 lines download raw bytes

1(function ($, sr) {
2  var debounce = function (func, threshold, execAsap) {
3    var timeout;
4    return function debounced() {
5      var obj = this, args = arguments;
6
7      function delayed() {
8        if (!execAsap)
9          func.apply(obj, args);
10        timeout = null;
11      };
12      if (timeout)
13        clearTimeout(timeout);
14      else if (execAsap)
15        func.apply(obj, args);
16
17      timeout = setTimeout(delayed, threshold || 100);
18    };
19  }
20  // smartresize
21  jQuery.fn[sr] = function (fn) {
22    return fn ? this.bind('resize', debounce(fn)) : this.trigger(sr);
23  };
24})(jQuery, 'smartresize');
25
26(function ($) {
27  $(window).load(function () {
28    refresh_size_queries();
29    if ($('.the_content table').length > 0) {
30      $('.the_content table').each(function () {
31        $(this).wrapAll('<div class="table_wrap"></div>');
32      })
33    }
34  });
35
36  $(document).ready(function () {
37    viewPageFooter();
38
39    refresh_size_queries();
40    manual_fancybox();
41    open_languages();
42    headerPosition();
43    openMenuSidebar();
44    submenuHighlight();
45    submenu();
46    submenuFooter();
47    slideshowSize();
48    collapsibleContent();
49    scrollToElement();
50    indexPreviews();
51    window.lazyLoadInstance = new LazyLoad({
52      elements_selector: ".lazy",
53      threshold: 50
54    });
55    $('#fbga-login-overlay').on('click', function () {
56      hide('fbga-login-overlay');
57    });
58  });
59
60  $(window).smartresize(function () {
61    refresh_size_queries();
62    headerPosition();
63  });
64
65  $(window).on('scroll', function () {
66    refresh_size_queries();
67    headerPosition();
68  });
69
70  function refresh_size_queries() {
71    var classes = [];
72    var scrollbarwidth = getScrollbarWidth();
73    window_width = $(window).width() + scrollbarwidth;
74    window_height = $(window).height();
75    is_phone = (window_width < 768);
76    is_mobile = (window_width < 992);
77    is_tablet_portrait = (window_width >= 768 && window_width < 992);
78    is_tablet_landscape = (window_width >= 992 && window_width < 1200 && window_height <= 768);
79    is_tablet = is_tablet_portrait || is_tablet_landscape;
80    is_desktop = (window_width >= 992);
81    is_desktop_large = (window_width >= 1200);
82    is_desktop_larger = (window_width >= 1400);
83
84    if (is_phone) {
85      classes.push('mq_phone');
86    }
87    if (is_mobile) {
88      classes.push('mq_mobile');
89    }
90    if (is_tablet_portrait) {
91      classes.push('mq_tablet_portrait');
92    }
93    if (is_tablet_landscape) {
94      classes.push('mq_tablet_landscape');
95    }
96    if (is_tablet) {
97      classes.push('mq_tablet');
98    }
99    if (is_desktop) {
100      classes.push('mq_desktop');
101    }
102    if (is_desktop_large) {
103      classes.push('mq_desktop_large');
104    }
105    if (is_desktop_larger) {
106      classes.push('mq_desktop_larger');
107    }
108
109
110    $('html').removeClass('mq_phone');
111    $('html').removeClass('mq_mobile');
112    $('html').removeClass('mq_tablet_portrait');
113    $('html').removeClass('mq_tablet_landscape');
114    $('html').removeClass('mq_tablet');
115    $('html').removeClass('mq_desktop');
116    $('html').removeClass('mq_desktop_large');
117    $('html').removeClass('mq_desktop_larger');
118
119    $('html').addClass(classes.join(' '));
120
121  }
122
123  function getScrollbarWidth() {
124    var outer = document.createElement("div");
125    outer.style.visibility = "hidden";
126    outer.style.width = "100px";
127    outer.style.msOverflowStyle = "scrollbar"; // needed for WinJS apps
128    document.body.appendChild(outer);
129    var widthNoScroll = outer.offsetWidth;
130    // force scrollbars
131    outer.style.overflow = "scroll";
132    // add innerdiv
133    var inner = document.createElement("div");
134    inner.style.width = "100%";
135    outer.appendChild(inner);
136    var widthWithScroll = inner.offsetWidth;
137    // remove divs
138    outer.parentNode.removeChild(outer);
139    return widthNoScroll - widthWithScroll;
140  }
141
142  window.sameHeightForAllElements = function (items, outerHeight) {
143    if ($(items).length > 0) {
144      var max_height = 0;
145      $(items).each(function (k, item) {
146        var height = $(item).outerHeight(outerHeight);
147        if (height > max_height) {
148          max_height = height;
149        }
150      });
151      $(items).each(function (k, item) {
152        $(item).css({
153          'height': max_height
154        });
155      });
156    }
157  }
158
159  function headerPosition() {
160    var header_wrapper = $('#header_wrapper');
161    var slideshow = $('#slideshow-1');
162    var scroll = $(window).scrollTop();
163    var wrap = $('#primary_menu_wrapper .wrap');
164    var wrap_w = wrap.width();
165    var cta_w = $('#main_book').width();
166    var ww = $(window).width();
167    var anchors = $('#anchors_wrap');
168
169    var side_space = (ww - wrap_w) / 2;
170    var overlapping = side_space - cta_w;
171
172    var breakpoint_1 = slideshow.length > 0 ? slideshow.outerHeight() / 2 : header_wrapper.height();
173    if (!$('body').hasClass('page-template-template-landing-page')) {
174      if (!is_mobile) {
175        if (slideshow.hasClass('size_xl')) {
176          header_wrapper.removeClass('custom');
177        }
178
179        if (scroll < breakpoint_1) {
180          header_wrapper.removeClass('fixed');
181          if (slideshow.hasClass('size_xl')) {
182            header_wrapper.removeClass('custom');
183          }
184          wrap.removeClass('modified');
185          wrap.css({
186            'width': 'unset',
187            'margin-left': 'auto',
188            'transform': 'translateX(0)'
189          });
190        } else {
191          header_wrapper.addClass('fixed');
192          if (slideshow.hasClass('size_xl')) {
193            header_wrapper.addClass('custom');
194          }
195
196          if (overlapping < 0 && !wrap.hasClass('modified')) {
197            if (side_space > Math.abs(overlapping)) {
198              wrap.css({
199                'transform': 'translateX(' + overlapping + 'px)',
200                'width': wrap_w
201              });
202              wrap.addClass('modified');
203            } else {
204              wrap.css({
205                'width': wrap_w - Math.abs(overlapping),
206                'margin-left': side_space
207              });
208              wrap.addClass('modified');
209            }
210          }
211        }
212
213      } else {
214        header_wrapper.addClass('custom');
215      }
216    } else {
217      if (!is_mobile) {
218        if (slideshow.hasClass('size_xl')) {
219          header_wrapper.removeClass('custom');
220        }
221        if (scroll < breakpoint_1) {
222          header_wrapper.removeClass('custom');
223        } else {
224          header_wrapper.addClass('custom');
225        }
226      } else {
227        header_wrapper.addClass('custom');
228      }
229    }
230
231
232    header_wrapper.removeClass('no_slideshow');
233    if (slideshow.hasClass('size_xl')) {
234      header_wrapper.addClass('size_xl');
235    }
236    if (slideshow.length === 0) {
237      header_wrapper.addClass('no_slideshow');
238    }
239
240    if (anchors.length > 0) {
241      if (slideshow.length > 0) {
242        slideshow.addClass('has_anchors');
243      }
244
245      if (scroll > anchors.offset().top - wrap.height()) {
246        anchors.addClass('fixed');
247      } else {
248        anchors.removeClass('fixed');
249      }
250    }
251  }
252
253  function openMenuSidebar() {
254    var link = $('.open_menu'),
255        wrap = $('#menu_sidebar_wrap'),
256        sidebar_overlay = $('#sidebar_overlay'),
257        close = wrap.find('.close_sidebar');
258    if (link.length > 0 && wrap.length > 0) {
259      link.click(function () {
260        wrap.addClass('open');
261        close.focus();
262        wrap.addClass('visible');
263        sidebar_overlay.addClass('visible');
264        $('html').addClass('no_scroll');
265        $('body > *:not(#menu_sidebar_wrap)').attr('inert', '');
266      });
267
268      close.click(function () {
269        wrap.removeClass('visible');
270        wrap.removeClass('open');
271        sidebar_overlay.removeClass('visible');
272        $('html').removeClass('no_scroll');
273        $('body > *:not(#menu_sidebar_wrap)').removeAttr('inert');
274        link.focus();
275      });
276
277      sidebar_overlay.click(function () {
278        wrap.removeClass('visible');
279        wrap.removeClass('open');
280        sidebar_overlay.removeClass('visible');
281        $('html').removeClass('no_scroll');
282        $('body > *:not(#menu_sidebar_wrap)').removeAttr('inert');
283        link.focus();
284      });
285
286      $(document).on('keyup', function (e) {
287        var subMenuFocus = wrap.find('ul.sub-menu:focus-within');
288        if (wrap.hasClass('visible') && e.which === 27 && subMenuFocus.length === 0) {
289          close.trigger('click');
290          $('body > *:not(#menu_sidebar_wrap)').removeAttr('inert');
291          link.focus();
292        }
293      });
294    }
295  }
296
297  function submenuHighlight() {
298    var submenuMobile = $('#primary_menu li.menu-item-has-children');
299    submenuMobile.each(function (node, child) {
300      var id = $(this).attr('id');
301      var list = $(this).find('ul.sub-menu');
302      list.attr('id', id + '_sub');
303      $(this).find('a').attr('id', id + '_label');
304      var btn =
305          '<button aria-labelledby="' + id + '_label' + '" aria-controls="' + id + '_sub' + '" aria-expanded="false" class="more_li">' +
306          '<span aria-hidden="true" class="fas fa-caret-down"></span>' +
307          '</button>';
308      $(btn).insertBefore($(this).find('ul.sub-menu'), child);
309    });
310
311    var currentPage = $('#primary_menu .current-menu-item a');
312    currentPage.attr('aria-current', 'page');
313
314    var currentAncestor = $('#primary_menu .current-menu-ancestor a');
315    currentAncestor.attr('aria-current', 'location');
316
317    var button = $("#primary_menu .more_li"),
318        parent = $("li.menu-item-has-children"),
319        submenu = $("ul.sub-menu"),
320        mClass = "open";
321
322    button.click(function () {
323      if (!$(this).closest(parent).hasClass('open')) {
324        parent.removeClass(mClass);
325        parent.find(submenu).stop().fadeOut();
326
327        $(this).closest(parent).find(submenu).stop().fadeIn(400,
328            function () {
329              $(this).closest(parent).addClass(mClass);
330            }
331        );
332        $(this).attr('aria-expanded', 'true');
333      } else {
334        $(this).closest(parent).find(submenu).removeAttr('style');
335        $(this).closest(parent).removeClass(mClass);
336        $(this).attr('aria-expanded', 'false');
337      }
338
339    });
340
341    //needed only if you want to show caret button on focus only
342    $("#primary_menu > ul.menu > li").find('> a, > span a').on('focus', function () {
343      $('.more_li[aria-expanded="true"]').click();
344    });
345    $("#primary_menu  ul.sub-menu").find('a').on('mousedown', function () {
346      $(this).closest("ul.sub-menu").parent().find('.more_li').hide();
347    });
348
349    //Source: https://www.w3.org/WAI/ARIA/apg/patterns/disclosure/examples/disclosure-navigation#kbd_label
350    //Example: https://www.w3.org/WAI/ARIA/apg/patterns/disclosure/examples/disclosure-navigation-hybrid/
351    //keydown navigation needed for preventing default
352    $(document).on('keydown', function (e) {
353      var menuHasFocus = $('#primary_menu:focus-within');
354      var buttonExpanded = $('#primary_menu .more_li[aria-expanded="true"]');
355      var subMenuExpanded = $('#primary_menu ul.sub-menu:focus-within');
356
357      //SUBMENU - keyboard navigation
358      if(menuHasFocus.length > 0) {
359        if (subMenuExpanded.length > 0) {
360          var menuExpanded = buttonExpanded.next();
361          if (menuExpanded.find('a:focus').length > 0) {
362            //arrow down and arrow right
363            if (e.which === 39 || e.which === 40) {
364              e.preventDefault();
365              menuExpanded.find('a:focus').parent().parent().next().find('a').focus();
366            }
367            //arrow up and arrow left
368            else if (e.which === 37 || e.which === 38) {
369              e.preventDefault();
370              menuExpanded.find('a:focus').parent().parent().prev().find('a').focus();
371            }
372            //home
373            else if (e.which === 36) {
374              e.preventDefault();
375              menuExpanded.find('li:first-child a').focus();
376            }
377            //end
378            else if (e.which === 35) {
379              e.preventDefault();
380              menuExpanded.find('li:last-child a').focus();
381            }
382          }
383
384        }
385
386        //MAIN MENU - keyboard navigation
387        else {
388          var focusedEl = menuHasFocus.find('*:focus'),
389              firstEl = menuHasFocus.find('ul.menu li:first-child a'),
390              lastEl = menuHasFocus.find('li:last-child button').length > 0 ? menuHasFocus.find('li:last-child button') : menuHasFocus.find('li:last-child a');
391
392          var nextEl = focusedEl.parent().next().length === 0 ? focusedEl.parent().parent().next().find('> a, > span a') : focusedEl.parent().next();
393          if (focusedEl.is('button')) {
394            nextEl = focusedEl.parent().next().find('> a, > span a');
395          }
396
397          var prevEl = focusedEl.parent().parent().prev().find('button').length === 0 ? focusedEl.parent().parent().prev().find('> a, > span a') : focusedEl.parent().parent().prev().find('button');
398          if (focusedEl.is('button')) {
399            prevEl = focusedEl.prev().find('> a, > span a');
400          }
401
402          //arrow down for button if expanded
403          if (e.which === 40 && buttonExpanded.is(':focus')) {
404            e.preventDefault();
405            menuHasFocus.find('ul.sub-menu:visible > li:first-child a').focus();
406          }
407          //arrow down and arrow right
408          else if (e.which === 39 || (e.which === 40 && !buttonExpanded.is(':focus'))) {
409            e.preventDefault();
410            nextEl.focus();
411            console.log(nextEl)
412          }
413          //arrow up and arrow left
414          else if (e.which === 37 || e.which === 38) {
415            e.preventDefault();
416            prevEl.focus();
417          }
418          //home
419          else if (e.which === 36) {
420            e.preventDefault();
421            firstEl.focus();
422          }
423          //end
424          else if (e.which === 35) {
425            e.preventDefault();
426            lastEl.focus();
427          }
428        }
429      }
430    });
431
432    //keyup navigation
433    $(document).on('keyup', function (e) {
434      var buttonExpanded = $('#primary_menu .more_li[aria-expanded="true"]');
435      var submenuVisible = $('#primary_menu .sub-menu:visible');
436      var submenuVisibleParent =submenuVisible.parent();
437
438      console.log(submenuVisible);
439
440      //SUBMENU - keyboard navigation
441      if (buttonExpanded.length > 0 && e.which === 27) {
442        buttonExpanded.click();
443        buttonExpanded.focus();
444      }
445
446      //WCAG 1.4.13 Content on Hover on Focus
447      if (submenuVisible.length > 0 && e.which === 27) {
448        submenuVisible.addClass('hidden_menu_hover');
449      }
450
451      submenuVisibleParent.on('mouseleave', function () {
452        $(this).find('.sub-menu').removeClass('hidden_menu_hover');
453      });
454    });
455
456    //close submenu if click outside
457    $(document).on('click', function (e) {
458      var parents = $(e.target).parents();
459      var is_menu_item = false;
460
461      parents.each(function () {
462        if ($(this).is('#primary_menu')) {
463          is_menu_item = true;
464        }
465      });
466      if (!is_menu_item) {
467        $('#primary_menu .more_li[aria-expanded="true"]').click();
468      }
469    });
470  }
471  function submenu() {
472    var submenuMobile = $('#menu_sidebar_wrap li.menu-item-has-children > span');
473    submenuMobile.each(function () {
474      var id = $(this).parent().attr('id');
475      var list = $(this).parent().find('ul.sub-menu');
476      list.attr('id', id);
477      $(this).find('a').attr('id', id + '_label');
478      $(this).append('<button aria-labelledby="' + id + '_label' + '" aria-controls="' + id + '_sub' + '" aria-expanded="false" class="more_li"><span aria-hidden="true" class="fas fa-angle-right"></span></button>');
479    });
480
481    var currentPage = $('#menu_sidebar_wrap .current-menu-item > a, #menu_sidebar_wrap .current-menu-item > span a');
482    currentPage.attr('aria-current', 'page');
483
484    var currentAncestor = $('#menu_sidebar_wrap .current-menu-ancestor > a, #menu_sidebar_wrap .current-menu-ancestor > span a');
485    currentAncestor.attr('aria-current', 'location');
486
487    var button = $("#menu_sidebar_wrap .more_li"),
488        parent = $("li.menu-item-has-children"),
489        submenu = $("ul.sub-menu"),
490        mClass = "open";
491
492    button.click(function () {
493      if (!$(this).closest(parent).hasClass('open')) {
494        parent.find('.more_li[aria-expanded="true"]').click();
495
496        $(this).closest(parent).find(submenu).stop().fadeIn(400,
497            function () {
498              $(this).closest(parent).addClass(mClass);
499            }
500        );
501        $(this).attr('aria-expanded', 'true');
502      } else {
503        $(this).closest(parent).find(submenu).stop().fadeOut(400,
504            function () {
505              $(this).closest(parent).removeClass(mClass);
506            });
507        $(this).attr('aria-expanded', 'false');
508      }
509
510    });
511
512    //Source: https://www.w3.org/WAI/ARIA/apg/patterns/disclosure/examples/disclosure-navigation#kbd_label
513    //Example: https://www.w3.org/WAI/ARIA/apg/patterns/disclosure/examples/disclosure-navigation-hybrid/
514    //keydown navigation needed for preventing default
515    $(document).on('keydown', function (e) {
516      var menuHasFocus = $('#menu_sidebar_wrap:focus-within');
517      var menuIsVisible = $('#menu_sidebar_wrap:visible');
518      var buttonExpanded = $('#menu_sidebar_wrap .more_li[aria-expanded="true"]');
519      var subMenuExpanded = $('#menu_sidebar_wrap ul.sub-menu:focus-within');
520
521      if (menuIsVisible.length > 0) {
522        //SUBMENU - keyboard navigation
523        if (subMenuExpanded.length > 0) {
524          var menuExpanded = buttonExpanded.parent().parent().find('ul.sub-menu');
525          if (menuExpanded.find('a:focus').length > 0) {
526            console.log(e.which);
527            //arrow down and arrow right
528            if (e.which === 39 || e.which === 40) {
529              e.preventDefault();
530              menuExpanded.find('a:focus').parent().parent().next().find('a').focus();
531            }
532            //arrow up and arrow left
533            else if (e.which === 37 || e.which === 38) {
534              e.preventDefault();
535              menuExpanded.find('a:focus').parent().parent().prev().find('a').focus();
536            }
537            // home
538            else if (e.which === 36) {
539              e.preventDefault();
540              menuExpanded.find('li:first-child a').focus();
541            }
542            // end
543            else if (e.which === 35) {
544              e.preventDefault();
545              menuExpanded.find('li:last-child a').focus();
546            }
547          }
548        }
549
550        //MAIN MENU - keyboard navigation
551        else {
552          var focusedEl = menuHasFocus.find('*:focus'),
553              nextEl = !focusedEl.next().is('ul.sub-menu') && focusedEl.next().length > 0 ? focusedEl.next() : focusedEl.parent().parent().next().find('> a, > span a'),
554              firstEl = menuHasFocus.find('ul.menu > li:first-child a'),
555              lastEl = menuHasFocus.find('li:last-child button').length > 0 ? menuHasFocus.find('li:last-child button') : menuHasFocus.find('li:last-child a');
556          var prevEl = focusedEl.prev();
557          prevEl = prevEl.length === 0 ? focusedEl.parent().parent().prev().find('button') : prevEl;
558          prevEl = prevEl.length === 0 ? focusedEl.parent().parent().prev().find('> a, > span a') : prevEl;
559          //arrow down for button if expanded
560          if (e.which === 40 && buttonExpanded.is(':focus')) {
561            e.preventDefault();
562            menuHasFocus.find('ul.sub-menu:visible > li:first-child a').focus();
563          }
564          //arrow down and arrow right
565          else if (e.which === 39 || (e.which === 40 && !buttonExpanded.is(':focus'))) {
566            e.preventDefault();
567            nextEl.focus();
568          }
569          //arrow up and arrow left
570          else if (e.which === 37 || e.which === 38) {
571            e.preventDefault();
572            prevEl.focus();
573          }
574          //home
575          else if (e.which === 36) {
576            e.preventDefault();
577            firstEl.focus();
578          }
579          //end
580          else if (e.which === 35) {
581            e.preventDefault();
582            lastEl.focus();
583          }
584        }
585      }
586    });
587
588    $(document).on('keyup', function (e) {
589      var buttonExpanded = $('#menu_sidebar_wrap .more_li[aria-expanded="true"]');
590      var menuExpanded = $('#menu_sidebar_wrap ul.sub-menu:focus-within');
591      //esc from submenu
592      if ((buttonExpanded.is(':focus') || menuExpanded.length > 0) && e.which === 27) {
593        buttonExpanded.click();
594        buttonExpanded.focus();
595      }
596
597    })
598
599    parent.find('> a').click(function () {
600      var link = $(this);
601      if (link.attr('href') == 'javascript:;') {
602
603        if (!link.closest(parent).hasClass('open')) {
604          parent.removeClass(mClass);
605          parent.find(submenu).stop().fadeOut();
606
607          $(this).closest(parent).find(submenu).stop().fadeIn(400,
608              function () {
609                $(this).closest(parent).addClass(mClass);
610              }
611          );
612        } else {
613          link.closest(parent).find(submenu).stop().fadeOut(400,
614              function () {
615                $(this).closest(parent).removeClass(mClass);
616              });
617        }
618
619      }
620    });
621  }
622
623  function submenuFooter() {
624    var currentPage = $('#footer_top_menu .current-menu-item a');
625    currentPage.attr('aria-current', 'page');
626    $(document).on('keydown', function (e) {
627      var menuHasFocus = $('#footer_top_menu:focus-within');
628
629      if (menuHasFocus.length > 0) {
630        var focusedEl = menuHasFocus.find('*:focus'),
631            nextEl = focusedEl.parent().next().find('> a, > span a'),
632            prevEl = focusedEl.parent().prev().find('> a, > span a'),
633            firstEl = menuHasFocus.find('ul.menu li:first-child a'),
634            lastEl = menuHasFocus.find('li:last-child a');
635        //arrow down and arrow right
636        if (e.which === 39 || e.which === 40) {
637          e.preventDefault();
638          nextEl.focus();
639        }
640        //arrow up and arrow left
641        else if (e.which === 37 || e.which === 38) {
642          e.preventDefault();
643          prevEl.focus();
644        }
645        //home
646        else if (e.which === 36) {
647          e.preventDefault();
648          firstEl.focus();
649        }
650        //end
651        else if (e.which === 35) {
652          e.preventDefault();
653          lastEl.focus();
654        }
655      }
656    });
657  }
658  function manual_fancybox() {
659    $(document).click(function (e) {
660      if (typeof $(e.target).attr('data-manual-fancy') !== 'undefined') {
661        var button = $(e.target);
662        var data = button.data('src');
663        if (!data) {
664          return;
665        }
666        var html = $(data).text();
667        var inerted = $('#header, header, #footer, footer, #right_sidebar, .de_block, #slideshow-1, .skip')
668        $.fancybox.open(html, {
669          arrows: false,
670          infobar: false,
671          trapFocus: false, //avoid conflicts with datepicker
672          touch: false, //disable gestures
673          'beforeShow': function () {
674            //make the rest of the page inert
675            inerted.prop('inert', true);
676          },
677          'afterShow': function (instance, current) {
678            //duplicate the close button and focus on it (A11Y to check)
679            var close = $(current.$smallBtn);
680            // close.clone().prependTo('.hidden_fancybox:visible');
681            // $('.hidden_fancybox:visible button[data-fancybox-close]:first-child').focus();
682            // console.log('after show');
683
684            var closeNew = $('.hidden_fancybox:visible .new_close');
685            if(closeNew.length === 0) {
686              close.clone().addClass('new_close').prependTo('.hidden_fancybox:visible');
687            }
688            close.remove();
689            $('.hidden_fancybox:visible button[data-fancybox-close]').focus();
690
691            //datepicker calclate his position based on body, so we need to position it absolute. It will
692            //anyway appear fixed respect to the fancybox
693            $('.hidden_fancybox:visible').find('.hasDatepicker').on('focus', function () {
694              var dp = $('#ui-datepicker-div');
695              dp.css('position', 'fixed');
696              dp.css('top', $(this)[0].offsetTop + $(this)[0].offsetHeight + $('.hidden_fancybox:visible')[0].offsetTop + 'px');
697              dp.css('left', $(this)[0].offsetLeft + $('.hidden_fancybox:visible').offsetLeft + 'px');
698              console.log(($(this)[0].offsetTop + $(this)[0].height + dp.height()), window_height);
699              if (($(this)[0].offsetTop + $(this)[0].offsetHeight + dp.height()) > window_height) {
700                dp.css('transform', 'translateY(calc(-100% - ' + $(this)[0].offsetHeight + 'px)');
701              }
702            });
703          },
704          'beforeClose': function (instance) {
705            //remove inert and make back-focus on the last focused element (button which opened the fancybox)
706            inerted.prop('inert', false);
707            if(typeof instance.$lastFocus !== 'undefined' ) {
708              var last = ($(instance.$lastFocus[0]));
709              last.focus();
710            }
711          },
712          'afterLoad': function (instance, current) {
713            //force form re-render and datepicker re-init
714            var formId = $(current.$content).find('.gform_wrapper').attr('id');
715            if (formId) {
716              $(document).trigger('gform_post_render', formId.replace('gform_wrapper_', ''));
717              if (typeof gformInitDatepicker !== 'undefined') {
718                setTimeout(gformInitDatepicker, 101);
719              }
720            }
721          },
722        });
723      }
724    });
725  }
726
727  function viewPageFooter() {
728    $('ul.menu li a.view_privacy').click(function () {
729      var thisLink = $(this);
730      var overlayToOpen = '#' + $(this).attr('data-link');
731      var contentToShow = $(overlayToOpen).html();
732      $('body').append(contentToShow);
733      $('html').addClass('no_scroll');
734      $('body > *:not(.mega_details_wrapper)').attr('inert', '');
735      var close = $('.mega_details_wrapper .close');
736      close.focus();
737      close.click(function () {
738        $(this).closest('.mega_details_wrapper').remove();
739        $('html').removeClass('no_scroll');
740        $('body > *').removeAttr('inert');
741        thisLink.focus();
742      })
743    });
744  }
745  function open_languages() {
746    var other_languages = $('.other_languages');
747    var lang_sel = $('.lang_sel_sel');
748    lang_sel.on('click', function () {
749      if (!other_languages.hasClass('show')) {
750        other_languages.addClass('show');
751        other_languages.fadeIn();
752        $(this).attr('aria-expanded', 'true');
753      } else {
754        other_languages.removeClass('show');
755        other_languages.fadeOut();
756        $(this).attr('aria-expanded', 'false');
757      }
758    });
759
760    other_languages.on('focusout', function () {
761      if ($('#other_languages:focus-within').length === 0) {
762        other_languages.removeClass('show');
763        other_languages.fadeOut();
764        lang_sel.attr('aria-expanded', 'false');
765      }
766    });
767
768    $(document).on('mouseup', function (e) {
769      if (!lang_sel.is(e.target) && lang_sel.has(e.target).length === 0) {
770        other_languages.removeClass('show');
771        other_languages.fadeOut();
772        $(this).attr('aria-expanded', 'false');
773      }
774    });
775
776    $(document).on('keydown', function (e) {
777      if ($('#other_languages:focus-within').length > 0) {
778        var focusLang = other_languages.find('a:focus');
779        //arrow down and arrow right
780        if (e.which === 39 || e.which === 40) {
781          e.preventDefault();
782          focusLang.parent().next().find('a').focus();
783        }
784        //arrow up and arrow left
785        else if (e.which === 37 || e.which === 38) {
786          e.preventDefault();
787          focusLang.parent().prev().find('a').focus();
788        }
789        // home
790        else if (e.which === 36) {
791          e.preventDefault();
792          other_languages.find('li:first-child a').focus();
793        }
794        // end
795        else if (e.which === 35) {
796          e.preventDefault();
797          other_languages.find('li:last-child a').focus();
798        }
799      }
800      if ((lang_sel.is(':focus')) && e.which === 40) {
801        e.preventDefault();
802        other_languages.find('li:first-child a').focus();
803      }
804    });
805
806    $(document).on('keyup', function (e) {
807      if (other_languages.hasClass('show') && e.which == 27) {
808        other_languages.removeClass('show');
809        other_languages.fadeOut();
810        lang_sel.attr('aria-expanded', 'false');
811        lang_sel.focus();
812      }
813
814    });
815  }
816  function slideshowSize() {
817    var slideshow = $('#slideshow-1.size_xl');
818    var anchors = $('#anchors');
819    var bf = $('#slideshow-1 + #booking-form-1');
820    if (slideshow.length > 0 && anchors.length > 0 && !is_phone) {
821      slideshow.css({
822        height: $(window).height() - anchors.height()
823      });
824      if (is_tablet_landscape) {
825        bf.css({
826          bottom: '80px'
827        })
828      } else {
829
830        bf.css({
831          bottom: '120px'
832        })
833      }
834    }
835  }
836  function collapsibleContent() {
837    var button = $('.read_more.btn'),
838        mClass = 'open',
839        mClass2 = 'content_is_visible';
840    button.click(function () {
841      var btn = $(this);
842      var parent = btn.closest('.collapsibleContent_wrap');
843      if (btn.closest('#children_v2').length > 0) {
844        parent = btn.closest('.content');
845        var gallery = btn.closest('.item').find('.gallery_wrap');
846        if (gallery.length > 0) {
847          gallery.css({height: gallery.height()});
848        }
849      }
850
851      var wrap = parent.find('.collapsibleContent');
852      if (!btn.hasClass(mClass)) {
853
854        var height = wrap.find('.internal_wrap').outerHeight(true);
855        wrap.css({
856          'height': height
857        });
858        btn.addClass(mClass);
859        $(parent).addClass(mClass2);
860      } else {
861        wrap.css({
862          'height': 0
863        });
864        btn.removeClass(mClass);
865        $(parent).removeClass(mClass2);
866      }
867    });
868  }
869  function scrollToElement() {
870    var btn = $('.scrollToElement a');
871    if (btn.size() > 0) {
872      btn.each(function () {
873        var link = $(this);
874        link.click(function () {
875          var goTo = '#' + link.attr('data-scroll');
876          var top_part = $('#primary_menu_wrapper').height();
877          var paddingTxt = $('.section').eq(1).css('padding-bottom');
878          var padding = paddingTxt.replace('px', '');
879          var top = $(goTo).offset().top - top_part - padding;
880          $('html,body').stop().animate({scrollTop: top}, 500);
881        });
882
883      })
884    }
885  }
886  function indexPreviews() {
887    var items = $('.de_block_post_preview.grid .item');
888    if (items.length > 0 && !is_mobile) {
889      items.each(function () {
890        var item = $(this);
891        var desc = item.find('.hidden_content');
892        var desc_height = item.find('.more').outerHeight() + item.find('.description').outerHeight(true);
893        item.mouseenter(function () {
894          desc.parent().css({
895            height: desc_height
896          })
897        });
898        item.mouseleave(function () {
899          desc.parent().css({
900            height: 0
901          })
902        })
903      });
904    }
905  }
906})(jQuery);

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.