PageSourceSearch

https://www.tiendacpu.com/modules/iqitthemeeditor/views/js/custom_s_1.js

js tiendacpu.com collected 2026-10-04 01:31:01 UTC 2,666 bytes, 71 lines download raw bytes

1 $(document).ready(function() {
2    var $titleBar = $('.product-info-row > .col-12.mb-3').first();
3    
4    // --- FUNCIÓN NUEVA: BORRAR EL TEXTO DE LAS OPINIONES ---
5    function limpiarOpiniones() {
6        // Buscamos el enlace de NetReviews (el padre de las estrellas)
7        $('.netreviews_cpt_recap a, #netreviews_cpt_recap a').each(function() {
8            // Este código elimina solo los trozos de texto "sueltos" (como "1 opinión") 
9            // pero respeta las etiquetas <span> e <img> donde viven las estrellas.
10            $(this).contents().filter(function() {
11                return this.nodeType === 3; // 3 significa "Nodo de Texto"
12            }).remove();
13        });
14    }
15
16    // Ejecutamos la limpieza nada más cargar la web
17    limpiarOpiniones();
18
19    if($titleBar.length) {
20        var stickyOffset = $titleBar.offset().top;
21        
22        var $placeholder = $('<div class="sticky-placeholder"></div>').css({
23            'height': $titleBar.outerHeight() + 'px',
24            'display': 'none',
25            'width': '100%'
26        });
27        $titleBar.after($placeholder);
28
29        $(window).scroll(function() {
30            var scrollPos = $(window).scrollTop();
31            var windowWidth = $(window).width();
32            
33            var threshold;
34            if (windowWidth > 768) {
35                var alturaMenu = 160; 
36                threshold = stickyOffset - alturaMenu;
37            } else {
38                threshold = stickyOffset; 
39            }
40            
41            if (scrollPos > threshold) {
42                $titleBar.addClass('is-sticky-fixed');
43                
44                // --- LIMPIEZA EXTRA AL ACTIVAR EL STICKY ---
45                // Por si el navegador vuelve a renderizar el texto al mover el elemento
46                limpiarOpiniones();
47
48                if (windowWidth > 768) {
49                    $titleBar.css('width', $placeholder.width() + 'px');
50                } else {
51                    $titleBar.css('width', '100%');
52                }
53                $placeholder.show();
54            } else {
55                $titleBar.removeClass('is-sticky-fixed');
56                $titleBar.css('width', ''); 
57                $placeholder.hide();
58            }
59        });
60        
61        $(window).resize(function() {
62            if($titleBar.hasClass('is-sticky-fixed')) {
63                if ($(window).width() > 768) {
64                    $titleBar.css('width', $placeholder.width() + 'px');
65                } else {
66                    $titleBar.css('width', '100%');
67                }
68            }
69        });
70    }
71});

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.