PageSourceSearch

https://www.marset.com/wp-content/themes/marset/js/2024/scripts-2025.js?v=v3

js marset.com collected 2026-10-01 14:40:23 UTC 6,937 bytes, 349 lines download raw bytes

1// Java Script
2'use strict';
3
4const THEME_PATH = ''; // wp_helper.home_path + '/';
5let screenRes_ = {
6	isDesktop: true,
7	isTablet: false,
8	isMobile: false,
9};
10
11document.addEventListener('DOMContentLoaded', function() {
12	// loadFonts();
13	checkScreenSize();
14	lazyLoad();
15	setPropertyHeaderHeight();
16	initPageLoadedClass();
17	initVisualSlider();
18
19	// dev 2
20
21	// dev 3
22
23	// dev 4
24
25	// dev 5
26});
27
28window.addEventListener('load', function() {
29
30	// dev 2
31
32	// dev 3
33
34	// dev 4
35
36	// dev 5
37});
38
39window.addEventListener('resize', function() {
40	checkScreenSize();
41
42	// dev 2
43
44	// dev 3
45
46	// dev 4
47
48	// dev 5
49});
50
51window.addEventListener('scroll', function() {
52	document.documentElement.scrollTop > 0 ? document.documentElement.classList.add('scrolled') : document.documentElement.classList.remove('scrolled');
53
54	// dev 2
55
56	// dev 3
57
58	// dev 4
59
60	// dev 5
61});
62
63// load fonts
64function loadFonts() {
65	WebFont.load({
66		google: {
67			families: ['Libre Baskerville:400,400i,700,700i', 'DM Sans:400,400i,500,500i,700,700i'],
68		},
69		custom: {
70			families: ['Font Awesome 6 Free', 'Font Awesome 6 Brands', 'TimesNow:i3,n4'],
71			urls: [THEME_PATH + 'css/fonts.css'],
72		}
73	});
74}
75
76function checkScreenSize() {
77	let winWidth = window.innerWidth;
78
79	screenRes_.isDesktop = (winWidth > 1024);
80	screenRes_.isMobile = (winWidth < 768);
81	screenRes_.isTablet = (!screenRes_.isMobile && (winWidth < 992));
82}
83
84// lazyLoad Images
85function lazyLoad() {
86	const images = document.querySelectorAll('img.lazyload');
87
88	if (images.length) {
89		images.forEach(function (img) {
90			img.onload = function() {
91				img.classList.add('lazyloaded');
92
93				if (img.classList.contains('svg-html')) {
94					replaseInlineSvg(img);
95				}
96			};
97		});
98
99		window.addEventListener('load', (e) => {
100			images.forEach(img => {
101				if (img.complete && img.naturalHeight !== 0) {
102					img.classList.add('lazyloaded');
103
104					if (img.classList.contains('svg-html')) {
105						replaseInlineSvg(img);
106					}
107				}
108			});
109		});
110	}
111}
112
113// replaseInlineSvg
114function replaseInlineSvg(el) {
115	const imgID = el.getAttribute('id');
116	const imgClass = el.getAttribute('class');
117	const imgURL = el.getAttribute('src');
118
119	fetch(imgURL)
120		.then(data => data.text())
121		.then(response => {
122			const parser = new DOMParser();
123			const xmlDoc = parser.parseFromString(response, 'text/html');
124			let svg = xmlDoc.querySelector('svg');
125
126			if (typeof imgID !== 'undefined') {
127				svg.setAttribute('id', imgID);
128			}
129
130			if (typeof imgClass !== 'undefined') {
131				svg.setAttribute('class', imgClass + ' replaced-svg');
132			}
133
134			svg.removeAttribute('xmlns:a');
135
136			if (el.parentNode) {
137				el.parentNode.replaceChild(svg, el);
138			}
139	});
140}
141
142const slideUp = (target, duration = 500) => {
143	target.style.transitionProperty = 'height, margin, padding';
144	target.style.transitionDuration = duration + 'ms';
145	target.style.boxSizing = 'border-box';
146	target.style.height = target.offsetHeight + 'px';
147	target.offsetHeight;
148	target.style.overflow = 'hidden';
149	target.style.height = 0;
150	target.style.paddingTop = 0;
151	target.style.paddingBottom = 0;
152	target.style.marginTop = 0;
153	target.style.marginBottom = 0;
154	window.setTimeout(() => {
155		target.style.display = 'none';
156		target.style.removeProperty('height');
157		target.style.removeProperty('padding-top');
158		target.style.removeProperty('padding-bottom');
159		target.style.removeProperty('margin-top');
160		target.style.removeProperty('margin-bottom');
161		target.style.removeProperty('overflow');
162		target.style.removeProperty('transition-duration');
163		target.style.removeProperty('transition-property');
164	}, duration);
165}
166
167const slideDown = (target, duration = 500) => {
168	target.style.removeProperty('display');
169	let display = window.getComputedStyle(target).display;
170	if (display === 'none') display = 'block';
171	target.style.display = display;
172	let height = target.offsetHeight;
173	target.style.overflow = 'hidden';
174	target.style.height = 0;
175	target.style.paddingTop = 0;
176	target.style.paddingBottom = 0;
177	target.style.marginTop = 0;
178	target.style.marginBottom = 0;
179	target.offsetHeight;
180	target.style.boxSizing = 'border-box';
181	target.style.transitionProperty = "height, margin, padding";
182	target.style.transitionDuration = duration + 'ms';
183	target.style.height = height + 'px';
184	target.style.removeProperty('padding-top');
185	target.style.removeProperty('padding-bottom');
186	target.style.removeProperty('margin-top');
187	target.style.removeProperty('margin-bottom');
188	window.setTimeout(() => {
189		target.style.removeProperty('height');
190		target.style.removeProperty('overflow');
191		target.style.removeProperty('transition-duration');
192		target.style.removeProperty('transition-property');
193	}, duration);
194}
195
196const getOffsetYRelativeDocument = (element) => {
197	const RECT = element.getBoundingClientRect();
198	return RECT.top + window.scrollY;
199}
200
201function getSiblings(element) {
202	let siblings = [];
203
204	if(!element.parentNode) {
205		return siblings;
206	}
207
208	let sibling = element.parentNode.firstChild;
209
210	while(sibling) {
211		if(sibling.nodeType === 1 && sibling !== element) {
212			siblings.push(sibling);
213		}
214		sibling = sibling.nextSibling;
215	}
216	return siblings;
217}
218
219function getHeaderHeight() {
220	return document.querySelector('#header').offsetHeight;
221}
222
223function setPropertyHeaderHeight() {
224	const HEADER = document.querySelector('#header');
225	const RESIZE_DELAY = 300;
226
227	if(HEADER) {
228		window.addEventListener('load', run);
229		window.addEventListener('resize', function() {
230			setTimeout((function() {
231				run();
232			}), RESIZE_DELAY);
233		});
234
235		function run() {
236			document.documentElement.style.setProperty('--header-height', getHeaderHeight() + 'px');
237		}
238	}
239}
240
241function initPageLoadedClass() {
242	window.addEventListener('load', function() {
243		document.documentElement.classList.add('page-loaded');
244	});
245}
246
247
248function initVisualSlider() {
249	document.querySelectorAll('.visual-slider').forEach(slider => {
250		let init = false;
251		let swiper;
252		const enableSwiper = function() {
253			swiper = new Swiper(slider, {
254				preloadImages: false,
255				lazy: true,
256				slidesPerView: 'auto',
257				spaceBetween: 30,
258				pagination: {
259					el: '.swiper-pagination',
260					clickable: true,
261				},
262			});
263		}
264		function checkSwiper() {
265			if (window.innerWidth >= 768 && !init) {
266				init = true;
267				enableSwiper();
268			}
269			else if (window.innerWidth < 768 && init) {
270				swiper.destroy();
271				init = false;
272			}
273		}
274		checkSwiper();
275		window.addEventListener('resize', () => {
276			checkSwiper();
277		});
278	});
279}
280
281// dev 2
282
283// dev 3
284
285// dev 4
286
287// dev 5
288
289// JQuery
290(function($) {
291	'use strict';
292
293	$(document).ready(function() {
294
295		// dev 2
296
297		// dev 3
298
299		// dev 4
300
301		// dev 5
302
303	}); // ready
304
305	$(window).on('load', function() {
306
307		// dev 2
308
309		// dev 3
310
311		// dev 4
312
313		// dev 5
314
315	}); // load
316
317	$(window).on('resize', function() {
318
319		// dev 2
320
321		// dev 3
322
323		// dev 4
324
325		// dev 5
326
327	}); // resize
328
329	$(window).scroll(function() {
330
331		// dev 2
332
333		// dev 3
334
335		// dev 4
336
337		// dev 5
338
339	}); // scroll
340
341	// dev 2
342
343	// dev 3
344
345	// dev 4
346
347	// dev 5
348
349})(this.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.