1var ready = (callback) => { 2 if (document.readyState != "loading") callback(); 3 else document.addEventListener("DOMContentLoaded", callback); 4} 5 6ready(() => { 7 const is_reduced_motion = window.matchMedia(`(prefers-reduced-motion: reduce)`) === true || window.matchMedia(`(prefers-reduced-motion: reduce)`).matches === true; 8 if( is_reduced_motion ) { 9 console.info( "%cBased on the accessibility settings of your operating system, this website has limited animations.", 'font-weight: bold' ); 10 } 11 12 13 /* 14 ** Change icon - Social icons link 15 */ 16 document.querySelectorAll(".wp-social-link-chain svg").forEach( item => { 17 item.setAttribute( 'viewBox', '0 0 24 24' ); 18 item.innerHTML = '<path d="M8.75,21.4A5.77,5.77,0,0,1,8.16,9.89a1,1,0,0,1,1.09.89,1,1,0,0,1-.89,1.1A3.73,3.73,0,0,0,6.08,13a3.77,3.77,0,0,0,5.34,5.33A3.7,3.7,0,0,0,12.5,16a1,1,0,0,1,1.1-.9,1,1,0,0,1,.89,1.1A5.77,5.77,0,0,1,8.75,21.4Zm1.42-6.16A1,1,0,0,1,9.46,15a1,1,0,0,1,0-1.41l4.82-4.83a1,1,0,0,1,1.42,1.42L10.87,15A1,1,0,0,1,10.17,15.24ZM16.59,14a1,1,0,0,1-.09-2,3.73,3.73,0,0,0,2.27-1.08A3.77,3.77,0,0,0,16.1,4.5h0a3.73,3.73,0,0,0-2.66,1.1,3.8,3.8,0,0,0-1.09,2.28,1,1,0,0,1-1.09.9,1,1,0,0,1-.9-1.1A5.78,5.78,0,1,1,16.7,14Z"/>'; 19 }); 20 21 22 /* 23 ** Change icon - Search 24 */ 25 document.querySelectorAll(".wp-block-search__button svg").forEach( item => { 26 item.setAttribute( 'viewBox', '0 0 32 32' ); 27 item.innerHTML = '<path d="M29.243,31c-0.384,0-0.768-0.146-1.061-0.439l-4.184-4.183c-2.384,1.829-5.364,2.917-8.595,2.917 c-7.801,0-14.147-6.347-14.147-14.147S7.604,1,15.404,1s14.147,6.347,14.147,14.147c0,3.492-1.272,6.693-3.377,9.163l4.129,4.129 c0.586,0.586,0.586,1.535,0,2.121C30.011,30.854,29.627,31,29.243,31z M15.404,4C9.258,4,4.257,9,4.257,15.147 c0,6.146,5.001,11.147,11.147,11.147s11.147-5.001,11.147-11.147C26.552,9,21.551,4,15.404,4z"/>'; 28 }); 29 30 31 /* 32 ** Read time counter 33 */ 34 if( document.querySelector('.lemmony-read-time-counter') ) { 35 var read_time = 0; 36 if( document.querySelector('.entry-content.wp-block-post-content') ) { 37 var post_content = document.querySelector('.entry-content.wp-block-post-content').innerHTML; 38 post_content = post_content.replace(/<[^>]*>?/gm, ''); 39 post_content = post_content.replace(/(\r\n|\n|\r)/gm, ""); 40 var post_content_words = post_content.split(' ').length; 41 if( post_content_words / 200 > 1 ) { 42 read_time = Math.floor( post_content_words / 200 ); 43 44 if( post_content_words / 200 > 0.25 ) { 45 read_time++; 46 } 47 } else { 48 read_time = 1; 49 } 50 } 51 document.querySelector('.lemmony-read-time-counter').prepend( read_time + ' ' ); 52 } 53 54 55 /* 56 * Animation - Background Parallax 57 */ 58 if( typeof simpleParallax !== 'undefined' && !is_reduced_motion ) { 59 var parallax = document.querySelectorAll('.lemmony-parallax .wp-block-cover__image-background'); 60 if( parallax ) { 61 parallax.forEach( image => { 62 new simpleParallax(image, { 63 overflow: false, 64 delay: .5, 65 transition: 'cubic-bezier(0,0,0,1)', 66 scale: 1.2 67 }); 68 }); 69 } 70 } 71 72 73 /* 74 ** Animation - Blocks 75 */ 76 var sections = document.querySelectorAll('.lemmony-animation'); 77 if( sections && !is_reduced_motion ) { 78 sections.forEach( (section, index) => { 79 section.classList.add( 'animation-inited' ); 80 }); 81 82 function reveal() { 83 sections.forEach((section) => { 84 if( lemmony_is_element_in_viewport( section ) ) { 85 section.classList.add("animate"); 86 } else { 87 section.classList.remove("animate"); 88 } 89 }); 90 } 91 92 window.addEventListener( "load", reveal ); 93 window.addEventListener( "scroll", reveal ); 94 window.addEventListener( "resize", reveal ); 95 } 96 97 function lemmony_is_element_in_viewport( el ) { 98 var rect = el.getBoundingClientRect(); 99 var windowHeight = ( window.innerHeight || document.documentElement.clientHeight ); 100 var windowWidth = ( window.innerWidth || document.documentElement.clientWidth ); 101 var verticallyInView = ( rect.top <= windowHeight ) && (( rect.top + rect.height ) >= 0 ); 102 var horizontallyInView = ( rect.left <= windowWidth ) && (( rect.left + rect.width ) >= 0 ); 103 104 return ( verticallyInView && horizontallyInView ); 105 } 106 107 108 /* 109 ** Animation - Counter 110 */ 111 var counters = document.querySelectorAll('.wp-block-lemmony-companion-counter .lemmony-counter-wrapper'); 112 if( counters ) {
113 counters.forEach( counter => { 114 new CountUp( counter.querySelector('.lemmony-counter-number'), counter.getAttribute('data-end'), { 115 startVal: parseInt( counter.getAttribute('data-start') ), 116 enableScrollSpy: true, 117 duration: !is_reduced_motion ? parseInt( counter.getAttribute('data-duration') ) : 0, 118 scrollSpyOnce: false, 119 scrollSpyDelay: 100, 120 }); 121 }); 122 } 123 124 125 /* 126 ** Animation - Typing text 127 */ 128 var typedTexts = document.querySelectorAll('.lemmony-typing-wrapper'); 129 if( typedTexts && !is_reduced_motion ) { 130 var options2 = { 131 rootMargin: '0px', 132 threshold: 0.25 133 } 134 135 var callback2 = ( entries ) => { 136 entries.forEach( entry => { 137 let typedText = entry.target; 138 if( entry.intersectionRatio >= 0.25 && !typedText.classList.contains( "active" ) ) { 139 typedText.classList.add( "active" ); 140 let content = []; 141 typedText.querySelectorAll('.lemmony-typing-item').forEach( item => { 142 content.push( item.innerHTML ); 143 }); 144 145 if( content.length ) { 146 new Typed( typedText.querySelector(".lemmony-typing-action"), { 147 strings: content, 148 typeSpeed: 75, 149 backSpeed: 25, 150 backDelay: 3000, 151 startDelay: 500, 152 loop: true, 153 }); 154 } 155 } 156 }); 157 }; 158 159 var observer2 = new IntersectionObserver( callback2, options2 ) 160 typedTexts.forEach(( item, index ) => { 161 observer2.observe( item ); 162 }); 163 } 164 165 166 /* 167 ** Navigation - Fullscreen dropdown collapse 168 */ 169 var navigation_items = document.querySelectorAll('.wp-block-navigation-submenu__toggle'); 170 if( navigation_items ) { 171 navigation_items.forEach( item => { 172 item.addEventListener("click", ( item2 ) => { 173 item2.target.previousSibling.classList.toggle('is-menu-open'); 174 item2.target.nextSibling.classList.toggle('is-menu-open'); 175 }); 176 }); 177 } 178 179 180 /* 181 ** Accordion block 182 */ 183 var accordions = document.querySelectorAll('.wp-block-lemmony-companion-accordion'); 184 if( accordions ) { 185 accordions.forEach( item => { 186 item.querySelector('.lemmony-accordion-icon').addEventListener( "click", ( item2 ) => { 187 item2.target.parentNode.classList.toggle('is-open'); 188 }); 189 190 item.querySelector('.lemmony-accordion-title').addEventListener( "click", ( item2 ) => { 191 item2.target.parentNode.parentNode.classList.toggle('is-open'); 192 }); 193 }); 194 } 195 196 197 /* 198 ** Hero auto slider block 199 */ 200 if( typeof Splide !== 'undefined' ) { 201 var splides = document.querySelectorAll('.lemmony-splide'); 202 if( splides ) { 203 splides.forEach( item => { 204 let ratio = item.getAttribute('data-aspect-ratio'); 205 if( ratio ) { 206 let parts = ratio.split(":"); 207 ratio = parseFloat(parts[1]) / parseFloat(parts[0]); 208 } 209 210 let speed = item.getAttribute('data-speed'); 211 let speedMap = { 212 "slow": 9000, 213 "normal": 4500, 214 "fast": 3000, 215 }; 216 217 var splide = new Splide( item, { 218 drag: false, 219 type: 'loop', 220 direction: 'ttb', 221 wheel: true, 222 releaseWheel: true, 223 heightRatio: ratio ? ratio : 1, 224 gap: '15vh', 225 speed: 1000, 226 easing: 'cubic-bezier(1, 0, 0.1, 0.95)',
227 arrows: false, 228 pagination: false, 229 autoplay: true, 230 interval: speed ? speedMap[speed] : speedMap['normal'], 231 pauseOnHover: false, 232 waitForTransition: true, 233 resetProgress: false, 234 wheel: false, 235 }); 236 splide.mount(); 237 }); 238 } 239 } 240 241 242 /* 243 ** Mobile navigation menu and X syncer 244 */ 245 var navigation_icons = document.querySelectorAll('.wp-block-navigation__responsive-container-open'); 246 if( navigation_icons ) { 247 navigation_icons.forEach( item => { 248 item.addEventListener("click", () => { 249 var top = item.getBoundingClientRect().top; 250 document.querySelector('.wp-block-navigation__responsive-dialog').style.paddingTop = ( top ) + 'px'; 251 if( top > 40 ) { 252 document.querySelector('.wp-block-navigation__responsive-container-close').style.top = top + 'px'; 253 } 254 }); 255 }); 256 } 257 258});
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.