1/** 2 * @package Helix Ultimate Framework 3 * @author JoomShaper https://www.joomshaper.com 4 * @copyright Copyright (c) 2010 - 2021 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, #sp-header-museo, #sp-header-comitato'); 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 var tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"], .hasTooltip')); 86 var tooltipList = tooltipTriggerList.map(function (tooltipTriggerEl) { 87 return new bootstrap.Tooltip(tooltipTriggerEl,{ 88 html: true 89 }); 90 }); 91 92 // Popover 93 var popoverTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="popover"]')); 94 var popoverList = popoverTriggerList.map(function (popoverTriggerEl) { 95 return new bootstrap.Popover(popoverTriggerEl); 96 }); 97 98 // Article Ajax voting 99 $('.article-ratings .rating-star').on('click', function (event) { 100 event.preventDefault(); 101 var $parent = $(this).closest('.article-ratings'); 102 103 var request = { 104 'option': 'com_ajax', 105 'template': template, 106 'action': 'rating', 107 'rating': $(this).data('number'), 108 'article_id': $parent.data('id'), 109 'format': 'json' 110 }; 111 112 $.ajax({ 113 type: 'POST', 114 data: request, 115 beforeSend: function () { 116 $parent.find('.fa-spinner').show(); 117 }, 118 success: function (response) { 119 var data = $.parseJSON(response); 120 $parent.find('.ratings-count').text(data.message); 121 $parent.find('.fa-spinner').hide(); 122 123 if(data.status) 124 { 125 $parent.find('.rating-symbol').html(data.ratings) 126 } 127 128 setTimeout(function(){ 129 $parent.find('.ratings-count').text('(' + data.rating_count + ')') 130 }, 3000); 131 } 132 }); 133 }); 134 135 // Cookie consent 136 $('.sp-cookie-allow').on('click', function(event) { 137 event.preventDefault(); 138 139 var date = new Date(); 140 date.setTime(date.getTime() + (30 * 24 * 60 * 60 * 1000)); 141 var expires = "; expires=" + date.toGMTString(); 142 document.cookie = "spcookie_status=ok" + expires + "; path=/"; 143 144 $(this).closest('.sp-cookie-consent').fadeOut(); 145 }); 146 147 $(".btn-group label:not(.active)").click(function() 148 { 149 var label = $(this); 150 var input = $('#' + label.attr('for')); 151 152 if (!input.prop('checked')) { 153 label.closest('.btn-group').find("label").removeClass('active btn-success btn-danger btn-primary'); 154 if (input.val() === '') { 155 label.addClass('active btn-primary'); 156 } else if (input.val() == 0) { 157 label.addClass('active btn-danger'); 158 } else { 159 label.addClass('active btn-success'); 160 } 161 input.prop('checked', true); 162 input.trigger('change'); 163 } 164 var parent = $(this).parents('#attrib-helix_ultimate_blog_options'); 165 if( parent ){ 166 showCategoryItems( parent, input.val() ) 167 } 168 }); 169 $(".btn-group input[checked=checked]").each(function() 170 { 171 if ($(this).val() == '') { 172 $("label[for=" + $(this).attr('id') + "]").addClass('active btn btn-primary'); 173 } else if ($(this).val() == 0) { 174 $("label[for=" + $(this).attr('id') + "]").addClass('active btn btn-danger'); 175 } else { 176 $("label[for=" + $(this).attr('id') + "]").addClass('active btn btn-success'); 177 } 178 var parent = $(this).parents('#attrib-helix_ultimate_blog_options'); 179 if( parent ){ 180 parent.find('*[data-showon]').each( function() { 181 $(this).hide(); 182 }) 183 } 184 }); 185 186 187 function showCategoryItems(parent, value){ 188 var controlGroup = parent.find('*[data-showon]'); 189 controlGroup.each( function() { 190 var data = $(this).attr('data-showon') 191 data = typeof data !== 'undefined' ? JSON.parse( data ) : [] 192 if( data.length > 0 ){ 193 if(typeof data[0].values !== 'undefined' && data[0].values.includes( value )){ 194 $(this).slideDown(); 195 }else{ 196 $(this).hide(); 197 } 198 } 199 }) 200 } 201 202 $(window).on('scroll', function(){ 203 var scrollBar = $(".sp-reading-progress-bar"); 204 if( scrollBar.length > 0 ){ 205 var s = $(window).scrollTop(), 206 d = $(document).height(), 207 c = $(window).height(); 208 var scrollPercent = (s / (d - c)) * 100; 209 const postition = scrollBar.data('position') 210 if( postition === 'top' ){ 211 // var sticky = $('.header-sticky'); 212 // if( sticky.length > 0 ){ 213 // sticky.css({ top: scrollBar.height() }) 214 // }else{ 215 // sticky.css({ top: 0 }) 216 // } 217 } 218 scrollBar.css({width: `${scrollPercent}%` }) 219 } 220 221 }) 222 223});
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.