1(function ($, Drupal, once) { 2 "use strict"; 3 4 Drupal.behaviors.CohesionLazyLoad = { 5 attach: function (context, settings) { 6 7 function isScrollable(el) { 8 return (el.scrollWidth > el.clientWidth && (getComputedStyle(el).overflowY === 'auto' || getComputedStyle(el).overflowY === 'scroll')) || 9 (el.scrollHeight > el.clientHeight && (getComputedStyle(el).overflowX === 'auto' || getComputedStyle(el).overflowX === 'scroll')) || 10 el.tagName === 'HTML'; 11 } 12 13 once('lazyload-once', '[loading=lazy]', context).forEach(function(item) { 14 var $this = $(item); 15 $this.parents().each(function() { 16 var $parent = $(this); 17 if($parent.data('lazyContainerFound') === true) { 18 if($parent.data('llContainer')) { 19 $parent.data('llContainer').update(); 20 } 21 return false; 22 } else if(isScrollable(this)) { 23 $parent.data('lazyContainerFound', true); 24 var llContainer = new LazyLoad({ 25 container: this.tagName === 'HTML' ? document : this, 26 elements_selector: "[loading=lazy]", 27 class_loading: 'coh-lazy-loading', 28 class_loaded: 'coh-lazy-loaded', 29 class_error: 'coh-lazy-error', 30 use_native: true 31 }); 32 $parent.data('llContainer', llContainer); 33 return false; 34 } 35 }); 36 37 if ($.fn.matchHeight) { 38 $this.on('load', function () { 39 if ($(this).length) { 40 $.fn.matchHeight._update(); 41 } 42 }); 43 } 44 }); 45 } 46 }; 47 48})(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.