PageSourceSearch

https://get-way.com/wp-content/themes/woodmart/js/scripts/elements/slider.js?ver=7.5.2

js get-way.com collected 2026-10-07 19:14:42 UTC 5,346 bytes, 178 lines download raw bytes

1woodmartThemeModule.$document.on('wdShopPageInit', function() {
2	woodmartThemeModule.sliderAnimations();
3	woodmartThemeModule.sliderLazyLoad();
4});
5
6[
7	'frontend/element_ready/wd_slider.default'
8].forEach( function (value) {
9	woodmartThemeModule.wdElementorAddAction(value, function() {
10		woodmartThemeModule.sliderAnimations();
11		woodmartThemeModule.sliderLazyLoad();
12	});
13});
14
15woodmartThemeModule.sliderClearAnimations = function($activeSlide, firstLoad) {
16	// WPB clear on first load first slide.
17	if (firstLoad) {
18		$activeSlide.querySelectorAll('[class*="wpb_animate"]').forEach( function (animateElement) {
19			var classes = Array.from(animateElement.classList);
20			var name;
21
22			for (var index = 0; index < classes.length; index++) {
23				if (classes[index].indexOf('wd-anim-name_') >= 0) {
24					name = classes[index].split('_')[1];
25				}
26			}
27
28			if ( animateElement.classList.contains('wpb_start_animation') ) {
29				animateElement.classList.remove('wpb_start_animation')
30			}
31			if ( animateElement.classList.contains('animated') ) {
32				animateElement.classList.remove('animated')
33			}
34			if ( animateElement.classList.contains(name) ) {
35				animateElement.classList.remove(name)
36			}
37		});
38	}
39
40	// WPB clear all siblings slides.
41	$activeSlide.parentNode.querySelectorAll('[class*="wpb_animate"]').forEach( function (animateElement) {
42		var classes = Array.from(animateElement.classList);
43		var delay = 0;
44		var name;
45
46		for (var index = 0; index < classes.length; index++) {
47			if (classes[index].indexOf('wd-anim-delay_') >= 0) {
48				delay = parseInt(classes[index].split('_')[1]);
49			}
50
51			if (classes[index].indexOf('wd-anim-name_') >= 0) {
52				name = classes[index].split('_')[1];
53			}
54		}
55
56		setTimeout(function() {
57			if ( animateElement.classList.contains('wpb_start_animation') ) {
58				animateElement.classList.remove('wpb_start_animation')
59			}
60			if ( animateElement.classList.contains('animated') ) {
61				animateElement.classList.remove('animated')
62			}
63			if ( animateElement.classList.contains(name) ) {
64				animateElement.classList.remove(name)
65			}
66		}, delay);
67	});
68};
69
70woodmartThemeModule.sliderAnimations = function() {
71	document.querySelectorAll('.wd-slider > .wd-carousel-inner > .wd-carousel').forEach( function (sliderWrapper) {
72		sliderWrapper.querySelectorAll('[class*="wd-animation"]').forEach( function (slide) {
73			slide.classList.add('wd-animation-ready');
74		});
75
76		runAnimations(sliderWrapper.querySelector('.wd-slide'), true);
77
78		sliderWrapper.addEventListener('wdSlideChange', function (e) {
79			var slide = Array.prototype.filter.call(
80				e.target.swiper.wrapperEl.children,
81				(element) => e.detail.activeIndex == element.dataset.swiperSlideIndex,
82			).shift();
83
84			runAnimations(slide);
85		});
86
87		function runAnimations(slide, firstLoad = false) {
88			woodmartThemeModule.sliderClearAnimations(slide, firstLoad);
89			woodmartThemeModule.runAnimations(slide, firstLoad);
90		}
91
92	});
93};
94
95woodmartThemeModule.runAnimations = function($activeSlide, firstLoad) {
96	// Elementor.
97	$activeSlide.parentElement.querySelectorAll('[class*="wd-animation"]').forEach( function (animateElement) {
98		animateElement.classList.remove('wd-animated');
99	});
100
101	$activeSlide.querySelectorAll('[class*="wd-animation"]').forEach( function (animateElement) {
102		var classes = animateElement.classList;
103		var delay = 0;
104
105		for (var index = 0; index < classes.length; index++) {
106			if (classes[index].indexOf('wd_delay_') >= 0) {
107				delay = parseInt(classes[index].split('_')[2]);
108			}
109		}
110
111		// if (firstLoad) {
112		// 	delay += 500;
113		// }
114
115		setTimeout(function() {
116			animateElement.classList.add('wd-animated');
117		}, delay);
118	});
119
120	// WPB.
121	$activeSlide.querySelectorAll('[class*="wpb_animate"]').forEach( function (animateElement) {
122		var classes = animateElement.classList;
123		var delay = 0;
124		var name;
125
126		for (var index = 0; index < classes.length; index++) {
127			if (classes[index].indexOf('wd-anim-delay_') >= 0) {
128				delay = parseInt(classes[index].split('_')[1]);
129			}
130
131			if (classes[index].indexOf('wd-anim-name_') >= 0) {
132				name = classes[index].split('_')[1];
133			}
134		}
135
136		// if (firstLoad) {
137		// 	delay += 500;
138		// }
139
140		setTimeout(function() {
141			animateElement.classList.remove('wd-off-anim');
142			animateElement.classList.add('wpb_start_animation');
143			animateElement.classList.add('animated');
144		}, delay);
145	});
146};
147
148woodmartThemeModule.sliderLazyLoad = function() {
149	document.querySelectorAll('.wd-slider > .wd-carousel-inner >
149 .wd-carousel').forEach( function (carousel) {
150		load(carousel.querySelector('.wd-carousel-wrap').firstElementChild);
151
152		carousel.addEventListener('wdSlideChange', function (e) {
153			var slide = Array.prototype.filter.call(
154				e.target.swiper.wrapperEl.children,
155				(element) => e.detail.activeIndex == element.dataset.swiperSlideIndex,
156			).shift();
157
158			load(slide);
159		});
160	});
161
162	function load(activeSlide) {
163		if (activeSlide && activeSlide.nextElementSibling) {
164			activeSlide.nextElementSibling.classList.add('woodmart-loaded');
165		}
166
167		activeSlide.classList.add('woodmart-loaded');
168
169		activeSlide.closest('.wd-carousel').querySelectorAll('[id="' + activeSlide.id + '"]').forEach( function (slide) {
170			slide.classList.add('woodmart-loaded');
171		});
172	}
173};
174
175window.addEventListener('load',function() {
176	woodmartThemeModule.sliderAnimations();
177	woodmartThemeModule.sliderLazyLoad();
178});

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.