PageSourceSearch

https://phoenixfinancial.co.il/wp-content/plugins/irm-subscription/assets/js/irm-ajax.js?1790847168&ver=1.0

js phoenixfinancial.co.il collected 2026-10-05 23:17:40 UTC 7,962 bytes, 249 lines download raw bytes

1jQuery(document).ready(function($) {
2    console.log('irm-ajax.js loaded');
3
4    function request_ajax_follow($terms, $this) {
5        var data = {
6            'action': 'irm_ajax_follow_taxonomy',
7            'nonce': irm_ajax_params.nonce, 
8            'terms': $terms
9        };
10
11        // add loading class
12        $this.addClass('ajax-loading');
13
14        $.post(irm_ajax_params.ajaxurl, data, function(response) {
15            console.log(response);
16            if (response.success) {
17                $this.text(response.data.message);
18                // rename data attribute
19                $this.attr('data-unsubscribe-from-terms', $terms);
20
21                // remove old data attribute
22                $this.removeAttr('data-subscribe-to-terms');
23
24                $this.removeClass('ajax-loading');
25                $this.addClass('irm-following');
26            }else{
27                // create error popup
28                const popup = new Popup("", response.data.message, ["error-popup"]);
29                popup.showPopup();
30                $this.removeClass('ajax-loading');
31            }
32        });
33    }
34
35    $(document).on('click', '[data-subscribe-to-terms]:not(.irm-following)', function(e) {
36        e.preventDefault();
37        
38        var $this = $(this);
39        var $terms = $this.data('subscribe-to-terms');
40
41        console.log('terms: ' + $terms);
42
43        if($terms) {
44            request_ajax_follow($terms, $this);
45        }
46
47    });
48
49    function request_ajax_subscription_form($form, $this) {
50        var data = {
51            'action': 'irm_subscription_form',
52            'nonce': irm_ajax_params.nonce, 
53            'data': $form
54        };
55
56        // add loading class
57        $this.addClass('ajax-loading');
58
59        $.post(irm_ajax_params.ajaxurl, data, function(response) {
60            console.log(response);
61            if (response.success) {
62                // remove error message
63                $this.find('.irm-subscription-form__message').remove();
64
65                // append success message
66                $this.append('<div class="irm-subscription-form__message success">'+response.data.message+'</div>');
67
68                // remove form
69                // $this.find('.irm-subscription-form__form').remove();
70
71                // remove loading class
72                $this.removeClass('ajax-loading');
73
74            }else{
75                // remove error message
76                $this.find('.irm-subscription-form__message').remove();
77
78                // append error message
79                $this.append('<div class="irm-subscription-form__message error">'+response.data.message+'</div>');
80
81                // remove loading class
82                $this.removeClass('ajax-loading');
83            }
84        });
85    }
86
87    $(document).on('submit', '.irm-subscription-form', function(e) {
88        e.preventDefault();
89        
90        var $this = $(this);
91        var $data = $this.serialize();
92
93        console.log($data);
94
95        if($data) {
96            request_ajax_subscription_form($data, $this);
97        }
98
99
100    });
101
102    function request_ajax_unfollow($terms, $this) {
103        var data = {
104            'action': 'irm_ajax_unfollow_taxonomy',
105            'nonce': irm_ajax_params.nonce, 
106            'terms': $terms
107        };
108
109        // add loading class
110        $this.addClass('ajax-loading');
111
112        $.post(irm_ajax_params.ajaxurl, data, function(response) {
113            console.log(response);
114            if (response.success) {
115                $this.text(response.data.message);
116                // rename data attribute
117                $this.attr('data-subscribe-to-terms', $terms);
118
119                // remove old data attribute
120                $this.removeAttr('data-unsubscribe-from-terms');
121
122                $this.removeClass('ajax-loading');
123                $this.removeClass('irm-following');
124            }else{
125                // create error popup
126                const popup = new Popup("", response.data.message, ["error-popup"]);
127                popup.showPopup();
128                $this.removeClass('ajax-loading');
129            }
130        });
131    }
132
133    $(document).on('click', '[data-unsubscribe-from-terms]', function(e) {
134        e.preventDefault();
135        
136        var $this = $(this);
137        var $terms = $this.data('unsubscribe-from-terms');
138
139        console.log('terms: ' + $terms);
140
141        if($terms) {
142            request_ajax_unfollow($terms, $this);
143        }
144
145    });
146
147    function request_ajax_unsubscription_form($form, $this) {
148        var data = {
149            'action': 'irm_unsubscription_form',
150            'nonce': irm_ajax_params.nonce, 
151            'data': $form
152        };
153
154        // add loading class
155        $this.addClass('ajax-loading');
156
157        $.post(irm_ajax_params.ajaxurl, data, function(response) {
158            console.log(response);
159            if (response.success) {
160                // remove error message
161                $this.find('.irm-unsubscription-form__message').remove();
162
163                // append success message
164                $this.append('<div class="irm-unsubscription-form__message success">'+response.data.message+'</div>');
165
166                // remove form
167                // $this.find('.irm-unsubscription-form__form').remove();
168
169                // remove loading class
170                $this.removeClass('ajax-loading');
171
172            }else{
173                // remove error message
174                $this.find('.irm-unsubscription-form__message').remove();
175
176                // append error message
177                $this.append('<div class="irm-unsubscription-form__message error">'+response.data.message+'</div>');
178
179                // remove loading class
180                $this.removeClass('ajax-loading');
181            }
182        });
183    }
184
185    $(document).on('submit', '.irm-unsubscription-form', function(e) {
186        e.preventDefault();
187        
188        var $this = $(this);
189        var $data = $this.serialize();
190
191        console.log($data);
192
193        if($data) {
194            request_ajax_unsubscription_form($data, $this);
195        }
196    });
197
198    $(document).on('submit', '.irm-guest-unsubscription-form', function(e) {
199        e.preventDefault();
200        
201        var $this = $(this);
202        var $data = $this.serialize();
203
204        console.log($data);
205
206        if($data) {
207            request_ajax_guest_unsubscription_form($data, $this);
208        }
209    });
210
211    function request_ajax_guest_unsubscription_form($form, $this) {
212        var data = {
213            'action': 'irm_guest_unsubscription_form',
214            'nonce': irm_ajax_params.nonce, 
215            'data': $form
216        };
217
218        // add loading class
219        $this.addClass('ajax-loading');
220
221        $.post(irm_ajax_params.ajaxurl, data, function(response) {
222            console.log(response);
223            if (response.success) {
224                // remove error message
225                $this.find('.irm-unsubscription-form__message').remove();
226
227                // append success message
228                $this.append('<div class="irm-unsubscription-form__message success">'+response.data.message+'</div>');
229
230                // remove form
231                // $this.find('.irm-unsubscription-form__form').remove();
232
233                // remove loading class
234                $this.removeClass('ajax-loading');
235
236            }else{
237                // remove error message
238                $this.find('.irm-unsubscription-form__message').remove();
239
240                // append error message
241                $this.append('<div class="irm-unsubscription-form__message error">'+response.data.message+'</div>');
242
243                // remove loading class
244                $this.removeClass('ajax-loading');
245            }
246        });
247    }
248
249});

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.