1'use strict'; 2 3/** 4 * Slick initializer â CI3 parity (assets/themes/ue_silver/js/wla_home_*.js). 5 * Any element with `data-slick` is bound to slick using its `data-option` 6 * attribute as a config object. Markup matches CI3 exactly so widgets ported 7 * from CI3 (offers, best_sellers, newly_launched, etc.) work unchanged. 8 * 9 * Example: <div data-slick data-option="slidesToShow: 3, autoplay: true, ..."> 10 * 11 * Requires jQuery + slick (both loaded globally from base.php). 12 */ 13(function ($) { 14 if (typeof $ === 'undefined' || typeof $.fn.slick === 'undefined') return; 15 16 function mySlick($elems) { 17 $elems.each(function () { 18 var $current = $(this); 19 if ($current.hasClass('slick-initialized')) return; 20 try { 21 /* eslint-disable no-eval */ 22 var opts = eval('({' + ($current.attr('data-option') || '') + '})'); 23 /* eslint-enable no-eval */ 24 $current.slick(opts || {}); 25 } catch (err) { 26 if (window.console) console.warn('slick init failed', this, err); 27 } 28 }); 29 } 30 31 // Wait for window.load + one rAF tick so the layout is fully painted 32 // before slick measures slide widths. Init too early and slick can latch 33 // onto a transitional parent width (e.g. 720px from a Bootstrap container 34 // breakpoint) instead of the final desktop width. 35 $(window).on('load', function () { 36 requestAnimationFrame(function () { 37 mySlick($('[data-slick]')); 38 }); 39 }); 40 41 // On resize: setPosition repositions but does NOT recompute slide widths, 42 // so a viewport change that crosses a `responsive` breakpoint or otherwise 43 // changes the parent's width needs a full unslick + reinit to pick up the 44 // new dimensions. Debounced to avoid thrashing during drag-resize. 45 var resizeTimer; 46 $(window).on('resize', function () { 47 clearTimeout(resizeTimer); 48 resizeTimer = setTimeout(function () { 49 $('[data-slick].slick-initialized').each(function () { 50 try { $(this).slick('unslick'); } catch (e) {} 51 }); 52 mySlick($('[data-slick]')); 53 }, 150); 54 }); 55 56 window.mySlick = mySlick; 57})(window.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.