PageSourceSearch

https://box.mk/wp-content/plugins/gt3-themes-core/core/elementor/assets/js/core-frontend.js?ver=2.2.7

js box.mk collected 2026-09-26 09:46:38 UTC 13,120 bytes, 425 lines download raw bytes

1;'use strict';
2
3(function (factory) {
4	window.gt3Elementor = window.gt3Elementor || {};
5	window.gt3Elementor.CoreFrontend = window.gt3Elementor.CoreFrontend || factory(window.jQuery);
6})(function ($) {
7
8
9	function CoreFrontend() {
10		if (!this || this.widgets !== CoreFrontend.prototype.widgets) {
11			return new CoreFrontend()
12		}
13
14		this.initialize();
15	}
16
17
18
19	$.extend(CoreFrontend.prototype, {
20		widgets: {
21					'gt3-core-gallerypackery': 'GalleryPackery',
22		},
23		body: $('body'),
24		html: $('html'),
25		window: $(window),
26		footer: $('footer'),
27		editMode: false,
28		array_chunk: function (input, size) {
29			if (Array.isArray(input)) {
30				for (var x, i = 0, c = -1, l = input.length, n = []; i < l; i++) {
31					(x = i % size) ? n[c][x] = input[i] : n[++c] = [input[i]];
32				}
33				return n;
34			}
35			return input;
36		},
37		initialize: function () {
38
39			var that = this;
40			if (typeof window.elementorFrontend !== 'undefined') {
41				$.each(this.widgets, function (name, callback) {
42					window.elementorFrontend.hooks.addAction('frontend/element_ready/' + name + '.default', that[callback].bind(that));
43				})
44			}
45			if (typeof elementorFrontend !== 'undefined') {
46				this.editMode = elementorFrontend.config.isEditMode || (elementorFrontend.isEditMode && elementorFrontend.isEditMode());
47			}
48
49			jQuery( 'body:not(.elementor-editor-active) .gt3_column_link-elementor' ).each(function(){
50				var element = jQuery(this);
51				var element_url = element.attr('data-column-clickable-url');
52				var element_link_blank = element.attr('data-column-clickable-blank')
53
54				element.find('.elementor-widget-wrap').on('click',function(e){
55
56					if (e.target.nodeName != 'A') {
57						if (element_link_blank == 'yes') {
58							window.open(element_url, '_blank');
59						}else{
60							window.location.href = element_url;
61						}
62					}
63
64				})
65			})
66
67
68			if (this.editMode) {
69				jQuery(function ($) {
70					jQuery(':input');
71				});
72
73				window.elementor.on("preview:loaded", function () {
74					if (window.elementor.elements === undefined) {
75						var timer = setInterval(function () {
76							if (window.elementor.elements !== undefined) {
77								clearInterval(timer);
78								var elementorItemsModels = window.elementor.elements.models;
79								elementorItemsModels.forEach(function(item, i, arr){
80									that.find_any_element(item.attributes);
81								})
82							}
83						}, 100);
84					}
85				});
86			}
87		},
88		find_any_element: function (item){
89			var that = this;
90			if (item.elType == 'column') {
91
92				if (item.settings.attributes.gt3_carousel_back_end === 'yes') {
93
94					var attributes = item.settings.attributes;
95					var settings = {};
96
97					settings.items_per_line = attributes.gt3_carousel_items_per_line;
98					settings.item_per_line_mobile = attributes.gt3_carousel_items_per_line_mobile;
99					settings.item_per_line_tablet = attributes.gt3_carousel_items_per_line_tablet;
100					settings.autoplay = attributes.gt3_carousel_autoplay == 'yes' ? true : false;
101					settings.autoplaySpeed = attributes.gt3_carousel_autoplay_time;
102					settings.dots = attributes.gt3_carousel_nav == 'dots' ? true : false;
103					settings.arrows = attributes.gt3_carousel_nav == 'arrows' ? true : false;
104					settings.centerMode = attributes.gt3_carousel_center_mode == 'yes' ? true : false;
105					settings.l10n = {};
106					settings.l10n.prev = attributes.gt3_carousel_nav_prev ? attributes.gt3_carousel_nav_prev : '';
107					settings.l10n.next = attributes.gt3_carousel_nav_next ? attributes.gt3_carousel_nav_next : '';
108
109					if (item.settings.attributes.gt3_carousel === 'yes') {
110						if (item.id) {
111							jQuery('.elementor-element-'+item.id).addClass('gt3_carousel-elementor');
112							jQuery('.elementor-element-'+item.id).attr('data-settings',JSON.stringify(settings));
113							jQuery('.elementor-element-'+item.id).addClass('gt3_carousel_items_per_line-'+settings.items_per_line);
114							jQuery('.elementor-element-'+item.id).addClass('gt3_carousel_items_per_line_tablet-'+settings.item_per_line_tablet);
115							jQuery('.elementor-element-'+item.id).addClass('gt3_carousel_items_per_line_mobile-'+settings.item_per_line_mobile);
116						}
117					}
118					jQuery('.elementor-element-'+item.id).removeClass('gt3_carousel_destroy-elementor');
119				}else{
120					jQuery('.elementor-element-'+item.id).addClass('gt3_carousel_destroy-elementor');
121				}
122
123			}
124
125			if (item.widgetType == 'toggle') {
126				if (item.settings.attributes.add_question_marker === 'yes') {
127					jQuery('.elementor-element-'+item.id).find('.elementor-tab-title').addClass('add_question_marker').attr('data-question_marker', item.settings.attributes.question_marker);
128				}else{
129					jQuery('.elementor-element-'+item.id).find('.elementor-tab-title').removeClass('add_question_marker')
130				}
131			}
132
133
134			if (item.elements.length) {
135				if (item.elements.models.length) {
136					item.elements.models.forEach(function(item, i, arr){
137						if (item.attributes) {
138							that.find_any_element(item.attributes);
139						}
140					})
141				}
142			}
143		},
144		GalleryPackery: function ($scope) {
145			var that = this;
146			var wrapper = $scope.hasClass('packery_wrapper') ? $scope : jQuery('.packery_wrapper', $scope);
147			if (!wrapper.length) {
148				console.warn('Packery wrapper not found');
149				return;
150			}
151
152			var isotope = jQuery('.isotope_wrapper', $scope);
153
154			var query = wrapper.data('settings');
155			query.action = 'gt3_core_packery_load_images';
156
157
158			var	images = this.array_chunk(wrapper.data('images'), query.load_items),
159				packery = query.packery,
160				wrap_width_origin, index, wrap_width, wrap_height,
161				wrap_ratio, img_ratio;
162
163			var paged = 0,
164				max_page = images.length,
165				lightbox = query.lightbox,
166				lightbox_array,
167				lightbox_obj,
168				gap;
169
170			if (lightbox) {
171				lightbox_array = window['images' + query.uid];
172				if (!that.editMode) {
173					wrapper.on('click', '.lightbox', function (event) {
174						event.preventDefault();
175						event.stopPropagation();
176						var options = {
177							index: $(this).closest('.isotope_item').index(),
178							container: '#popup_gt3_elementor_gallery',
179							event: event,
180							instance: query.uid
181						};
182
183						lightbox_obj = blueimp.ElementorGallery(lightbox_array, options);
184					});
185				}
186			}
187
188			query.packery = null;
189
190			function resize() {
191				if (query.gap_unit === '%') {
192					gap = (wrapper.width() * parseFloat(query.gap_value) / 100).toFixed(2);
193					isotope.find('.isotope_item').css('padding-right', gap + 'px').css('padding-bottom', gap + 'px');
194				}
195
196				var grid = packery.grid;
197				var lap = packery.lap;
198
199				if ($(window).outerWidth() < 600) {
200					grid = 1;
201				} else if ($(window).outerWidth() < 900 && (grid % 2 === 0)) {
202					lap = lap / 2;
203					grid /= 2;
204				}
205
206				wrap_width_origin = Math.floor(isotope.width() / grid);
207
208				var local_key = 0;
209				wrapper.find('img').each(function (key, value) {
210					var img = $(this);
211					var parent = img.closest('.isotope_item');
212					if ($(window).outerWidth() < 600) {
213						parent
214							.css('height', 'auto')
215							.css('width', 'auto')
216							.attr('data-ratio', '');
217
218						img.attr('data-ratio', '')
219							.closest('.img').css('height', 'auto').css('width', 'auto')
220					} else {
221						wrap_height = wrap_width = wrap_width_origin;
222
223						index = local_key % lap + 1;
224						if (index in packery.elem) {
225							if ('w' in packery.elem[index] && packery.elem[index].w > 1) {
226								wrap_width = wrap_width_origin * packery.elem[index].w;
227							}
228							if ('h' in packery.elem[index] && packery.elem[index].h > 1) {
229								wrap_height = wrap_width_origin * packery.elem[index].h;
230							}
231						}
232
233						local_key++;
234
235						wrap_ratio = (wrap_width / wrap_height);
236						img_ratio = ((img.attr('width') || 1) / (img.attr('height') || 1));
237						if (wrap_ratio > img_ratio) img_ratio = 0.5;
238
239						var wrap_data_ratio = wrap_ratio >= 1 ? 'landscape' : 'portrait';
240						var img_data_ratio = img_ratio >= 1 ? 'landscape' : 'portrait';
241
242						if (wrap_data_ratio === 'portrait' && img_data_ratio === 'portrait' && wrap_ratio >= img_ratio) {
243							wrap_data_ratio = 'landscape';
244						} else if (wrap_data_ratio === 'landscape' && img_data_ratio === 'landscape' && img_ratio <= wrap_ratio) {
245							img_data_ratio = 'portrait';
246						}
247
248						parent
249							.css('height', Math.floor(wrap_height))
250							.css('width', Math.floor(wrap_width))
251							.attr('data-ratio-n', wrap_ratio)
252
253							.attr('data-ratio', wrap_data_ratio);
254
255						img.attr('data-ratio', img_data_ratio)
256							.attr('data-ratio-n', img_ratio)
257
258							.closest('.img_wrap').css('height', parent.height()).css('width', parent.width())
259
260					}
261				});
262
263				isotope.isotope({
264					layoutMode: 'masonry',
265					itemSelector: '.isotope_item',
266					masonry: {
267						columnWidth: wrap_width_origin
268					},
269					originLeft: !jQuery('body').hasClass('rtl')
270				}).isotope('layout');
271			}
272
273			resize();
274			isotope.imagesLoaded(function () {
275				resize();
276				showImages();
277			});
278
279			if (!that.editMode) {
280				$scope.on("click", ".isotope-filter a", function (e) {
281					e.preventDefault();
282					var data_filter = this.getAttribute("data-filter");
283					jQuery(this).siblings().removeClass("active");
284					jQuery(this).addClass("active");
285					isotope.isotope({filter: data_filter});
286				});
287
288				$('.view_more_link', $scope).on('click', function (e) {
289					e.preventDefault();
290					query.images = images[paged++];
291
292					jQuery.ajax({
293						type: "POST",
294						data: query,
295						url: gt3_themes_core.ajaxurl,
296						success: function (data) {
297							if ('post_count' in data) {
298								if (data.post_count > 0) {
299									var add = $(data.respond);
300									isotope.append(add).isotope('appended', add);
301									if (lightbox && 'gallery_items' in data) {
302										lightbox_array = lightbox_array.concat(data.gallery_items);
303									}
304									setTimeout(function () {
305										isotope.isotope({sortby: 'original-order'});
306										resize();
307									}, 50);
308									setTimeout(function () {
309										showImages();
310									}, 800);
311								}
312							}
313						},
314						error: function (e) {
315							console.error('Error request');
316						}
317					});
318					if (paged >= max_page) {
319						jQuery(this).addClass('hidden');
320					}
321				});
322			}
323
324			function showImages() {
325				if (jQuery('.loading:first', $scope).length) {
326					jQuery('.loading:first', $scope).removeClass('loading');
327					setTimeout(showImages, 240);
328				} else {
329					resize();
330				}
331			}
332
333
334			$(window).on('resize', function () {
335				resize();
336			});
337
338			if (paged >= max_page) {
339				jQuery('.view_more_link', $scope).remove();
340			}
341		},
342	});
343
344	return CoreFrontend;
345});
346
347jQuery(window).on('elementor/frontend/init', function () {
348	if ('function' === typeof window.gt3Elementor.CoreFrontend) {
349		window.gt3Elementor.CoreFrontend = window.gt3Elementor.CoreFrontend();
350	}
351});
352
353/* PinContainer */
354if (typeof gsap !== 'undefined' && typeof ScrollTrigger !== 'undefined') {
355	gsap.registerPlugin(ScrollTrigger);
356
357	const PinContainer = elementorModules.frontend.handlers.Base.extend({
358		bindEvents: function bindEvents() {
359			if (this.isEdit) {
360				return;
361			}
362
363			if ("yes" !== this.getElementSettings("gt3_pin_container")) {
364				return;
365			}
366
367			if (this.getElementSettings("gt3_pin_container_breakpoint")) {
368				if (
369					jQuery(window).width() >
370					elementorFrontend.config.responsive.activeBreakpoints[
371						this.getElementSettings("gt3_pin_container_breakpoint")
372						].value
373				) {
374					this.run();
375				}
376			} else {
377				this.run();
378			}
379		},
380
381		run: function run() {
382			let pin_area = this.$element;
383			let pin_area_start = this.getElementSettings("gt3_pin_container_area_start");
384			let pin_area_end = this.getElementSettings("gt3_pin_container_area_end");
385			let end_trigger = this.getElementSettings("gt3_pin_container_end_trigger");
386
387			if ("custom" === pin_area_start) {
388				pin_area_start = this.getElementSettings(
389					"gt3_pin_container_area_start_custom"
390				);
391			}
392
393			if ("custom" === pin_area_end) {
394				pin_area_end = this.getElementSettings("gt3_pin_container_area_end_custom");
395			}
396
397			if (this.getElementSettings("gt3_pin_container_custom_area")) {
398				pin_area = this.getElementSettings("gt3_pin_container_custom_area");
399			}
400
401			gsap.to(this.$element, {
402				scrollTrigger: {
403					trigger: pin_area,
404					endTrigger: end_trigger,
405					pin: this.$element,
406					pinSpacing: false,
407					start: pin_area_start,
408					end: pin_area_end,
409					delay: 0.5,
410					markers: false,
411				},
412			});
413
414			this.$element.css("transition", "none");
415		},
416	});
417
418	jQuery(window).on('elementor/frontend/init', () => {
419		window.elementorFrontend.hooks.addAction("frontend/element_ready/container", function($scope) {
420			window.elementorFrontend.elementsHandler.addHandler(PinContainer, {
421				$element: $scope,
422			});
423		});
424	});
425}

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.