PageSourceSearch

https://www.we-hotels.com/wp-content/themes/pro-theme-fuji/js/main.js?ver=1.0.1

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