PageSourceSearch

https://www.fundaciosunol.org/wp-content/themes/fsunol/js/crispshop-ajax.js?ver=1.0.0

js fundaciosunol.org collected 2026-10-02 11:05:48 UTC 5,075 bytes, 113 lines download raw bytes

1
2jQuery(document).ready(function() {
3
4        jQuery('.single_add_to_cart_button').click(function(e) {
5
6          e.preventDefault();
7
8          if(jQuery(this).is( ".disabled" )){
9            console.log('disabled');
10          }else{
11
12            var product_id = jQuery(this).val();
13
14          jQuery(this).addClass('adding-cart');
15              var variation_id = jQuery('input[name="variation_id"]').val();
16              var quantity_field_name = '#product-' + product_id + ' input[name="quantity"]';
17              console.log(quantity_field_name);
18            var quantity = jQuery(quantity_field_name).val();
19              console.log(quantity);
20              var dedicatoria = jQuery('input[name="dedicatoria-field"]').val();
21              jQuery('.cart-dropdown-inner').empty();
22
23              if (variation_id != '') {
24                jQuery.ajax ({
25                  url: crispshop_ajax_object.ajax_url,
26                  type:'POST',
27                  data:'action=crispshop_add_cart_single&product_id=' + product_id + '&variation_id=' + variation_id + '&quantity=' + quantity + '&dedicatoria_id=' + dedicatoria,
28                  //data:'action=crispshop_add_cart_single&product_id=' + product_id + '&variation_id=' + variation_id + '&quantity=' + quantity,
29
30                  success:function(results) {
31                    jQuery('.cart-dropdown-inner').append(results);
32                    var cartcount = jQuery('.item-count').html();
33                    jQuery('.cart-logo span').html(cartcount);
34                    jQuery('.single_add_to_cart_button').removeClass('adding-cart');
35                    jQuery('.cart-verification-sidebar').addClass('show');
36                    jQuery('.cart-verification-sidebar').addClass('show-cart');
37                    jQuery('.cart-sidebar__background').fadeIn(200);
38                    jQuery('body').css('overflow', 'hidden');
39                  }
40                });
41              } else {
42                jQuery.ajax ({
43                  url: crispshop_ajax_object.ajax_url,  
44                  type:'POST',
45                  data:'action=crispshop_add_cart_single&product_id=' + product_id + '&quantity=' + quantity + '&dedicatoria_id=' + dedicatoria,
46                  //data:'action=crispshop_add_cart_single&product_id=' + product_id + '&quantity=' + quantity,
47
48                  success:function(results) {
49                    jQuery('.cart-dropdown-inner').append(results);
50                    var cartcount = jQuery('.item-count').html();
51                    jQuery('.cart-logo span').html(cartcount);
52                    jQuery('.single_add_to_cart_button').removeClass('adding-cart');
53                    jQuery('.cart-verification-sidebar').addClass('show');
54                    jQuery('.cart-verification-sidebar').addClass('show-cart');
55                    jQuery('.cart-sidebar__background').fadeIn(200);
56                    jQuery('body').css('overflow', 'hidden');
57                  }
58                });
59              }
60
61          }
62
63      
64          
65        });
66
67
68      });
69
70      jQuery('.cart-logo').click(function(e) { // click boton carrito
71        jQuery('.cart-verification-sidebar').toggleClass('show');
72        jQuery('.cart-verification-sidebar').toggleClass('show-cart');
73        jQuery('.cart-sidebar__background').fadeIn(200);
74        jQuery('body').css('overflow', 'hidden');
75      });
76
77      jQuery('.cart-sidebar__background').click(function(e) { // click sidebar background
78        jQuery('.cart-verification-sidebar').toggleClass('show');
79        jQuery('.cart-verification-sidebar').removeClass('show-cart');
80        jQuery('.cart-sidebar__background').fadeOut(200);
81        jQuery('body').css('overflow', 'inherit');
82      });
83
84      function closeSidebar() {// click close sidebar svg
85        jQuery('.cart-verification-sidebar').toggleClass('show');
86        jQuery('.cart-verification-sidebar').removeClass('show-cart');
87        jQuery('.cart-sidebar__background').fadeOut(200);
88        jQuery('body').css('overflow', 'inherit');
89      }
90
91      function removeProductFunction(productID) {
92        var product_id = productID;
93        jQuery('.cart-dropdown-inner').empty();
94        jQuery('.spinner-cart__container').css("display", "flex");
95        jQuery.ajax ({
96            url: crispshop_ajax_object.ajax_url,  
97            type:'POST',
98            data:'action=removeProduct&product_id=' + product_id,
99
100            success:function(results) {
101              jQuery('.spinner-cart__container').css("display", "none");
102              jQuery('.cart-dropdown-inner').append(results);
103              var cartcount = jQuery('.item-count').html();
104              jQuery('.cart-logo span').html(cartcount);
105              jQuery('.single_add_to_cart_button').removeClass('adding-cart');
106              jQuery('.cart-verification-sidebar').addClass('show');
107              jQuery('.cart-verification-sidebar').addClass('show-cart');
108              jQuery('.cart-sidebar__background').fadeIn(200);
109              jQuery('body').css('overflow', 'hidden');
110            } 
111        }); 
112      } 
113

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.