PageSourceSearch

https://blackparakeetztoo.com/wp-content/plugins/woo-gift-cards-li…gifr_cards_lite_check_balance.js?ver=3.2.12

js blackparakeetztoo.com collected 2026-10-08 08:10:15 UTC 6,653 bytes, 145 lines download raw bytes

1(function( $ ) {
2
3	'use strict';
4	jQuery( document ).ready(
5		function($){
6            $( document ).on(
7                'click',
8                '#wps_check_balance',
9                function(){
10
11                    var email = $( '#gift_card_balance_email' ).val();
12                    var coupon = $( '#gift_card_code' ).val();
13
14                    $( "#wps_wgm_loader" ).show();
15                    var data = {
16                        action:'wps_uwgc_check_gift_balance_org',
17                        email:email,
18                        coupon:coupon,
19                        wps_wgm_nonce_check:wps_wgm_check_balance.wps_nonce_check
20                    };
21                    $.ajax(
22                        {
23                            url: wps_wgm_check_balance.ajaxurl,
24                            type: "POST",
25                            data: data,
26                            dataType :'json',
27                            success: function(response) {
28                                console.log(response)
29                                $( "#wps_wgm_loader" ).hide();
30                                if (response.result == true) {
31                                    var html = response.html;
32                                    var html_balance = response.html;
33                                    $('#wps_myaccount_balance_notice').remove()
34                                } else {
35                                    var message = response.message;
36                                    var html = '<b style="color:red; margin-left:2%">' + message + '</b>';
37                                    var html_notice = '<div class="woocommerce-error" id="wps_myaccount_balance_notice" role="alert">'+message+'</div>';
38                                }
39                                $( "#wps_notification" ).html( html );
40
41                                $('#wps_balance').html(html_balance)
42                                $("#wps-check-balamce-error").html(html_notice)
43
44                                // Initialize copy button functionality after AJAX response
45                                setTimeout(function() {
46                                    initializeCopyButtons();
47                                }, 100);
48                            }
49                        }
50                    );
51                }
52            );
53
54            // Copy button functionality
55            function initializeCopyButtons() {
56                $('.wps-copy-balance-btn').off('click').on('click', function() {
57                    var button = $(this);
58                    var couponCode = button.attr('data-coupon');
59                    var originalText = button.text();
60                    var buttonColor = wps_wgm_check_balance.button_color || '#17a2b8';
61
62                    // Modern clipboard API
63                    if (navigator.clipboard && navigator.clipboard.writeText) {
64                        navigator.clipboard.writeText(couponCode).then(function() {
65                            button.text('Copied!');
66                            button.css('background', '#28a745');
67
68                            setTimeout(function() {
69                                button.text(originalText);
70                                button.css('background', buttonColor);
71                            }, 2000);
72                        }).catch(function(err) {
73                            console.error('Failed to copy:', err);
74                        });
75                    } else {
76                        // Fallback for older browsers
77                        var textArea = document.createElement('textarea');
78                        textArea.value = couponCode;
79                        textArea.style.position = 'fixed';
80                        textArea.style.left = '-999999px';
81                        document.body.appendChild(textArea);
82                        textArea.select();
83
84                        try {
85                            document.execCommand('copy');
86                            button.text('Copied!');
87                            button.css('background', '#28a745');
88
89                            setTimeout(function() {
90                                button.text(originalText);
91                                button.css('background', buttonColor);
92                            }, 2000);
93                        } catch (err) {
94                            console.error('Failed to copy:', err);
95                        }
96
97                        document.body.removeChild(textArea);
98                    }
99                });
100            }
101
102            // PAR compatibility.
103            jQuery(document).on('click', '#wps_wgm_redeem_coupon', function(){
104                
105                jQuery(this).prop('disabled', true);
106                jQuery('#wps_wgm_coupon_redeem_notify').html('');
107                jQuery('.wps_wgm_coupon_redeem_loader').css( 'display', 'inline-block' );
108                var coupon_code = jQuery('#wps_wgm_coupon_redeem_value').val().trim();
109                if ( '' == coupon_code ) {
110
111                    jQuery('#wps_wgm_coupon_redeem_notify').show();
112                    jQuery('#wps_wgm_coupon_redeem_notify').html('<b style="color:red;">' + wps_wgm_check_balance.empty_msg + '</b>');
113                    jQuery(this).prop('disabled', false);
114                    jQuery('.wps_wgm_coupon_redeem_loader').hide();
115                } else {
116
117                    var data = {
118                        'action'              : 'redeem_gift_card_coupon',
119                        'wps_wgm_nonce_check' :wps_wgm_check_balance.wps_nonce_check,
120                        'coupon_code'         : coupon_code,
121                    };
122
123                    jQuery.ajax({
124                        'method' : 'POST',
125                        'url'    : wps_wgm_check_balance.ajaxurl,
126                        'data'   : data,
127                        success  : function(response) {
128                            jQuery('#wps_wgm_coupon_redeem_notify').show();
129                            jQuery('#wps_wgm_redeem_coupon').prop('disabled', false);
130                            jQuery('.wps_wgm_coupon_redeem_loader').hide();
131                            if ( true == response.result ) {
132
133                                jQuery('#wps_wgm_coupon_redeem_notify').html('<b style="color:green;">' + response.msg + '</b>');
134                            } else {
135
136                                jQuery('#wps_wgm_coupon_redeem_notify').html('<b style="color:red;">' + response.msg + '</b>');
137                            }
138                        }
139                    });
140                }
141            });
142        }
143    );
144
145})( jQuery );

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.