1function biomedInitCarousels() { 2 if ( typeof Flickity === 'undefined' ) return; 3 4 var arrowSvg = '<svg xmlns="http://www.w3.org/2000/svg" width="30" height="30" viewBox="0 0 30 30" fill="none"><path d="M15 0C23.2843 7.24234e-07 30 6.71573 30 15C30 23.2843 23.2843 30 15 30C6.71573 30 6.93267e-07 23.2843 0 15C7.24234e-07 6.71573 6.71573 6.93267e-07 15 0ZM15 1C7.26801 1 1 7.26801 1 15C1 22.732 7.26801 29 15 29C22.732 29 29 22.732 29 15C29 7.26801 22.732 1 15 1ZM17.5303 10.5303L13.0605 15L17.5303 19.4697L16.4697 20.5303L10.9395 15L16.4697 9.46973L17.5303 10.5303Z" fill="#0078BF"/></svg>'; 5 6 function getTrackElement( el, selector ) { 7 var selectors = selector.split( ', ' ); 8 var inner = el.querySelector( '.wp-block-group__inner-container, .wp-block-group__inner-blocks, .is-layout-flow, .is-layout-constrained, .is-layout-flex, .block-editor-block-list__layout' ); 9 if ( inner && inner.querySelector( selector ) ) { 10 return inner; 11 } 12 13 if ( Array.prototype.some.call( el.children, function ( child ) { 14 return selectors.some( function ( singleSelector ) { 15 return child.matches( singleSelector ); 16 } ); 17 } ) ) { 18 return el; 19 } 20 21 return inner || el; 22 } 23 24 function buildNav( el, trackEl, flkty ) { 25 var nav = document.createElement( 'div' ); 26 nav.className = 'slider-nav'; 27 28 var prevBtn = document.createElement( 'button' ); 29 prevBtn.className = 'flickity-btn flickity-btn--prev'; 30 prevBtn.setAttribute( 'aria-label', 'Zurück' ); 31 prevBtn.innerHTML = arrowSvg; 32 prevBtn.addEventListener( 'click', function () { flkty.previous(); } ); 33 34 var nextBtn = document.createElement( 'button' ); 35 nextBtn.className = 'flickity-btn flickity-btn--next'; 36 nextBtn.setAttribute( 'aria-label', 'Weiter' ); 37 nextBtn.innerHTML = arrowSvg; 38 nextBtn.addEventListener( 'click', function () { flkty.next(); } ); 39 40 var dots = trackEl.querySelector( '.flickity-page-dots' ); 41 42 nav.appendChild( prevBtn ); 43 if ( dots ) nav.appendChild( dots ); 44 nav.appendChild( nextBtn ); 45 el.appendChild( nav ); 46 return nav; 47 } 48 49 function getVisibleCardCount( el ) { 50 var width = window.innerWidth; 51 52 if ( el.classList.contains( 'is-style-slider-4' ) ) { 53 if ( width <= 450 ) return 1; 54 if ( width <= 700 ) return 2; 55 if ( width <= 1100 ) return 3; 56 return 4; 57 } 58 59 if ( el.classList.contains( 'is-style-slider-3' ) ) { 60 if ( width <= 450 ) return 1; 61 if ( width <= 700 ) return 2; 62 return 3; 63 } 64 65 if ( el.classList.contains( 'is-style-slider-2' ) ) { 66 if ( width <= 450 ) return 1; 67 return 2; 68 } 69 70 return 1; 71 } 72 73 /* Card / Zitat / Icon-Box sliders */ 74 var carousels = document.querySelectorAll( '.is-style-slider-2, .is-style-slider-3, .is-style-slider-4' ); 75 carousels.forEach( function ( el ) { 76 if ( el.dataset.carouselInitialized === 'true' ) return; 77 78 var isPostTemplate = el.classList.contains( 'wp-block-post-template' ); 79 var cellSelector = isPostTemplate 80 ? 'li' 81 : '.is-style-card, .wp-block-biomed-card, .wp-block-biomed-zitat, .wp-block-biomed-icon-box'; 82 var trackEl = isPostTemplate ? el : getTrackElement( el, cellSelector ); 83 84 if ( !trackEl.querySelector( cellSelector ) ) return; 85 var opts = { 86 cellAlign: 'left', 87 contain: true, 88 pageDots: true, 89 prevNextButtons: false, 90 wrapAround: true, 91 groupCells: false, 92 cellSelector: cellSelector, 93 }; 94 var flkty = null; 95 var nav = null; 96 97 function getCellCount() { 98 return trackEl.querySelectorAll( cellSelector ).length; 99 } 100 101 function enable() { 102 if ( flkty ) return; 103 trackEl.classList.remove( 'biomed-slider-static' ); 104 flkty = new Flickity( trackEl, opts ); 105 nav = buildNav( el, trackEl, flkty ); 106 } 107 108 function disable() { 109 if ( nav ) { nav.remove(); nav = null; } 110 if ( flkty ) { flkty.destroy(); flkty = null; } 111 trackEl.classList.add( 'biomed-slider-static' ); 112 } 113 114 function shouldEnable() { 115 return getCellCount() > getVisibleCardCount( el ); 116 } 117 118 function decide() { 119 if ( shouldEnable() ) { 120 enable(); 121 return; 122 } 123 124 disable(); 125 } 126 127 decide(); 128 129 var lastWidth = window.innerWidth; 130 var resizeTimer; 131 window.addEventListener( 'resize', function () { 132 var w = window.innerWidth; 133 if ( w === lastWidth ) return; // ignore pure height changes 134 lastWidth = w; 135 clearTimeout( resizeTimer ); 136 resizeTimer = setTimeout( decide, 200 ); 137 } ); 138 139 el.dataset.carouselInitialized = 'true'; 140 } ); 141 142 /* Logo grid slider â enabled on smaller viewports */ 143 var logoGrids = document.querySelectorAll( '.is-style-logo-grid' ); 144 logoGrids.forEach( function ( el ) { 145 if ( el.dataset.carouselInitialized === 'true' ) return; 146 147 var trackEl = getTrackElement( el, '.wp-block-image' ); 148 var enableLogoSlider = window.matchMedia( '(max-width: 1024px)' ); 149 var opts = { 150 cellAlign: 'left', 151 contain: true, 152 pageDots: true,
153 prevNextButtons: false, 154 wrapAround: true, 155 autoPlay: 3000, 156 groupCells: false, 157 cellSelector: '.wp-block-image', 158 }; 159 var flkty = null; 160 var nav = null; 161 162 function enable() { 163 if ( flkty ) return; 164 flkty = new Flickity( trackEl, opts ); 165 nav = buildNav( el, trackEl, flkty ); 166 } 167 168 function disable() { 169 if ( nav ) { nav.remove(); nav = null; } 170 if ( flkty ) { flkty.destroy(); flkty = null; } 171 } 172 173 function shouldEnable() { 174 return enableLogoSlider.matches && trackEl.querySelectorAll( '.wp-block-image' ).length > 1; 175 } 176 177 function decide() { 178 disable(); 179 if ( shouldEnable() ) enable(); 180 } 181 182 // Wait for logo images before first layout so Flickity measures correctly. 183 var imgs = trackEl.querySelectorAll( 'img' ); 184 var pending = 0; 185 function tick() { if ( --pending === 0 ) decide(); } 186 imgs.forEach( function ( img ) { 187 if ( !img.complete ) { 188 pending++; 189 img.addEventListener( 'load', tick ); 190 img.addEventListener( 'error', tick ); 191 } 192 } ); 193 if ( pending === 0 ) decide(); 194 195 var lastWidth = window.innerWidth; 196 var resizeTimer; 197 window.addEventListener( 'resize', function () { 198 var w = window.innerWidth; 199 if ( w === lastWidth ) return; // ignore pure height changes 200 lastWidth = w; 201 clearTimeout( resizeTimer ); 202 resizeTimer = setTimeout( decide, 200 ); 203 } ); 204 205 el.dataset.carouselInitialized = 'true'; 206 } ); 207} 208 209if ( document.readyState === 'loading' ) { 210 document.addEventListener( 'DOMContentLoaded', biomedInitCarousels ); 211} else { 212 biomedInitCarousels(); 213}
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.