PageSourceSearch

https://www.pandemiadigital.net/wp-content/themes/merimag/assets/js/scripts.js?ver=6.2.6

js pandemiadigital.net collected 2026-10-02 10:27:57 UTC 15,875 bytes, 405 lines download raw bytes

1/* SHARE */
2(function($) {
3  $(document).ready( function() {
4    $(document).on('click', '.merimag-share-item.more', function() {
5      $(this).parent('.merimag-inline-sharing').toggleClass('collapsed-sharing');
6      if( $(this).parent('.merimag-inline-sharing').hasClass('prio') === true ) {
7        $(this).addClass('parenthasprio');
8      }
9      if( $(this).hasClass('parenthasprio') === true ) {
10        $(this).parent('.merimag-inline-sharing').toggleClass('prio');
11      }
12      return false;
13    });
14  });
15})(jQuery);
16
17/* SCRIPTS */
18(function($) {
19  merimag_options_UI = {
20
21    sidebars: [],
22    init: function() {
23     
24      var in_customizer = false;
25      // check for wp.customize return boolean
26      if ( typeof wp !== 'undefined' ) {
27          in_customizer =  typeof wp.customize !== 'undefined' ? true : false;
28      }
29      this.init_elements();
30      this.woocommerce();
31      this.back_to_top();
32    },
33    load_styles: function() {
34      var styles = merimag_theme.styles;
35      for(var i in styles) {
36        $('body').append('<link rel="stylesheet" href="'  +  styles[i] + '" lazyload>');
37      }
38    },
39
40    back_to_top: function() {
41      $(document).ready(function() {
42        show_back_to_top();
43      })
44      $(window).scroll(function() {
45        show_back_to_top();
46      })
47      $(document).on('click', '.merimag-back-to-top', function() {
48        document.body.scrollTop = 0;
49      });
50      function show_back_to_top() {
51        if (document.body.scrollTop > 50 || document.documentElement.scrollTop > 50) {
52          $('.merimag-back-to-top').fadeIn();
53        } else {
54          $('.merimag-back-to-top').fadeOut();
55        }
56      }
57    },
58
59    load_images: function( elem ) {
60      $(elem).find('[data-src]').each( function() {
61        var image = $(this).data('src');
62        $(this).css('background-image', image );
63      })
64    },
65    woocommerce: function() {
66      $.initialize('.products', function() {
67        $(this).find('.woocommerce-LoopProduct-link').matchHeight();
68      });
69      $(document).ready(function() {
70        $('.woocommerce-tabs').tabs( {
71          beforeActivate: function(event, ui) {
72            $(ui.oldTab).css('background', 'transparent');
73            var background = merimag_options_UI.get_bgcolor( $(ui.newPanel) );
74            $(ui.newTab).css('background',background );
75          },
76          create: function(event, ui ) {
77            var background = merimag_options_UI.get_bgcolor( $(ui.panel) );
78            $(ui.tab).css('background',background );
79          }
80        });
81      })
82      
83      $.initialize('.flex-control-thumbs', function() {
84          $(this).slick({
85            slidesToShow: 4,
86            slidesToScroll: 1,
87            focusOnSelect: true,
88            arrows: true,
89            infinite: false,
90          });
91          $(this).on('beforeChange', function(e, slick, currentSlide, nextSlide) {
92            var elm = $(this).find('.slick-slide[data-slick-index="' + nextSlide + '"]');
93            $(elm).find('img').trigger('click');
94          });
95      });
96      $(document).on('click', '.merimag-promo-bar-close', function() {
97          $(this).parents('.merimag-promo-bar').slideUp();
98          return false;
99      });
100     
101      $(document).on('added_to_cart removed_from_cart updated_cart_totals updated_wc_div ', function() {
102        var elm = $('.merimag-cart-count');
103        $.ajax({
104          type: 'POST',
105          url: merimag_theme.ajax,
106          data:{ nonce: merimag_theme.nonce, action: 'merimag_get_cart_count' },
107          success: function(data) {
108            var count = parseInt(data);
109            $(elm).text(count);
110          },
111
112        });
113      });
114      
115    },
116    get_bgcolor: function(obj) {
117        var real = obj.css('background-color');
118        var t = real.split('(');
119        if ( t[0] === 'rgba') {
120            return obj.parents().filter(function() {
121               var bg = $(this).css('background-color');
122                var h = bg.split('(');
123                return h[0] !== 'rgba'
124            }).first().css('background-color');
125        } else {
126            return real
127        }
128    },
129
130    get_offset: function() {
131      if( $('body').hasClass('logged-in') === true ) {
132        var fixed = $('#wpadminbar').css('position');
133        return fixed === 'fixed' ? $('#wpadminbar').outerHeight() : 0;
134      }
135      return 0;
136    },
137    init_elements: function() {
138      $.initialize('.comment-reply-title', function() {
139        var elem = $(this);
140        $(this).find('.block-title small').appendTo($(elem));
141      });
142      $.initialize('#merimag-toc', function() {
143          $(this).toc({content: ".merimag-article-content", headings: "h2:not(.block-infos-title),h3:not(.block-infos-title),h4:not(.block-infos-title),h5:not(.block-infos-title),h6:not(.block-infos-title)"});
144      });
145
146      $(document).on('click', '.merimag-toc-toggle', function() {
147          $('#merimag-toc').slideToggle();
148          return false;
149      });
150      function isAnyPartOfElementInViewport(el) {
151
152          const rect = el.getBoundingClientRect();
153          // DOMRect { x: 8, y: 8, width: 100, height: 100, top: 8, right: 108, bottom: 108, left: 8 }
154          const windowHeight = (window.innerHeight || document.documentElement.clientHeight);
155          const windowWidth = (window.innerWidth || document.documentElement.clientWidth);
156
157          // http://stackoverflow.com/questions/325933/determine-whether-two-date-ranges-overlap
158          const vertInView = ((rect.top  + (rect.height/5)) <= windowHeight ) && ((rect.top + rect.height) >= 0);
159          const horInView = (rect.left <= windowWidth) && ((rect.left + rect.width) >= 0);
160
161          return (vertInView && horInView);
162      }
163
164      $(window).scroll(function() {
165        if($('.merimag-article-content').length > 0 ) {
166          var isInView = isAnyPartOfElementInViewport($('.merimag-article-content')[0]);
167          if( isInView ) {
168            $('.merimag-toc-container').show();
169          } else {
170            $('.merimag-toc-container').hide();
171          }
172        }
173      })
174      $("body").one("inview", '.merimag-article-content', function(event, isInView) {
175        if( isInView ) {
176          $('.merimag-toc-container').show();
177        } else {
178          $('.merimag-toc-container').hide();
179        }
180      });
181      $.initialize('.merimag-sidebar', function() {
182        var id = $(this).attr('id');
183        $('.merimag-sidebar').appendTo('body');
184        $(this).children('merimag-sidebar-content').append('')
185        $('body').append('<div data-id="' +  id + '" class="merimag-sidebar-content"></div>');
186         $('.merimag-sidebar-content[data-id="' + id + '"]').append($(this).html());
187         $(this).html('');
188        $('.merimag-sidebar-content[data-id="' + id + '"]').appendTo( $(this));
189        var elm = $(this);
190        var position = $(this).data('position') && $(this).data('position') === 'right' ? $(this).data('position') : 'left';
191        if( $('body').hasClass('rtl') === true ) {
192          position = position === 'right' ? 'left' : 'right';
193        }
194        merimag_options_UI.sidebars[id] = $('#' + id).slideReveal({
195          trigger: $('.merimag-sidebar-opener[data-id=' + id + ']'),
196          position: position,
197          overlay: true,
198          width:400,
199          push: false,
200          zIndex:999999,
201          show: function() {
202            $(elm).show();
203          }
204        });
205        $(this).mCustomScrollbar({
206          theme:"dark"
207        });
208        
209      });
210      $(document).on('click', '.merimag-sidebar-opener', function() {
211        return false;
212      })
213      $(document).on('click', '.merimag-sidebar-close', function() {
214        var id = $(this).data('id');
215        merimag_options_UI.sidebars[id].slideReveal("hide");
216        return false;
217      })
218
219      
220
221      var window_width = $(window).width();
222      $(document).on('click', '.widget_nav_menu li.menu-item-has-children > a', function() {
223        $(this).parent().children('.sub-menu').slideToggle();
224        $(this).parent().toggleClass('sub-menu-opened');
225        return false;
226      });
227      $(document).on('click', '.merimag-mobile-sidebar-menu li.menu-item-has-children > a', function() {
228        $(this).parent().children('.sub-menu, .mega-menu').slideToggle();
229        $(this).parent().toggleClass('sub-menu-opened');
230        return false;
231      });
232     
233      // sticky sidebar
234      sticky_sidebar();
235      function sticky_sidebar() {
236          var bottomSpacing = parseInt( $('html').css('margin-top') ) + 30;
237      }
238      $(window).resize(function() {
239        $('.merimag-mobile-menu-sidebar').removeClass('reveal');
240        $('body').removeClass('hidden-overflow');
241        $('.merimag-mobile-search-form').hide();
242        $('.merimag-mobile-menu-search').find('i').removeClass('icofont-close-line');
243        $('.merimag-mobile-menu-search').find('i').addClass('fa fa-search ');
244      });
245      // sticky header
246      $(document).ready(function() {
247        if( $('body').hasClass('merimag-sticky-header-desktop') === true ) {
248          var position = $(window).scrollTop();
249          var header_container_position = $('.merimag-site-header').outerHeight();
250          $(window).resize(function(event) {
251            event.stopPropagation();
252            hide_sticky_header();
253          });
254          $(window).scroll(function(event) {
255             event.stopPropagation();
256              var scroll = $(window).scrollTop();
257              if( scroll <= position && scroll >= header_container_position ) {
258                  show_sticky_header();
259              } else {
260                  hide_sticky_header();
261              }
262              position = scroll;
263          });
264          function hide_sticky_header() {
265            $('.merimag-sticky-header').removeClass('animated slideInDown faster').addClass('animated slideOutUp faster');
266            $('.sticky-header-menu').children().appendTo('.main-menu-dynamic');
267          }
268          function show_sticky_header() {
269            $('.main-menu-dynamic').children().appendTo('.sticky-header-menu');
270            $('.merimag-sticky-header').css('top', merimag_options_UI.get_offset()).removeClass('animated slideOutUp faster').addClass('animated slideInDown faster').show();
271          }
272        }
273      })
274
275      $(document).ready(function(){
276        var direction = $('body').hasClass('rtl') === true ? 'right' : 'left';
277        $.initialize('.merimag-footer-tags-inline .merimag-footer-tags-list ', function() {
278          var width = $(this).outerWidth();
279          $(this).marquee({
280              duration: width * 50,
281              delayBeforeStart: 2000,
282              startVisible: true,
283              duplicated: true,
284              gap: 0,
285              pauseOnHover:true,
286              direction: direction,
287          });
288        })
289        
290      });
291      $(window).load(function() {
292        $.initialize( '[data-video-background]', function() {
293          var video_id = $(this).data('video-background');
294          $(this).YTPlayer({
295              fitToBackground: true,
296              videoId: video_id,
297              playerVars: {
298                modestbranding: 1,
299                autoplay: 1,
300                controls: 0,
301                showinfo: 0,
302                branding: 0,
303                rel: 0,
304                autohide: 1,
305                start: 0
306              }
307          });
308        });
309      });
310      $.initialize('.merimag-fitvids', function() {
311        $(this).fitVids();
312      });
313      $(window).load(function() {
314        merimag_options_UI.load_images( $('.merimag-marquee') );
315      })
316      $.initialize('.merimag-marquee', function() {
317        var elm = $(this);
318        
319        $(elm).marquee({
320          duration: 20000,
321          delayBeforeStart: 1000,
322          startVisible: true,
323          duplicated: true,
324          gap: 0,
325          pauseOnHover: true,
326        })
327        
328      });
329      $.initialize('.gallery-item figcaption', function() {
330        $(this).attr('title', $(this).text());
331      })
332      $(window).load(function() {
333        $('.price_slider_wrapper').show();
334      })
335     
336      $(document).on("mouseenter", ".menu-item-has-children:not(.click-event)", function(t) {
337          var a = $(this);
338          if( $(a).parents('.elementor-widget-wrap').length > 0 ) {
339            return;
340          }
341          a.siblings("li:not(.click-event)").stop().clearQueue().removeClass("merimag-enter").addClass("merimag-leave");
342          a.stop().clearQueue().removeClass("merimag-leave").addClass("merimag-enter");
343          var e_right_offset = ($(window).width() - ($(this).offset().left + $(this).outerWidth()));
344          var e_left_offset = $(this).offset().left;
345          var sub_menu_width = $(this).children('.sub-menu').outerWidth();
346          var in_sub_menu = $(this).parent('.sub-menu').length  > 0 ? true : false;
347          if( $(this).hasClass('menu-item-has-mega-menu') === false && $(this).parents('.menu-item-has-mega-menu').length === 0 ) {
348            if( e_right_offset < sub_menu_width && e_left_offset > sub_menu_width ) {
349              $(this).addClass('right-side-sub-menu');
350            } else {
351              $(this).removeClass('right-side-sub-menu');
352            }
353            if( e_left_offset < sub_menu_width && e_right_offset > sub_menu_width ) {
354               $(this).addClass('left-side-sub-menu');
355            } else {
356              $(this).removeClass('left-side-sub-menu');
357            }
358            if( e_left_offset < sub_menu_width && e_right_offset < sub_menu_width ) {
359               $(this).addClass('mobile-sub-menu');
360            } else {
361              $(this).removeClass('mobile-sub-menu');
362            }
363          }
364          
365      }).on("mouseleave", ".menu-item-has-children:not(.click-event)", function() {
366          $(this).stop().delay(10).queue(function(t) {
367              $(this).removeClass("merimag-enter");
368          }).delay(10).queue(function(t) {
369              $(this).addClass("merimag-leave");
370          });
371      });
372      $(document).on('click',".menu-item-has-children.click-event > a", function() {
373        var parent = $(this).parent();
374        var e_right_offset = ($(window).width() - ($(parent).offset().left + $(parent).outerWidth()));
375          var e_left_offset = $(parent).offset().left;
376          var sub_menu_width = $(parent).children('.sub-menu').outerWidth();
377          var in_sub_menu = $(parent).parent('.sub-menu').length  > 0 ? true : false;
378          if( $(this).parents('.menu-item-has-mega-menu').length === 0 ) {
379            if( e_right_offset < sub_menu_width && e_left_offset > sub_menu_width ) {
380              $(parent).addClass('right-side-sub-menu');
381            } else {
382              $(parent).removeClass('right-side-sub-menu');
383            }
384            if( e_left_offset < sub_menu_width && e_right_offset > sub_menu_width ) {
385               $(parent).addClass('left-side-sub-menu');
386            } else {
387              $(parent).removeClass('left-side-sub-menu');
388            }
389            if( e_left_offset < sub_menu_width && e_right_offset < sub_menu_width ) {
390               $(parent).addClass('mobile-sub-menu');
391            } else {
392              $(parent).removeClass('mobile-sub-menu');
393            }
394          }
395          $(parent).toggleClass('merimag-enter').toggleClass('merimag-leave').toggleClass('active-menu-item');
396          return false;
397         
398      });
399    }
400  };
401        
402 
403     merimag_options_UI.init();
404})(jQuery);
405

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.