PageSourceSearch

https://www.tuttofarma.it/modules/yeb_responsivemenu/views/js/responsivemenu.js

js tuttofarma.it collected 2026-10-04 04:14:49 UTC 21,229 bytes, 523 lines download raw bytes

1/**
2* 2007-2021 YEB!
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 YEB! <[email protected]>
17* @copyright 2007-2021 YEB!
18* @license Valid for 1 website (or project) for each purchase of license
19* International Registered Trademark & Property of YEB!
20*/
21$(function() {
22    $(document).mouseup(function (e)
23    {
24        var container_block_search = $('.rm_extra_item.active');
25        if (!container_block_search.is(e.target)&& container_block_search.has(e.target).length === 0)
26        {
27            $('.rm_extra_item').removeClass('active');
28        }
29    });
30    
31    if($('.rm_extra_item button[type="submit"]').length)
32    {
33        $(document).on('click','.rm_extra_item button[type="submit"]',function(){
34           if(!$(this).closest('.rm_extra_item').hasClass('rm_display_search_default') )
35           {
36                if ( !$(this).closest('.rm_extra_item').hasClass('active') ){
37                    $(this).closest('.rm_extra_item').addClass('active');
38                    return false;
39                } else {
40                    if ($(this).prev('input').val() == 0){
41                        $('.rm_extra_item').removeClass('active');
42                        return false;
43                    }
44                }
45           } 
46        });
47    }
48    displayHeightTab();
49     if ($('.yeb_rm_responsivemenu.sticky_enabled').length > 0)
50     {
51        var sticky_navigation_offset_top = $('.yeb_rm_responsivemenu.sticky_enabled').offset().top;
52        var headerFloatingHeight = $('.yeb_rm_responsivemenu.sticky_enabled').height()+($('#header').length > 0 ? parseInt($('.yeb_rm_responsivemenu.sticky_enabled').css('marginTop').replace('px',''))+parseInt($('.yeb_rm_responsivemenu.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(!$('.yeb_rm_responsivemenu').hasClass('sticky_enabled'))
56                return false;
57            var scroll_top = $(window).scrollTop(); 
58            if (scroll_top > sticky_navigation_offset_top) {
59                $('.yeb_rm_responsivemenu.sticky_enabled').addClass('scroll_heading');
60                if($('#header').length > 0)
61                    $('#header').css({'marginBottom':headerFloatingHeight+'px'});
62            } else {
63                $('.yeb_rm_responsivemenu.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 ($('.yeb_mn_submenu_full_height').length > 0 ){
85        var ver_sub_height = $('.yeb_mn_submenu_full_height').height();
86        $('.yeb_mn_submenu_full_height').find('.rm_columns_ul').css("min-height",ver_sub_height);
87     }
88     });
89     
90     if ( $('.rm_columns_ul_tab_content').length > 0 && $('body#index').length >0 ){
91        $('.rm_columns_ul_tab_content').addClass('active').prev('.arrow').removeClass('closed').addClass('opened');
92    
93    }
94     
95     
96     $(window).resize(function(){
97        $('.rm_menus_ul:not(.yeb_rm_all_show_resize)').removeClass('yeb_mn_active');
98     });
99     $(document).on('click','.rm_has_sub > .arrow',function(){
100            var wrapper = $(this).next('.rm_columns_ul');
101            if($(this).hasClass('closed'))
102            {
103                $('.rm_columns_ul').removeClass('active');
104                $('.rm_has_sub > .arrow').removeClass('opened');
105                $('.rm_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.rm_menus_li').hover(function(){
122        if($(window).width() >= 768){
123            $(this).find('.rm_columns_ul').stop(true,true).slideDown(300);
124        }
125    }, function(){
126        if($(window).width() >= 768){
127            $(this).find('.rm_columns_ul').stop(true,true).slideUp(0);
128        }
129    });
130    
131    
132    //$('.ybc-menu-toggle, .ybc-menu-vertical-button').on('click',function(){
133    $('#menu-icon, .ybc-menu-toggle, .ybc-menu-vertical-button').on('click',function(){
134            var wrapper = $('.ybc-menu-toggle').next('.rm_menus_ul');
135            //var wrapper = $('.rm_menus_ul');
136            var wrapper2 = $('.ybc-menu-toggle');
137            var wrapper3 = $('#menu-icon');
138            
139            if($(this).hasClass('closed'))
140            {
141                var btnObj = $(this); 
142                btnObj.removeClass('closed');
143                btnObj.addClass('opened');
144                
145                //btnObj.text('-');
146                wrapper.stop(true,true).addClass('active');
147                wrapper2.removeClass('closed');
148                wrapper2.addClass('opened');
149                wrapper3.removeClass('closed');
150                wrapper3.addClass('opened');
151                if ( $('.transition_slide.transition_default').length != '' ){
152                    wrapper.stop(true,true).slideDown(0);
153                }
154                
155            }
156            else
157            {
158                var btnObj = $(this); 
159                btnObj.removeClass('opened');
160                btnObj.addClass('closed');
161                //btnObj.text('+');           
162                wrapper.stop(true,true).removeClass('active');
163                wrapper2.removeClass('opened');
164                wrapper2.addClass('closed');
165                wrapper3.removeClass('opened');
166                wrapper3.addClass('closed');
167                if ( $('.transition_slide.transition_default').length != '' ){
168                    wrapper.stop(true,true).slideUp(0);
169                }
170            }
171            
172    });
173    $('.close_menu').on('click',function(){
174            var wrapper2 = $('.ybc-menu-toggle');
175            var wrapper3 = $('#menu-icon');
176            $(this).parent().prev().removeClass('opened');
177            $(this).parent().prev().addClass('closed');        
178            wrapper2.removeClass('opened');
179            wrapper2.addClass('closed');
180            wrapper3.removeClass('opened');
181            wrapper3.addClass('closed');
182            $(this).parent().stop(true,true).removeClass('active');
183      
184    });
185    //Active menu
186    if($('.yeb_rm_responsivemenu').hasClass('enable_active_menu') && $('.rm_menus_ul > li').length > 0)
187    {
188        var currentUrl = window.location.href;      
189        $('.rm_menus_ul > li').each(function(){
190            if($(this).find('a[href="'+currentUrl+'"]').length > 0)
191            {
192                $(this).addClass('active');
193                return false;
194            }
195        });
196    }
197    if($('.rm_breaker').length > 0 && $('.rm_breaker').prev('li').length > 0)
198    {
199        $('.rm_breaker').prev('li').addClass('rm_before_breaker');
200    }
201    
202    $('.rm_tab_li_content').hover(function(){
203        if(!$(this).closest('.rm_tabs_li').hasClass('open'))
204        {
205            $(this).closest('.rm_columns_ul_tab').find('.rm_tabs_li').removeClass('open');
206            $(this).closest('.rm_tabs_li').addClass('open');
207            $(this).closest('.rm_columns_ul').removeClass('rm_tab_no_content');
208            if ( !$(this).next('.rm_columns_contents_ul').length ){
209                $(this).closest('.rm_columns_ul').addClass('rm_tab_no_content');
210            }
211            displayHeightTab();
212        }
213    }, function() {
214        if(!$(this).closest('.rm_tabs_li').hasClass('ver_alway_hide'))
215        {
216            $(this).closest('.rm_tabs_li').removeClass('open');
217        }
218
219    });
220
221    /*$('.rm_tab_li_content').on({
222        'mouseover': function (event) {
223            if(!$(this).closest('.rm_tabs_li').hasClass('open'))
224            {
225                $(this).closest('.rm_columns_ul_tab').find('.rm_tabs_li').removeClass('open');
226                $(this).closest('.rm_tabs_li').addClass('open');
227                $(this).closest('.rm_columns_ul').removeClass('rm_tab_no_content');
228                if ( !$(this).next('.rm_columns_contents_ul').length ){
229                    $(this).closest('.rm_columns_ul').addClass('rm_tab_no_content');
230                }
231                displayHeightTab();
232            }
233        },
234        'mouseout': function (event) {
235            var e = event.toElement || event.relatedTarget;
236            if(!$(this).closest('.rm_tabs_li').hasClass('ver_alway_hide') && (e.parentNode !== this))
237            {
238                $(this).closest('.rm_tabs_li').removeClass('open');
239            }
240        }
241    });*/
242
243    $('.rm_menus_li:not(.menu_ver_alway_show_sub )').hover(function(){
244        $('.menu_ver_alway_show_sub .rm_columns_ul_tab_content').removeClass('active');
245    }, function() {
246        $('.menu_ver_alway_show_sub .rm_columns_ul_tab_content').addClass('active');
247    });
248
249    if ($('.clicktext_show_submenu').length <= 0)
250    {
251        $(document).on('click touchstar', '.rm_tab_li_content', function (evt) {
252            var btnObj = $(this), wrapper = $(this).next();
253            if (!btnObj.find('.rm_tab_toggle_title a').is(evt.target))
254            {
255                if(btnObj.hasClass('closed'))
256                {
257                    $('.rm_tab_li_content').removeClass('opened');
258                    $('.rm_tab_li_content').addClass('closed');
259                    $('.rm_columns_contents_ul').removeClass('active');
260                    btnObj.removeClass('closed');
261                    btnObj.addClass('opened');
262                    wrapper.stop(true,true).addClass('active');
263                }
264                else
265                {
266                    btnObj.removeClass('opened');
267                    btnObj.addClass('closed');
268                    wrapper.stop(true,true).removeClass('active');
269                }
270        }
271        });
272    }
273
274});
275function autoChangeStatus()
276{
277    var width_ul_menu = $('ul.rm_menus_ul').width();
278    var width_li_menu=0;
279    $('ul.rm_menus_ul li.rm_menus_li').each(function(){
280        width_li_menu += parseFloat($(this).width());
281    });
282    
283    if(width_li_menu > width_ul_menu+5)
284    {
285        $('.yeb_rm_responsivemenu').addClass('changestatus'); 
286        $('.menu_ver_alway_show_sub .rm_columns_ul_tab_content').removeClass('active');
287        $('#index .menu_ver_alway_show_sub .arrow').removeClass('opened').addClass('closed');
288    }
289    else
290    {
291        $('.yeb_rm_responsivemenu').removeClass('changestatus');
292        if ( $(window).width() > 767 ){
293            $('#index .menu_ver_alway_show_sub .arrow').addClass('opened').removeClass('closed');
294            $('#index .menu_ver_alway_show_sub .rm_columns_ul_tab_content').addClass('active');
295        }
296    }
297    if ( $(window).width() < 768 ){
298        $('.menu_ver_alway_show_sub .rm_columns_ul_tab_content').removeClass('active');
299        $('.menu_ver_alway_show_sub .arrow').removeClass('opened').addClass('closed');
300    }
301}
302
303function itemClickMenu($this){
304    var btnObj =  $($this).next('.arrow');
305     var wrapper =  btnObj.next();
306    if ( ! btnObj.length ){
307        var btn_temp = $($this).closest('.rm_tab_li_content').first();
308        var wrapper =  btn_temp.next();
309        if( btn_temp.hasClass('closed')){
310            $('.rm_tab_li_content').removeClass('opened');
311                    $('.rm_tab_li_content').addClass('closed');
312                    $('.rm_tab_li_content + .rm_columns_contents_ul').removeClass('active');
313            btn_temp.removeClass('closed');
314            btn_temp.addClass('opened');
315            wrapper.stop(true,true).addClass('active');
316            
317                        
318        }else{
319            btn_temp.removeClass('opened');
320            btn_temp.addClass('closed');      
321            wrapper.stop(true,true).removeClass('active');
322        }
323    }else{
324        if(btnObj.hasClass('closed'))
325        {
326            $('.rm_has_sub > .arrow').removeClass('opened');
327            $('.rm_has_sub > .arrow').addClass('closed');      
328            $('.rm_columns_ul').removeClass('active');
329            
330            btnObj.removeClass('closed');
331            btnObj.addClass('opened');
332            wrapper.stop(true,true).addClass('active');
333        }
334        else
335        {
336            btnObj.removeClass('opened');
337            btnObj.addClass('closed');      
338            wrapper.stop(true,true).removeClass('active');
339        } 
340    }
341}
342function clickTextShowMenu(){
343    if ( $('.clicktext_show_submenu').length > 0 ){
344         $('.clicktext_show_submenu li.has-sub').each(function() {
345            $(this).find('a').first().on('click', function(e){
346                if ($(window).width() <= 767 ){
347                    e.preventDefault();
348                   var btnObj =  $(this).next('.arrow');
349                    var wrapper =  btnObj.next();
350                   if(btnObj.hasClass('closed'))
351                    {                        
352                        btnObj.removeClass('closed');
353                        btnObj.addClass('opened');
354                        wrapper.stop(true,true).addClass('active');
355                    }
356                    else
357                    {
358                        btnObj.removeClass('opened');
359                        btnObj.addClass('closed');      
360                        wrapper.stop(true,true).removeClass('active');
361                    } 
362               } 
363            });
364            
365        });
366        
367    }
368    if ( $('.clicktext_show_submenu').length > 0 ){
369        $('.clicktext_show_submenu li.has-sub').each(function() {
370            $(this).find('a').first().on('click', function(e){
371                
372                if ( $('.yeb_rm_responsivemenu').hasClass('changestatus') && $(window).width() > 767 ){
373                   e.preventDefault();
374                   //itemClickMenu(this);
375                   var btnObj =  $(this).next('.arrow');
376                    var wrapper =  btnObj.next();
377                   if(btnObj.hasClass('closed'))
378                    {                        
379                        btnObj.removeClass('closed');
380                        btnObj.addClass('opened');
381                        wrapper.stop(true,true).addClass('active');
382                    }
383                    else
384                    {
385                        btnObj.removeClass('opened');
386                        btnObj.addClass('closed');      
387                        wrapper.stop(true,true).removeClass('active');
388                    } 
389                }
390            });
391        });
392    }
393    
394    if ( $('.clicktext_show_submenu').length > 0 ){
395         $('.clicktext_show_submenu li.rm_tabs_has_content > div').each(function() {
396            $(this).find('a').first().on('click', function(e){
397                if ($(window).width() <= 767 ){
398                    e.preventDefault();
399                    itemClickMenu(this);
400               } 
401            });
402            
403        });
404    }
405    if ( $('.clicktext_show_submenu').length > 0 ){
406        $('.clicktext_show_submenu li.rm_tabs_has_content > div').each(function() {
407            $(this).find('a').first().on('click', function(e){
408                if ( $('.yeb_rm_responsivemenu').hasClass('changestatus') && $(window).width() > 767 ){
409                   e.preventDefault();
410                   itemClickMenu(this);
411                }
412            });
413        });
414    }
415    if ( $('.clicktext_show_submenu').length > 0 ){
416         $('.clicktext_show_submenu li.rm_has_sub > a').each(function() {
417            $(this).on('click', function(e){
418                if ($(window).width() <= 767 ){
419                    e.preventDefault();
420                   itemClickMenu(this);
421               } 
422            });
423            
424        });
425        
426    }
427    if ( $('.clicktext_show_submenu').length > 0 ){
428        $('.clicktext_show_submenu li.rm_has_sub > a').each(function() {
429            $(this).on('click', function(e){
430                if ( $('.yeb_rm_responsivemenu').hasClass('changestatus') && $(window).width() > 767 ){
431                   e.preventDefault();
432                   itemClickMenu(this);
433                }
434            });
435        });
436    }
437    if ( $('.clicktext_show_submenu').length > 0 ){
438        $('.rm_tab_has_child > .rm_tab_toggle_title').on('click', function(e){
439            if ( $(this).find('a').length <= 0 ){
440                if ( $('.yeb_rm_responsivemenu').hasClass('changestatus') || $(window).width() > 767 ){
441                   var btnObj = $(this).parents('.rm_tab_li_content'), wrapper = $(this).parents('.rm_tab_li_content').next();
442
443                    if(btnObj.hasClass('closed'))
444                    {
445                        $('.rm_tab_li_content').removeClass('opened');
446                        $('.rm_tab_li_content').addClass('closed');
447                        $('.rm_tab_li_content + .rm_columns_contents_ul').removeClass('active');
448
449                        btnObj.removeClass('closed');
450                        btnObj.addClass('opened');
451                        wrapper.stop(true,true).addClass('active');
452                    }
453                    else
454                    {
455                        btnObj.removeClass('opened');
456                        btnObj.addClass('closed');
457                        wrapper.stop(true,true).removeClass('active');
458                    }
459                }
460            }
461        });
462    }
463}
464
465
466$(document).on('click','.yeb_rm_categories .has-sub .arrow',function(e){
467        e.stopPropagation();
468        var wrapper = $(this).next('.yeb_rm_categories');
469        if($(this).hasClass('closed'))
470        {
471            var btnObj = $(this); 
472            btnObj.removeClass('closed');
473            btnObj.addClass('opened');
474            wrapper.stop(true,true).addClass('active');
475        }
476        else
477        {
478            var btnObj = $(this); 
479            btnObj.removeClass('opened');
480            btnObj.addClass('closed');
481            //btnObj.text('+');           
482            wrapper.stop(true,true).removeClass('active');
483        }
484        
485});
486
487function displayHeightTab()
488{
489    if($('.rm_tabs_li.open .rm_columns_contents_ul').length)
490    {
491        $('.rm_tabs_li.open .rm_columns_contents_ul').each(function(){
492           $(this).closest('.rm_columns_ul_tab').css('height', $(this).height('px')); 
493        });
494    }
495}
496$(document).ready(function(){
497
498    var YEB_RM_ACTIVE_BG_GRAY = $('.yeb_rm_responsivemenu').attr('data-bggray');
499    $('.yeb_rm_responsivemenu').removeClass('bg_submenu');
500    if (typeof YEB_RM_ACTIVE_BG_GRAY !== "undefined" && YEB_RM_ACTIVE_BG_GRAY ) {
501        $('.yeb_rm_responsivemenu .rm_menus_ul > li.rm_has_sub').mouseenter(function() {
502            $('.yeb_rm_responsivemenu').addClass('bg_submenu');
503        })
504        .mouseleave(function() {
505            $('.yeb_rm_responsivemenu').removeClass('bg_submenu');
506        });
507    }
508
509});
510$(document).ready(function(){
511    autoChangeStatus();
512    clickTextShowMenu();
513    
514    $(window).resize(function(){
515        autoChangeStatus();
516    });
517
518    $('.rm_menus_li iframe').hover(function () {
519        $(this).parents('.rm_menus_li').addClass('menu_hover');
520    }, function () {
521        $(this).parents('.rm_menus_li').removeClass('menu_hover');
522    });
523});

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.