1(function($) { 2 var detectIE = function () { 3 var ua = window.navigator.userAgent; 4 5 var msie = ua.indexOf('MSIE '); 6 if (msie > 0) { 7 // IE 10 or older => return version number 8 return parseInt(ua.substring(msie + 5, ua.indexOf('.', msie)), 10); 9 } 10 11 var trident = ua.indexOf('Trident/'); 12 if (trident > 0) { 13 // IE 11 => return version number 14 var rv = ua.indexOf('rv:'); 15 return parseInt(ua.substring(rv + 3, ua.indexOf('.', rv)), 10); 16 } 17 18 var edge = ua.indexOf('Edge/'); 19 if (edge > 0) { 20 // Edge (IE 12+) => return version number 21 return parseInt(ua.substring(edge + 5, ua.indexOf('.', edge)), 10); 22 } 23 24 // other browser 25 return false; 26 } 27 var beforeDoc = true; 28 var LazyLoadImgIO = (typeof IntersectionObserver == 'undefined' || detectIE()) ? undefined : new IntersectionObserver(function(entries) { 29 for(ind in entries) { 30 if(entries[ind].isIntersecting) { 31 swapOut(entries[ind].target) 32 LazyLoadImgIO.unobserve(entries[ind].target) 33 } 34 } 35 }, {rootMargin: "80px 0px 80px 0px"}); 36 var LazyLoadJumpIO = (typeof IntersectionObserver == 'undefined' || detectIE()) ? undefined : new IntersectionObserver(function(entries) { 37 for(ind in entries) { 38 if(entries[ind].isIntersecting) { 39 lazyJump(entries[ind].target) 40 LazyLoadJumpIO.unobserve(entries[ind].target) 41 } 42 } 43 }, {rootMargin: "80px 0px 80px 0px"}); 44 var swapOut = function(elem) { 45 var $elem = $(elem), 46 srcset; 47 if (beforeDoc) { 48 setSrc($elem); 49 } else { 50 srcset = $elem.attr('data-srcset'); 51 if (srcset) { 52 srcset = 'srcset="' + srcset + '" '; 53 } 54 55 $('<img src="' + $elem.attr('data-src') + '" ' + srcset + '/>').on('load', function() { 56 setSrc($elem); 57 }); 58 } 59 } 60 function setSrc($elem) { 61 var src = $elem.attr('data-src'), 62 srcset = $elem.attr('data-srcset'); 63 $elem.attr('src', src); 64 $elem.addClass('bto-lazy-loaded'); 65 if (srcset) { 66 $elem.attr('srcset', srcset); 67 } 68 } 69 var lazyLoad = function(context) { 70 $('img[data-src].bto-lazy', context).once('btoLazyLoad', function() { 71 if(typeof LazyLoadImgIO != 'undefined') { 72 LazyLoadImgIO.observe(this) 73 } else { 74 swapOut(this) 75 } 76 }) 77 $('div.bto-lazy-jump', context).once('btoLazyLoad', function() { 78 if(typeof LazyLoadJumpIO != 'undefined') { 79 LazyLoadJumpIO.observe(this) 80 } else { 81 lazyJump(this) 82 } 83 }) 84 } 85 var lazyJump = function(elem) { 86 $.get($(elem).attr('data-bto-jump-select'), function(data) { 87 var sel = $(data) 88 $(sel).addClass('bto-lazy-loaded') 89 $(elem).replaceWith(sel) 90 Drupal.attachBehaviors(sel, Drupal.settings) 91 }); 92 } 93 Drupal.behaviors.btoLazyLoad = { 94 attach: function(context) { 95 lazyLoad(context) 96 } 97 } 98 lazyLoad(document) 99 $(document).ready(function() { 100 beforeDoc = false 101 }) 102})(jQuery)
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.