1(function ($, Drupal) { 2 'use strict'; 3 // ////////////////////////////////////////////////////////////////////////////// 4 // [ DROPDOWN LANGUAGE MENU MOBILE ] 5 $(() => { 6 if (window.matchMedia('(max-width: 768px)').matches) { 7 $('#language-selector').addClass('dropup'); 8 } 9 else { 10 $('#language-selector').removeClass('dropup'); 11 } 12 }); 13 14 // ////////////////////////////////////////////////////////////////////////////// 15 // [ DESKTOP MENU - SEARCH TOGGLE ] 16 $('#menu-main').on('click', '.form-actions', function (e) { 17 $('#menu-main') 18 .toggleClass('show-search') 19 .find('.form-search') 20 .focus(); 21 $(this).toggleClass('active'); 22 e.preventDefault(); 23 }); 24 25 // ////////////////////////////////////////////////////////////////////////////// 26 // [ ANCHOR OFFSET ] 27 $(() => { 28 const target = window.location.hash; 29 // only try to scroll to offset if target has been set in location hash 30 31 if (target !== '') { 32 const $target = jQuery(target); 33 jQuery('html, body') 34 .stop() 35 .animate( 36 { 37 scrollTop: $target.offset().top - 150 38 }, // set offset value here i.e. 50 39 100, 40 'swing', 41 () => { 42 window.location.hash = target - 80; 43 } 44 ); 45 } 46 }); 47 48 // ////////////////////////////////////////////////////////////////////////////// 49 // [ MOBILE NAV - SMOOTH OPENING/CLOSING SUBMENU ] 50 if (window.matchMedia('(max-width: 768px)').matches) { 51 let open = $('#menu-main .dropdown-toggle'); 52 let a = $('#menu-main .nav').find('.dropdown-toggle'); 53 54 open.click(function (e) { 55 e.preventDefault(); 56 let $this = $(this); 57 let speed = 250; 58 if ($this.hasClass('active-menu') === true) { 59 $this 60 .removeClass('active-menu') 61 .next('.dropdown-menu') 62 .slideUp(speed); 63 } 64 else if (a.hasClass('active-menu') === false) { 65 $this 66 .addClass('active-menu') 67 .next('.dropdown-menu') 68 .slideDown(speed); 69 } 70 else { 71 a.removeClass('active-menu') 72 .next('.dropdown-menu') 73 .slideUp(speed); 74 $this 75 .addClass('active-menu') 76 .next('.dropdown-menu') 77 .delay(speed) 78 .slideDown(speed); 79 } 80 }); 81 } 82 // ////////////////////////////////////////////////////////////////////////////// 83 // [ BOOTSTRAP COMPONENTS ] 84 85 // [ TOOLTIP ] 86 $(() => { 87 $('[data-toggle="tooltip"]').tooltip({ 88 delay: { 89 show: 100, 90 hide: 250 91 } 92 }); 93 }); 94 95 // [ POPOVERS ] 96 $(() => { 97 $('[data-toggle="popover"]').popover(); 98 }); 99 100 // [ CAROUSEL ] 101 $(() => { 102 $('.carousel').carousel({ 103 interval: 2000 104 }); 105 }); 106 107 // [ MODAL ] 108 $(() => { 109 $('#bs-modal').on('shown.bs.modal', () => { 110 $('#bs-modal-button').trigger('focus'); 111 }); 112 }); 113 // ////////////////////////////////////////////////////////////////////////////// 114 // [ SUBMIT WITH ENTER KEYSTROKE ] 115 $(() => { 116 $('.form-search').keydown(function (event) { 117 // enter has keyCode = 13, change it if you want to use another button 118 if (event.keyCode === 13) { 119 this.form.submit(); 120 return false; 121 } 122 }); 123 }); 124 125 // ////////////////////////////////////////////////////////////////////////////// 126 // [ HIDE / SHOW IMAGE LOGO ON SCROOL ] 127 $(() => { 128 const logo = $('#header-menu .navbar-brand'); 129 $(window).scroll(() => { 130 const scroll = $(window).scrollTop(); 131 132 if (scroll >= 85) { 133 if (!logo.hasClass('show-logo')) { 134 logo.removeClass('hide-logo').addClass('show-logo'); 135 } 136 } 137 else if (!logo.hasClass('hide-logo')) { 138 logo.removeClass('show-logo').addClass('hide-logo'); 139 } 140 }); 141 }); 142})(jQuery, Drupal);
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.