1/** 2 * @file 3 * Global utilities. 4 * 5 */ 6(function (Drupal) { 7 8 'use strict'; 9 10 Drupal.behaviors.bootstrap_barrio = { 11 attach: function (context, settings) { 12 13 var position = window.scrollY; 14 window.addEventListener('scroll', function() { 15 if (window.scrollY > 50) { 16 document.querySelector('body').classList.add("scrolled"); 17 } 18 else { 19 document.querySelector('body').classList.remove("scrolled"); 20 } 21 var scroll = window.scrollY; 22 if (scroll > position) { 23 document.querySelector('body').classList.add("scrolldown"); 24 document.querySelector('body').classList.remove("scrollup"); 25 } else { 26 document.querySelector('body').classList.add("scrollup"); 27 document.querySelector('body').classList.remove("scrolldown"); 28 } 29 position = scroll; 30 }); 31 32 document.addEventListener('click', function (event) { 33 34 // If the clicked element doesn't have the right selector, bail 35 if (!event.target.matches('.dropdown-item a.dropdown-toggle')) return; 36 37 // Don't follow the link 38 event.preventDefault(); 39 40 toggle(event.target.next('ul')); 41 event.stopPropagation(); 42 43 }, false); 44 45 // Toggle element visibility 46 var toggle = function (elem) { 47 48 // If the element is visible, hide it 49 if (window.getComputedStyle(elem).display === 'block') { 50 hide(elem); 51 return; 52 } 53 54 // Otherwise, show it 55 show(elem); 56 57 }; 58 59 var show = function (elem) { 60 elem.style.display = 'block'; 61 }; 62 63 var hide = function (elem) { 64 elem.style.display = 'none'; 65 }; 66 } 67 }; 68 69})(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.