PageSourceSearch

https://irtranslate.com/wp-content/plugins/sar-referral-form/assets/js/main.js?ver=1.0.2

js irtranslate.com collected 2026-10-09 22:40:00 UTC 2,957 bytes, 74 lines download raw bytes

1(function ($) {
2    'use strict';
3
4    $(document).ready(function () {
5
6        $(document).on('submit', '.sar-rf-form', function (e) {
7            e.preventDefault();
8
9            var form = $(this);
10            var messageDiv = form.next('.sar-rf-message');
11            var submitButton = form.find('.sar-rf-submit-button');
12            var originalButtonText = submitButton.html(); 
13            var formData = form.serialize();
14            formData += '&action=sar_submit_referral_form';
15            
16            $.ajax({
17                type: 'POST',
18                url: sar_ajax_object.ajax_url, 
19                data: formData,
20                beforeSend: function () {
21                    submitButton.prop('disabled', true).html('در حال ارسال...');
22                    messageDiv.hide().empty();
23                },
24                success: function (response) {
25                    if (response.success) {
26                        var widgetId = form.attr('id').replace('sar-referral-form-', '');
27                        var popup = $('#sar-popup-' + widgetId);
28                        var codeInput = $('#sar-generated-code-' + widgetId);
29                        
30                        codeInput.val(response.data.code);
31                        popup.css('display', 'flex').hide().fadeIn();
32                        form[0].reset();
33                    } else {
34                        messageDiv.html('<p class="sar-rf-error">' + response.data.message + '</p>').fadeIn();
35                    }
36                },
37                error: function () {
38                    messageDiv.html('<p class="sar-rf-error">خطایی در ارتباط با سرور رخ داد.</p>').fadeIn();
39                },
40                complete: function () {
41                    submitButton.prop('disabled', false).html(originalButtonText);
42                }
43            });
44        });
45
46        $(document).on('click', '.sar-rf-copy-button', function () {
47            var copyButton = $(this);
48            var codeInput = copyButton.siblings('input');
49            
50            navigator.clipboard.writeText(codeInput.val()).then(function() {
51                var originalText = copyButton.text();
52                copyButton.text('کپی شد!');
53                setTimeout(function () {
54                    copyButton.text(originalText);
55                }, 2000);
56            }, function() {
57                alert('خطا در کپی کردن کد.');
58            });
59        });
60
61        $(document).on('click', '.sar-rf-popup-close', function () {
62            $(this).closest('.sar-rf-popup-overlay').fadeOut();
63        });
64
65        $(document).on('click', '.sar-rf-popup-overlay', function () {
66            $(this).fadeOut();
67        });
68
69        $(document).on('click', '.sar-rf-popup-content', function (e) {
70            e.stopPropagation();
71        });
72    });
73
74})(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.