1/** 2 * global 3 * @version 1.0.4 4 * @release 01-04-2021 5 * @author msolowski Marcin So�owski 6 * @website http://msolowski.pl 7 * 8 * @require scroll-out-2.2.7.min.js 9 * @require typed-2.0.11.min.js 10 * @require lax-1.2.3.min.js 11 * 12 * data attributes 13 * @speed data-speed 14 * @delay data-delay 15 */ 16 17document.addEventListener('DOMContentLoaded', function() 18{ 19 window.addEventListener('load', function() 20 { 21 var header = document.querySelector('#header'); 22 if(typeof(header) !== 'undefined' && header !== null) 23 { 24 header.classList.remove('is_translate'); 25 } 26 }); 27 28 ////////////////////////////////////////////////////////////////////////////////////////////////// 29 30 window.addEventListener('load', function() 31 { 32 document.querySelector('body').classList.add('is_ready'); 33 34 ScrollOut( 35 { 36 once: true, 37 // threshold: 0, 38 targets: '.is_animate', 39 onShown: function(el) 40 { 41 if(el.dataset.typed) 42 { 43 var elTyped = el.querySelector('.typed'), 44 elTypedSource = el.querySelector('.typed_source'), 45 elTypedWrapper = el.querySelector('.typed_wrapper'), 46 speed = 0, // default if data-speed is not exist
47 delay = 0, // default if data-delay is not exist 48 cursor = false, // default if data-cursor is not exist 49 dataSpeed = elTyped.dataset.speed, 50 dataDelay = elTyped.dataset.delay; 51 dataCursor = elTyped.dataset.cursor; 52 53 if(typeof(dataSpeed) !== 'undefined' && dataSpeed !== null){ speed = dataSpeed; } 54 if(typeof(dataDelay) !== 'undefined' && dataDelay !== null){ delay = dataDelay; } 55 if(typeof(dataCursor) !== 'undefined' && dataCursor !== null){ cursor = dataCursor; } 56 57 var typed = new Typed(elTyped, 58 { 59 stringsElement: elTypedSource, 60 typeSpeed: speed, 61 startDelay: delay, 62 // fadeOut: true, 63 // cursorChar: '|', 64 cursorChar: '❚', 65 showCursor: cursor, 66 autoInsertCss: true, 67 preStringTyped: function() 68 { 69 var cursor = el.querySelector('.typed-cursor'); 70 71 if(typeof(cursor) !== 'undefined' && cursor !== null) 72 { 73 cursor.style.opacity = 1; 74 } 75 }, 76 onBegin: function() 77 { 78 elTypedWrapper.style.width = elTypedSource.firstElementChild.getBoundingClientRect().width + 'px'; 79 elTyped.style.width = elTypedSource.firstElementChild.getBoundingClientRect().width + 'px'; 80 }, 81 onComplete: function() 82 { 83 84 85 var cursor = el.querySelector('.typed-cursor'); 86 87 if(typeof(cursor) !== 'undefined' && cursor !== null) 88 { 89 // cursor.remove(); 90 } 91 92 /*$('.typed_source').text("");*/ 93 94 } 95 }); 96 } 97 98 // if(el.src) 99 if(el.dataset.src) 100 { 101 // el.parentNode.classList.add('is_loaded'); 102 el.src = el.dataset.src; 103 imagesLoaded(el, function() 104 { 105 el.classList.add('is_ready'); 106 // el.parentNode.style.backgroundImage = 'none'; 107 }); 108 } 109 110 if(el.dataset.backgroundImage) 111 { 112 el.style.backgroundImage = 'url("'+ el.dataset.backgroundImage +'")'; 113 114 if(el.dataset.backgroundImageX2) 115 { 116 el.style.backgroundImage = 'url("'+ el.dataset.backgroundImage +'")'; 117 el.style.backgroundImage = '-webkit-image-set(url("'+ el.dataset.backgroundImage +'") 1x, url("'+ el.dataset.backgroundImageX2 +'") 2x)'; 118 el.style.backgroundImage = 'image-set(url("'+ el.dataset.backgroundImage +'") 1x, url("'+ el.dataset.backgroundImageX2 +'") 2x)'; 119 } 120 121 if(el.dataset.backgroundImageX2 && el.dataset.backgroundImageGradient) 122 { 123 el.style.backgroundImage = 'url("'+ el.dataset.backgroundImage +'"), '+ el.dataset.backgroundImageGradient; 124 el.style.backgroundImage = '-webkit-image-set(url("'+ el.dataset.backgroundImage +'") 1x, url("'+ el.dataset.backgroundImageX2 +'") 2x), '+ el.dataset.backgroundImageGradient; 125 el.style.backgroundImage = 'image-set(url("'+ el.dataset.backgroundImage +'") 1x, url("'+ el.dataset.backgroundImageX2 +'") 2x), '+ el.dataset.backgroundImageGradient; 126 } 127 imagesLoaded(el, { background: true }, function() 128 { 129 el.classList.add('is_ready'); 130 }); 131 } 132 133 if(el.dataset.elementAnimation) 134 { 135 el.classList.add('is_ready'); 136 // el.style.maxHeight = el.scrollHeight + 'px'; 137 } 138 139 if(el.dataset.toCount) 140 { 141 const elCount = el, 142 elID = el.id, 143 dataDuration = elCount.dataset.duration, 144 dataEnd = elCount.dataset.end; 145 146 const options = { 147 startVal: 0, 148 duration: dataDuration, 149 separator: ' ', 150 suffix: ' USD' 151 // useEasing: false 152 }; 153 let count = new countUp.CountUp(elID, dataEnd, options); 154 155 if(!count.error) 156 { 157 count.start(); 158 } 159 } 160 } 161 }); 162 }); 163 164 ////////////////////////////////////////////////////////////////////////////////////////////////// 165 166 if(typeof window.lax !== 'undefined') 167 { 168 window.addEventListener('load', function() 169 { 170 lax.setup(); 171 172 /* document.addEventListener('scroll', function() 173 { 174 lax.update(window.scrollY); 175 }); */ 176 177 var updateLax = function updateLax() 178 { 179 lax.update(window.scrollY); 180 window.requestAnimationFrame(updateLax); 181 }; 182 window.requestAnimationFrame(updateLax); 183 184 }); 185 186 window.addEventListener('resize', function() 187 { 188 lax.updateElements(); 189 }); 190 191 lax.addPreset('presetTest', function() 192 { 193 return{ "data-lax-translate-x": "(1*vh) 500, (0.5*vh) 0" } 194 }); 195 } 196});
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.