PageSourceSearch

https://www.imilani.com/modules/ets_megamenu/views/js/megamenu.js

js imilani.com collected 2026-10-07 00:09:22 UTC 20,175 bytes, 502 lines download raw bytes

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

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.