PageSourceSearch

https://istuprofi.ru/wp-content/plugins/learnpress/assets/js/front…?nocache=1790379144.1216&ver=3.2.5.3

js istuprofi.ru collected 2026-09-25 23:32:46 UTC 3,579 bytes, 93 lines download raw bytes

1/**
2 * Become a Teacher form handler
3 *
4 * @author ThimPress
5 * @package LearnPress/JS
6 * @version 3.0.0
7 */
8if (typeof jQuery === 'undefined') {
9    console.log('jQuery is not defined');
10} else {
11    (function ($) {
12        $(document).ready(function () {
13            $('form[name="become-teacher-form"]').each(function () {
14                var $form = $(this),
15                    $submit = $form.find('button[type="submit"]'),
16                    hideMessages = function () {
17                        $('.learn-press-error, .learn-press-message').fadeOut('fast', function () {
18                            $(this).remove()
19                        });
20                    },
21                    showMessages = function (messages) {
22                        var m = [];
23                        if ($.isPlainObject(messages)) {
24                            for (var i in messages) {
25                                m.push($(messages[i]));
26                            }
27                        } else if ($.isArray(messages)) {
28                            m = messages.reverse();
29                        } else {
30                            m = [messages];
31                        }
32                        for (var i = 0; i < m.length; i++) {
33                            $(m[i]).insertBefore($form);
34                        }
35
36                    },
37                    blockForm = function (block) {
38                        return $form.find('input, select, button, textarea')
39                            .prop('disabled', !!block)
40                    },
41                    beforeSend = function () {
42                        hideMessages();
43
44                        blockForm(true)
45                            .filter($submit)
46                            .data('origin-text', $submit.text())
47                            .html($submit.data('text'));
48
49                    },
50                    ajaxSuccess = function (response) {
51                        response = LP.parseJSON(response);
52                        if (response.message) {
53                            showMessages(response.message)
54                        }
55
56                        blockForm().filter($submit).html($submit.data('origin-text'));
57
58                        if (response.result === 'success') {
59                            $form.remove();
60                        } else {
61                            $submit.prop('disabled', false);
62                            $submit.html($submit.data('text'));
63                        }
64
65                    },
66                    ajaxError = function (response) {
67                        response = LP.parseJSON(response);
68
69                        if (response.message) {
70                            showMessages(response.message)
71                        }
72
73                        blockForm().filter($submit).html($submit.data('origin-text'));
74                    };
75
76                $form.submit(function () {
77                    if ($form.triggerHandler('become_teacher_send') !== false) {
78                        $.ajax({
79                            url: window.location.href.addQueryVar('lp-ajax', 'request-become-a-teacher'),
80                            data: $form.serialize(),
81                            dataType: 'text',
82                            type: 'post',
83                            beforeSend: beforeSend,
84                            success: ajaxSuccess,
85                            error: ajaxError
86                        });
87                    }
88                    return false;
89                });
90            })
91        });
92    })(jQuery);
93}

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.