PageSourceSearch

https://yug-frost.ru/templates/cult-v3/resource/js/rscomponent/plugins/uikitmodal.js

js yug-frost.ru collected 2026-10-08 16:16:51 UTC 2,385 bytes, 79 lines download raw bytes

1/**
2 * Открывает модальное окно с заданным содержимым.
3 * Зависит от bootstrap.Modal
4 */
5new class Modal extends RsJsCore.classes.plugin {
6    /**
7     * Открывает модальное окно
8     * @param html Содержимое окна
9     * @param onOpen callback, вызываемый после открытия окна
10     * @param options объект, любые дополнительные свойства
11     */
12    open(html, onOpen, options) {
13        let isReopen = this.isOpen();
14        if (this.modal) {
15            //При повторном открытии без анимации закрываем текущее окно
16            this.modal.$el.innerHTML = html;
17            this.modal.$el.dispatchEvent(new CustomEvent('shown', {bubbles: true}));
18            return;
19        }
20
21        let element = document.createElement('div');
22        element.className = 'modal rs-dialog' + (isReopen ? '' : ' fade');
23        element.dataset.ukModal = true;
24
25        element.addEventListener('shown', (event) => {
26            element.dispatchEvent(new CustomEvent('new-content', {bubbles: true}));
27        });
28
29        element.addEventListener('shown', onOpen);
30        element.addEventListener('hide', () => {
31            this.modal = null
32        });
33        element.addEventListener('hidden', (event) => {
34            event.target.remove();
35        });
36
37        element.innerHTML = html;
38
39        this.modal = UIkit.modal(element, options);
40        this.modal.show();
41    }
42
43    /**
44     * Закрывает модальное окно
45     */
46    close() {
47        if (this.modal) {
48            this.modal.hide();
49        }
50    }
51
52    /**
53     * Возвращает true, если модальное окно сейчас открыто
54     *
55     * @returns boolean
56     */
57    isOpen() {
58        return !!this.modal;
59    }
60
61    /**
62     * Отображает лоадер внутри диалогового окна
63     */
64    showLoader() {
65        if (this.modal) {
66            this.loader = document.createElement('div');
67            this.loader.classList.add('rs-loader');
68        }
69    }
70
71    /**
72     * Скрывает лоадер внутри диалогового окна
73     */
74    hideLoader() {
75        if (this.loader) {
76            this.loader.remove();
77        }
78    }
79};

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.