PageSourceSearch

https://hpmedical.com.bo/modules/ets_prettymenu/views/js/megamenu.js

js hpmedical.com.bo collected 2026-10-08 20:05:11 UTC 23,083 bytes, 546 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*/
19var ets_prmn_top_menu =0;
20$(function() {
21    $(document).mouseup(function (e)
22    {
23        var container_block_search = $('.prmn_extra_item.active');
24        if (!container_block_search.is(e.target)&& container_block_search.has(e.target).length === 0)
25        {
26            $('.prmn_extra_item').removeClass('active');
27        }
28    });
29    $(document).on('mouseenter touchend','.prmn_menus_li',function(e){
30        var posP = $(this).position().top + $(this).outerHeight();
31        $(this).find('.prmn_columns_ul').css('top',posP);
32    });
33    if($('.prmn_extra_item button[type="submit"], .prmn_extra_item #search_widget').length)
34    {
35        $(document).on('click','.prmn_extra_item #search_widget',function(){
36           if(!$(this).closest('.prmn_extra_item').hasClass('prmn_display_search_default') )
37           {
38                if ( !$(this).closest('.prmn_extra_item').hasClass('active') ){
39                    $(this).closest('.prmn_extra_item').addClass('active');
40                    if($(this).prev('input').length)
41                    {
42                        $(this).prev('input').focus();
43                    }
44                    else
45                    {
46                        $(this).find('input[type="text"]').focus();
47                    }
48                    return false;
49                } else {
50                    if($(this).prev('input').length)
51                    {
52                        if ($(this).prev('input').val() == 0){
53                            $('.prmn_extra_item').removeClass('active');
54                            return false;
55                        }
56                    }
57                }
58           } 
59        });
60    }
61    displayHeightTab();
62     if ($('.ets_prmn_megamenu.sticky_enabled').length > 0)
63     {
64        var sticky_navigation_offset_top = $('.ets_prmn_megamenu.sticky_enabled').offset().top;
65        var headerFloatingHeight = $('.ets_prmn_megamenu.sticky_enabled').height()+($('#header').length > 0 ? parseInt($('.ets_prmn_megamenu.sticky_enabled').css('marginTop').replace('px',''))+parseInt($('.ets_prmn_megamenu.sticky_enabled').css('marginBottom').replace('px','')) : 0);
66        var oldHeaderMarginBottom = $('#header').length > 0 ? parseInt($('#header').css('marginBottom').replace('px','')) : 0;
67        var sticky_navigation = function(){
68            if(!$('.ets_prmn_megamenu').hasClass('sticky_enabled'))
69                return false;
70            var scroll_top = $(window).scrollTop(); 
71            if (scroll_top > sticky_navigation_offset_top) {
72                $('.ets_prmn_megamenu.sticky_enabled').addClass('scroll_heading');
73                if($('#header').length > 0)
74                    $('#header').css({'marginBottom':headerFloatingHeight+'px'});
75            } else {
76                $('.ets_prmn_megamenu.sticky_enabled').removeClass('scroll_heading');
77                if($('#header').length > 0)
78                    $('#header').css({'marginBottom':oldHeaderMarginBottom+'px'});
79            } 
80        };
81        sticky_navigation();
82        $(window).scroll(function() {
83             sticky_navigation();
84        });
85        if($(window).width() < 768 && !$('body').hasClass('disable-sticky'))
86                    $('body').addClass('disable-sticky');
87        $(window).on('resize',function(e){
88            if($(window).width() < 768 && !$('body').hasClass('disable-sticky'))
89                $('body').addClass('disable-sticky');
90            else
91                if($(window).width() >= 768 && $('body').hasClass('disable-sticky'))
92                    $('body').removeClass('disable-sticky');
93         });
94     }
95     
96     $(window).on('load',function(){
97        if ($('.ets_mn_submenu_full_height').length > 0 ){
98            var ver_sub_height = $('.ets_mn_submenu_full_height').height();
99            $('.ets_mn_submenu_full_height').find('.prmn_columns_ul').css("min-height",ver_sub_height);
100         }
101     });
102     
103     if ( $('.prmn_columns_ul_tab_content').length > 0 && $('body#index').length >0 ){
104        $('.prmn_columns_ul_tab_content').addClass('active').prev('.arrow').removeClass('closed').addClass('opened');
105     }
106
107     $(window).on('resize',function(){
108        $('.prmn_menus_ul:not(.ets_prmn_all_show_resize)').removeClass('ets_mn_active');
109     });
110     $(document).on('click','.prmn_has_sub > .arrow',function(){
111        var wrapper = $(this).next('.prmn_columns_ul');
112        if($(this).hasClass('closed'))
113        {
114            $('.prmn_columns_ul').removeClass('active');
115            $('.prmn_has_sub').removeClass('open_c');
116            $('.prmn_has_sub > .arrow').removeClass('opened');
117            $('.prmn_has_sub > .arrow').addClass('closed');
118            var btnObj = $(this);
119            btnObj.removeClass('closed');
120            btnObj.addClass('opened').parents('.prmn_has_sub').addClass('open_c');
121            wrapper.stop(true,true).addClass('active');
122        }
123        else
124        {
125            var btnObj = $(this);
126            btnObj.removeClass('opened')
127            $('.prmn_has_sub').removeClass('open_c');
128            btnObj.addClass('closed');
129            wrapper.stop(true,true).removeClass('active').parents('.prmn_menus_li.prmn_has_sub').removeClass('open_c');
130        }
131    }); 
132
133
134    $('.ybc-menu-toggle, .ybc-menu-vertical-button').on('click',function(){
135            var wrapper = $(this).next('.prmn_menus_ul');
136            if($(this).hasClass('closed'))
137            {
138                var btnObj = $(this); 
139                btnObj.removeClass('closed');
140                btnObj.addClass('opened');
141                wrapper.stop(true,true).addClass('active');
142                if ( $('.transition_slide.transition_default').length != '' ){
143                    wrapper.stop(true,true).slideDown(0);
144                }
145            }
146            else
147            {
148                var btnObj = $(this); 
149                btnObj.removeClass('opened');
150                btnObj.addClass('closed');
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_prmn_megamenu').hasClass('enable_active_menu') && $('.prmn_menus_ul > li').length > 0)
166    {
167        var currentUrl = window.location.href;      
168        $('.prmn_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($('.prmn_breaker').length > 0 && $('.prmn_breaker').prev('li').length > 0)
177    {
178        $('.prmn_breaker').prev('li').addClass('prmn_before_breaker');
179    }
180    $('.prmn_tabs_li.hover').on('mouseenter',function(){
181        if(!$(this).hasClass('open')){
182            $(this).closest('.prmn_columns_ul_tab').find('.prmn_tabs_li').removeClass('open');
183            $(this).addClass('open');
184            $(this).closest('.prmn_columns_ul').removeClass('prmn_tab_no_content');
185            if ( !$(this).find('.prmn_columns_contents_ul').length ){
186                $(this).closest('.prmn_columns_ul').addClass('prmn_tab_no_content');
187            }
188            displayHeightTab();
189        }
190    });
191    $('.prmn_tabs_li.hover').on('mouseleave',function(){
192        if(!$(this).closest('.prmn_tabs_li').hasClass('ver_alway_hide')){
193            $(this).closest('.prmn_tabs_li').removeClass('open');
194        }
195        if($(this).closest('.prmn_columns_ul_tab').find('.prmn_tabs_li.open_first').length)
196            $(this).closest('.prmn_columns_ul_tab').find('.prmn_tabs_li.open_first').addClass('open');
197    });
198    $('.prmn_tabs_li').on('mouseenter',function(){
199        if( $(this).parents('.prmn_columns_ul').find('.prmn_tabs_li.open_first').length > 0 ){
200            $('.prmn_tabs_li.open_first').removeClass('open');
201        }
202    });
203    $('.prmn_tabs_li').on('mouseleave', function() {
204        $('.prmn_tabs_li.open_first').addClass('open');
205    });
206    $('.prmn_menus_li:not(.menu_ver_alway_show_sub )').on('mouseenter',function(){
207        $('.menu_ver_alway_show_sub .prmn_columns_ul_tab_content').removeClass('active');
208    });
209    $('.prmn_menus_li:not(.menu_ver_alway_show_sub )').on('mouseleave', function() {
210        $('.menu_ver_alway_show_sub .prmn_columns_ul_tab_content').addClass('active');
211    });
212
213    $(document).on('click touchstar', '.prmn_tab_li_content .toggle_arrow', function (evt) {
214        var btnObj = $(this).parents('.prmn_tab_li_content'),
215            wrapper = $(this).parents('.prmn_tab_li_content').next();
216        if (!btnObj.find('.prmn_tab_toggle_title a').is(evt.target)) {
217            if (btnObj.hasClass('closed')) {
218                $('.prmn_tab_li_content').removeClass('opened');
219                $('.prmn_tab_li_content').addClass('closed');
220                $('.prmn_columns_contents_ul').removeClass('active');
221                btnObj.removeClass('closed');
222                btnObj.addClass('opened');
223                wrapper.stop(true, true).addClass('active');
224            } else {
225                btnObj.removeClass('opened');
226                btnObj.addClass('closed');
227                wrapper.stop(true, true).removeClass('active');
228            }
229        }
230    });
231    $(document).on('mouseenter touchend', '.prmn_menus_li.prmn_has_sub', function () {
232        displayWidthSettings();
233    });
234    ets_prmn_top_menu = $('.ets_prmn_megamenu').length ? $('.ets_prmn_megamenu').offset().top: 10;
235    $(document).scroll(function(){
236        stickyMenu();
237    });
238});
239function stickyMenu(){
240    if($('.ets_prmn_megamenu').hasClass('prmn_enabled_sticky'))
241    {
242        if($(document).scrollTop() >= ets_prmn_top_menu)
243            $('.ets_prmn_megamenu').addClass('stickied');
244        else
245            $('.ets_prmn_megamenu').removeClass('stickied');
246    }
247}
248
249function displayWidthSettings(){
250    if ( $(window).width() >= 1200 ){
251        var pos_left = $('.ets_prmn_megamenu').offset().left;
252        var mainmenu_w = $('.ets_prmn_megamenu').width();
253        var menu_w = $('.prmn_menus_li > .prmn_columns_ul').width();
254        var window_w = $(window).width();
255
256        if ( ( window_w - menu_w )/2 > pos_left ){
257            var change_left = ( window_w - menu_w )/2 - pos_left ;
258        } else {
259            var change_left = pos_left - (window_w - menu_w)/2 ;
260        }
261        if ( (pos_left + mainmenu_w) > (pos_left + menu_w)){
262            var change_left_2 = change_left - ( (pos_left + mainmenu_w) - (pos_left + menu_w) );
263        } else {
264            if ( (pos_left + menu_w) > window_w ) {
265                if ( (pos_left + menu_w) - (pos_left + mainmenu_w) > change_left){
266                    var change_left_2 = change_left ;
267                } else {
268                    var change_left_2 = (pos_left + menu_w) - (pos_left + mainmenu_w);
269                }
270
271            } else {
272                if ( change_left > pos_left){
273                    var change_left_2 = pos_left - 15 ;
274                } else {
275                    var change_left_2 = change_left ;
276                }
277            }
278        }
279        $('.ets_prmn_megamenu:not(.stickied) .prmn_menus_li.prmn_sub_align_auto > .prmn_columns_ul,.ets_megamenu:not(.sticky_fixed) .prmn_sub_align_auto > .list-tabs').css('margin-left','-'+change_left_2+'px');
280    } else {
281        $('.ets_prmn_megamenu:not(.stickied) .prmn_menus_li.prmn_sub_align_auto > .prmn_columns_ul,.ets_megamenu:not(.sticky_fixed) .prmn_sub_align_auto > .list-tabs').css('margin-left','auto');
282    }
283}
284
285function autoChangeStatus()
286{
287    var width_ul_menu = $('ul.prmn_menus_ul').width();
288    var width_li_menu=0;
289    $('ul.prmn_menus_ul li.prmn_menus_li').each(function(){
290        width_li_menu += parseFloat($(this).width());
291    });
292    
293    if(width_li_menu > width_ul_menu+5)
294    {
295        $('.ets_prmn_megamenu').addClass('changestatus'); 
296        $('.menu_ver_alway_show_sub .prmn_columns_ul_tab_content').removeClass('active');
297        $('#index .menu_ver_alway_show_sub .arrow').removeClass('opened').addClass('closed');
298    }
299    else
300    {
301        $('.ets_prmn_megamenu').removeClass('changestatus');
302        if ( $(window).width() > 767 ){
303            $('#index .menu_ver_alway_show_sub .arrow').addClass('opened').removeClass('closed');
304            $('#index .menu_ver_alway_show_sub .prmn_columns_ul_tab_content').addClass('active');
305        }
306    }
307    if ( $(window).width() < 768 ){
308        $('.menu_ver_alway_show_sub .prmn_columns_ul_tab_content').removeClass('active');
309        $('.menu_ver_alway_show_sub .arrow').removeClass('opened').addClass('closed');
310    }
311}
312
313function itemClickMenu($this){
314    var btnObj =  $($this).next('.arrow');
315     var wrapper =  btnObj.next();
316    if ( ! btnObj.length ){
317        var btn_temp = $($this).closest('.prmn_tab_li_content').first();
318        var wrapper =  btn_temp.next();
319        if( btn_temp.hasClass('closed')){
320            $('.prmn_tab_li_content').removeClass('opened');
321                    $('.prmn_tab_li_content').addClass('closed');
322                    $('.prmn_tab_li_content + .prmn_columns_contents_ul').removeClass('active');
323            btn_temp.removeClass('closed');
324            btn_temp.addClass('opened');
325            wrapper.stop(true,true).addClass('active');
326        }else{
327            btn_temp.removeClass('opened');
328            btn_temp.addClass('closed');      
329            wrapper.stop(true,true).removeClass('active');
330        }
331    }else{
332        if(btnObj.hasClass('closed'))
333        {
334            $('.prmn_has_sub > .arrow').removeClass('opened');
335            $('.prmn_has_sub > .arrow').addClass('closed');      
336            $('.prmn_columns_ul').removeClass('active');
337            
338            btnObj.removeClass('closed');
339            btnObj.addClass('opened');
340            wrapper.stop(true,true).addClass('active');
341        }
342        else
343        {
344            btnObj.removeClass('opened');
345            btnObj.addClass('closed');      
346            wrapper.stop(true,true).removeClass('active');
347        } 
348    }
349}
350function clickTextShowMenu(){
351    if ( $('.clicktext_show_submenu').length > 0 ){
352         $('.clicktext_show_submenu li.has-sub').each(function() {
353            $(this).find('a').first().on('click', function(e){
354                if ($(window).width() <= 767 ){
355                    e.preventDefault();
356                   var btnObj =  $(this).next('.arrow');
357                    var wrapper =  btnObj.next();
358                   if(btnObj.hasClass('closed'))
359                    {                        
360                        btnObj.removeClass('closed');
361                        btnObj.addClass('opened');
362                        wrapper.stop(true,true).addClass('active');
363                    }
364                    else
365                    {
366                        btnObj.removeClass('opened');
367                        btnObj.addClass('closed');      
368                        wrapper.stop(true,true).removeClass('active');
369                    } 
370               } 
371            });
372            
373        });
374        
375    }
376    if ( $('.clicktext_show_submenu').length > 0 ){
377        $('.clicktext_show_submenu li.has-sub').each(function() {
378            $(this).find('a').first().on('click', function(e){
379                
380                if ( $('.ets_prmn_megamenu').hasClass('changestatus') && $(window).width() > 767 ){
381                   e.preventDefault();
382                   var btnObj =  $(this).next('.arrow');
383                    var wrapper =  btnObj.next();
384                   if(btnObj.hasClass('closed'))
385                    {                        
386                        btnObj.removeClass('closed');
387                        btnObj.addClass('opened');
388                        wrapper.stop(true,true).addClass('active');
389                    }
390                    else
391                    {
392                        btnObj.removeClass('opened');
393                        btnObj.addClass('closed');      
394                        wrapper.stop(true,true).removeClass('active');
395                    } 
396                }
397            });
398        });
399    }
400    
401    if ( $('.clicktext_show_submenu').length > 0 ){
402         $('.clicktext_show_submenu li.prmn_tabs_has_content > div').each(function() {
403            $(this).find('a').first().on('click', function(e){
404                if ($(window).width() <= 767 ){
405                    e.preventDefault();
406                    itemClickMenu(this);
407               } 
408            });
409            
410        });
411    }
412    if ( $('.clicktext_show_submenu').length > 0 ){
413        $('.clicktext_show_submenu li.prmn_tabs_has_content > div').each(function() {
414            $(this).find('a').first().on('click', function(e){
415                if ( $('.ets_prmn_megamenu').hasClass('changestatus') && $(window).width() > 767 ){
416                   e.preventDefault();
417                   itemClickMenu(this);
418                }
419            });
420        });
421    }
422    if ( $('.clicktext_show_submenu').length > 0 ){
423         $('.clicktext_show_submenu li.prmn_has_sub > a').each(function() {
424            $(this).on('click', function(e){
425                if ($(window).width() <= 767 ){
426                    e.preventDefault();
427                   itemClickMenu(this);
428               } 
429            });
430            
431        });
432        
433    }
434    if ( $('.clicktext_show_submenu').length > 0 ){
435        $('.clicktext_show_submenu li.prmn_has_sub > a').each(function() {
436            $(this).on('click', function(e){
437                if ( $('.ets_prmn_megamenu').hasClass('changestatus') && $(window).width() > 767 ){
438                   e.preventDefault();
439                   itemClickMenu(this);
440                }
441            });
442        });
443    }
444    if ( $('.clicktext_show_submenu').length > 0 ){
445        $('.prmn_tab_has_child > .prmn_tab_toggle_title').on('click', function(e){
446            if ( $(this).find('a').length <= 0 ){
447                if ( $('.ets_prmn_megamenu').hasClass('changestatus') || $(window).width() > 767 ){
448                   var btnObj = $(this).parents('.prmn_tab_li_content'), wrapper = $(this).parents('.prmn_tab_li_content').next();
449                    if(btnObj.hasClass('closed'))
450                    {
451                        $('.prmn_tab_li_content').removeClass('opened');
452                        $('.prmn_tab_li_content').addClass('closed');
453                        $('.prmn_tab_li_content + .prmn_columns_contents_ul').removeClass('active');
454                        btnObj.removeClass('closed');
455                        btnObj.addClass('opened');
456                        wrapper.stop(true,true).addClass('active');
457                    }
458                    else
459                    {
460                        btnObj.removeClass('opened');
461                        btnObj.addClass('closed');
462                        wrapper.stop(true,true).removeClass('active');
463                    }
464                }
465            }
466        });
467    }
468}
469
470
471$(document).on('click','.ets_prmn_categories .has-sub .arrow',function(e){
472        e.stopPropagation();
473        var wrapper = $(this).next('.ets_prmn_categories');
474        if($(this).hasClass('closed'))
475        {
476            var btnObj = $(this); 
477            btnObj.removeClass('closed');
478            btnObj.addClass('opened');
479            wrapper.stop(true,true).addClass('active');
480        }
481        else
482        {
483            var btnObj = $(this); 
484            btnObj.removeClass('opened');
485            btnObj.addClass('closed');
486            wrapper.stop(true,true).removeClass('active');
487        }
488        
489});
490
491function displayHeightTab()
492{
493    if($('.prmn_tabs_li.open .prmn_columns_contents_ul').length)
494    {
495        $('.prmn_tabs_li.open .prmn_columns_contents_ul').each(function(){
496           $(this).closest('.prmn_columns_ul_tab').css('height', $(this).height('px')); 
497        });
498    }
499}
500$(document).ready(function(){
501    autoChangeStatus();
502    clickTextShowMenu();
503    
504    $(window).on('resize',function(){
505        autoChangeStatus();
506    });
507
508    $('.prmn_menus_li iframe').on('mouseenter',function () {
509        $(this).parents('.prmn_menus_li').addClass('menu_hover');
510    });
511    $('.prmn_menus_li iframe').on('mouseleave', function () {
512        $(this).parents('.prmn_menus_li').removeClass('menu_hover');
513    });
514
515    $(".prmn_menus_li.prmn_has_sub.click_open_submenu > a").on('click',function(e){
516        e.preventDefault();
517        if(!$(this).parent().find(".prmn_columns_ul").hasClass('open'))
518        {
519            $(".prmn_columns_ul").removeClass("open");
520            $(".prmn_menus_li.click_open_submenu").removeClass('open');
521            $(this).parent().find(".prmn_columns_ul").addClass("open");
522            $(this).parent().addClass("open");
523        } else {
524            $(".prmn_columns_ul").removeClass("open");
525            $(".prmn_menus_li.click_open_submenu").removeClass('open');
526        }
527    });
528    $(document).on("click", function(event){
529        if(!$(event.target).closest(".prmn_menus_li").length){
530            $(".prmn_columns_ul").removeClass("open");
531            $(".prmn_menus_li.click_open_submenu").removeClass('open');
532        }
533    });
534    $(document).on("click", function(event){
535        if(!$(event.target).closest(".prmn_tabs_li").length){
536            $(".prmn_tabs_li").removeClass("open");
537            $(".prmn_tabs_li.open_first").addClass('open');
538        }
539    });
540    $(document).on('click','.ets_prmn_megamenu a',function(){
541       if($(this).attr('href')=='' || $(this).attr('href')=='#')
542       {
543            return false;
544       } 
545    });
546});

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.