1(function(){ 2 function VerticalTimeline( element ) { 3 this.element = element; 4 this.blocks = this.element.getElementsByClassName("journey-timeline__block"); 5 this.images = this.element.getElementsByClassName("journey-timeline__item-number"); 6 this.contents = this.element.getElementsByClassName("journey-timeline__content"); 7 this.offset = 0.8; 8 this.hideBlocks(); 9 }; 10 11 VerticalTimeline.prototype.hideBlocks = function() { 12 if ( !"classList" in document.documentElement ) { 13 return; // no animation on older browsers 14 } 15 //hide timeline blocks which are outside the viewport 16 var self = this; 17 for( var i = 0; i < this.blocks.length; i++) { 18 (function(i){ 19 if( self.blocks[i].getBoundingClientRect().top > window.innerHeight*self.offset ) { 20 self.images[i].classList.add("journey-timeline__item-number--hidden"); 21 self.contents[i].classList.add("journey-timeline__content--hidden"); 22 } 23 })(i); 24 } 25 }; 26 27 VerticalTimeline.prototype.showBlocks = function() { 28 if ( ! "classList" in document.documentElement ) { 29 return; 30 } 31 var self = this; 32 for( var i = 0; i < this.blocks.length; i++) { 33 (function(i){ 34 if( self.contents[i].classList.contains("journey-timeline__content--hidden") && self.blocks[i].getBoundingClientRect().top <= window.innerHeight*self.offset ) { 35 // add bounce-in animation 36 self.images[i].classList.add("journey-timeline__item-number--bounce-in"); 37 self.contents[i].classList.add("journey-timeline__content--bounce-in"); 38 self.images[i].classList.remove("journey-timeline__item-number--hidden"); 39 self.contents[i].classList.remove("journey-timeline__content--hidden"); 40 } 41 })(i); 42 } 43 }; 44 45 var verticalTimelines = document.getElementsByClassName("journey-timeline"), 46 verticalTimelinesArray = [], 47 scrolling = false; 48 if( verticalTimelines.length > 0 ) { 49 for( var i = 0; i < verticalTimelines.length; i++) { 50 (function(i){ 51 verticalTimelinesArray.push(new VerticalTimeline(verticalTimelines[i])); 52 })(i); 53 } 54 55 //show timeline blocks on scrolling 56 window.addEventListener("scroll", function(event) { 57 if( !scrolling ) { 58 scrolling = true; 59 (!window.requestAnimationFrame) ? setTimeout(checkTimelineScroll, 250) : window.requestAnimationFrame(checkTimelineScroll); 60 } 61 }); 62 } 63 64 function checkTimelineScroll() { 65 verticalTimelinesArray.forEach(function(timeline){ 66 timeline.showBlocks(); 67 }); 68 scrolling = false; 69 }; 70})();
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.