PageSourceSearch

https://vse.rv.ua/assets/5b9f50a9/js/index.js?v=1678709582

js vse.rv.ua collected 2026-10-02 11:49:11 UTC 2,662 bytes, 99 lines download raw bytes

1/**
2 * Main Modal js object
3 * @var {Object}
4 */
5var Modal = (function (window, document, $, undefined) {
6    /**
7     * Main options
8     * @type {Object}
9     * @private
10     */
11    var _options = {
12        message: {
13            modalContainer: '.ownbox-message',
14            contentContainer: '.mess-cont',
15            contentClasses: 'success error',
16            default: {
17                type: 'error',
18                text: "Something went wrong"
19            }
20        },
21    };
22
23    /**
24     * Show message modal method
25     * @param response
26     */
27    var showMessage = function(response) {
28        var modal = $(_options.message.modalContainer);
29        var content = modal.find(_options.message.contentContainer);
30
31        // Set type and message
32        var type = ('type' in response) ? response.type : _options.message.default.type;
33        var message = ('message' in response) ? response.message : _options.message.default.text;
34
35        // Set content options
36        content.removeClass(_options.message.contentClasses);
37        content.addClass(type);
38        content.html(message);
39
40        // Show modal
41        if (!modal.is('visible')) {
42            modal.show();
43        }
44    };
45
46    var replaceContent = function(response) {
47        // Set container and type
48        var container = ('container' in response) ? response.container : '';
49        var content = ('content' in response) ? response.content : '';
50
51        // Get ownbox
52        var ownbox = $('#ownbox');
53        ownbox.find(container).replaceWith(content);
54    };
55
56    // Facade
57    return {
58        /**
59         * Show error
60         * @param error
61         */
62        error: function (error) {
63            showMessage({
64                type: 'error',
65                message: 'Something went wrong'
66            });
67        },
68        /**
69         * Initialize method
70         * @param {Object} options
71         */
72        init: function(options) {
73            $.extend(_options, options);
74        },
75        /**
76         * Main run method
77         * @param {Object} response
78         */
79        run: function(response) {
80
81            if (typeof response !== 'object') {
82                try {
83                    response = JSON.parse(response);
84                } catch (e) {
85                    response = undefined;
86                }
87            }
88            if (typeof response === 'undefined') {
89                return;
90            }
91
92            if (('message' in response)) {
93                showMessage(response);
94            } else if (('content' in response)) {
95                replaceContent(response);
96            }
97        },
98    };
99}(window, document, $));

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.