1(function ($) { 2 3 initializeSlickSliderBlock = function (obj) { 4 let slider_settings = $(obj).data('slider'); 5 let slider_settings_responsive = $(obj).data('slider-responsive'); 6 let individual_texts = typeof $(obj).attr('data-individual-texts') == 'undefined' ? false : $(obj).attr('data-individual-texts'); 7 8 9 if (typeof slider_settings === 'undefined') { 10 console.error('Slider settings not found'); 11 return; 12 } 13 14 let slick_options = { 15 dots: true, 16 arrows: true, 17 slidesToShow: 1, 18 prevArrow: '<button type="button" class="slick-prev">' + standoutFaIcons.slick.buttonPrev + '</button>', 19 nextArrow: '<button type="button" class="slick-next">' + standoutFaIcons.slick.buttonNext + '</button>', 20 lazyLoad: 'progressive', 21 speed: 175, 22 accessibility: true, 23 draggable: true, 24 touchMove: true, 25 focusOnSelect: false, 26 mobileFirst: true, 27 pauseOnFocus: true, 28 pauseOnHover: true, 29 responsive: [ 30 { 31 breakpoint: 1281, 32 settings: { 33 accessibility: true, 34 draggable: true, 35 touchMove: true, 36 } 37 } 38 ], 39 }; 40 41 // if ($(obj).closest('.off-center-slider').length) { 42 slick_options.prevArrow = '<button type="button" class="slick-prev">' + standoutFaIconsCustom.slick.buttonPrev + '</button>'; 43 slick_options.nextArrow = '<button type="button" class="slick-next">' + standoutFaIconsCustom.slick.buttonNext + '</button>'; 44 // } 45 46 for (const [key, value] of Object.entries(slider_settings)) { 47 if (key === 'custom_input_data') { 48 if (value != false) { 49 for (const data of value) { 50 slick_options[data.name] = data.value; 51 } 52 } 53 } else if (typeof value === 'string' && value.toLowerCase() === 'true') { 54 slick_options[key] = true; 55 } else if (typeof value === 'string' && value.toLowerCase() === 'false') { 56 slick_options[key] = false; 57 } else if (typeof value === 'string' && /^\d+$/.test(value)) { 58 slick_options[key] = parseInt(value); 59 } else if (typeof value === 'boolean') { 60 slick_options[key] = value; 61 } 62 } 63 64 if (typeof slider_settings_responsive !== 'undefined' && slider_settings_responsive) { 65 slider_settings_responsive.forEach((setting, i) => { 66 slick_options.responsive[i] = { 67 breakpoint: setting.breakpoint, 68 settings: { 69 slidesToShow: parseInt(setting.slidesToShow), 70 } 71 } 72 73 if (setting.custom_input_data !== false) { 74 setting.custom_input_data.forEach((data_input, $j) => { 75 if (typeof data_input.value === 'string' && data_input.value.toLowerCase() === 'true') { 76 $value = true; 77 } else if (typeof data_input.value === 'string' && data_input.value.toLowerCase() === 'false') { 78 $value = false; 79 } else if (typeof data_input.value === 'string' && /^\d+$/.test(value)) { 80 $value = parseInt(value); 81 } else if (typeof data_input.value === 'boolean') { 82 $value = data_input.value; 83 } 84 85 slick_options.responsive[i].settings[data_input.name] = $value; 86 }); 87 }; 88 }); 89 } 90 91 slick_options.responsive.push( 92 { 93 breakpoint: 959, 94 settings: { 95 slidesToShow: (slick_options.slidesToShow - 1 < 1 ? 1 : slick_options.slidesToShow - 1) 96 } 97 }, 98 { 99 breakpoint: 700, 100 settings: { 101 slidesToShow: (slick_options.slidesToShow == 1 ? 1 : (slick_options.slidesToShow - 3 < 2 ? 2 : slick_options.slidesToShow - 3)) 102 } 103 }, 104 { 105 breakpoint: 600, 106 settings: { 107 // dots: true, 108 // arrows: false, 109 slidesToShow: (slick_options.slidesToShow - 2 < 1 ? 1 : slick_options.slidesToShow - 2), 110 centerPadding: 0 111 } 112 }, 113 { 114 breakpoint: 320, 115 settings: { 116 // dots: true, 117 // arrows: false, 118 slidesToShow: (slick_options.slidesToShow - 5 < 1 ? 1 : slick_options.slidesToShow - 5), 119 centerPadding: 0 120 } 121 } 122 ); 123 124 if (individual_texts) { 125 $(obj).find('.slider-images').first().slick(slick_options); 126 window.setTimeout(function() { 127 $(obj).find('.slider-images').first().slick('refresh'); 128 }, 500); 129 } else { 130 $(obj).find('.acf-innerblocks-container').first().slick(slick_options); 131 window.setTimeout(function() { 132 $(obj).find('.acf-innerblocks-container').first().slick('refresh'); 133 }, 500); 134 135 //Skal den kommenteres ud? 136 if ($(obj).closest('.off-center-slider').length) { 137 $(obj).find('.acf-innerblocks-container').first().get(0).style.setProperty("--slick-off-center-padding", 'calc(' + $(obj).find('.acf-innerblocks-container .slick-slide').first().css('width') + ' / 2)'); 138 } 139 } 140 } 141 142 143 $(window).on('load', function() { 144 slickSliderHandler = function() { 145 if (!$('.standout-section.standout-slider').length) 146 return; 147 148 149 if (jQuery.fn.slick) { 150 $('.standout-section.standout-slider').each(function() { 151 initializeSlickSliderBlock(this); 152 }); 153 } else { 154 pre('Slick Slider Could\'t Initialize'); 155 } 156 } 157 158 slickSliderHandler(); 159 }); 160 161 $(document).on('click', '.standout-slider .abningstider_overlay .opentext', function() { 162 $(this).closest('.abningstider_overlay').toggleClass('show'); 163 164 $('.view_full', $(this).closest('.abningstider_overlay')).slideToggle(400); 165 }); 166 167 168 $(document).on('mouseenter', '.content-element-slider .standout-slide-element:has(video[poster])', function() { 169 $('video', this).get(0).play(); 170 }).on('mouseleave', '.content-element-slider .standout-slide-element:has(video[poster])', function() { 171 $('video', this).get(0).pause(); 172 }); 173 174 175 // $(window).on('load', function() { 176 $('.content-element-slider .wp-block-video:has(video[poster])').each(function() { 177 $(this).css('--poster-url', 'url(' + $('video', this).attr('poster') + ')'); 178 }); 179 // }); 180 181})(jQuery);
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.