PageSourceSearch

https://stguthlacs.org.uk/js/component/swiperLegacyAlias.js?v=5

js stguthlacs.org.uk collected 2026-09-24 12:52:11 UTC 1,287 bytes, 33 lines download raw bytes

1/* Mirror Swiper's dynamic active-slide class onto legacy class names so
2 * per-site CSS written against jquery.slick / jquery.cycle2 keeps
3 * working on a Swiper-rendered gallery without same-day re-skinning.
4 *
5 * Static aliases (.slick-slide, .slick-prev, .cycle-prev, etc.) are
6 * already on the DOM at render time; this helper handles the
7 * dynamic-state aliases only: .swiper-slide-active gets mirrored to
8 * .slick-active + .slick-current + .cycle-slide-active.
9 *
10 * Usage from a gallery init script:
11 *   window.swiperLegacyAlias(mySwiper);
12 *
13 * Registered through Core\Asset\AssetCatalog as plugin
14 * 'swiperLegacyAlias'; gallery / fw-image / folder-carousel renderers
15 * pull it in alongside swiper.
16 */
17window.swiperLegacyAlias = function(swiper) {
18	if (!swiper || typeof swiper.on !== 'function') return;
19
20	function sync(s) {
21		if (!s || !s.slides) return;
22		Array.prototype.forEach.call(s.slides, function(slide) {
23			var active = slide.classList.contains('swiper-slide-active');
24			slide.classList.toggle('slick-active',       active);
25			slide.classList.toggle('slick-current',      active);
26			slide.classList.toggle('cycle-slide-active', active);
27		});
28	}
29
30	swiper.on('slideChangeTransitionEnd', sync);
31	swiper.on('slideChange',              sync);
32	sync(swiper);
33};

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.