PageSourceSearch

https://fitundfun-iwona.de/wp-content/themes/realgym/assets/js/public/main.js?ver=1.0.4

js fitundfun-iwona.de collected 2026-10-07 04:28:43 UTC 12,697 bytes, 447 lines download raw bytes

1/**
2 * Main Javascript methods.
3 *
4 * @author  Balcomsoft
5 * @package RealGym
6 * @version 1.0.0
7 * @since   1.0.0
8 */
9
10/* Custom Script Index
11-------------------
12Init WOWjs
13Overflow visible for sticy elements
14Fixed Header
15Scroll Disabler
16Mega Menu Dropdown
17Main Menu Dropdown
18*/
19
20
21(function ($) {
22	// Define that this file uses modern javascript.
23	"use strict";
24
25	// When page is ready.
26	$( document ).ready(
27		function () {
28			// 01. Overflow visible for sticky elements
29			$( ".sticky" ).parents().css( "overflow", "visible" );
30
31
32			let page_header = $( ".page-header" );
33
34			// 02. Fixed Header
35			if (page_header.hasClass( "make-fixed" )) {
36				$( window ).scroll(
37					function () {
38						if ($( window ).scrollTop() > (($( ".show-fixed-header" ).length && $( ".show-fixed-header" ).offset().top + $( ".show-fixed-header" ).outerHeight()) || page_header.outerHeight())) {
39							$( 'body' ).addClass( "fixed-menu" );
40							$( '.page-header' ).addClass( "fixed-header" );
41							$( ".page-main" ).css( "padding-top", $( ".page-header" ).outerHeight() )
42						} else {
43							$( 'body' ).removeClass( "fixed-menu" );
44							$( '.page-header' ).removeClass( "fixed-header" );
45							$( ".page-main" ).css( "padding-top", 0 )
46						}
47					}
48				);
49			}
50
51			if (page_header.hasClass( "header-absolute" )) {
52				page_header.attr( "absolute", true )
53			}
54
55			if ($( window ).width() < 991) {
56				$( ".menu-item.menu-item-has-children > a" ).attr( 'href', "#" );
57			}
58
59
60			if (page_header.attr( "absolute" ) && (
61				$( window ).width() > 991 && page_header.hasClass( "header-sticky-desktop" ) ||
62				$( window ).width() > 768 && $( window ).width() < 991 && page_header.hasClass( "header-sticky-tablet" ) ||
63				$( window ).width() < 768 && page_header.hasClass( "header-sticky-mobile" )
64			)) {
65				$( window ).scroll(
66					function() {
67						if ($( window ).scrollTop() >= 100) {
68							page_header.removeClass( "header-absolute" );
69						} else {
70							page_header.addClass( "header-absolute" );
71						}
72					}
73				);
74			}
75
76			let headerHeight = page_header.outerHeight();
77			if (
78				$( window ).width() > 991 && page_header.hasClass( "header-sticky-desktop" ) ||
79				$( window ).width() > 768 && $( window ).width() < 991 && page_header.hasClass( "header-sticky-tablet" ) ||
80				$( window ).width() < 768 && page_header.hasClass( "header-sticky-mobile" )
81			) {
82				if ( ! $( ".page-header" ).hasClass( "header-absolute" )) {
83					$( ".page-wrapper" ).css( "padding-top", headerHeight + "px" );
84				}
85			}
86
87			$( "[data-modal]" ).on(
88				"click",
89				function () {
90					let id      = $( this ).attr( "data-modal" );
91					let content = $( '[data-modal-content="' + id + '"]' );
92					let overlay = $( '[data-modal-overlay="' + id + '"]' );
93					if (content.length) {
94						if (content.hasClass( "realgym-modal-active" )) {
95							content.removeClass( "realgym-modal-active" );
96							overlay.removeClass( "realgym-modal-overlay-active" );
97							$( "body" ).removeClass( "disable-scroll" )
98						} else {
99							content.addClass( "realgym-modal-active" );
100							overlay.addClass( "realgym-modal-overlay-active" );
101							$( "body" ).addClass( "disable-scroll" )
102						}
103					}
104				}
105			);
106
107			$( "[data-modal-overlay]" ).on(
108				"click",
109				function () {
110					let content = $( '[data-modal-content="' + $( this ).attr( "data-modal-overlay" ) + '"]' );
111					let overlay = $( '[data-modal-overlay="' + $( this ).attr( "data-modal-overlay" ) + '"]' );
112					$( "body" ).removeClass( "disable-scroll" )
113					content.removeClass( "realgym-modal-active" );
114					overlay.removeClass( "realgym-modal-overlay-active" );
115				}
116			);
117
118			// 03. Scroll Disabler
119			function disableScroll(status) {
120				if (status) {
121					$( "body" ).addClass( "disable-scroll" );
122				} else {
123					$( "body" ).removeClass( "disable-scroll" );
124				}
125				$( window ).resize();
126			}
127
128			// Mobile Menu Open
129			$( ".toggle-menu-open" ).on(
130				"click",
131				function () {
132					$( ".header-menu" ).addClass( "menu-active" );
133					disableScroll( true );
134				}
135			);
136			// Mobile Menu Close
137			$( ".toggle-menu-close" ).on(
138				"click",
139				function () {
140					$( ".header-menu" ).removeClass( "menu-active" );
141					disableScroll( false );
142				}
143			)
144
145			// 10. Modal Switcher
146			$( "[show-modal]" ).on(
147				"click",
148				function () {
149					let elem = $( "[modal-id=" + $( this ).attr( "show-modal" ) + "]" );
150					elem.addClass( "active" );
151				}
152			)
153			$( "[hide-modal]" ).on(
154				"click",
155				function () {
156					let elem = $( "[modal-id=" + $( this ).attr( "hide-modal" ) + "]" );
157					elem.removeClass( "active" );
158				}
159			)
160			$( document ).click(
161				function (e) {
162					let modal = $( ".modal" );
163					if ( ! modal.is( e.target ) && modal.has( e.target ).length === 0) {
164						if (e.target.closest( ".modal-wrapper" ) && e.target.closest( ".modal-wrapper" ).classList.length > 0) {
165							e.target.closest( ".modal-wrapper" ).classList.remove( "active" )
166						}
167					}
168				}
169			);
170
171			$( ".switch-view" ).on(
172				"click",
173				function (){
174					let allList = $( this ).attr( "data-all-list" )
175					let newItem = $( this ).attr( "data-new-item" )
176
177					$( allList ).removeClass( "active" );
178					$( newItem ).addClass( "active" );
179				}
180			);
181
182			if ($( window ).width() <= 991) {
183				$( ".header-menu .menu-item.menu-item-has-children .menu-link" ).on(
184					"click",
185					function (){
186						$( this ).siblings( ".sub-menu" ).slideToggle();
187					}
188				);
189			}
190
191			// 11. Main Slider
192			new Swiper(
193				".realgym-slider",
194				{
195					draggable: true,
196					grabCursor: true,
197					autoHeight: true,
198					// loop: true,
199					// autoplay: {
200					// delay: 2500,
201					// disableOnInteraction: false,
202					// pauseOnMouseEnter: true,
203					// },
204					pagination: {
205						el: '.swiper-pagination',
206						clickable: true,
207						renderBullet: function (index, className) {
208							return '<span class="' + className + '"></span>';
209						},
210					},
211					keyboard: {
212						enabled: true,
213					},
214				}
215			);
216
217			// 12. Video Player.
218			$( ".video-play .video-play-btn" ).on(
219				"click",
220				function () {
221					let id = $( this ).attr( "id" );
222					if ($( this ).parent( ".video-play" ).hasClass( "playing" )) {
223						$( this ).parent( ".video-play" ).removeClass( "playing" );
224						$( "[data-video=" + id + "]" ).trigger( 'pause' );
225					} else {
226						$( this ).parent( ".video-play" ).addClass( "playing" );
227						$( "[data-video=" + id + "]" ).trigger( 'play' );
228					}
229				}
230			);
231
232			$( '.reveal-real-player' ).on(
233				'click',
234				function (e) {
235					e.preventDefault();
236					$( this ).siblings( '.wp-video' ).unwrap( '.realgym-video-poster' );
237					$( this ).siblings( 'iframe' ).unwrap( '.realgym-video-poster' );
238					$( this ).siblings( '#realgym-vimeo-iframe-wrap' ).unwrap( '.realgym-video-poster' );
239					$( this ).remove();
240					$( this ).siblings( 'iframe' ).show();
241					$( this ).siblings( '#realgym-vimeo-iframe-wrap' ).find( 'iframe' ).show();
242				}
243			);
244
245			$( 'body' ).on(
246				'hidden.bs.modal',
247				function (e) {
248					$( 'video' ).trigger( 'pause' );
249					let iframes = $( e.target ).find( 'iframe' );
250					iframes.each(
251						function(index, iframe) {
252							$( iframe ).attr( 'src', $( iframe ).attr( 'src' ) );
253						}
254					);
255				}
256			);
257
258			$( document ).on(
259				'click',
260				'.realgym-play-button:not(.reveal-real-player)',
261				function (e) {
262					e.preventDefault();
263
264					let video_id = $( this ).data( 'video' );
265
266					if (typeof video_id === 'undefined' || video_id.length == 0) {
267						return false;
268					}
269
270					let video_player_modal = bootstrap.Modal.getOrCreateInstance( document.getElementById( 'realgym-video-modal' ) );
271
272					// check old value.
273					let current_id = $( '#realgym-video-wrapper' ).data( 'current_video_id' );
274					if (typeof current_id !== 'undefined' && current_id.length > 0 && current_id == video_id) {
275						video_player_modal.show();
276					} else {
277						$( '#realgym-video-wrapper' ).data( 'current_video_id', '' );
278						$( '#realgym-video-wrapper' ).html( '' );
279						$.ajax(
280							{
281								url: realgym_object.ajax_url,
282								dataType: 'json',
283								method: 'POST',
284								data: {
285									'video_id': video_id,
286									'action': 'realgym_get_video_player_content',
287									'security': realgym_object.realgym_video_player,
288								},
289								complete: function (data) {
290									var dt = data.responseJSON;
291									if (typeof dt.html !== 'undefined') {
292										$( '#realgym-video-wrapper' ).data( 'current_video_id', dt.video_id );
293										$( '#realgym-video-wrapper' ).html( dt.html );
294										// native HTML5 video
295										if ($( '#realgym-video-wrapper .realgym-video-player .wp-video' ).length > 0) {
296											$( '#realgym-video-wrapper .realgym-video-player .wp-video' ).css( 'width', '100%' );
297										}
298										video_player_modal.show();
299									}
300								}
301							}
302						);
303					}
304				}
305			);
306
307			$( '.toggler-arrow-wrap' ).on(
308				'click touchend',
309				function(e) {
310					e.stopPropagation();
311					e.preventDefault();
312					let child_id = $( this ).data( 'child' );
313					if (typeof child_id !== 'undefined') {
314						let child_wrapper = $( '.realgym-categories-widget .children.child-' + child_id );
315						let clicked_arrow = $( '.toggler-arrow-wrap[data-child="' + child_id + '"] .toggler-arrow' );
316						if (child_wrapper.is( ':visible' )) {
317							child_wrapper.slideUp( 500 );
318							clicked_arrow.css( 'transform', 'rotate(-45deg)' );
319						} else {
320							$( '.realgym-categories-widget .children' ).slideUp( 500 );
321							$( '.toggler-arrow-wrap .toggler-arrow' ).css( 'transform', 'rotate(-45deg)' );
322							child_wrapper.slideDown( 500 );
323							clicked_arrow.css( 'transform', 'rotate(45deg)' );
324						}
325					} else {
326						let link = $( this ).closest( 'a' );
327						if ( typeof link !== 'undefined' && link.length > 0) {
328							let href = link.attr( "href" );
329							if ( typeof href !== 'undefined' && href.length > 0) {
330								location.href = href;
331							}
332						}
333					}
334				}
335			);
336
337			$( '.footer-subscription .mc4wp-form .mc4wp-form-fields input[type="submit"]' ).val( '>' );
338
339			// load more pagination
340			$( '.realgym-load-more' ).on(
341				'click',
342				function(){
343					let loadMoreBtn = $( this );
344					if (loadMoreBtn.hasClass( 'loading' )) {
345						return false;
346					}
347					loadMoreBtn.addClass( 'loading' );
348
349					let type    = loadMoreBtn.data( 'type' );
350					let page    = loadMoreBtn.data( 'page' );
351					let view    = loadMoreBtn.data( 'view' );
352					let columns = loadMoreBtn.data( 'columns' );
353					let ordering = loadMoreBtn.data( 'ordering' );
354
355					$.ajax(
356						{
357							url: realgym_object.ajax_url,
358							dataType: 'json',
359							method: 'POST',
360							data: {
361								'type': type,
362								'page': page,
363								'view': view,
364								'columns': columns,
365								'ordering': ordering,
366								'action': 'realgym_general_load_more_paginator',
367								'security': realgym_object.realgym_load_more_paginator,
368							},
369							complete: function (data) {
370								var dt = data.responseJSON;
371								if (typeof dt.html !== 'undefined') {
372									$( '.appendables-wrap' ).append( dt.html );
373								}
374
375								if (typeof dt.page !== 'undefined') {
376									loadMoreBtn.data( 'page', dt.page ).attr( 'data-page', dt.page );
377
378									if (typeof dt.max_pages !== 'undefined') {
379										if (dt.page == dt.max_pages) {
380											loadMoreBtn.remove();
381										}
382									}
383								}
384
385								loadMoreBtn.removeClass( 'loading' );
386							}
387						}
388					);
389
390				}
391			);
392
393			let progressBar = $( '.realgym-progress-wrapper' );
394			$( progressBar ).each(
395				function () {
396					initProgress( $( this ) );
397				}
398			);
399
400			function initProgress(item) {
401				let progressFluid = item.find( '.progress-fluid' );
402				let progressCount = "" + item.find( '.progress-count' ).text();
403				if (progressCount.length > 1 && progressCount != 100) {
404					let firstNumber  = progressCount[0];
405					let secondNumber = progressCount[1];
406					for (let i = 0; i < firstNumber; i++) {
407						let progress = $( progressFluid[i] ).children();
408						progress.css(
409							{
410								width: "100%"
411							}
412						)
413					}
414					$( progressFluid[firstNumber] ).children().css(
415						{
416							width: (secondNumber * 10) + '%'
417						}
418					)
419				}
420				if (progressCount.length === 1) {
421					$( progressFluid[0] ).children().css(
422						{
423							width: (progressCount * 10) + '%'
424						}
425					)
426				}
427				if (+progressCount === 100) {
428					$( progressFluid ).children().css(
429						{
430							width: '100%'
431						}
432					)
433				}
434			}
435		}
436	);
437
438	$( window ).on(
439		'load',
440		function () {
441			if ($( '.realgym-video-player .wp-video' ).length > 0) {
442				$( '.realgym-video-player .wp-video' ).css( 'width', '100%' );
443			}
444		}
445	);
446
447})( 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.