PageSourceSearch

https://montagut.com/modules/ets_megamenu/views/js/megamenu.js

js montagut.com collected 2026-10-08 01:33:22 UTC 21,687 bytes, 512 lines download raw bytes

1/**
2 * Copyright ETS Software Technology Co., Ltd
3 *
4 * NOTICE OF LICENSE
5 *
6 * This file is not open source! Each license that you purchased is only available for 1 website only.
7 * If you want to use this file on more websites (or projects), you need to purchase additional licenses.
8 * You are not allowed to redistribute, resell, lease, license, sub-license or offer our resources to any third party.
9 *
10 * DISCLAIMER
11 *
12 * Do not edit or add to this file if you wish to upgrade PrestaShop to newer
13 * versions in the future.
14 *
15 * @author ETS Software Technology Co., Ltd
16 * @copyright  ETS Software Technology Co., Ltd
17 * @license    Valid for 1 website (or project) for each purchase of license
18 */
19$(function() {
20    $(document).mouseup(function (e)
21    {
22        var container_block_search = $('.mm_extra_item.active');
23        if (!container_block_search.is(e.target)&& container_block_search.has(e.target).length === 0)
24        {
25            $('.mm_extra_item').removeClass('active');
26        }
27    });
28    
29    if($('.mm_extra_item button[type="submit"]').length)
30    {
31        $(document).on('click','.mm_extra_item button[type="submit"]',function(){
32           if(!$(this).closest('.mm_extra_item').hasClass('mm_display_search_default') )
33           {
34                if ( !$(this).closest('.mm_extra_item').hasClass('active') ){
35                    $(this).closest('.mm_extra_item').addClass('active');
36                    return false;
37                } else {
38                    if ($(this).prev('input').val() == 0){
39                        $('.mm_extra_item').removeClass('active');
40                        return false;
41                    }
42                }
43           } 
44        });
45    }
46    displayHeightTab();
47     if ($('.ets_mm_megamenu.sticky_enabled').length > 0)
48     {
49        var sticky_navigation_offset_top = $('.ets_mm_megamenu.sticky_enabled').offset().top;
50        var headerFloatingHeight = $('.ets_mm_megamenu.sticky_enabled').height()+($('#header').length > 0 ? parseInt($('.ets_mm_megamenu.sticky_enabled').css('marginTop').replace('px',''))+parseInt($('.ets_mm_megamenu.sticky_enabled').css('marginBottom').replace('px','')) : 0);
51        var oldHeaderMarginBottom = $('#header').length > 0 ? parseInt($('#header').css('marginBottom').replace('px','')) : 0;
52        var sticky_navigation = function(){
53            if(!$('.ets_mm_megamenu').hasClass('sticky_enabled'))
54                return false;
55            var scroll_top = $(window).scrollTop(); 
56            if (scroll_top > sticky_navigation_offset_top) {
57                $('.ets_mm_megamenu.sticky_enabled').addClass('scroll_heading');
58                if($('#header').length > 0)
59                    $('#header').css({'marginBottom':headerFloatingHeight+'px'});
60            } else {
61                $('.ets_mm_megamenu.sticky_enabled').removeClass('scroll_heading');
62                if($('#header').length > 0)
63                    $('#header').css({'marginBottom':oldHeaderMarginBottom+'px'});
64            } 
65        };
66        sticky_navigation();
67        $(window).scroll(function() {
68             sticky_navigation();
69        });
70        if($(window).width() < 768 && !$('body').hasClass('disable-sticky'))
71                    $('body').addClass('disable-sticky');
72        $(window).on('resize',function(e){
73                if($(window).width() < 768 && !$('body').hasClass('disable-sticky'))
74                    $('body').addClass('disable-sticky');
75                else
76                    if($(window).width() >= 768 && $('body').hasClass('disable-sticky'))
77                        $('body').removeClass('disable-sticky');
78         });
79     }
80     
81     $(window).load(function(){
82        if ($('.ets_mn_submenu_full_height').length > 0 ){
83        var ver_sub_height = $('.ets_mn_submenu_full_height').height();
84        $('.ets_mn_submenu_full_height').find('.mm_columns_ul').css("min-height",ver_sub_height);
85     }
86     });
87     
88     if ( $('.mm_columns_ul_tab_content').length > 0 && $('body#index').length >0 ){
89        $('.mm_columns_ul_tab_content').addClass('active').prev('.arrow').removeClass('closed').addClass('opened');
90    }
91     
92     $(window).resize(function(){
93        $('.mm_menus_ul:not(.ets_mm_all_show_resize)').removeClass('ets_mn_active');
94     });
95     $(document).on('click','.mm_has_sub > .arrow',function(){
96            var wrapper = $(this).next('.mm_columns_ul');
97            if($(this).hasClass('closed'))
98            {
99                $('.mm_columns_ul').removeClass('active');
100                $('.mm_has_sub > .arrow').removeClass('opened');
101                $('.mm_has_sub > .arrow').addClass('closed');
102                var btnObj = $(this); 
103                btnObj.removeClass('closed');
104                btnObj.addClass('opened');
105                wrapper.stop(true,true).addClass('active');
106            } else {
107                var btnObj = $(this); 
108                btnObj.removeClass('opened');
109                btnObj.addClass('closed');
110                wrapper.stop(true,true).removeClass('active');
111            }
112    }); 
113     $('.transition_slide:not(.changestatus):not(.click_open_submenu) li.mm_menus_li').hover(function(){
114        if($(window).width() >= 768){
115            $(this).find('.mm_columns_ul').stop(true,true).slideDown(200);
116        }
117    }, function(){
118        if($(window).width() >= 768){
119            $(this).find('.mm_columns_ul').stop(true,true).slideUp(0);
120        }
121    });
122
123
124    $(document).on('mouseenter','.ets_mm_megamenu .mm_menus_li:not(.mm_menus_li_tab),.ets_mm_megamenu .mm_menus_li.mm_menus_li_tab',function(e){
125        if ( $('#header .ets_mm_megamenu:not(.scroll_heading)').length > 0 ){
126            var mm_content_height = $('#header').height();
127        } else if ( $('#header .ets_mm_megamenu.scroll_heading').length > 0 ){
128            var mm_content_height = $('.ets_mm_megamenu').height();
129        } else {
130            var mm_content_height = $('#header').height() + $('.ets_mm_megamenu').height();
131        }
132
133
134    });
135
136    $(document).on('mouseenter','.ets_mm_megamenu .mm_menus_li.mm_has_sub',function(e){
137        if ( ($(window).width() > 767 && $('.ets_mm_megamenu:not(.changestatus)').length > 0) || ($(window).width() > 1199 && $('.ets_mm_megamenu.changestatus').length > 0) ){
138            var _mm_item_position = $(this).position().top + $(this).outerHeight();
139            $(this).find('.mm_columns_ul').css('top',_mm_item_position+'px');
140        }
141    });
142
143    $(document).on('mouseleave','.ets_mm_megamenu',function(e){
144        $('.mm_columns_ul').css('top','');
145    });
146
147    $('.transition_slide.click_open_submenu:not(.changestatus) li.mm_menus_li').on('click',function(e){
148        if($(window).width() >= 768){
149            $(this).find('.mm_columns_ul').stop(true,true).slideDown(200);
150        }
151    });
152    
153    $('.ybc-menu-toggle, .ybc-menu-vertical-button').on('click',function(){
154        var wrapper = $(this).next('.mm_menus_ul');
155        if($(this).hasClass('closed'))
156        {
157            var btnObj = $(this);
158            $('body').addClass('noscroll');
159            btnObj.removeClass('closed');
160            btnObj.addClass('opened');
161            wrapper.stop(true,true).addClass('active');
162            if ( $('.transition_slide.transition_default').length != '' ){
163                wrapper.stop(true,true).slideDown(0);
164            }
165        } else {
166            $('body').removeClass('noscroll');
167            var btnObj = $(this);
168            btnObj.removeClass('opened');
169            btnObj.addClass('closed');
170            wrapper.stop(true,true).removeClass('active');
171            if ( $('.transition_slide.transition_default').length != '' ){
172                wrapper.stop(true,true).slideUp(0);
173            }
174        }
175    });
176    $('.close_menu').on('click',function(){
177        $('body').removeClass('noscroll');
178        $(this).parent().prev().removeClass('opened');
179        $(this).parent().prev().addClass('closed');
180        $(this).parent().stop(true,true).removeClass('active');
181    });
182    if($('.ets_mm_megamenu').hasClass('enable_active_menu') && $('.mm_menus_ul > li').length > 0)
183    {
184        var currentUrl = window.location.href;      
185        $('.mm_menus_ul > li').each(function(){
186            if($(this).find('a[href="'+currentUrl+'"]').length > 0)
187            {
188                $(this).addClass('active');
189                return false;
190            }
191        });
192    }
193    if($('.mm_breaker').length > 0 && $('.mm_breaker').prev('li').length > 0)
194    {
195        $('.mm_breaker').prev('li').addClass('mm_before_breaker');
196    }
197
198    $('.mm_menus_li .mm_tabs_li').hover(function(){
199        if(!$(this).hasClass('open'))
200        {
201            $(this).parents('.mm_columns_ul_tab').find('.mm_tabs_li').removeClass('open');
202            $(this).addClass('open');
203            $(this).closest('.mm_columns_ul').removeClass('mm_tab_no_content');
204            if ( !$(this).find('.mm_columns_contents_ul').length ){
205                $(this).closest('.mm_columns_ul').addClass('mm_tab_no_content');
206            }
207            displayHeightTab();
208            var mmlitab_height = $(this).outerHeight() * ($('.mm_tabs_li:not(.mm_tab_content_hoz)').index($('.open')) + 1) + 1;
209            $('.mm_columns_contents_ul').css('min-height',mmlitab_height);
210        }
211    }, function() {
212        $('.mm_tabs_li.menu_ver_alway_open_first').addClass('open').parents('.mm_columns_ul_tab').removeClass('mm_tab_no_content');
213        $('.mm_tabs_li:not(.menu_ver_alway_open_first)').removeClass('open');
214    });
215
216    $('.mm_menus_li:not(.menu_ver_alway_show_sub )').hover(function(){
217        $('.menu_ver_alway_show_sub .mm_columns_ul_tab_content').removeClass('active');
218    }, function() {
219        $('.menu_ver_alway_show_sub .mm_columns_ul_tab_content').addClass('active');
220    });
221
222    if ($('.clicktext_show_submenu').length <= 0)
223    {
224        $(document).on('click touchstar', '.mm_tab_li_content', function (evt) {
225            var btnObj = $(this), wrapper = $(this).next();
226            if (!btnObj.find('.mm_tab_toggle_title a').is(evt.target))
227            {
228                if(btnObj.hasClass('closed'))
229                {
230                    $('.mm_tab_li_content').removeClass('opened');
231                    $('.mm_tab_li_content').addClass('closed');
232                    $('.mm_columns_contents_ul').removeClass('active');
233                    btnObj.removeClass('closed');
234                    btnObj.addClass('opened');
235                    wrapper.stop(true,true).addClass('active');
236                } else {
237                    btnObj.removeClass('opened');
238                    btnObj.addClass('closed');
239                    wrapper.stop(true,true).removeClass('active');
240                }
241        }
242        });
243    }
244
245});
246function autoChangeStatus()
247{
248    var width_ul_menu = $('ul.mm_menus_ul').width();
249    var width_li_menu=0;
250    $('ul.mm_menus_ul li.mm_menus_li').each(function(){
251        width_li_menu += parseFloat($(this).width());
252    });
253    
254    if(width_li_menu > width_ul_menu+5)
255    {
256        $('.ets_mm_megamenu').addClass('changestatus'); 
257        $('.menu_ver_alway_show_sub .mm_columns_ul_tab_content').removeClass('active');
258        $('#index .menu_ver_alway_show_sub .arrow').removeClass('opened').addClass('closed');
259    }
260    else
261    {
262        $('.ets_mm_megamenu').removeClass('changestatus');
263        if ( $(window).width() > 767 ){
264            $('#index .menu_ver_alway_show_sub .arrow').addClass('opened').removeClass('closed');
265            $('#index .menu_ver_alway_show_sub .mm_columns_ul_tab_content').addClass('active');
266        }
267    }
268    if ( $(window).width() < 768 ){
269        $('.menu_ver_alway_show_sub .mm_columns_ul_tab_content').removeClass('active');
270        $('.menu_ver_alway_show_sub .arrow').removeClass('opened').addClass('closed');
271    }
272}
273
274function itemClickMenu($this){
275    var btnObj =  $($this).next('.arrow');
276     var wrapper =  btnObj.next();
277    if ( ! btnObj.length ){
278        var btn_temp = $($this).closest('.mm_tab_li_content').first();
279        var wrapper =  btn_temp.next();
280        if( btn_temp.hasClass('closed')){
281            $('.mm_tab_li_content').removeClass('opened');
282                    $('.mm_tab_li_content').addClass('closed');
283                    $('.mm_tab_li_content + .mm_columns_contents_ul').removeClass('active');
284            btn_temp.removeClass('closed');
285            btn_temp.addClass('opened');
286            wrapper.stop(true,true).addClass('active');
287        }else{
288            btn_temp.removeClass('opened');
289            btn_temp.addClass('closed');      
290            wrapper.stop(true,true).removeClass('active');
291        }
292    }else{
293        if(btnObj.hasClass('closed'))
294        {
295            $('.mm_has_sub > .arrow').removeClass('opened');
296            $('.mm_has_sub > .arrow').addClass('closed');      
297            $('.mm_columns_ul').removeClass('active');
298            
299            btnObj.removeClass('closed');
300            btnObj.addClass('opened');
301            wrapper.stop(true,true).addClass('active');
302        } else {
303            btnObj.removeClass('opened');
304            btnObj.addClass('closed');      
305            wrapper.stop(true,true).removeClass('active');
306        } 
307    }
308}
309function clickTextShowMenu(){
310    if ( $('.clicktext_show_submenu').length > 0 ){
311         $('.clicktext_show_submenu li.has-sub').each(function() {
312            $(this).find('a').first().on('click', function(e){
313                if ($(window).width() <= 767 ){
314                    e.preventDefault();
315                   var btnObj =  $(this).next('.arrow');
316                    var wrapper =  btnObj.next();
317                   if(btnObj.hasClass('closed'))
318                    {                        
319                        btnObj.removeClass('closed');
320                        btnObj.addClass('opened');
321                        wrapper.stop(true,true).addClass('active');
322                    } else {
323                        btnObj.removeClass('opened');
324                        btnObj.addClass('closed');      
325                        wrapper.stop(true,true).removeClass('active');
326                    } 
327               } 
328            });
329            
330        });
331        
332    }
333    if ( $('.clicktext_show_submenu').length > 0 ){
334        $('.clicktext_show_submenu li.has-sub').each(function() {
335            $(this).find('a').first().on('click', function(e){
336                if ( $('.ets_mm_megamenu').hasClass('changestatus') && $(window).width() > 767 ){
337                   e.preventDefault();
338                   var btnObj =  $(this).next('.arrow');
339                    var wrapper =  btnObj.next();
340                   if(btnObj.hasClass('closed'))
341                    {                        
342                        btnObj.removeClass('closed');
343                        btnObj.addClass('opened');
344                        wrapper.stop(true,true).addClass('active');
345                    } else {
346                        btnObj.removeClass('opened');
347                        btnObj.addClass('closed');      
348                        wrapper.stop(true,true).removeClass('active');
349                    } 
350                }
351            });
352        });
353    }
354    
355    if ( $('.clicktext_show_submenu').length > 0 ){
356         $('.clicktext_show_submenu li.mm_tabs_has_content > div').each(function() {
357            $(this).find('a').first().on('click', function(e){
358                if ($(window).width() <= 767 ){
359                    e.preventDefault();
360                    itemClickMenu(this);
361               } 
362            });
363        });
364    }
365    if ( $('.clicktext_show_submenu').length > 0 ){
366        $('.clicktext_show_submenu li.mm_tabs_has_content > div').each(function() {
367            $(this).find('a').first().on('click', function(e){
368                if ( $('.ets_mm_megamenu').hasClass('changestatus') && $(window).width() > 767 ){
369                   e.preventDefault();
370                   itemClickMenu(this);
371                }
372            });
373        });
374    }
375    if ( $('.clicktext_show_submenu').length > 0 ){
376         $('.clicktext_show_submenu li.mm_has_sub > a').each(function() {
377            $(this).on('click', function(e){
378                if ($(window).width() <= 767 ){
379                    e.preventDefault();
380                   itemClickMenu(this);
381               } 
382            });
383        });
384    }
385    if ( $('.clicktext_show_submenu').length > 0 ){
386        $('.clicktext_show_submenu li.mm_has_sub > a').each(function() {
387            $(this).on('click', function(e){
388                if ( $('.ets_mm_megamenu').hasClass('changestatus') && $(window).width() > 767 ){
389                   e.preventDefault();
390                   itemClickMenu(this);
391                }
392            });
393        });
394    }
395    if ( $('.clicktext_show_submenu').length > 0 ){
396        $('.mm_tab_has_child > .mm_tab_toggle_title').on('click', function(e){
397            if ( $(this).find('a').length <= 0 ){
398                if ( $('.ets_mm_megamenu').hasClass('changestatus') || $(window).width() > 767 ){
399                   var btnObj = $(this).parents('.mm_tab_li_content'), wrapper = $(this).parents('.mm_tab_li_content').next();
400
401                    if(btnObj.hasClass('closed'))
402                    {
403                        $('.mm_tab_li_content').removeClass('opened');
404                        $('.mm_tab_li_content').addClass('closed');
405                        $('.mm_tab_li_content + .mm_columns_contents_ul').removeClass('active');
406
407                        btnObj.removeClass('closed');
408                        btnObj.addClass('opened');
409                        wrapper.stop(true,true).addClass('active');
410                    } else {
411                        btnObj.removeClass('opened');
412                        btnObj.addClass('closed');
413                        wrapper.stop(true,true).removeClass('active');
414                    }
415                }
416            }
417        });
418    }
419}
420
421
422$(document).on('click','.ets_mm_categories .has-sub .arrow',function(e){
423        e.stopPropagation();
424        var wrapper = $(this).next('.ets_mm_categories');
425        if($(this).hasClass('closed'))
426        {
427            var btnObj = $(this); 
428            btnObj.removeClass('closed');
429            btnObj.addClass('opened');
430            wrapper.stop(true,true).addClass('active');
431        } else {
432            var btnObj = $(this); 
433            btnObj.removeClass('opened');
434            btnObj.addClass('closed');
435            wrapper.stop(true,true).removeClass('active');
436        }
437        
438});
439
440function displayHeightTab()
441{
442    if($('.mm_tabs_li.open .mm_columns_contents_ul').length)
443    {
444        $('.mm_tabs_li.open .mm_columns_contents_ul').each(function(){
445           $(this).closest('.mm_columns_ul_tab').css('height', $(this).height('px')); 
446        });
447    }
448}
449$(document).ready(function(){
450
451    var ETS_MM_ACTIVE_BG_GRAY = $('.ets_mm_megamenu').attr('data-bggray');
452    $('.ets_mm_megamenu').removeClass('bg_submenu');
453    if (typeof ETS_MM_ACTIVE_BG_GRAY !== "undefined" && ETS_MM_ACTIVE_BG_GRAY ) {
454        $('.ets_mm_megamenu .mm_menus_ul > li.mm_has_sub.hover').mouseenter(function() {
455            $('.ets_mm_megamenu').addClass('bg_submenu');
456        })
457        .mouseleave(function() {
458            $('.ets_mm_megamenu').removeClass('bg_submenu');
459        });
460    }
461    $(".mm_menus_li.click_open_submenu > a.ets_mm_url").click(function(e){
462        e.preventDefault();
463    });
464    $(".mm_menus_li.click_open_submenu").click(function(){
465        if ( $(this).hasClass('open_li') ){
466            $(".mm_menus_li").removeClass("open_li");
467            $(".mm_menus_li .mm_columns_ul").removeClass("open");
468        } else {
469            $(".mm_menus_li").removeClass("open_li");
470            $(".mm_menus_li .mm_columns_ul").removeClass("open");
471            $(this).addClass('open_li');
472            $(this).find('.mm_columns_ul').addClass('open');
473        }
474    });
475    $(document).on("click", function(event){
476        if(!$(event.target).closest(".mm_menus_li").length){
477            $('.transition_slide.click_open_submenu').find(".mm_columns_ul.open").slideUp(100);
478            $(".mm_columns_ul").removeClass("open");
479            $(".mm_menus_li").removeClass("open_li");
480        }
481    });
482    $(document).on('click','.mm_tab_li_content',function(){
483        $('.mm_tabs_li').not($(this).parent()).removeClass('open');
484        $(this).parent('.mm_tabs_li').toggleClass('open');
485    });
486    $(document).on("click", function(event){
487        if(!$(event.target).closest(".mm_tabs_li").length){
488            $(".mm_tabs_li").removeClass("open");
489            $(".mm_tabs_li.menu_ver_alway_open_first").addClass("open");
490        }
491    });
492    $(document).on('click','.ets_mm_megamenu a',function(){
493       if($(this).attr('href')=='' || $(this).attr('href')=='#')
494       {
495            return false;
496       } 
497    });
498});
499$(document).ready(function(){
500    autoChangeStatus();
501    clickTextShowMenu();
502    
503    $(window).resize(function(){
504        autoChangeStatus();
505    });
506
507    $('.mm_menus_li iframe').hover(function () {
508        $(this).parents('.mm_menus_li').addClass('menu_hover');
509    }, function () {
510        $(this).parents('.mm_menus_li').removeClass('menu_hover');
511    });
512});

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.