1jQuery(function($){ 2 $(document).ready(function(){ 3 if ($("#breadcrumb-block").length){ 4 if ($('.eb-entry-head').length) { 5 $("#breadcrumb-block").append($('.eb-entry-head')); 6 $('.eb-entry-head').attr('id','eb'); 7 } 8 // if ($('.item-heading').length) { 9 // $("#breadcrumb-block").append($('.item-heading')); 10 // } 11 if ($('#hikashop_product_top_part').length) { 12 $("#breadcrumb-block").append($('#hikashop_product_top_part')); 13 } 14 } 15 }); 16}); 17 18 19 20document.addEventListener('DOMContentLoaded', function () { 21 22 const article = 23 document.querySelector('.com-content-article__body') || 24 document.querySelector('.item-page') || 25 document.querySelector('article'); 26 27 if (!article) return; 28 29 const images = article.querySelectorAll('img'); 30 31 images.forEach(function (img) { 32 33 if (img.closest('a')) return; 34 35 const link = document.createElement('a'); 36 37 link.href = img.src; 38 link.classList.add('article-lightbox'); 39 40 if (img.alt) { 41 link.setAttribute('data-title', img.alt); 42 } 43 44 img.parentNode.insertBefore(link, img); 45 link.appendChild(img); 46 47 }); 48 49 GLightbox({ 50 selector: '.article-lightbox', 51 touchNavigation: true, 52 loop: true, 53 zoomable: true, 54 openEffect: 'zoom', 55 closeEffect: 'fade' 56 }); 57 58}); 59 60document.addEventListener("DOMContentLoaded", function(){ 61 62 let article = 63 document.querySelector(".com-content-article__body") 64 || document.querySelector(".item-page") 65 || document.querySelector("article") 66 || document.querySelector(".articleBody"); 67 68 if(!article){ 69 return; 70 } 71 72 article.classList.add("article-font-target"); 73 74 const DEFAULT_SIZE = 18; 75 const MIN_SIZE = 14; 76 const MAX_SIZE = 32; 77 78 let currentSize = 79 parseInt(localStorage.getItem("articleFontSize")) 80 || DEFAULT_SIZE; 81 82 function applyFontSize(){ 83 84 article.style.fontSize = currentSize + "px"; 85 article.style.lineHeight = (currentSize * 1.8) + "px"; 86 87 localStorage.setItem( 88 "articleFontSize", 89 currentSize 90 ); 91 } 92 93 applyFontSize(); 94 95 document 96 .getElementById("increase-font") 97 ?.addEventListener("click", function(){ 98 99 if(currentSize < MAX_SIZE){ 100 currentSize++; 101 applyFontSize(); 102 } 103 104 }); 105 106 document 107 .getElementById("decrease-font") 108 ?.addEventListener("click", function(){ 109 110 if(currentSize > MIN_SIZE){ 111 currentSize--; 112 applyFontSize(); 113 } 114 115 }); 116 117 document 118 .getElementById("reset-font") 119 ?.addEventListener("click", function(){ 120 121 currentSize = DEFAULT_SIZE; 122 applyFontSize(); 123 124 }); 125 126}); 127 128 129 130//BEGIN Chú thÃch cho ảnh 131 132document.addEventListener('DOMContentLoaded', function () { 133 134 const article = document.querySelector('[itemprop="articleBody"]'); 135 136 if (!article || typeof lightGallery === 'undefined') { 137 return; 138 } 139 140 document.querySelectorAll('.article-lightbox').forEach(function (link) { 141 142 let caption = ''; 143 144 const p = link.closest('p'); 145 146 if (!p) return; 147 148 /* 149 * TRƯá»NG HỢP 1: 150 * Ảnh và caption nằm cùng 1 p 151 * 152 * <p style="text-align:center"> 153 * <a><img></a><br> 154 * <em>Caption</em> 155 * </p> 156 */ 157 const pStyle = (p.getAttribute('style') || '').toLowerCase(); 158 159 if ( 160 pStyle.includes('text-align: center') && 161 p.querySelector('em') 162 ) { 163 caption = p.querySelector('em').textContent.trim(); 164 } 165 166 /* 167 * TRƯá»NG HỢP 2: 168 * Caption nằm á» p kế tiếp 169 * 170 * <p><a><img></a></p> 171 * <p style="text-align:center"><em>Caption</em></p> 172 */ 173 if (!caption) { 174 175 const nextP = p.nextElementSibling; 176 177 if ( 178 nextP && 179 nextP.tagName === 'P' 180 ) { 181 182 const nextStyle = 183 (nextP.getAttribute('style') || '').toLowerCase(); 184 185 const em = nextP.querySelector('em'); 186 187 if ( 188 em && 189 nextStyle.includes('text-align: center') 190 ) { 191 caption = em.textContent.trim(); 192 } 193 } 194 } 195 196 if (caption) { 197 link.setAttribute('data-sub-html', caption); 198 } 199 }); 200 201 lightGallery(article, { 202 selector: '.article-lightbox', 203 204 plugins: [ 205 lgZoom, 206 lgFullscreen, 207 lgThumbnail 208 ], 209 210 speed: 300, 211 counter: true, 212 download: true, 213 thumbnail: true 214 }); 215 216 gallery.on('lgBeforeOpen', function () { 217 218 const fontTools = document.getElementById('font-tools'); 219 220 if (fontTools) { 221 fontTools.style.display = 'none'; 222 } 223 224}); 225 226gallery.on('lgAfterClose', function () { 227 228 const fontTools = document.getElementById('font-tools'); 229 230 if (fontTools) { 231 fontTools.style.display = 'flex'; 232 } 233 234}); 235 236}); 237//END Chú thÃch cho ảnh
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.