PageSourceSearch

https://guideposts.org/wp-content/themes/astra-guideposts/assets/js/custom-ajax.js

js guideposts.org collected 2026-09-24 09:03:46 UTC 6,464 bytes, 183 lines download raw bytes

1jQuery(document).ready(function($) {
2
3
4    $(document).on('click', '.recentfillter .wpfFilterTitle', function (e) {
5        e.preventDefault();
6
7        const $icon   = $(this).find('.wpfTitleToggle');
8        const $target = $(this).parent().find('.recent-viewed-products'); 
9        if ($icon.hasClass('fa-minus')) {            
10            $icon.removeClass('fa-minus').addClass('fa-plus');
11            $target.addClass('wpfHide');
12        } else {           
13            $icon.removeClass('fa-plus').addClass('fa-minus');
14            $target.removeClass('wpfHide');
15        }
16    });
17
18    //  $(document).on('click', '.nk-trigger-add-to-cart', function(e){
19    //     e.preventDefault();
20    //     $(this).addClass('additems');
21    //     alert('hi');
22    //     // $(this).text('Adding to cart...').prop('disabled', true); 
23    //     // Find and click the native add-to-cart button
24    //     $('.single_add_to_cart_button').trigger('click');
25    // });
26
27     
28    /********************* Donate cart page js *********************************/
29    $(document).on("click", ".donatecustom_price_submit", function(e) {  
30        e.preventDefault();  
31        //alert('teet');  
32        $('#donateoption').val(1);  
33
34        if ($('#custom_price').val().trim() == '') {  
35            $('.msg').html('please enter or select value');  
36            return;  
37        }  
38        $amount = $('#custom_price').val();
39        $pid = $('#donationpid').val();
40    
41
42             $.ajax({
43            type: 'POST',
44            url: ajax_object.ajax_url,
45            data: {
46                action: 'update_cart_item_price',
47                pid: $pid,
48                price: $amount
49            },
50            success: function(response) {
51                //console.log(response);
52               window.location.reload();
53            },
54            error: function(xhr, status, error) {
55                console.error(xhr.responseText);
56                // Optionally, you can handle errors here (e.g., display an error message)
57            }
58        });
59        //$('.woocommerce-cart-form').trigger('submit');
60        // window.location.reload();  
61    });  
62
63    /********************* end Donate cart page js *********************************/
64    // $('#shop_search').on('keyup', function () {
65    //     alert('eee');
66    //         let searchTerm = $(this).val().trim();
67
68    //         if (searchTerm.length === 0) {
69    //             $('#search-loader').fadeOut(200);
70    //             $('#ajax-search-results').fadeOut(200, function () {
71    //                 $(this).html(''); // clear the results after fade out
72    //             });
73    //             $('#overlay').fadeIn(200);
74    //         } else {
75    //             $('#overlay').fadeOut(200);
76    //             $('#search-loader').fadeIn(200);
77
78    //             $.ajax({
79    //                 type: 'POST',
80    //                 url: ajax_object.ajax_url,
81    //                 data: {
82    //                     action: 'custom_ajax_product_search',
83    //                     term: searchTerm,
84    //                 },
85    //                 success: function (response) {
86    //                     $('#search-loader').fadeOut(200);
87    //                     $('#ajax-search-results').html(response).fadeIn(200);
88    //                 }
89    //             });
90    //         }
91    //     });
92
93});
94
95/********************* ATC popup open page js *********************************/
96// jQuery(function($) {
97//     $('form.cart').on('submit', function(e) {
98//         e.preventDefault(); // Prevent default form submission
99
100//         var $form = $(this);
101//         var $button = $form.find('.single_add_to_cart_button');
102//         var originalText = $button.text();
103//         var formData = $form.serialize(); // Serialize form data
104
105//         // Show loading state
106//         $button.text('Adding to cart...').prop('disabled', true);      
107    
108//     });
109// });
110
111
112jQuery(document.body).on('wc_fragments_refreshed', function() {    
113    if (jQuery('body').hasClass('single-product')) {
114        jQuery(".woocommerce-notices-wrapper").hide();
115         if (jQuery('.widget_shopping_cart_content .woocommerce-mini-cart').length > 0) {
116            jQuery('#elementor-menu-cart__toggle_button').trigger('click');
117        }
118    } 
119  
120 });  
121 
122/********************* ATC popup open page js *********************************/
123
124/********************* stacky header *********************************/
125document.addEventListener("DOMContentLoaded", function () {
126  // Skip on WooCommerce cart and single product pages
127  if (
128    document.body.classList.contains("woocommerce-cart") ||
129    document.body.classList.contains("single-product")
130  ) {
131    return;
132  }
133
134  const header = document.querySelector(".ast-custom-header");
135  if (!header) return;
136
137   let lastScroll = 0;
138
139  window.addEventListener("scroll", function () {
140    const currentScroll = window.scrollY;
141
142    // Apply sticky at the start of scroll
143    if (currentScroll > 0) {
144      header.style.setProperty("position", "sticky", "important");
145      header.style.setProperty("top", "0px", "important");
146    //  header.style.setProperty("z-index", "9999", "important");
147     // header.style.setProperty("transition", "top 0.9s ease-in-out", "important");
148    }
149
150    // Only hide if scrolled past 250px
151    if (currentScroll > 250) {
152      if (currentScroll > lastScroll) {
153        // Scrolling down → hide header
154        header.style.setProperty("top", "-250px", "important");
155      } else {
156        // Scrolling up → show header
157        header.style.setProperty("top", "0px", "important");
158      }
159    }
160
161    lastScroll = currentScroll <= 0 ? 0 : currentScroll;
162  });
163}); 
164
165document.addEventListener("click", function(e) {
166  const infoModal = document.getElementById("infoModal");
167  const closeModal = document.getElementById("closeModal");
168
169  // Open modal when clicking on info icon (even after AJAX reload)
170  if (e.target.closest("#infoShip")) {
171    infoModal.style.display = "flex";
172  }
173
174  // Close modal when clicking the close button
175  if (e.target.closest("#closeModal")) {
176    infoModal.style.display = "none";
177  }
178
179  // Close modal when clicking outside the content
180  if (e.target === infoModal) {
181    infoModal.style.display = "none";
182  }
183});

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.