1/** 2 * Feature detect and conditionally load polyfills for outdated browsers 3 */ 4(function () { 5 function loadScript(src) { 6 var firstScript = document.querySelector('script'); 7 var newScript = document.createElement('script'); 8 9 newScript.src = src; 10 newScript.defer = true; 11 12 if (firstScript) { 13 // insert new script after first script tag 14 firstScript 15 .parentNode 16 .insertBefore(newScript, firstScript.nextSibling); 17 } 18 } 19 20 /** 21 * Check to see if the browser fully supports IntersectionObserver 22 * @returns {boolean} - Whether or not the browser fully supports IntersectionObserver 23 */ 24 function supportsIntersectionObserver() { 25 if (!('IntersectionObserver' in window) || 26 !('IntersectionObserverEntry' in window) || 27 !('intersectionRatio' in window.IntersectionObserverEntry.prototype) || 28 !('isIntersecting' in window.IntersectionObserverEntry.prototype)) { 29 return false; 30 } 31 32 return true; 33 } 34 35 /** 36 * Check to see if the browser supports sticky position value 37 * @returns {boolean} - Whether or not the browser supports the sticky position 38 */ 39 function supportsPositionSticky() { 40 var prop = 'position:'; 41 var value = 'sticky'; 42 var prefixes = ' -webkit- -moz- -o- -ms- '.split(' '); 43 44 var el = document.createElement('a'); 45 var mStyle = el.style; 46 mStyle.cssText = prop + prefixes.join(value + ';' + prop).slice(0, - prop.length); 47 48 return mStyle.position.indexOf(value) !== -1; 49 }; 50 51 if (!supportsPositionSticky()) { 52 loadScript(window.__staticPath__ + 'js/lib/stickyfill.min.js'); 53 } 54 55 if (!supportsIntersectionObserver()) { 56 loadScript(window.__staticPath__ + 'js/lib/intersection-observer.min.js'); 57 } 58})();
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.