PageSourceSearch

https://www.comercialveterinaria.com/themes/dfd-comercialveterinaria/assets/js/custom.js

js comercialveterinaria.com collected 2026-10-08 08:32:36 UTC 4,692 bytes, 167 lines download raw bytes

1
2$( document ).ready( function() {
3    // Mover modal de mi cuenta
4    $( 'body' ).append( $( '#userinfo_modal' ) );
5
6    // Header/menu estático
7    $( window ).scroll(function()
8    {
9        var navpos1 = $( window ).scrollTop();
10        if ( navpos1 > 100 )
11        {
12            $( '#header' ).addClass( 'fixed' );
13        }
14        else
15        {
16            $( '#header' ).removeClass( 'fixed' );
17        }
18    });
19
20    // Botón volver arriba
21    $( ".back-top" ).hide();
22    $(function () {
23
24        $(window).scroll(function () {
25            if ( $(this).scrollTop() > 150 )
26            {
27                $( '.back-top' ).fadeIn();
28            }
29            else
30            {
31                $( '.back-top' ).fadeOut();
32            }
33        });
34
35        $( '.back-top' ).click(function () {
36
37            $( 'body,html' ).animate({
38                scrollTop: 0
39            }, 1000 );
40
41            return false;
42        });
43    });
44
45
46    // Carrito lateral
47    $( "#header .blockcart" ).click(function() 
48    {
49        var pathname = window.location.pathname;
50
51        if( pathname != "/pedido" && pathname != "/carrito" )
52        {
53            if( $( "#blockcart-modal" ).length == 0 )
54            {
55                var refreshURL = $('.blockcart').data( 'refresh-url' );
56                var requestData = {
57                    action: "add-to-cart"
58                };
59        
60                $.post( refreshURL, requestData ).then(function ( resp ) 
61                {
62                    if ( resp.modal ) 
63                    {
64                        $( 'body' ).append( resp.modal );
65                        $( '#blockcart-modal' ).modal( 'show' );
66                    }
67        
68                }).fail(function ( resp ) {
69                    prestashop.emit( 'handleError', { eventType: 'updateShoppingCart', resp: resp });
70                });
71            }
72            else
73            {
74                $( '#blockcart-modal' ).modal( 'show' );
75            }
76        }
77        else
78        {
79            window.location.href = $( this ).data( 'url' );
80        }
81        
82    });
83
84    // Cambiar el icono mostrar/ocultar contraseña
85    for( let i = 0 ; i < $( 'div.input-password-generic span.input-group-btn button' ).length ; i++ )
86    {
87        $( 'div.input-password-generic span.input-group-btn button' )[i].innerHTML = '<img src="/themes/dfd-comercialveterinaria/assets/img/icons/view-eye.png" width="24" height="24" />';
88        $( 'div.input-password-generic span.input-group-btn button' ).on( 'click', function()
89        {
90            var icon = '';
91            if( $( 'div.input-password-generic input' )[i].type == 'password' )
92            {
93                icon = '<img src="/themes/dfd-comercialveterinaria/assets/img/icons/view-eye.png" width="24" height="24"/>';
94            }
95            else
96            {
97                icon = '<img src="/themes/dfd-comercialveterinaria/assets/img/icons/hidden-eye.png" width="24" height="24"/>';
98            }
99
100            $( 'div.input-password-generic span.input-group-btn button' )[i].innerHTML = icon;
101
102        });
103    }
104
105    // Mostrar barra de busqueda
106    $( '.mobile_search' ).click( function(){
107        var search = $( '#mobile_search' );
108
109        if( search.hasClass( 'hidden' ) )
110        {
111        search.removeClass( 'hidden' );
112        }
113        else
114        {
115        search.addClass( 'hidden' );
116        }
117    });
118
119    // Carrusel top bar
120    let mobile = false;
121    let slidesTimeout = false;
122    let slideIndex = 0;
123
124    function showSlides() {
125        let i;
126        let slides = document.getElementsByClassName("slider_item_topbar");
127        for (i = 0; i < slides.length; i++) {
128            slides[i].style.display = "none";  
129        }
130        slideIndex++;
131        if (slideIndex > slides.length) {slideIndex = 1}    
132
133        slides[slideIndex-1].style.display = "block";  
134        slidesTimeout = setTimeout(showSlides, 4000); // Change image every 4 seconds
135    }
136
137    if( window.innerWidth <= 1200 ){
138        showSlides();
139    }
140
141    $(window).resize(function() {
142
143        //Si la resolución es menor a 991 empezar el carrusel
144        if( window.innerWidth <= 1200 )
145        {
146            if( !mobile )
147            {
148                mobile = true;
149                let slideIndex = 0;
150                showSlides();
151            }
152        }
153        //Si es escritorio mostrar todo
154        else
155        {
156            mobile = false;
157            clearTimeout(slidesTimeout);
158            let slides = document.getElementsByClassName("slider_item_topbar");
159            for (i = 0; i < slides.length; i++) {
160                slides[i].style.display = "block";  
161            }
162        }
163    })
164
165});
166
167

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.