1const slideUp = (target, duration=500) => { 2 target.style.transitionProperty = 'height, margin, padding'; 3 target.style.transitionDuration = duration + 'ms'; 4 target.style.boxSizing = 'border-box'; 5 target.style.height = target.offsetHeight + 'px'; 6 target.offsetHeight; 7 target.style.overflow = 'hidden'; 8 target.style.height = 0; 9 target.style.paddingTop = 0; 10 target.style.paddingBottom = 0; 11 target.style.marginTop = 0; 12 target.style.marginBottom = 0; 13 window.setTimeout( () => { 14 target.style.display = 'none'; 15 target.style.removeProperty('height'); 16 target.style.removeProperty('padding-top'); 17 target.style.removeProperty('padding-bottom'); 18 target.style.removeProperty('margin-top'); 19 target.style.removeProperty('margin-bottom'); 20 target.style.removeProperty('overflow'); 21 target.style.removeProperty('transition-duration'); 22 target.style.removeProperty('transition-property'); 23 //alert("!"); 24 }, duration); 25} 26 27const slideDown = (target, duration=500) => { 28 target.style.removeProperty('display'); 29 let display = window.getComputedStyle(target).display; 30 31 if (display === 'none') 32 display = 'block'; 33 34 target.style.display = display; 35 let height = target.offsetHeight; 36 target.style.overflow = 'hidden'; 37 target.style.height = 0; 38 target.style.paddingTop = 0; 39 target.style.paddingBottom = 0; 40 target.style.marginTop = 0; 41 target.style.marginBottom = 0; 42 target.offsetHeight; 43 target.style.boxSizing = 'border-box'; 44 target.style.transitionProperty = "height, margin, padding"; 45 target.style.transitionDuration = duration + 'ms'; 46 target.style.height = height + 'px'; 47 target.style.removeProperty('padding-top'); 48 target.style.removeProperty('padding-bottom'); 49 target.style.removeProperty('margin-top'); 50 target.style.removeProperty('margin-bottom'); 51 window.setTimeout( () => { 52 target.style.removeProperty('height'); 53 target.style.removeProperty('overflow'); 54 target.style.removeProperty('transition-duration'); 55 target.style.removeProperty('transition-property'); 56 }, duration); 57} 58 59const slideToggle = (target, duration = 500) => { 60 if (window.getComputedStyle(target).display === 'none') { 61 return slideDown(target, duration); 62 } else { 63 return slideUp(target, duration); 64 } 65} 66 67const slideWindow = () => { 68 const body = document.querySelector('.cpcta-flyin .cpcta-content-panel') 69 slideToggle(body); 70 71 document.querySelector('.cpcta-flyin').classList.toggle('slidOut'); 72} 73 74document.addEventListener('DOMContentLoaded', () => { 75 /** 76 * Once the content finishes loading, attach the following event listeners. 77 * 1. When a user clicks on the tab (i.e. top-bar), reveal/hide the content window. 78 * 2. When a user clicks on the "close" button, hide the content window 79 */ 80 81 // auto-pop out cta window 82 const autopopTime = document.querySelector('.cpcta-flyin').dataset.autopopTimer; 83 let autopopCountdown; 84 if(autopopTime) { 85 autopopCountdown = setTimeout(slideWindow, parseInt(autopopTime)); 86 } 87 88 document.querySelector('.cpcta-top-bar').addEventListener('click', () => { 89 slideWindow(); 90 if(autopopCountdown) clearTimeout(autopopCountdown); 91 }); 92 document.querySelector('.cpcta-close').addEventListener('click', slideWindow); 93 94 95 // set max-height based on size of window 96 const windowHeight = window.innerHeight; 97 const maxHeight = windowHeight - (windowHeight * .2); 98 document.querySelector('.cpcta-content-panel').style.maxHeight = Math.floor(maxHeight) + 'px'; 99})
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.