1/** 2* 2012 - 2020 HiPresta 3* 4* MODULE Blog 5* 6* @author HiPresta <[email protected]> 7* @copyright HiPresta 2020 8* @license Addons PrestaShop license limitation 9* @link https://hipresta.com 10* 11* NOTICE OF LICENSE 12* 13* Don't use this module on several shops. The license provided by PrestaShop Addons 14* for all its modules is valid only once for a single shop. 15*/ 16 17$(document).ready(function(){ 18 $("a.blog_image_zoom").fancybox({ 19 helpers: { 20 overlay: { 21 locked: false 22 } 23 } 24 }); 25 26 $('.hi-blog-post-slider').flexslider({ 27 animation: "fade", 28 controlNav: false, 29 minItems: 1, 30 maxItems: 0, 31 prevText: '', 32 nextText: '', 33 }); 34 35 $('.hi-blog-slider').flexslider({ 36 animation: "slide", 37 prevText: '', 38 nextText: '', 39 controlNav: false 40 }); 41 42 $(document).on('click', '.heart-icon-big, .hi-blog-post-like', function(){ 43 var $this = $(this); 44 $.ajax({ 45 type: 'POST', 46 dataType: "JSON", 47 url: blog_front_controller_url, 48 data: { 49 action : 'bloglike', 50 ajax : true, 51 secure_key : blog_secure_key, 52 id_post: $(this).attr('data-id-post'), 53 psv: psv, 54 }, 55 success: function(response){ 56 $this.closest('.post-published').find('.like-count').html(response.like_count); 57 } 58 }); 59 60 return false; 61 }); 62 $(document).on('click', '#blog-add-comment', function(e){ 63 e.preventDefault(); 64 var th = $(this); 65 $.ajax({ 66 type: 'POST', 67 dataType: "JSON", 68 url: blog_front_controller_url, 69 data: { 70 action : 'blogcomments', 71 ajax : true, 72 secure_key : blog_secure_key, 73 id_post: $(this).attr('data-id-post'), 74 name: $('[name=cm-name]').val(), 75 email: $('[name=cm-email]').val(), 76 website: $('[name=cm-website]').val(), 77 comment: $('[name=cm-comment]').val(), 78 psv: psv, 79 }, 80 success: function(response){ 81 if (response.error) { 82 $('.errors').removeClass('hide'); 83 $('.errors').html(response.error); 84 } else { 85 $('.errors').addClass('hide'); 86 $('.errors').html(''); 87 $('#comments').html(response.content); 88 $('.customer-comment-count span').html(response.comment_count); 89 $('[name=cm-name], [name=cm-email], [name=cm-website], [name=cm-comment]').val(''); 90 if (response.blog_comments_approve) { 91 $('.customer-comments-form-block').html(response.blog_comments_approve_text); 92 $('.customer-comments-form-block').addClass('alert alert-success'); 93 } 94 } 95 } 96 }); 97 }); 98 99 $(document).on('click', '.reset-text', function(e){ 100 e.preventDefault(); 101 $('[name=cm-name], [name=cm-email], [name=cm-website], [name=cm-comment]').val(''); 102 }); 103 104 $('.toggle-tab').hide(); 105 $('.coments-container .comment-tabs li:first').addClass('active'); 106 $('.coments-container .blog-tab-content div.toggle-tab:first').show(); 107 $(document).on('click', '.comment-tabs li a', function(e){ 108 e.preventDefault(); 109 $('.coments-container .comment-tabs li').removeClass('active'); 110 $(this).parent().addClass('active'); 111 $('.toggle-tab').hide(); 112 var id_tab = $(this).attr('data-id-tab'); 113 $('.'+id_tab).show(); 114 return false; 115 }); 116 117 $('.hi-blog-sidebar-carousel, .hi-blog-block-carousel').each(function(){ 118 var items = $(this).attr('data-posts-count'); 119 var desktop_small = 1; 120 var itemsTablet = 1; 121 var itemsMobile = 1; 122 if (items > 1) { 123 desktop_small = items - 1; 124 } 125 if (desktop_small > 1) { 126 itemsTablet = desktop_small - 1; 127 } 128 if (itemsTablet > 1) { 129 itemsMobile = itemsTablet - 1; 130 } 131 $(this).HIBowlCarousel({ 132 margin: 10, 133 slideBy: 'page', 134 dots: false, 135 autoplay: false, 136 items: items, 137 nav: true, 138 loop: false, 139 rewind: true, 140 responsive:{ 141 320:{items:itemsMobile}, 142 479:{items:itemsMobile}, 143 480:{items:itemsTablet}, 144 768:{items:itemsTablet}, 145 980:{items:desktop_small}, 146 1199:{items:items} 147 }, 148 onInitialized: function() { 149 $('.hi-blog-post-slider').flexslider({ 150 animation: "fade", 151 controlNav: false, 152 minItems: 1, 153 maxItems: 0, 154 prevText: '', 155 nextText: '', 156 }); 157 158 $('.hi-blog-slider').flexslider({ 159 animation: "slide", 160 prevText: '', 161 nextText: '', 162 controlNav: false 163 }); 164 } 165 }); 166 }); 167 168 $('.facebook-share, .twitter-share, .linkedin-share, .pinterest-share').on('click', function(){ 169 hiBlogShare($(this).attr('href'), 600, 350); 170 171 return false;
172 }); 173}); 174 175function hiBlogShare(url, winWidth, winHeight) { 176 var winTop = (screen.height / 2) - (winHeight / 2) - 100; 177 var winLeft = (screen.width / 2) - (winWidth / 2); 178 window.open(url, 'sharer', 'top=' + winTop + ',left=' + winLeft + ',toolbar=0,status=0,width=' + winWidth + ',height=' + winHeight); 179} 180 181document.addEventListener("DOMContentLoaded", function() { 182 var lazyImages = [].slice.call(document.querySelectorAll('img.hi-blog-lazy')); 183 184 if ("IntersectionObserver" in window) { 185 let lazyImageObserver = new IntersectionObserver(function(entries, observer) { 186 entries.forEach(function(entry) { 187 if (entry.isIntersecting) { 188 let lazyImage = entry.target; 189 lazyImage.src = lazyImage.dataset.src; 190 lazyImage.srcset = lazyImage.dataset.srcset; 191 lazyImage.classList.remove('hi-blog-lazy'); 192 lazyImageObserver.unobserve(lazyImage); 193 } 194 }); 195 }); 196 197 lazyImages.forEach(function(lazyImage) { 198 lazyImageObserver.observe(lazyImage); 199 }); 200 } else { 201 lazyImages.forEach(function(lazyImage) { 202 lazyImage.src = lazyImage.dataset.src; 203 lazyImage.srcset = lazyImage.dataset.srcset; 204 lazyImage.classList.remove('hi-blog-lazy'); 205 }); 206 } 207});
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.