1/** 2 * 3 */ 4 5(function ($, Drupal,drupalSettings) { 6 'use strict'; 7 jQuery(document).ready(function($) { 8 9 if (typeof enableWcagMenuTabTrapping === 'function') { 10 const wcagConfig = { 11 menuSelector: '.menu--main', 12 toggleSelector: '#menu-button' 13 }; 14 enableWcagMenuTabTrapping(wcagConfig); 15 } 16 17 // CBIS Filter toggle 18 $('.cbis-list-controller-area form label').on('click', function() { 19 $(this).toggleClass('visible'); 20 $(this).siblings('fieldset').toggleClass('visible'); 21 }); 22 23 24 // Language switcher 25 $('.block-language-blocklanguage-interface .language-toggle').on('click', function() { 26 $('.link').toggleClass('visible'); 27 $('.overlay').toggleClass('visible'); 28 29 // Toggle aria-expanded for accessibility 30 const isExpanded = $(this).attr('aria-expanded') === 'true'; 31 $(this).attr('aria-expanded', !isExpanded); 32 }); 33 34 // Close language menu on Escape key press 35 $(document).on('keydown', function(e) { 36 if (e.keyCode === 27 || e.key === 'Escape') { // Escape key 37 if ($('.overlay').hasClass('visible')) { 38 $('.link').removeClass('visible'); 39 $('.overlay').removeClass('visible'); 40 $('.language-toggle').attr('aria-expanded', 'false'); 41 } 42 } 43 }); 44 45 // Close language menu when clicking outside 46 $(document).on('click', function(e) { 47 const $languageBlock = $('.block-language-blocklanguage-interface'); 48 if (!$languageBlock.is(e.target) && $languageBlock.has(e.target).length === 0) { 49 if ($('.overlay').hasClass('visible')) { 50 $('.link').removeClass('visible'); 51 $('.overlay').removeClass('visible'); 52 $('.language-toggle').attr('aria-expanded', 'false'); 53 } 54 } 55 }); 56 57 // Citybreak widget toggle 58 $(document).on('click','#citybreak-widget .widget-tab',function () { 59 /* Remove active classes on all */ 60 $('#citybreak-widget .widget-tab').removeClass('active'); 61 // var current = $(this).parent().next('.field--name-field-widget-type'); 62 $(".widget-content-type > div").removeClass('visible'); 63 64 /* Add active classes on clicked */ 65 $(this).addClass('active'); 66 var id = $(this).data('type'); 67 var ref = $(this).data('ref'); 68 $(".field--name-field-widget-type > .field__item:nth-child("+ref+") .widget-content-type > div").addClass('visible'); 69 }) 70 71 $(document).on("mouseup.hideDocClick", function (e) 72 { 73 //Toggle widget on click outside 74 var containerWidget = $("#citybreak-widget"); 75 var containerPopup = $(".Citybreak_engine.cb-popout"); 76 var containerPopupdate= $("#cb-ui-datepicker-div"); 77 78 // if the target of the click isn't the container nor a descendant of the container 79 if (!containerWidget.is(e.target) && containerWidget.has(e.target).length === 0 && !containerPopup.is(e.target) && containerPopup.has(e.target).length === 0 && !containerPopupdate.is(e.target) && containerPopupdate.has(e.target).length === 0) 80 { 81 containerWidget.removeClass('open'); 82 } 83 //Toggle menu on click outside 84 var containerMenu = $("header.menu"); 85 86 // if the target of the click isn't the container nor a descendant of the container 87 if (!containerMenu.is(e.target) && containerMenu.has(e.target).length === 0) 88 { 89 if($('body').hasClass('show-menu')){ 90 $('body').removeClass('show-menu').addClass('hide-menu'); 91 $('#menu-button').removeClass('open'); 92 } 93 } 94 }); 95 96 // Close menu on Escape key press 97 $(document).on("keydown", function (e) { 98 if (e.keyCode === 27 || e.key === 'Escape') { // Escape key 99 if($('body').hasClass('show-menu')){ 100 $('body').removeClass('show-menu').addClass('hide-menu'); 101 $('#menu-button').removeClass('open'); 102 } 103 } 104 }); 105 106 107 /* make masonry of list if it is a mobile */ 108 if ($(window).width() < 960 && /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) { 109 // alert('Less than 960'); 110 if($('.content-list.no-slideshow').length){ 111 // init Masonry on list 112 var $gridLpbT = $('.content-list.no-slideshow').masonry({ 113 itemSelector: '.content-list .views-row', 114 percentPosition: true 115 }); 116 // layout Masonry after each image loads 117 $gridLpbT.imagesLoaded().progress( function() { 118 $gridLpbT.masonry('layout'); 119 }); 120 } 121 } 122 123 124 /* Widget tabs in select tag */ 125 $(document).on('click','#cbis-item-book-button',function () { 126 127 $(this).toggleClass('open'); 128 // $('.cbis-item-widget-js').toggleClass('hidden'); 129 130 $('html,body').animate({ 131 scrollTop: $(".cbis-item-widget-js").offset().top - 200}, 132 'slow'); 133 134 }); 135 136 137 /* If scroll-down button is clicked, scroll down to cbis body */ 138 $('#scroll-down').on('click', function(e) { 139 $('html,body').animate({ 140 scrollTop: $(".cbis-product-body").offset().top},'slow'); 141 }); 142 143 /* If scroll-up button is clicked, scroll up */ 144 $('#scroll-to-top').on('click', function(e) { 145 $('html,body').animate({ 146 scrollTop: 0},'slow'); 147 }); 148 149 /* Sticky header on scroll */ 150 var iScrollPos = 0; 151 $(window).scroll(function () { 152 var iCurScrollPos = $(this).scrollTop(); 153 if (iCurScrollPos > iScrollPos) { 154 //Scrolling Down 155 if(iCurScrollPos > 500){ 156 $('header').addClass('scroll-down').removeClass('scroll-up'); 157 } 158 } else { 159 $('header').removeClass('scroll-down').addClass('scroll-up'); 160 //Scrolling Up 161 } 162 //If at top remove classes 163 if(iCurScrollPos < 80){ 164 $('header').removeClass('scroll-down').removeClass('scroll-up'); 165 } 166 iScrollPos = iCurScrollPos; 167 }); 168 /* END Sticky header on scroll */ 169 170 171 }); 172 173 174})(jQuery, Drupal,drupalSettings);
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.