PageSourceSearch

https://latinalista.com/wp-content/themes/ri-maxazine/js/scripts.js?ver=7.1.2

js latinalista.com collected 2026-09-24 19:03:25 UTC 16,738 bytes, 403 lines download raw bytes

1(function ($) {
2    "use strict";
3
4    $(document).ready(function () {
5        resizeVideo();
6        CustomWoocommerceJS();
7        MobileNav();
8        WooMenu();
9        Headline();
10        Ritsearch('#activesearch', '#topsearch-block');
11        $('select').selectric();
12        var val;
13        $('.newsletter-email').focus(function () {
14            val = $(this).attr('value');
15            $(this).attr('value', '');
16        })
17        $('.newsletter-email').focusout(function () {
18            var newval = $(this).attr('value');
19            if (newval == '') {
20                $(this).attr('value', val);
21            }
22        });
23        $('#respond').ShowFormCmt();
24    });
25
26    // Run when all load done
27    $(window).load(function () {
28        stickySingle();
29        BacktoTop();
30        $('.sticky-wrapper').Stickyfix();
31        $('.wrapper-mobile-nav').niceScroll();
32        stickysidebar();
33    });
34
35    //Function
36    $.fn.extend({
37        //Fix sticky wp-admin bar
38        Stickyfix: function () {
39            if ($(this)[0]) {
40                if ($('#wpadminbar')[0]) {
41                    $(window).on('resize', function () {
42                        if ($(window).width() > 600) {
43                            var lastCroll = 0;
44                            jQuery(window).bind("scroll", function () {
45                                var scroll = jQuery(this).scrollTop();
46                                if (scroll > lastCroll) {
47                                    $('#wpadminbar').css('transform', 'translateY(-50px)');
48
49                                }
50                                else {
51                                    $('#wpadminbar').css('transform', 'translateY(0px)');
52                                }
53                                lastCroll = scroll;
54                            })
55                        }
56                    }).resize();
57                }
58            }
59        },
60        //Show Comment form
61        ShowFormCmt: function () {
62            if ($(this)[0]) {
63                var $this = $(this);
64                var height = $this.outerHeight();
65                $this.height(height).addClass('hiddenform');
66                $('#reply-title span, .comment-reply-link, .add-cmt').on('click', function () {
67                    $this.removeClass('hiddenform');
68                });
69                $('#cancel-comment-reply-link').on('click', function () {
70                    $this.addClass('hiddenform');
71                });
72            }
73        }
74    })
75    function stickysidebar() {
76        if ($('.sidebar-fixed')[0]) {
77            $('.sidebar-fixed').wrapInner('<div class="sidebar-fixed-block"></div>');
78            jQuery(window).resize(function () {
79                if (jQuery(window).width() > 980) {
80                    var wrappH, itemH, maxMove, item;
81                    $('.wrapper-sidebar-fixed').each(function () {
82                        wrappH = $(this).height();
83                        itemH = $(this).find('.sidebar-fixed').height();
84                        item = $(this).find('.sidebar-fixed-block');
85                        maxMove = wrappH - itemH;
86                        item.data('maxMove', maxMove);
87                    })
88                    jQuery(window).bind("scroll", function () {
89                        $('.wrapper-sidebar-fixed').each(function () {
90                            var toTop;
91                            if ($(this).find('.sidebar-fixed')[0]) {
92                                var wrapptoTop = $(this).find('.sidebar-fixed').offset().top;
93                                item = $(this).find('.sidebar-fixed-block');
94                                maxMove = item.data('maxMove');
95                                toTop = $(window).scrollTop() - wrapptoTop;
96                                if (toTop > 0 && toTop <= maxMove) {
97                                    item.css('padding-top', toTop + 'px');
98                                }
99                                if ($(window).scrollTop() < wrapptoTop) {
100                                    item.css('padding-top', 0 + 'px');
101                                }
102                                if (toTop > maxMove) {
103                                    item.css('padding-top', maxMove + 'px');
104                                }
105                            }
106                        })
107                    });
108                }
109            }).resize();
110        }
111    }
112
113    //sticky single
114    function stickySingle() {
115        if ($('.single-post .site-main')[0]) {
116            var footerTop = $('#rit-footer').offset().top - $(window).height();
117            //Check Scroll down
118            jQuery(window).bind("scroll", function () {
119                var checkactive = $('.single-post .site-main').offset().top;
120                var scroll = jQuery(this).scrollTop();
121                if (checkactive < jQuery(window).scrollTop() && footerTop >= scroll) {
122                    $('#sticky-single').addClass('active');
123                }
124                else {
125                    $('#sticky-single').removeClass('active');
126                }
127            })
128        }
129    }
130
131    //Resize Video
132    function resizeVideo() {
133        // Find all YouTube videos
134        var allVideos = jQuery(".wrapper-video iframe, .wrapper-video embed");
135// Figure out and save aspect ratio for each video
136        allVideos.each(function () {
137            jQuery(this).data('aspectRatio', this.height / this.width)
138                // and remove the hard coded width/height
139                .removeAttr('height')
140                .removeAttr('width');
141        });
142// When the window is resized
143        jQuery(window).resize(function () {
144            var newWidth = jQuery(".wrapper-video").width();
145            // Resize all videos according to their own aspect ratio
146            allVideos.each(function () {
147                var el = jQuery(this);
148                el
149                    .width(newWidth)
150                    .height(newWidth * el.data('aspectRatio'));
151
152            });
153// Kick off one resize to fix all videos on page load
154        }).resize();
155    }
156
157    /*------Accordion menu-------*/
158    function WooMenu() {
159        if ($('.product-categories li.cat-parent')[0]) {
160            $('.product-categories li.cat-parent>a').after('<span class="triggernav"><i class="expand-icon"></i></span>');
161            toggleMobileNav('.triggernav', '.widget_product_categories .product-categories li ul');
162        }
163    }
164
165    /*--------For mobile nav-------*/
166    function MobileNav() {
167        var windowH = $(window).height();
168        if ($('.mobile-header-2')[0]) {
169            $('body').append('<div id="mask-nav"></div>');
170            $('#mobile-nav-block').prepend($('#logo').clone());
171            jQuery('#mobile-nav-block').append('<span id="close-nav"></span>');
172            $('#mobile-nav-block').addClass('vertical');
173            $('.mobile-header-2').width($(window).width());
174            var blockH = windowH;
175            if ($('#mobile-nav-block #logo')[0]) {
176                blockH = blockH - $('#mobile-nav-block #logo').outerHeight(true);
177            }
178            if ($('#mobile-nav-block .rit-socail-page')[0]) {
179                blockH = blockH - $('#mobile-nav-block .rit-socail-page').outerHeight(true);
180            }
181            $('.wrapper-mobile-nav').css('max-height', blockH + 'px');
182        }
183        jQuery('#mobile-nav-block li:has("ul")>a').after('<span class="triggernav"><i class="fa fa-angle-down"></i></span>');
184        toggleMobileNav('.triggernav', '#mobile-nav-block ul li ul');
185        jQuery('.mobile-nav:not(.active)').on("click", function () {
186            if ($('.mobile-header-2')[0]) {
187                $('body').addClass('nav-active');
188            }
189            jQuery('#mobile-nav-block').toggleClass('active');
190            if ($('#mask-nav')[0]) {
191                $('#mask-nav').addClass('active');
192                $('.wrapper-body').addClass('active');
193            }
194            if ($('.mobile-header-2').length == 0) {
195                var top = $('#rit-header-page').height();
196                jQuery(this).toggleClass('active');
197                $('.wrapper-mobile-nav').css('top', top + 'px');
198                var blockH = windowH - top;
199                if ($('#mobile-nav-block #logo')[0]) {
200                    blockH = blockH - $('#mobile-nav-block #logo').outerHeight(true);
201                }
202                if ($('#mobile-nav-block .rit-socail-page')[0]) {
203                    blockH = blockH - $('#mobile-nav-block .rit-socail-page').outerHeight(true);
204                }
205                $('.wrapper-mobile-nav').css('max-height', blockH + 'px');
206            }
207        });
208        jQuery('#close-nav, .mobile-nav.active').on("click", function () {
209            $('body').removeClass('nav-active');
210            $('.mobile-nav.active').toggleClass('active');
211            jQuery('#mobile-nav-block').removeClass('active');
212            if ($('#mask-nav')[0]) {
213                $('#mask-nav').removeClass('active');
214                $('.wrapper-body').removeClass('active');
215            }
216        });
217        jQuery('#mask-nav').on("click", function () {
218            $('body').removeClass('nav-active');
219            $(this).removeClass('active');
220            jQuery('#mobile-nav-block').removeClass('active');
221            $('.wrapper-body').removeClass('active');
222        })
223    }
224
225    function toggleMobileNav(trigger, target) {
226        jQuery(target).each(function () {
227            jQuery(this).attr('data-h', jQuery(this).outerHeight());
228        });
229        jQuery(target).addClass('unvisible');
230        var h;
231        jQuery(trigger).on("click", function () {
232            h = 0;
233            jQuery(this).prev('a').toggleClass('active');
234            jQuery(this).toggleClass('active');
235            jQuery.this = jQuery(this).next(target);
236            if (jQuery.this.hasClass('unvisible')) {
237                //Get height of this item
238                if (jQuery.this.has("ul").length > 0) {
239                    h = parseInt(jQuery.this.attr('data-h')) - parseInt(jQuery.this.find(target).attr('data-h'));
240                }
241                else {
242                    h = parseInt(jQuery.this.attr('data-h'));
243                }
244                //resize for parent
245                jQuery.this.parents(target).each(function () {
246                    jQuery(this).css('height', jQuery(this).outerHeight() + h);
247                })
248                //set height for this item
249                jQuery.this.css('height', h + "px");
250            }
251            else {
252                jQuery.this.find(target).not(':has(.unvisible)').addClass('unvisible');
253                //resize for parent when this item hide
254                h = jQuery.this.outerHeight();
255                jQuery.this.parents(target).each(function () {
256                    jQuery(this).css('height', jQuery(this).outerHeight() - h);
257                })
258            }
259            jQuery.this.toggleClass('unvisible');
260            //if(jQuery(trigger).parents('#mobile-menu')[0]){
261            $('.wrapper-mobile-nav').getNiceScroll().resize();
262            //}
263        });
264    }
265
266//===============Woo js======================//
267    function CustomWoocommerceJS() {
268        setTimeout(function () {
269            jQuery('.woocommerce-message').css('right', '0');
270        }, 500);
271        setTimeout(function () {
272            jQuery('.woocommerce-message').removeAttr('style');
273        }, 3000);
274//Set cookie for change product layout
275        jQuery('.pageviewitem').not('.active').on("click", function () {
276            if (jQuery.cookie('product-view') != '') {
277                jQuery.cookie('product-view', jQuery(this).attr('data-view'));
278                document.location.reload();
279            }
280        });
281    }
282
283//======================Back to top====================//
284    function BacktoTop() {
285        var checkScroll = 0;
286        jQuery(window).scroll(function () {
287            var st = jQuery(this).scrollTop();
288            if (jQuery(this).scrollTop() > 100 && checkScroll > st) {
289                jQuery('#back-to-top').addClass('show');
290            } else {
291                jQuery('#back-to-top').removeClass('show');
292            }
293            checkScroll = st;
294        });
295        jQuery('#back-to-top').on("click", function () {
296            jQuery('body,html').animate({
297                scrollTop: 0
298            }, 800);
299            return false;
300        });
301    }
302
303//================Headline js===================//
304    function Headline() {
305        $(window).resize(function () {
306            if ($(window).width() > 600) {
307                if ($('.headline-widgets.fade')[0]) {
308                    if (jQuery('.headline-widgets li.active').length == 0) {
309                        jQuery('.headline-widgets li:first-child').addClass('active');
310                    }
311                    var loop = setInterval(function () {
312                        Nextheadline()
313                    }, 3000);
314                    jQuery('.headline-widgets li, .rit-control-headline span').on('hover', function () {
315                            clearInterval(loop);
316                        }, function () {
317                            loop = setInterval(function () {
318                                Nextheadline()
319                            }, 3000);
320                        }
321                    )
322                    jQuery('.rit-control-headline .next').click(function () {
323                        Nextheadline();
324                    });
325                    jQuery('.rit-control-headline .prev').click(function () {
326                        Prevheadline();
327                    });
328                } else if ($('.headline-widgets.slide')[0]) {
329                    var widthHL = 0;
330                    $('.headline-widgets li').each(function () {
331                        widthHL = widthHL + $(this).outerWidth();
332                    });
333                    $('.headline-widgets').width(widthHL);
334                    slidepost('.headline-widgets li:first-child');
335                    $('.headline-widgets').on('mouseover', function () {
336                        $('.headline-widgets li:first-child').stop();
337                    });
338                    $('.headline-widgets').on('mouseout', function () {
339                        slidepost('.headline-widgets li:first-child')
340                    })
341                }
342            }
343        }).resize();
344    }
345
346    var time;
347    var width;
348    var toLeft;
349
350    function slidepost(id) {
351        width = $(id).outerWidth();
352        time = width * 30;
353        toLeft = $('.headline-widgets').offset().left - $(id).offset().left;
354        if (toLeft <= 0) {
355            time = width * 30;
356        }
357        else {
358            time = (width - toLeft) * 30;
359        }
360        $(id).animate({'margin-left': -width}, time, 'linear', function () {
361            var clone_item = jQuery(id).clone();
362            clone_item.css({'margin-left': '0'});
363            $('.headline-widgets').append(clone_item);
364            jQuery(id).remove();
365            setTimeout(slidepost('.headline-widgets li:first-child'), 100);
366        });
367    }
368
369    function Nextheadline() {
370        if (jQuery('.headline-widgets li.active').next('li').length > 0) {
371            jQuery('.headline-widgets li.active').removeClass('active').next().addClass('active');
372        }
373        else {
374            jQuery('.headline-widgets li.active').removeClass('active');
375            jQuery('.headline-widgets li:first-child').addClass('active');
376        }
377    }
378
379    function Prevheadline() {
380        if (jQuery('.headline-widgets li.active').prev('li').length > 0) {
381            jQuery('.headline-widgets li.active').removeClass('active').prev().addClass('active');
382        }
383        else {
384            jQuery('.headline-widgets li.active').removeClass('active');
385            jQuery('.headline-widgets li:last-child').addClass('active');
386        }
387    }
388
389//===============End head line js====================//
390//For search
391    function Ritsearch(trigger, id) {
392        (function ($) {
393            "use strict";
394            $(trigger).on("click", function () {
395                $(id).removeClass('hidesearch');
396                $(id).find('input').focus;
397            })
398            $('#close-search').on("click", function () {
399                $(id).addClass('hidesearch');
400            });
401        })(jQuery)
402    }
403})(jQuery);

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.