1window.initSwiperBrands = () => { 2 new Swiper('#swiper-marcas', { 3 spaceBetween: 40, 4 loop: true, 5 grabCursor: true, 6 loopAddBlankSlides: false, 7 pagination: { 8 el: ".swiper-pagination" 9 }, 10 navigation: { 11 nextEl: ".swiper-button-next", 12 prevEl: ".swiper-button-prev" 13 }, 14 watchOverflow: true, 15 centerInsufficientSlides: true, 16 breakpoints: { 17 340: { 18 slidesPerView: 2, 19 spaceBetween: 20, 20 slidesPerGroup: 2, 21 navigation: { 22 enabled: false 23 }, 24 }, 25 768: { 26 slidesPerView: 3, 27 spaceBetween: 40, 28 slidesPerGroup: 3 29 }, 30 1200: { 31 slidesPerView: 4, 32 spaceBetween: 50, 33 slidesPerGroup: 4, 34 navigation: { 35 enabled: true 36 }, 37 } 38 } 39 }); 40}; 41 42window.initSwiperProduct = () => { 43 new Swiper('#swiper-productos', { 44 spaceBetween: 40, 45 loop: true, 46 grabCursor: true, 47 loopAddBlankSlides: false, 48 pagination: { 49 el: ".swiper-pagination", 50 }, 51 navigation: { 52 nextEl: ".productos-button-next", 53 prevEl: ".productos-button-prev", 54 }, 55 breakpoints: { 56 340: { 57 slidesPerView: 1, 58 spaceBetween: 20, 59 slidesPerGroup: 1, 60 navigation: { 61 enabled: false, 62 }, 63 }, 64 768: { 65 slidesPerView: 2, 66 spaceBetween: 40, 67 slidesPerGroup: 2 68 }, 69 1200: { 70 slidesPerView: 4, 71 spaceBetween: 30, 72 slidesPerGroup: 4, 73 navigation: { 74 enabled: true, 75 } 76 } 77 } 78 }); 79}; 80 81window.initSwiperShortProducts = () => { 82 new Swiper('#swiper-productos-sin-precio1', { 83 spaceBetween: 40, 84 loop: true, 85 grabCursor: true, 86 loopAddBlankSlides: false, 87 pagination: { 88 el: ".swiper-pagination", 89 }, 90 navigation: { 91 nextEl: ".swiper-button-next", 92 prevEl: ".swiper-button-prev", 93 }, 94 breakpoints: { 95 340: { 96 slidesPerView: 1, 97 spaceBetween: 20, 98 slidesPerGroup: 1 99 }, 100 768: { 101 slidesPerView: 2, 102 spaceBetween: 30, 103 slidesPerGroup: 2 104 }, 105 1200: { 106 slidesPerView: 3, 107 spaceBetween: 20, 108 slidesPerGroup: 3 109 } 110 } 111 }); 112 new Swiper('#swiper-productos-sin-precio2', { 113 spaceBetween: 40, 114 loop: true, 115 grabCursor: true, 116 loopAddBlankSlides: false, 117 pagination: { 118 el: ".swiper-pagination", 119 }, 120 navigation: { 121 nextEl: ".swiper-button-next", 122 prevEl: ".swiper-button-prev", 123 }, 124 breakpoints: { 125 340: { 126 slidesPerView: 1, 127 spaceBetween: 20, 128 slidesPerGroup: 1 129 }, 130 768: { 131 slidesPerView: 2, 132 spaceBetween: 30, 133 slidesPerGroup: 2 134 }, 135 1200: { 136 slidesPerView: 3, 137 spaceBetween: 20, 138 slidesPerGroup: 3 139 } 140 } 141 }); 142}; 143 144window.initSwiperProductProductRelated = () => { 145 const swiperEl = document.querySelector('#productos-recomendados'); 146 if (!swiperEl) return; // Evita errores si el elemento no está presente en el DOM 147 148 new Swiper(swiperEl, { 149 spaceBetween: 20, 150 grabCursor: true, 151 pagination: { 152 el: ".swiper-pagination", 153 clickable: true 154 }, 155 navigation: { 156 nextEl: ".swiper-button-next", 157 prevEl: ".swiper-button-prev" 158 }, 159 autoplay: { 160 delay: 3000, // Cambia cada 3 segundos 161 }, 162 breakpoints: { 163 340: { 164 loop: true, 165 slidesPerView: 2, 166 slidesPerGroup: 2, 167 navigation: { 168 enabled: false, 169 }, 170 }, 171 768: { 172 loop: true, 173 slidesPerView: 4, 174 slidesPerGroup: 4 175 }, 176 1200: { 177 loop: false, 178 slidesPerView: 5, 179 slidesPerGroup: 5, 180 navigation: { 181 enabled: false, 182 }, 183 } 184 } 185 });
186}; 187 188window.initAutoFcous = (divId) => { 189 const interval = setInterval(() => { 190 if (divId !== "") { 191 const element = document.getElementById(divId); 192 if (element) { 193 clearInterval(interval); 194 element.scrollIntoView({ behavior: 'smooth', block: 'center', inline: 'center' }); 195 } 196 } 197 }, 100); // Verificar cada 100 milisegundos 198}; 199 200window.initCarousel = (carouselId) => { 201 var myCarousel = new bootstrap.Carousel(document.getElementById(carouselId), { 202 ride: "carousel", 203 keyboard: false 204 }); 205}; 206 207window.initSwiperProductFlashSale = () => { 208 // Solo monta cuando ya hay slides en el DOM (datos renderizados). 209 const swiperEl = document.getElementById('flash-sale'); 210 if (!swiperEl) return false; 211 212 const slides = swiperEl.querySelectorAll('.swiper-slide'); 213 if (!slides.length) return false; 214 215 const paginationEl = swiperEl.querySelector('.swiper-pagination'); 216 if (!paginationEl) return false; 217 218 if (swiperEl.swiper) { 219 try { swiperEl.swiper.destroy(true, true); } catch (_) { } 220 } 221 222 new Swiper(swiperEl, { 223 spaceBetween: 20, 224 grabCursor: true, 225 loop: false, 226 rewind: true, 227 autoplay: false, 228 loopAddBlankSlides: false, 229 observer: true, 230 observeParents: true, 231 updateOnWindowResize: true, 232 pagination: { 233 el: paginationEl, 234 clickable: true, 235 }, 236 navigation: { 237 nextEl: ".swiper-button-next", 238 prevEl: ".swiper-button-prev", 239 }, 240 breakpoints: { 241 340: { 242 slidesPerView: 1, 243 slidesPerGroup: 1, 244 navigation: { 245 enabled: false 246 } 247 }, 248 768: { 249 slidesPerView: 2, 250 slidesPerGroup: 2 251 }, 252 1200: { 253 slidesPerView: 4, 254 slidesPerGroup: 4, 255 navigation: { 256 enabled: true 257 } 258 } 259 } 260 }); 261 262 return true; 263}; 264 265 266window.initSwiperProductMarcasDestacadas = () => { 267 const swiperEl = document.getElementById('productos-descatados-marcas'); 268 if (!swiperEl) return; // Evita errores si el elemento no está presente en el DOM 269 270 new Swiper(swiperEl, { 271 spaceBetween: 20, 272 grabCursor: true, 273 loop: true, 274 pagination: { 275 el: ".swiper-pagination", 276 clickable: true 277 }, 278 navigation: { 279 nextEl: ".swiper-button-next", 280 prevEl: ".swiper-button-prev", 281 }, 282 breakpoints: { 283 340: { 284 loop: true, 285 slidesPerView: 2, 286 slidesPerGroup: 2, 287 }, 288 768: { 289 slidesPerView: 4, 290 slidesPerGroup: 4 291 }, 292 1200: { 293 loop: true, 294 slidesPerView: 5, 295 slidesPerGroup: 5, 296 } 297 } 298 }); 299}; 300 301window.initSwiperProductDetailPage2 = () => { 302 const swiperControlThumbs = document.querySelector('.detalle-prod-thumbs'); 303 const swiperControlImages = document.querySelector('.detalle-producto-imagenes'); 304 305 if (!swiperControlThumbs || !swiperControlImages) return; 306 307 // â Guarda instancia del thumbs (antes estabas pasando el elemento) 308 const thumbsSwiper = new Swiper(swiperControlThumbs, { 309 direction: 'vertical', 310 slidesPerView: 4, 311 spaceBetween: 10, 312 mousewheelControl: true, 313 scrollbar: { 314 el: '.js-swiper-scrollbar', 315 draggable: true, 316 snapOnRelease: true 317 } 318 }); 319 320 // â Define âmobile responsiveâ por ancho (esto es lo que QA está haciendo) 321 const isResponsiveMobile = window.matchMedia('(max-width: 991.98px)').matches; 322
323 // â Solo considera âdesktop mouseâ si NO estás en responsive mobile 324 const isDesktopMouse = 325 !isResponsiveMobile && 326 window.matchMedia('(hover: hover) and (pointer: fine)').matches; 327 328 const canPointerZoom = window.matchMedia('(hover: hover) and (pointer: fine)').matches; 329 // â Swiper de imágenes: pasa la instancia de thumbs y evita loop con zoom (menos glitches) 330 const imagesSwiper = new Swiper(swiperControlImages, { 331 loop: false, 332 spaceBetween: 10, 333 direction: 'horizontal', 334 thumbs: { swiper: thumbsSwiper }, 335 zoom: canPointerZoom ? { maxRatio: 4, minRatio: 1 } : false, 336 breakpoints: { 337 768: { 338 direction: 'vertical' 339 } 340 }, 341 // â Para que al hacer zoom (emulado o real) el drag no cambie de slide 342 nested: true, 343 touchStartPreventDefault: false, 344 passiveListeners: false, 345 // on: { 346 // zoomChange(swiper, scale) { 347 // const zoomed = !!scale && scale > 1; 348 // swiper.allowTouchMove = !zoomed; 349 // swiper.allowSlideNext = !zoomed; 350 // swiper.allowSlidePrev = !zoomed; 351 // }, 352 // zoomOut(swiper) { 353 // swiper.allowTouchMove = true; 354 // swiper.allowSlideNext = true; 355 // swiper.allowSlidePrev = true; 356 // } 357 // } 358 }); 359 360 // â Tu lógica de posicionamiento del zoom (CSS vars) 361 document.querySelectorAll('.zoom-container, .zoom-desktop').forEach(container => { 362 const img = container.querySelector('img'); 363 if (!img) return; 364 365 const setPos = (clientX, clientY) => { 366 const rect = container.getBoundingClientRect(); 367 const x = ((clientX - rect.left) / rect.width) * 100; 368 const y = ((clientY - rect.top) / rect.height) * 100; 369 img.style.setProperty('--x', `${x}%`); 370 img.style.setProperty('--y', `${y}%`); 371 }; 372 373 // â Si QA está en responsive (ancho pequeño), NO uses mousemove aunque haya mouse. 374 if (isDesktopMouse) { 375 container.addEventListener('mousemove', e => setPos(e.clientX, e.clientY)); 376 } else { 377 container.addEventListener( 378 'touchmove', 379 e => { 380 const t = e.touches[0]; 381 if (t) setPos(t.clientX, t.clientY); 382 }, 383 { passive: true } 384 ); 385 } 386 }); 387}; 388 389window.initSwiperProductDetailPage = () => { 390 const swiperControlThumbs = document.querySelector('.detalle-prod-thumbs'); 391 const swiperControlImages = document.querySelector('.detalle-producto-imagenes'); 392 393 if (!swiperControlThumbs || !swiperControlImages) return; 394 395 // â Guarda instancia del thumbs (antes estabas pasando el elemento).. 396 const thumbsSwiper = new Swiper(swiperControlThumbs, { 397 direction: 'vertical', 398 slidesPerView: 4, 399 spaceBetween: 10, 400 mousewheelControl: true, 401 scrollbar: { 402 el: '.js-swiper-scrollbar', 403 draggable: true, 404 snapOnRelease: true 405 } 406 }); 407 408 // â Define âmobile responsiveâ por ancho (esto es lo que QA está haciendo) 409 const isResponsiveMobile = window.matchMedia('(max-width: 991.98px)').matches; 410 411 // â Solo considera âdesktop mouseâ si NO estás en responsive mobile 412 const isDesktopMouse = 413 !isResponsiveMobile && 414 window.matchMedia('(hover: hover) and (pointer: fine)').matches; 415 416 const canPointerZoom = window.matchMedia('(hover: hover) and (pointer: fine)').matches; 417 // â Swiper de imágenes: pasa la instancia de thumbs y evita loop con zoom (menos glitches) 418 const imagesSwiper = new Swiper(swiperControlImages, { 419 loop: false, 420 spaceBetween: 10, 421 direction: 'horizontal', 422 thumbs: { swiper: thumbsSwiper }, 423 zoom: canPointerZoom ? { maxRatio: 4, minRatio: 1 } : false, 424 breakpoints: { 425 768: { 426 direction: 'vertical' 427 } 428 }, 429 // â Para que al hacer zoom (emulado o real) el drag no cambie de slide 430 nested: true, 431 touchStartPreventDefault: false, 432 passiveListeners: false, 433 // on: { 434 // zoomChange(swiper, scale) { 435 // const zoomed = !!scale && scale > 1; 436 // swiper.allowTouchMove = !zoomed; 437 // swiper.allowSlideNext = !zoomed; 438 // swiper.allowSlidePrev = !zoomed; 439 // }, 440 // zoomOut(swiper) { 441 // swiper.allowTouchMove = true; 442 // swiper.allowSlideNext = true; 443 // swiper.allowSlidePrev = true; 444 // } 445 // } 446 });
447 448 // â Tu lógica de posicionamiento del zoom (CSS vars) 449 document.querySelectorAll('.zoom-container, .zoom-desktop').forEach(container => { 450 const img = container.querySelector('img'); 451 if (!img) return; 452 453 const setPos = (clientX, clientY) => { 454 const rect = container.getBoundingClientRect(); 455 const x = ((clientX - rect.left) / rect.width) * 100; 456 const y = ((clientY - rect.top) / rect.height) * 100; 457 img.style.setProperty('--x', `${x}%`); 458 img.style.setProperty('--y', `${y}%`); 459 }; 460 461 // â Si QA está en responsive (ancho pequeño), NO uses mousemove aunque haya mouse. 462 if (isDesktopMouse) { 463 container.addEventListener('mousemove', e => setPos(e.clientX, e.clientY)); 464 } else { 465 container.addEventListener( 466 'touchmove', 467 e => { 468 const t = e.touches[0]; 469 if (t) setPos(t.clientX, t.clientY); 470 }, 471 { passive: true } 472 ); 473 } 474 }); 475}; 476
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.