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