PageSourceSearch

https://volhovogni.ru/static/uil/export/project_mo_theme_short_17/…/scripts/grid-form.js?20260220202337

js volhovogni.ru collected 2026-10-02 17:18:19 UTC 2,670 bytes, 70 lines download raw bytes

1$(window).on('load', function uil_init_grid_form() {
2
3    var DELAY_TIMEOUT = 500;
4
5    function init($root) {
6        if (window['grid-form'] !== undefined) return;
7        window['grid-form'] = true;
8        $root.find('.uil-grid-form').find('.uil-grid-form__item__body__item[data-grid-form-max-length]').each(function (i) {
9            var $container = $(this),
10                $input = $container.find('input[name], textarea[name]'),
11                name = $input.attr('name'),
12                id_counter = 'max_length_' + name + '_' + i,
13                max_length = parseInt($container.attr('data-grid-form-max-length')),
14                editor = tinyMCE.editors['id_' + name];
15
16            $container.parent().append(
17                '<div class="uil-grid-form__item__body__item">' +
18                '<div class="uil-grid-form__content uil-grid-form__content_help-text">' +
19                'Оставшееся количество символов: <span id="' + id_counter + '">' + max_length + '</span>' +
20                '</div>' +
21                '</div>'
22            );
23            var $counter = $('#' + id_counter);
24
25            if (editor !== undefined) {
26
27                var handler_tinymce = function () {
28                    var cur_length;
29                    try {
30                        cur_length = editor.getContent().length;
31                    } catch (e) {
32                    }
33                    if (cur_length !== undefined) {
34                        $counter.text(max_length - cur_length);
35                        if (cur_length > max_length)
36                            $counter.addClass('warning');
37                        else
38                            $counter.removeClass('warning');
39                    }
40                };
41
42                editor.on('Click DblClick MouseDown MouseUp KeyDown KeyPress KeyUp Init SetContent Change', $.debounce(DELAY_TIMEOUT, handler_tinymce));
43                handler_tinymce();
44
45            } else {
46
47                var handler_simple = function () {
48                    var cur_length = $input.val().length;
49                    $counter.text(max_length - cur_length);
50                    if (cur_length >= max_length)
51                        $counter.addClass('warning');
52                    else
53                        $counter.removeClass('warning');
54                };
55
56                $input.keyup($.debounce(DELAY_TIMEOUT, handler_simple));
57                handler_simple();
58
59            }
60
61        });
62        window['grid-form'] = undefined;
63    }
64
65    $(document).on('inova_popup.set_html:after', function () {
66        init(inova_popup.content);
67    });
68    init($(document));
69
70});

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.