PageSourceSearch

https://chinaguidedog.org/templates/shaper_helixultimate/js/main.js

js chinaguidedog.org collected 2026-10-02 20:21:26 UTC 7,145 bytes, 213 lines download raw bytes

1/**
2 * @package Helix Ultimate Framework
3 * @author JoomShaper https://www.joomshaper.com
4 * @copyright Copyright (c) 2010 - 2018 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({"max-width": windowWidth, "left": "auto"});
36        }
37    }
38
39    // go to top
40    $(window).scroll(function () {
41        if ($(this).scrollTop() > 100) {
42            $('.sp-scroll-up').fadeIn();
43        } else {
44            $('.sp-scroll-up').fadeOut(400);
45        }
46    });
47
48    $('.sp-scroll-up').click(function () {
49        $("html, body").animate({
50            scrollTop: 0
51        }, 600);
52        return false;
53    });
54
55    // Preloader
56    $(window).on('load', function () {
57        $('.sp-preloader').fadeOut(500, function() {
58            $(this).remove();
59        });
60    });
61
62    //mega menu
63    $('.sp-megamenu-wrapper').parent().parent().css('position', 'static').parent().css('position', 'relative');
64    $('.sp-menu-full').each(function () {
65        $(this).parent().addClass('menu-justify');
66    });
67
68    // Offcanvs
69    $('#offcanvas-toggler').on('click', function (event) {
70        event.preventDefault();
71        $('.offcanvas-init').addClass('offcanvas-active');
72    });
73
74    $('.close-offcanvas, .offcanvas-overlay').on('click', function (event) {
75        event.preventDefault();
76        $('.offcanvas-init').removeClass('offcanvas-active');
77    });
78    
79    $(document).on('click', '.offcanvas-inner .menu-toggler', function(event){
80        event.preventDefault();
81        $(this).closest('.menu-parent').toggleClass('menu-parent-open').find('>.menu-child').slideToggle(400);
82    });
83
84    //Tooltip
85    $('[data-toggle="tooltip"]').tooltip();
86
87    // Article Ajax voting
88    $('.article-ratings .rating-star').on('click', function (event) {
89        event.preventDefault();
90        var $parent = $(this).closest('.article-ratings');
91
92        var request = {
93            'option': 'com_ajax',
94            'template': template,
95            'action': 'rating',
96            'rating': $(this).data('number'),
97            'article_id': $parent.data('id'),
98            'format': 'json'
99        };
100
101        $.ajax({
102            type: 'POST',
103            data: request,
104            beforeSend: function () {
105                $parent.find('.fa-spinner').show();
106            },
107            success: function (response) {
108                var data = $.parseJSON(response);
109                $parent.find('.ratings-count').text(data.message);
110                $parent.find('.fa-spinner').hide();
111
112                if(data.status)
113                {
114                    $parent.find('.rating-symbol').html(data.ratings)
115                }
116
117                setTimeout(function(){
118                    $parent.find('.ratings-count').text('(' + data.rating_count + ')')
119                }, 3000);
120            }
121        });
122    });
123
124    //  Cookie consent
125    $('.sp-cookie-allow').on('click', function(event) {
126        event.preventDefault();
127        
128        var date = new Date();
129        date.setTime(date.getTime() + (30 * 24 * 60 * 60 * 1000));
130        var expires = "; expires=" + date.toGMTString();               
131        document.cookie = "spcookie_status=ok" + expires + "; path=/";
132
133        $(this).closest('.sp-cookie-consent').fadeOut();
134    });
135
136    $(".btn-group label:not(.active)").click(function()
137		{
138			var label = $(this);
139			var input = $('#' + label.attr('for'));
140            
141			if (!input.prop('checked')) {
142				label.closest('.btn-group').find("label").removeClass('active btn-success btn-danger btn-primary');
143				if (input.val() === '') {
144					label.addClass('active btn-primary');
145				} else if (input.val() == 0) {
146					label.addClass('active btn-danger');
147				} else {
148					label.addClass('active btn-success');
149				}
150				input.prop('checked', true);
151				input.trigger('change');
152            }
153            var parent = $(this).parents('#attrib-helix_ultimate_blog_options'); 
154            if( parent ){ 
155                showCategoryItems( parent, input.val() )
156            }
157		});
158		$(".btn-group input[checked=checked]").each(function()
159		{
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({width: `${scrollPercent}%` })
208                scrollBar.css({width: scrollPercent+'%' })
209            }
210             
211          })    
212
213});

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.