PageSourceSearch

https://www.wellnessliving.com/blog/wp-content/themes/helpguru/js/unsubscribe.js?ver=1.6

js wellnessliving.com collected 2026-09-24 08:47:38 UTC 2,548 bytes, 81 lines download raw bytes

1const Unsubscribe = {
2    email: '',
3    token: '',
4    data: {},
5    wl_ajax : wl_ajax,
6    invalid_email_error_text: 'Invalid Email Address',
7    init: function () {
8        this.form_control();
9    },
10    form_control: function () {
11        let self = this;
12        jQuery('.js-formEmailButton').click(function (e) {
13            e.preventDefault();
14            let formSend = true;
15            self.email = jQuery('#email-address').val();
16            if ( ! self.isEmail() ) {
17                jQuery('#email-address').addClass('error-field');
18                jQuery('.js-error-text').html('').html(self.invalid_email_error_text);
19                formSend = false;
20            }
21
22            jQuery('#email-address').click(function () {
23                jQuery(this).removeClass('error-field');
24                jQuery('.js-error-text').html('');
25            });
26
27            if ( ! formSend )
28                return false;
29            else
30                self.ajaxSendEmail();
31
32        });
33    },
34    isEmail: function () {
35        let EmailRegex = /^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/;
36        return EmailRegex.test(this.email);
37    },
38    ajaxSendEmail: function () {
39        let self = this;
40
41        this.token = window.location.search.split('=')[1];
42
43        this.data.action = 'lead_unsubscribe';
44        this.data.token = this.token;
45        this.data.email = this.email;
46        this.data.nonce_code = this.wl_ajax.nonce;
47
48        self.disableForm();
49
50        jQuery.ajax({
51            type: "POST",
52            url: this.wl_ajax.url,
53            data: this.data,
54            success: function (response) {
55                self.unDisableForm();
56                if ( response.success ) {
57                    jQuery('.js-success-text').html('').html(response.data.message);
58                }
59                else {
60                    jQuery('.js-error-text').html('').html(response.data.message);
61                }
62            },
63            error: function (response) {
64                self.unDisableForm();
65                console.log('error - response : ', response)
66            }
67        });
68    },
69    disableForm: function () {
70        jQuery('#email-address').prop('disabled', true);
71        jQuery('.js-formEmailButton').prop('disabled', true);
72        jQuery('.loading').show();
73    },
74    unDisableForm: function () {
75        jQuery('#email-address').removeAttr('disabled');
76        jQuery('.js-formEmailButton').removeAttr('disabled');
77        jQuery('.loading').hide();
78    }
79};
80
81Unsubscribe.init();

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.