PageSourceSearch

https://alergia.org.ar/templates/themis/js/main.js

js alergia.org.ar collected 2026-10-06 18:05:20 UTC 8,680 bytes, 258 lines download raw bytes

1/**
2 * @package Helix Ultimate Framework
3 * @author JoomShaper https://www.joomshaper.com
4 * @copyright Copyright (c) 2010 - 2019 JoomShaper
5 * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 or Later
6 */
7
8jQuery(function ($) {
9
10    // Stikcy Header
11    if ($('body').hasClass('sticky-header')) {
12        var header = $('#sp-header');
13
14        if ($('#sp-header').length) {
15            var headerHeight = header.outerHeight();
16            var stickyHeaderTop = header.offset().top;
17            var stickyHeader = function () {
18                var scrollTop = $(window).scrollTop();
19                if (scrollTop > stickyHeaderTop) {
20                    header.addClass('header-sticky');
21                } else {
22                    if (header.hasClass('header-sticky')) {
23                        header.removeClass('header-sticky');
24                    }
25                }
26            };
27            stickyHeader();
28            $(window).scroll(function () {
29                stickyHeader();
30            });
31        }
32
33        if ($('body').hasClass('layout-boxed')) {
34            var windowWidth = header.parent().outerWidth();
35            header.css({
36                "max-width": windowWidth,
37                "left": "auto"
38            });
39        }
40    }
41
42    // go to top
43    $(window).scroll(function () {
44        if ($(this).scrollTop() > 100) {
45            $('.sp-scroll-up').fadeIn();
46        } else {
47            $('.sp-scroll-up').fadeOut(400);
48        }
49    });
50
51    $('.sp-scroll-up').click(function () {
52        $("html, body").animate({
53            scrollTop: 0
54        }, 600);
55        return false;
56    });
57
58    // Preloader
59    $(window).on('load', function () {
60        $('.sp-preloader').fadeOut(500, function () {
61            $(this).remove();
62        });
63    });
64
65    //mega menu
66    $('.sp-megamenu-wrapper').parent().parent().css('position', 'static').parent().css('position', 'relative');
67    $('.sp-menu-full').each(function () {
68        $(this).parent().addClass('menu-justify');
69    });
70
71    // Offcanvs
72    $('#offcanvas-toggler').on('click', function (event) {
73        event.preventDefault();
74        $('.offcanvas-init').addClass('offcanvas-active');
75    });
76
77    $('.close-offcanvas, .offcanvas-overlay').on('click', function (event) {
78        event.preventDefault();
79        $('.offcanvas-init').removeClass('offcanvas-active');
80    });
81
82    $(document).on('click', '.offcanvas-inner .menu-toggler', function (event) {
83        event.preventDefault();
84        $(this).closest('.menu-parent').toggleClass('menu-parent-open').find('>.menu-child').slideToggle(400);
85    });
86
87    //Tooltip
88    $('[data-toggle="tooltip"]').tooltip();
89
90    // Article Ajax voting
91    $('.article-ratings .rating-star').on('click', function (event) {
92        event.preventDefault();
93        var $parent = $(this).closest('.article-ratings');
94
95        var request = {
96            'option': 'com_ajax',
97            'template': template,
98            'action': 'rating',
99            'rating': $(this).data('number'),
100            'article_id': $parent.data('id'),
101            'format': 'json'
102        };
103
104        $.ajax({
105            type: 'POST',
106            data: request,
107            beforeSend: function () {
108                $parent.find('.fa-spinner').show();
109            },
110            success: function (response) {
111                var data = $.parseJSON(response);
112                $parent.find('.ratings-count').text(data.message);
113                $parent.find('.fa-spinner').hide();
114
115                if (data.status) {
116                    $parent.find('.rating-symbol').html(data.ratings)
117                }
118
119                setTimeout(function () {
120                    $parent.find('.ratings-count').text('(' + data.rating_count + ')')
121                }, 3000);
122            }
123        });
124    });
125
126    //  Cookie consent
127    $('.sp-cookie-allow').on('click', function (event) {
128        event.preventDefault();
129
130        var date = new Date();
131        date.setTime(date.getTime() + (30 * 24 * 60 * 60 * 1000));
132        var expires = "; expires=" + date.toGMTString();
133        document.cookie = "spcookie_status=ok" + expires + "; path=/";
134
135        $(this).closest('.sp-cookie-consent').fadeOut();
136    });
137
138    $(".btn-group label:not(.active)").click(function () {
139        var label = $(this);
140        var input = $('#' + label.attr('for'));
141
142        if (!input.prop('checked')) {
143            label.closest('.btn-group').find("label").removeClass('active btn-success btn-danger btn-primary');
144            if (input.val() === '') {
145                label.addClass('active btn-primary');
146            } else if (input.val() == 0) {
147                label.addClass('active btn-danger');
148            } else {
149                label.addClass('active btn-success');
150            }
151            input.prop('checked', true);
152            input.trigger('change');
153        }
154        var parent = $(this).parents('#attrib-helix_ultimate_blog_options');
155        if (parent) {
156            showCategoryItems(parent, input.val())
157        }
158    });
159    $(".btn-group input[checked=checked]").each(function () {
160        if ($(this).val() == '') {
161            $("label[for=" + $(this).attr('id') + "]").addClass('active btn btn-primary');
162        } else if ($(this).val() == 0) {
163            $("label[for=" + $(this).attr('id') + "]").addClass('active btn btn-danger');
164        } else {
165            $("label[for=" + $(this).attr('id') + "]").addClass('active btn btn-success');
166        }
167        var parent = $(this).parents('#attrib-helix_ultimate_blog_options');
168        if (parent) {
169            parent.find('*[data-showon]').each(function () {
170                $(this).hide();
171            })
172        }
173    });
174
175
176    function showCategoryItems(parent, value) {
177        var controlGroup = parent.find('*[data-showon]');
178        controlGroup.each(function () {
179            var data = $(this).attr('data-showon')
180            data = typeof data !== 'undefined' ? JSON.parse(data) : []
181            if (data.length > 0) {
182                if (typeof data[0].values !== 'undefined' && data[0].values.includes(value)) {
183                    $(this).slideDown();
184                } else {
185                    $(this).hide();
186                }
187            }
188        })
189    }
190
191    $(window).on('scroll', function () {
192        var scrollBar = $(".sp-reading-progress-bar");
193        if (scrollBar.length > 0) {
194            var s = $(window).scrollTop(),
195                d = $(document).height(),
196                c = $(window).height();
197            var scrollPercent = (s / (d - c)) * 100;
198            const postition = scrollBar.data('position')
199            if (postition === 'top') {
200                // var sticky = $('.header-sticky');
201                // if( sticky.length > 0 ){
202                //     sticky.css({ top: scrollBar.height() })
203                // }else{
204                //     sticky.css({ top: 0 })
205                // }
206            }
207            scrollBar.css({
208                width: `${scrollPercent}%`
209            })
210        }
211
212    })
213
214    // Start template(Themis) related js here
215
216    // Top Search
217    $(".search-open-icon").on('click', function () {
218        $(".top-search-input-wrap").fadeIn(200).addClass("search-open");
219        $(this).hide();
220        $('.search-close-icon').show().css('display', 'inline-block');
221        $('body.off-canvas-menu-init').css({'overflow-y': 'hidden'});
222        $('#sp-header').css({'z-index': '999'});
223        setTimeout(function () {
224            $('.rhino-top-search input').focus();
225        }, 500);
226    });
227
228    $(".search-close-icon").on('click', function () {
229        $(".top-search-input-wrap").fadeOut(200).removeClass("search-open");
230        $('.search-close-icon').hide();
231        $('.search-open-icon').show();
232        $('body.off-canvas-menu-init').css({
233            'overflow-y': 'initial'
234        });
235        $('#sp-header').css({'z-index': '99'});
236    });
237    $('.search-suggested-tag > ul > li > a').on('click', function (e) {
238        e.preventDefault();
239        $('.search-suggested-tag > ul > li > a.active').removeClass('active');
240        $(this).addClass('active');
241        var tagText = $(this).text().trim();
242        $('.sp_search_input input').val(tagText).focus();
243    });
244
245    // press esc to hide search
246    $(document).keyup(function (e) {
247        if (e.keyCode == 27) { // esc keycode
248            $(".top-search-input-wrap").fadeOut(200);
249            $(".search-close-icon").fadeOut(200);
250            $(".search-open-icon").delay(200).fadeIn(200);
251            $('body.off-canvas-menu-init').css({'overflow-y': 'initial'});
252        }
253    });
254    // End Top Search
255
256    //End template(Themis) related js here
257
258});

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.