1/*! Created by: Udo Schmal | https://www.gocher.me/ */ 2(function() { 3 'use strict'; 4 if ('objectFit' in document.documentElement.style === false) { 5 console.log('object-fit fix'); 6 function cover(el) { 7 var bounding = el.parentNode.getBoundingClientRect(), height, width, src; 8 if (el.tagName.toLowerCase() == 'img') { 9 width = el.naturalWidth; 10 height = el.naturalHeight; 11 src = el.src; 12 } else if (el.tagName.toLowerCase() == 'video') { 13 width = el.videoWidth; 14 height = el.videoHeight; 15 src = el.getElementsByTagName("source")[0].src; 16 } 17 console.log('use object-fit.js for ' + src); 18 if ((bounding.width != 0) && (bounding.height != 0)) { 19 if ((bounding.width / bounding.height) > (width / height)) { 20 el.style.height = 'auto'; 21 } else { 22 el.style.width = 'auto'; 23 } 24 } 25 } 26 var els = document.querySelectorAll('.fit-cover'), len = els.length, i; 27 for (i=0; i < len; i++) { 28 if (els[i].tagName.toLowerCase() == 'img') { 29 if (!els[i].complete || (els[i].naturalWidth === 0)) { 30 els[i].addEventListener("load", function (event) { cover(this); }); 31 } else { 32 cover(els[i]); 33 } 34 } else if (els[i].tagName.toLowerCase() == 'video') { 35 if (els[i].videoWidth == 0) { 36 els[i].addEventListener("loadedmetadata", function (event) { cover(this); }); 37 } else { 38 cover(els[i]); 39 } 40 } 41 } 42 } else { 43 console.log('native object-fit'); 44 } 45})();
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.