1 2 // left: 37, up: 38, right: 39, down: 40, 3 // spacebar: 32, pageup: 33, pagedown: 34, end: 35, home: 36 4 var keys = {37: 1, 38: 1, 39: 1, 40: 1}; 5 var bodyId = document.body.id; 6 function preventDefault(e) { 7 e.preventDefault(); 8 } 9 function preventDefaultForScrollKeys(e) { 10 if (keys[e.keyCode]) { 11 preventDefault(e); 12 return false; 13 } 14 } 15 16 // modern Chrome requires { passive: false } when adding event 17 var supportsPassive = false; 18 try { 19 window.addEventListener("test", null, Object.defineProperty({}, 'passive', { 20 get: function () { supportsPassive = true; } 21 })); 22 } catch(e) {} 23 24 var wheelOpt = supportsPassive ? { passive: false } : false; 25 var wheelEvent = 'onwheel' in document.createElement('div') ? 'wheel' : 'mousewheel'; 26 27 // call this to Disable 28 function disableScroll() { 29 window.addEventListener('DOMMouseScroll', preventDefault, false); // older FF 30 window.addEventListener(wheelEvent, preventDefault, wheelOpt); // modern desktop 31 window.addEventListener('touchmove', preventDefault, wheelOpt); // mobile 32 window.addEventListener('keydown', preventDefaultForScrollKeys, false); 33 } 34 35 // call this to Enable 36 function enableScroll() { 37 window.removeEventListener('DOMMouseScroll', preventDefault, false); 38 window.removeEventListener(wheelEvent, preventDefault, wheelOpt); 39 window.removeEventListener('touchmove', preventDefault, wheelOpt); 40 window.removeEventListener('keydown', preventDefaultForScrollKeys, false); 41 } 42 43 44/** 45 * @param {object} elem - SVG element to be animated. 46 * @param {boolean} smooth - Turn on smooth transitioning. 47 * @param {boolean} reverse - Turn on reverse animation. 48 * @param {string} type - scroll or time. 49 * @param {any} param1 - If type=scroll, param1 is the position from the top of the viewport that the svg has to be located to start drawing, defaulting to half of the viewport.\nIf type=time, param1 is the amount of time the drawing will take, defaulting to 1 second. 50 * @param {number} delay - (Only for type=time) The delay for the drawing animation, defaulting to 0 seconds. 51 * @param {number} fillTime - (Only for type=time) If the SVG has a fill, this specifies how long the fill will take to fade in after the svg is drawn, defaulting to 1 second. If the SVG doesn't have a fill, this will add a fill the same color as the stroke. 52 * @param {number} fillDelay - (Only for type=time) The Delay for filling the SVG, defaulting to 0 seconds. 53 * @return {object} The updated SVG element. 54 */ 55function makeSvgDrawn(elem, smooth, reverse, type, param1, delay, fillTime, fillDelay) { 56 // let id = 0; 57 Array.prototype.forEach.call(elem.children, path => { 58 if(['path', 'rect'].includes(path.nodeName)) { 59 makePathDrawn(path, smooth, reverse, type, param1, delay, fillTime, fillDelay); 60 } else if(path.nodeName === 'g') { 61 makeSvgDrawn(path, smooth, reverse, type, param1, delay, fillTime); 62 } 63 }); 64 return elem; 65} 66 67function makeSvgDrawn(elem, smooth, reverse, type, param1, delay, fillTime) { 68 // let id = 0; 69 Array.prototype.forEach.call(elem.children, path => { 70 if(['path', 'rect'].includes(path.nodeName)) { 71 makePathDrawn(path, smooth, reverse, type, param1, delay, fillTime); 72 } else if(path.nodeName === 'g') { 73 makeSvgDrawn(path, smooth, reverse, type, param1, delay, fillTime); 74 } 75 }); 76 return elem; 77} 78function makePathDrawn(path, smooth, reverse, type, param1, delay, fillTime, fillDelay) { 79 let hideStroke = false; 80 let stroke = path.getAttribute('stroke'); 81 let fill = path.getAttribute('fill'); 82 if(stroke === 'none') stroke=undefined; 83 if(fill === 'none') fill=undefined; 84 if(!stroke || fill || fillTime) { 85 path.setAttribute('fill', '#0000'); 86 if(!stroke) { 87 path.setAttribute('stroke', fill ?? '#FFF'); 88 hideStroke = true; 89 } 90 } 91 92 let length = path.getTotalLength(); 93 path.style.strokeDasharray = length; 94 path.style.strokeDashoffset = length; 95 setTimeout(() => { 96 if(smooth) path.style.transition = 'stroke-dashoffset .5s ease-out'; 97 }, 1); 98 if(type === 'scroll') { 99 // the goal is that when window.scrollY + window.innerHeight === svg.height + svg.y, strokeDashoffset will equal 0 100 // and, when window.scrollY === svg.y, strokeDashoffset will begin to change, and will be equal to strokeDasharray 101 // therefore, distance * multiplier = length, or multiplier = length / distance 102 let height = path.getBoundingClientRect().height; 103 let start = param1 ?? window.innerHeight / 2; 104 let scrollDistance = height - window.innerHeight + start; 105 let top = path.getBoundingClientRect().y; 106 if(top >= document.body.offsetHeight - window.innerHeight) { 107 let parent = path.parentElement; 108 while(parent.nodeName !== 'svg') parent = parent.parentElement; 109 parent = parent.parentElement; 110 top = parent.getBoundingClientRect().y; 111 }
112 let multiplier = length / scrollDistance; 113 document.addEventListener('scroll', () => { 114 if(window.scrollY + start >= top && window.scrollY + window.innerHeight <= top + height) { 115 let offset = ((window.scrollY - top + start) * multiplier); 116 if(reverse) offset *= -1; 117 path.style.strokeDashoffset = length - offset; 118 } else if (window.scrollY + start < top) { 119 if(reverse) path.style.strokeDashoffset = -length; 120 else path.style.strokeDashoffset = length 121 } else { 122 path.style.strokeDashoffset = 0; 123 } 124 }); 125 } else if(type === 'time') { 126 let time = param1 ?? 1; 127 time *= 100; 128 let interval = length / time; 129 if(reverse) interval *= -1; 130 function showSvg(path, interval, time) { 131 if(time > 0) { 132 // console.log('1: ' + path.style.strokeDashoffset); 133 path.style.strokeDashoffset = parseFloat(path.style.strokeDashoffset) - interval; 134 // console.log('2: ' + path.style.strokeDashoffset); 135 setTimeout(() => showSvg(path, interval, time - 1), 10); 136 } else if(fill || fillTime) { 137 fillDelay = fillDelay ?? 0; 138 fillDelay *= 1000; 139 setTimeout(() => { 140 path.style.transition = `fill ${fillTime ?? 1}s, stroke ${fillTime ?? 1}s`; 141 path.setAttribute('fill', fill ?? stroke); 142 if(hideStroke) path.setAttribute('stroke', '#0000'); 143 }, fillDelay); 144 } 145 } 146 setTimeout(() => { 147 showSvg(path, interval, time); 148 }, delay * 1000 ?? 0); 149 } 150 else { 151 path.style.strokeDasharray = 'none'; 152 path.style.strokeDashoffset = 'none'; 153 console.error('invalid type for makeSvgDrawn function'); 154 } 155} 156 157document.addEventListener('DOMContentLoaded', () => { 158 159 if ( bodyId == 'template-about' || bodyId == 'template-experience' ) { 160 let heroline = document.getElementById('neoheroLine'); 161 makeSvgDrawn(heroline, true, false, 'time', 3, 3); 162 } 163 164 if ( bodyId == 'template-collection' ) { 165 let heroline = document.getElementById('neoheroLine'); 166 makeSvgDrawn(heroline, true, true, 'time', 3, 3); 167 // draw campus line 168 for (var i = 0; i < 3; i++) { 169 let campuseline = document.getElementById('campus-line-'+i); 170 // makeSvgDrawn(campuseline, false, false, 'scroll', 0); 171 makeSvgDrawn(campuseline, false, false, 'scroll', window.innerHeight / 4); 172 } 173 } 174 175 // SINGLE CAMPUS PAGES 176 if ( bodyId == 'single' ) { 177 let camLine = document.getElementById('neoCamLine'); 178 if (camLine !=null) { 179 makeSvgDrawn(camLine, false, false, 'scroll', window.innerHeight / 6); 180 } 181 } 182 183 // TARGET HOMEPAGE 184 if ( bodyId == 'index' ) { 185 186 let heroline = document.getElementById('neoheroLine'); 187 makeSvgDrawn(heroline, true, true, 'time', 4, 6); 188 let neoComLine = document.getElementById('neoComLine'); 189 makeSvgDrawn(neoComLine, false, true, 'scroll', window.innerHeight / 3); 190 let logoLoad = lottie.loadAnimation({ 191 container: document.getElementById('logoH'), 192 renderer: 'svg', 193 loop: false, 194 autoplay: true, 195 path: 'https://assets2.lottiefiles.com/private_files/lf30_rqrkuvwn.json' 196 }); 197 logoLoad.addEventListener('complete', function(e) { 198 // console.log('complete') 199 }) 200 // disable scrolling 201 disableScroll(); 202 203 setTimeout(function(){ document.getElementById("neoheader").classList.add("loaded"); }, 5000); 204 setTimeout(function(){ 205 // enable scrolling 206 enableScroll(); 207 document.getElementById("neoheader").classList.remove("neo_intro"); 208 }, 6500); 209 } 210 211 212 213 // let campuseline = document.getElementById('neoCamLine'); 214 // // makeSvgDrawn(campuseline, false, false, 'scroll', window.innerHeight / 4); 215 // makeSvgDrawn(campuseline, false, false, 'scroll', 0); 216 // 217 // let neoComLine = document.getElementById('neoComLine'); 218 // makeSvgDrawn(neoComLine, false, false, 'scroll', 0); 219 // 220 // let heroline = document.getElementById('neoheroLine'); 221 // makeSvgDrawn(heroline, true, true, 'time', 4, 6); 222 // 223 // // start transition of the LOGO 224 // // document.getElementsByTagName('lottie-player')[0].addEventListener('load', e => { 225 // // console.log('loaded'); 226 // // e.target.shadowRoot.children[0].children[0].children[0].style.height = 'auto !important'; 227 // // }); 228 // 229 // 230 // let logoLoad = lottie.loadAnimation({ 231 // container: document.getElementById('logoH'), 232 // renderer: 'svg', 233 // loop: false, 234 // autoplay: true, 235 // path: 'https://assets2.lottiefiles.com/private_files/lf30_rqrkuvwn.json' 236 // }); 237 // logoLoad.addEventListener('complete', function(e) { 238 // // console.log('complete') 239 // }) 240 241 // var player = document.querySelector("lottie-player"); 242 // player.load("https://assets2.lottiefiles.com/private_files/lf30_rqrkuvwn.json"); 243 // player.addEventListener('load', e => { 244 // console.log( 'loaded '); 245 // // e.target.shadowRoot.querySelector('svg').style.height = 'auto !important'; 246 // e.target.shadowRoot.querySelector('svg').style.height = 'auto'; 247 // }); 248 249 // let sandLogo = document.getElementById('neoimgLoad'); 250 // let paths = sandLogo.children[0].children; 251 // makePathDrawn(paths[2], false, true, 'time', 3, 1, 1, 1.5); 252 // makePathDrawn(paths[1], false, true, 'time', 3, 1, 1, 0.5); 253 // makePathDrawn(paths[0], false, true, 'time', 3, 1, 1, 0.5); 254 255 256 257});
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.