1// Do not use this file, only for demonstration purpose. 2(function ($, Drupal, once) { 3 Drupal.behaviors.trimTheTailThFooter = { 4 5 attach: function (context, settings) { 6 const $accordionItems = $(context).find('footer.region-footer .menu--footer, footer.region-footer .menu--for-our-partners-footer'); 7 const $window = $(window); 8 const accordionClassName = 'accordion-item-open'; 9 var cookieLink = $(context).find('footer.region-footer .main-footer .cookie-popup'); 10 11 // Prevent the page reload when the cookie link is clicked. 12 cookieLink.on('click', function (e) { 13 e.preventDefault(); 14 window.evidon.notice.showOptions(); 15 }); 16 17 // Process footer script behavior just once. 18 if (!once('footer-mobile', 'html').length) { 19 // Early return avoid changing the indentation 20 // for the rest of the code. 21 return; 22 }; 23 $(window).each(function () { 24 25 // Define breakpoints we want to listen. 26 $window.mediaQueryEvents({ 27 breakpoints: { 28 "footer_mob": '(min-width: 0px) and (max-width: 1200px)', 29 "footer_desk": '(min-width: 1201px)' 30 } 31 }); 32 33 /** 34 * Applies logic for managing items as accordion items. 35 * 36 * @param {Event} e 37 */ 38 const accordionStyle = function (e) { 39 const $el = $(this).parent(); 40 41 if ($el.hasClass(accordionClassName)) { 42 // Just close current item. 43 $el.removeClass(accordionClassName) 44 } 45 else { 46 // Close previous item/s and open the current one. 47 $accordionItems.removeClass(accordionClassName) 48 $el.addClass(accordionClassName) 49 } 50 } 51 52 // Listen mobile breakpoint. 53 $window.on('mq.footer_mob', function (e) { 54 $accordionItems.each(function () { 55 const $item = $(this).find('.menu-block-footer-title'); 56 const footerTitle = once('footer-title', $item); 57 $(footerTitle).click(accordionStyle); 58 }); 59 }); 60 61 // Listen desktop breakpoint. 62 $window.on('mq.footer_desk', function (e) { 63 $accordionItems.each(function () { 64 // Remove accordionClassName class for cleaning purposes. 65 $accordionItems.removeClass(accordionClassName) 66 }); 67 }); 68 }); 69 } 70 }; 71})(jQuery, Drupal, once);
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.