PageSourceSearch

https://srflyer.com/static/version1790660864/frontend/Comonline/MgsSuproChild/es_ES/js/mgs_theme.js

js srflyer.com collected 2026-10-04 16:03:46 UTC 21,682 bytes, 668 lines download raw bytes

1require([
2	'jquery'
3], function ($) {
4	var $_miniCart = $("header.page-header .minicart-wrapper .block-minicart");
5	var $_loginForm = $("header.page-header .header-top-links .login-form");
6	var $_settingSite = $("header.page-header .setting-site .setting-site-content");
7	var $_wishlistHeader = $("header.page-header .top-wishlist .block-wishlist");
8
9    /* Header LeftSide */
10    $(window).on('scroll', function () {
11        var headerLeftHeight = $(".left-side .page-header").innerHeight();
12        var window_height = $(this).height();
13        if (headerLeftHeight - window_height < $(this).scrollTop()) {
14            if (!$(".left-side .page-header").hasClass("fixed-bottom")) {
15                $(".left-side .page-header").addClass("fixed-bottom");
16            }
17        }
18        if (headerLeftHeight - window_height >= $(this).scrollTop()) {
19            if ($(".left-side .page-header").hasClass("fixed-bottom")) {
20                $(".left-side .page-header").removeClass("fixed-bottom");
21            }
22        }
23    });
24    /* Home Parallax */
25    $(document).ready(function(){
26        var sss = 1;
27        var numItems = $('.parallax_item').length;
28        if(numItems > 0){
29            $("html").addClass("parallax_wrapper");
30
31            function smoothScroll(target) {
32                $('body,html').stop().animate(
33                    {'scrollTop': target.offset().top + 1},
34                    600
35                );
36            }
37            function next() {
38                if(sss < numItems){
39                    sss = sss + 1;
40                    smoothScroll($('.parallax_item_' + sss));
41                    if($('.parallax_item_' + sss).hasClass('dark-item')){
42                        $('.header-area').addClass('text-white');
43                    }else{
44                        $('.header-area').removeClass('text-white');
45                    }
46                }else if(sss == numItems){
47                    sss = sss + 1;
48                    smoothScroll($('.footer'));
49                    $('.header-area').addClass('backgroud');
50                }
51            }
52            function prev() {
53                $('.header-area').removeClass('backgroud');
54                if(sss > 1){
55                    sss = sss - 1;
56                    smoothScroll($('.parallax_item_' + sss));
57                    if($('.parallax_item_' + sss).hasClass('dark-item')){
58                        $('.header-area').addClass('text-white');
59                    }else{
60                        $('.header-area').removeClass('text-white');
61                    }
62                }else{
63                    smoothScroll($('html'));
64                }
65            }
66            $('.scroll-to-top').on('click', function () {
67                sss = 1;
68            });
69            smoothScroll($('html'));
70            $(window).on('mousewheel DOMMouseScroll', function(event){
71                clearTimeout($.data(this, 'timer'));
72                $.data(this, 'timer', setTimeout(function() {
73                    if (event.originalEvent.wheelDelta > 0 || event.originalEvent.detail < 0) {
74                        setTimeout(function() {
75                            prev();
76                        }, 150);
77                    }
78                    else {
79                        setTimeout(function() {
80                            next();
81                        }, 150);
82                    }
83                }, 300));
84            });
85        }
86    });
87
88	$(document).ready(function(){
89		/* Header */
90		calAndSetHeightHeaderFooter();
91			/* Header Wishlist */
92			$(document).on("click",".top-wishlist > a",function(e){
93				e.preventDefault();
94				disableBodyScroll();
95				$(this).parent().toggleClass('active');
96			});
97
98			$(document).on("click","#close-wishlist-site",function(e){
99				$(this).parents('.top-wishlist').removeClass('active');
100				activeBodyScroll(false);
101			});
102			/* ++++++++++++ */
103
104			/* Header Top Links */
105			$(document).on("click",".header-top-links > .actions",function(e){
106				e.preventDefault();
107				if($('.header-area').hasClass('myaccount-slide')){
108					disableBodyScroll();
109				}
110				$('.header-top-links').toggleClass('active');
111				if($('.header-top-links').hasClass('active') && $('.header-top-links .captcha-reload').length){
112					$('.header-top-links').find('.captcha-reload').trigger('click');
113				}
114			});
115
116			$(document).on("click","#close-myaccount",function(e){
117				$(this).parents('.header-top-links').removeClass('active');
118				if($('header-area').hasClass('myaccount-slide')){
119					activeBodyScroll(false);
120				}
121			});
122			/* ++++++++++++ */
123
124			/* Search */
125			$(document).on("click",".block-search > .block-title",function(e){
126				e.preventDefault();
127				$(this).parent().toggleClass('active');
128				$('header.page-header').toggleClass('ative-search');
129				if($('.search-icon-popup').length){
130					$('body').toggleClass('search-popup');
131				}
132			});
133
134			$(document).on("click","#close-myaccount",function(e){
135				$(this).parents('.header-top-links').removeClass('active');
136				if($('header-area').hasClass('myaccount-slide')){
137					activeBodyScroll(false);
138				}
139			});
140			/* ++++++++++++ */
141
142			/* Mini Cart */
143			$(document).on("click",".minicart-wrapper .details-qty .minus",function(e){
144				var $itemQty = parseInt($(this).parent().find('.cart-item-qty').attr('data-item-qty'));
145				var $val = parseInt($(this).parent().find('.cart-item-qty').val());
146				var $valChange = $val - 1;
147				if($val > 1){
148					$(this).parent().find('.cart-item-qty').val($valChange);
149					if($itemQty != $valChange){
150						$(this).parents('.details-qty').find('.update-cart-item').show('fade', 300);
151					}else {
152						$(this).parents('.details-qty').find('.update-cart-item').hide('fade', 300);
153					}
154				}
155			});
156
157			$(document).on("click",".minicart-wrapper .details-qty .plus",function(e){
158				var $val = parseInt($(this).parent().find('.cart-item-qty').val());
159				var $itemQty = parseInt($(this).parent().find('.cart-item-qty').attr('data-item-qty'));
160				var $valChange = $val + 1;
161				$(this).parent().find('.cart-item-qty').val($valChange);
162				if($itemQty != $valChange){
163					$(this).parents('.details-qty').find('.update-cart-item').show('fade', 300);
164				}else {
165					$(this).parents('.details-qty').find('.update-cart-item').hide('fade', 300);
166				}
167			});
168			/* ++++++++++++ */
169
170			/* Header Setting */
171			$(document).on("click",".setting-site .actions .action.setting",function(e){
172				disableBodyScroll();
173				$(this).parents('.setting-site').addClass('active');
174			});
175
176			$(document).on("click","#close-setting-site",function(e){
177				$('header.page-header .setting-site').removeClass('active');
178				activeBodyScroll(false);
179			});
180			/* ++++++++++++ */
181
182			/* Header Sticky Menu */
183			if($('.active-sticky:not(.header7)').length){
184				var headerHeight = $('.active-sticky:not(.header7)').height();
185				$(window).scroll(function(){
186					var st = $(this).scrollTop();
187					if(st > headerHeight){
188						$('.active-sticky').addClass('start-stk');
189						$('.header-area .top-header').slideUp();
190					}else {
191						$('.active-sticky').removeClass('start-stk');
192						$('.header-area .top-header').slideDown();
193					}
194				});
195			}
196			/* Footer */
197			$(".footer-title").on('click', function(){
198				if($(window).width() < 767){
199					$(this).parent().toggleClass('active');
200					$(this).parent().find('ul').slideToggle();
201				}
202			});
203
204
205		$(document).on('mouseup', function(e) {
206			/* Header Wishlist */
207			var ctWishlist = $(".top-wishlist .block-wishlist");
208			if (!ctWishlist.is(e.target) && ctWishlist.has(e.target).length === 0) {
209				$('.top-wishlist').removeClass('active');
210				activeBodyScroll(true);
211			}
212			/* ++++++++++++ */
213
214			/* Header Top Links */
215			var ctLogin = $(".header-top-links > .login-form");
216			var ctLoginAction = $(".header-top-links > .actions");
217			if (!ctLogin.is(e.target) && ctLogin.has(e.target).length === 0 && !ctLoginAction.is(e.target) && ctLoginAction.has(e.target).length === 0) {
218				ctLogin.parent('.header-top-links').removeClass('active');
219				activeBodyScroll(true);
220			}
221			/* ++++++++++++ */
222
223			/* Header Setting */
224			if($('.setting-site').length){
225				var stSite = $(".setting-site.active > .setting-site-content");
226				if (!stSite.is(e.target) && stSite.has(e.target).length === 0) {
227					stSite.parent().removeClass('active');
228					activeBodyScroll(true);
229				}
230			}
231			/* ++++++++++++ */
232
233			/* Wishlist Message */
234			var ctResponseWishlist = $(".response_wishlist");
235			if (!ctResponseWishlist.is(e.target) && ctResponseWishlist.has(e.target).length === 0) {
236				ctResponseWishlist.removeClass('_show');
237			}
238			/* ++++++++++++ */
239
240			/* Search */
241			var ctSearch = $(".block-search");
242			if (!ctSearch.is(e.target) && ctSearch.has(e.target).length === 0) {
243				ctSearch.removeClass('active');
244				$('header.page-header').removeClass('ative-search');
245			}
246			/* ++++++++++++ */
247
248			/* Megamenu */
249			var ationMenu = $(".megamenu_action");
250			var ctMenu = $(".horizontal-menu");
251			var mbMenuLeft = $(".use-header-left .header7 .middle-header");
252			if (!ationMenu.is(e.target) && ationMenu.has(e.target).length === 0 && !ctMenu.is(e.target) && ctMenu.has(e.target).length === 0 && !mbMenuLeft.is(e.target) && mbMenuLeft.has(e.target).length === 0) {
253				$('header.page-header').removeClass('active-menu');
254			}
255			/* ++++++++++++ */
256		});
257		/* ++++++++++++ */
258
259		/* Megamenu */
260		var isTouchDevice = ('ontouchstart' in window || 'onmsgesturechange' in window),
261			$_level0Item = $('.horizontal-menu .mgs-megamenu--main .nav-main-menu li.level0'),
262			$_subItem = $('.horizontal-menu .mgs-megamenu--main .nav-main-menu li.level0.menu-1columns .dropdown-submenu');
263
264		if(!isTouchDevice){
265			$_level0Item.on({
266				mouseenter: function(){
267					$(this).addClass('_hover');
268				},
269				mouseleave: function(){
270					$(this).removeClass('_hover');
271				}
272			});
273			$_subItem.on({
274				mouseenter: function(){
275					$(this).addClass('_hover');
276				},
277				mouseleave: function(){
278					$(this).removeClass('_hover');
279				}
280			});
281
282		}else {
283			//fix js edge
284
285			$_level0Item.on({
286				mouseenter: function(){
287					$(this).addClass('_hover');
288				},
289				mouseleave: function(){
290					$(this).removeClass('_hover');
291				}
292			});
293			$_subItem.on({
294				mouseenter: function(){
295					$(this).addClass('_hover');
296				},
297				mouseleave: function(){
298					$(this).removeClass('_hover');
299				}
300			});
301
302		}
303
304
305
306		$(document).on("click",".horizontal-menu li > .toggle-menu",function(e){
307			if($(this).parent().find('> .dropdown-mega-menu').length){
308				$(this).parent().find('> .dropdown-mega-menu').slideToggle();
309				$(this).parent().toggleClass('_show-child');
310			}else if($(this).parent().find('> .sub-menu, > .dropdown-menu-ct').length){
311				$(this).parent().find('> .sub-menu, > .dropdown-menu-ct').slideToggle();
312				$(this).parent().toggleClass('_show-child');
313			}
314		});
315
316		$(document).on("click",".megamenu_action_mb",function(e){
317			if($('header.page-header').hasClass('active-menu')){
318				$('header.page-header').removeClass('active-menu');
319				activeBodyScroll(true);
320			}else {
321				$('header.page-header').addClass('active-menu');
322				disableBodyScroll();
323			}
324
325		});
326
327		$(document).on("click","#close-menu-site",function(e){
328			$('header.page-header').removeClass('active-menu');
329			activeBodyScroll(true);
330		});
331
332		$(document).on("click","#js_mobile_tabs button",function(e){
333
334			var $el_action = $(this).attr('id');
335			if(!$(this).hasClass('active-child')){
336				$('#js_mobile_tabs button.active-child').removeClass('active-child');
337				$(this).addClass('active-child');
338
339				switch ($el_action) {
340					case "back-home-action":
341						updateAnimation($_miniCart, "");
342						updateAnimation($_loginForm, "");
343						updateAnimation($_settingSite, "");
344						updateAnimation($_wishlistHeader, "");
345						setTimeout(function(){ $('body').removeClass('atv-cart atv-setting atv-myaccount atv-wishlist atv-sidebar'); }, 300);
346						break;
347					case "my-account-action":
348						$('body').addClass('atv-myaccount');
349						updateAnimation($_loginForm, "translateX(0)");
350						updateAnimation($_miniCart, "");
351						updateAnimation($_settingSite, "");
352						updateAnimation($_wishlistHeader, "");
353						setTimeout(function(){ $('body').removeClass('atv-cart atv-setting atv-wishlist atv-sidebar'); }, 300);
354						break;
355					case "wishlist-link-action":
356						$('body').addClass('atv-wishlist');
357						updateAnimation($_loginForm, "translateX(-100%)");
358						updateAnimation($_wishlistHeader, "translateX(0)");
359						updateAnimation($_miniCart, "");
360						updateAnimation($_settingSite, "");
361						setTimeout(function(){ $('body').removeClass('atv-cart atv-setting atv-myaccount atv-sidebar'); }, 300);
362						break;
363					case "cart-top-action":
364						$('body').addClass('atv-cart');
365						updateAnimation($_loginForm, "translateX(-100%)");
366						updateAnimation($_wishlistHeader, "translateX(-100%)");
367						updateAnimation($_miniCart, "translateX(0)");
368						updateAnimation($_settingSite, "");
369						setTimeout(function(){ $('body').removeClass('atv-myaccount atv-setting atv-wishlist atv-sidebar'); }, 300);
370						break;
371					case "setting-web-action":
372						$('body').addClass('atv-setting');
373						updateAnimation($_loginForm, "translateX(-100%)");
374						updateAnimation($_miniCart, "translateX(-100%)");
375						updateAnimation($_wishlistHeader, "translateX(-100%)");
376						updateAnimation($_settingSite, "translateX(0)");
377						setTimeout(function(){ $('body').removeClass('atv-cart atv-myaccount atv-wishlist atv-sidebar'); }, 300);
378						break;
379				}
380			}else {
381				$(this).removeClass('active-child');
382				updateAnimation($_miniCart, "");
383				updateAnimation($_loginForm, "");
384				updateAnimation($_settingSite, "");
385				updateAnimation($_wishlistHeader, "");
386				setTimeout(function(){ $('body').removeClass('atv-cart atv-setting atv-myaccount atv-wishlist atv-sidebar'); }, 300);
387			}
388		});
389
390		/* ++++++++++++ */
391
392		/* ++++++++++++ */
393		 $(".form-create-account .field:not('.choice') > .control > input, .form-create-account .field:not('.choice') select").each(function() {
394			$(this).focusin(function(){
395				$(this).parent().parent().find(' > .label').addClass('input-focus');
396			});
397			$(this).focusout(function(){
398				$(this).parent().find('.label').removeClass('input-focus');
399				$(this).blur(function(){
400					if( !$(this).val() ) {
401						$(this).parent().parent().find('.label').removeClass('input-focus');
402					}
403				});
404			});
405		 });
406		/* ++++++++++++ */
407
408	});
409
410	$(window).on('resize', function(){
411		if(!$('.header-area.scrolling').length){
412			calAndSetHeightHeaderFooter();
413		}
414		if($(this).width() >= 768){
415			if($('body').hasClass('atv-cart') || $('body').hasClass('atv-setting') || $('body').hasClass('atv-myaccount')){
416				$('#js_mobile_tabs button.active-child').removeClass('active-child');
417				updateAnimation(Form, "");
418				updateAnimation($_settingSite, "");
419				updateAnimation($_wishlistHeader, "");
420				$('body').removeClass('atv-cart atv-setting atv-myaccount atv-wishlist');
421			}
422		}else {
423			activeBodyScroll(false);
424		}
425	});
426
427	function updateAnimation($el, $value) {
428		$el.css('transform', $value);
429		$el.css('-webkit-transform', $value);
430		$el.css('-moz-transform', $value);
431		$el.css('-o-transform', $value);
432	}
433
434	function disableBodyScroll() {
435		$('body').addClass('fixed-content');
436	}
437
438	function activeBodyScroll($status) {
439		if(!$status){
440			$('body').removeClass('fixed-content');
441		}else {
442			if(!$('.page-header .header-top-links').hasClass('active') && !$('.page-header .top-wishlist').hasClass('active') && !$('.page-header .setting-site').hasClass('active') && !$('.page-header').hasClass('active-menu')){
443				$('body').removeClass('fixed-content');
444			}
445		}
446	}
447	/* Wishlist */
448
449	$(document).on("click",".box-tocart .qty .control .minus",function(e){
450		var $itemQty = parseInt($(this).parent().find('input.qty').attr('data-item-qty'));
451		var $val = parseInt($(this).parent().find('input.qty').val());
452		var $valChange = $val - 1;
453		if($valChange >= 0){
454			$(this).parent().find('input.qty').val($valChange);
455		}
456	});
457
458	$(document).on("click",".box-tocart .qty .control .plus",function(e){
459		var $itemQty = parseInt($(this).parent().find('input.qty').attr('data-item-qty'));
460		var $val = parseInt($(this).parent().find('input.qty').val());
461		var $valChange = $val + 1;
462		$(this).parent().find('input.qty').val($valChange);
463
464	});
465
466	/* ++++++++++++ */
467});
468
469/* Calculate height & set it for header & footer */
470function calAndSetHeightHeaderFooter() {
471    require([
472        'jquery'
473    ], function ($) {
474		var $heightHeader = $('header.page-header > div').height();
475		$('header.page-header').height($heightHeader);
476		if($('.footer-parallax').length){
477			var $heightFooter = $('footer.page-footer .footer-parallax').height();
478			$('footer.page-footer').height($heightFooter);
479		}
480    });
481}
482/* +++++++ */
483/* POPUP VIDEO */
484
485require([
486	'jquery',
487	'magnificPopup'
488], function(jQuery){
489	(function($) {
490		$(document).ready(function() {
491			$('.popup-video').magnificPopup({
492				disableOn: 700,
493				disableOn: 700,
494				type: 'iframe',
495				mainClass: 'mfp-img-gallery',
496				removalDelay: 160,
497				preloader: false,
498				fixedContentPos: false
499			});
500		});
501	})(jQuery);
502});
503require([
504	'jquery'
505], function(jQuery){
506	(function($) {
507		$(document).ready(function(){
508			function setWidth() {
509				var result = $(".pub-video .frame").width();
510				$('.pub-video').css('max-width', result);
511			};
512			setWidth();
513		});
514	})(jQuery);
515});
516/** Header **/
517require([
518	'jquery'
519], function(jQuery){
520	(function($) {
521		$(document).ready(function(){
522			$(document).on("click",".page-header .search-icon-left .block-title.theme-header-icon",function(e){
523				e.preventDefault();
524				disableBodyScroll();
525				$(this).parent().toggleClass('show-search-box');
526			});
527		});
528	})(jQuery);
529});
530
531
532/* Coming Soon */
533
534/* Coming Soon */
535
536require([
537	'jquery'
538], function(jQuery){
539	(function($) {
540		$(document).ready(function(){
541			$('.cms-coming-soon .page.messages').addClass('_show');
542			setTimeout(function(){ $('.cms-coming-soon .page.messages').removeClass('_show'); }, 10000);
543		});
544		countDownTimer('Apr 30 2019 23:59:00 GMT+0200');
545		function countDownTimer(date) {
546			var elem = $('#deal-time-coming .countdown');
547			var futureTime = new Date(date).getTime();
548
549			setInterval(function() {
550				var timeLeft = Math.floor( (futureTime - new Date().getTime()) / 1000 );
551				var days =  Math.floor(timeLeft / 86400);
552				timeLeft -= days * 86400;
553				var hours = Math.floor(timeLeft / 3600) % 24;
554				timeLeft -= hours * 3600;
555				var min = Math.floor(timeLeft / 60) % 60;
556				timeLeft -= min * 60;
557				var sec = timeLeft % 60;
558				var timeString = "<span class='days'>"+days+"</span>"+
559								 "<span class='hours'>"+hours+"</span>"+
560								 "<span class='minutes'>"+min+"</span>"+
561								 "<span class='seconds'>"+sec+"</span>";
562
563				elem.html(timeString);
564
565			}, 1000);
566		}
567	})(jQuery);
568});
569
570
571/* End Coming Soon */
572
573
574/* Home Full slider */
575require([
576	'jquery'
577], function(jQuery){
578	(function($) {
579		$(document).ready(function(){
580			$(document).on("click",".action-newsletter-mb .icon",function(e){
581				$(this).parent().parent().parent().toggleClass('active');
582			});
583		});
584	})(jQuery);
585});
586
587/*  End Home Full slider */
588
589function setLocation(url) {
590    require([
591        'jquery'
592    ], function (jQuery) {
593        (function () {
594            window.location.href = url;
595        })(jQuery);
596    });
597}
598
599/* js delivery */
600require( ['jquery', 'Magento_Ui/js/modal/modal'], function($, modal) {
601	var options = {
602		type: 'popup',
603		responsive: true,
604        innerScroll: true,
605        modalClass: 'popup-delivery'
606	};
607
608	if($('#side_guilde_modal').length > 0 && $('#delivery_return_modal').length > 0) {
609		var popup = modal(options, $('#side_guilde_modal'));
610
611		var popup2 = modal(options, $('#delivery_return_modal'));
612
613		// $('#popup-login').modal('openModal');
614
615		$(".extra-link > a:first-child").on('click', function(){
616			$('#side_guilde_modal').modal('openModal');
617		});
618
619		$(".extra-link > a:last-child").on('click', function(){
620			$('#delivery_return_modal').modal('openModal');
621		});
622	}
623
624});
625require( ['jquery', 'mage/translate'], function($) {
626	/********************** FILTER ***************************/
627	if($(this).width() <= 991){
628		$(document).ready(function(){
629			if($('#layered-filter-block').length){
630				var $_filterAction = '<div class="filter-placeholder"><a class="action-filter" href="javascript:void(0)">'+$.mage.__('Filter')+'</a></div>';
631				$('.top-toolbar .toolbar-products .toolbar-sorter').before($_filterAction);
632			}
633		});
634
635		$(document).on("click",".action-filter",function(e){
636			$('#layered-filter-block').addClass('active');
637		});
638
639		$(document).on("click",".block-subtitle.filter-subtitle",function(e){
640			$('#layered-filter-block').removeClass('active');
641		});
642		$(document).on("click",".filter-title",function(e){
643			$('#layered-filter-block').removeClass('active');
644		});
645	}
646	$(window).on('resize', function(){
647		if($(this).width() <= 991){
648			$(document).ready(function(){
649				if($('#layered-filter-block').length){
650					var $_filterAction = '<div class="filter-placeholder"><a class="action-filter" href="javascript:void(0)">'+$.mage.__('Filter')+'</a></div>';
651					$('.top-toolbar .toolbar-products .toolbar-sorter').before($_filterAction);
652				}
653			});
654
655			$(document).on("click",".action-filter",function(e){
656				$('#layered-filter-block').addClass('active');
657			});
658
659			$(document).on("click",".block-subtitle.filter-subtitle",function(e){
660				$('#layered-filter-block').removeClass('active');
661			});
662			$(document).on("click",".filter-title",function(e){
663				$('#layered-filter-block').removeClass('active');
664			});
665		}
666	});
667	/*********************************************************/
668});

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.