uawdijnntqw1x1x1
IP : 18.219.198.219
Hostname : axolotl
Kernel : Linux axolotl 4.9.0-13-amd64 #1 SMP Debian 4.9.228-1 (2020-07-05) x86_64
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,
OS : Linux
PATH:
/
var
/
www
/
axolotl
/
data
/
www
/
axolotl.ru
/
www
/
bitrix
/
js
/
main
/
popup
/
src
/
popup
/
popup-manager.js
/
/
import Popup from './popup'; import { type PopupOptions } from './popup-types'; import { Type } from 'main.core'; import { EventEmitter, type BaseEvent } from 'main.core.events'; export default class PopupManager { static _popups: Popup[] = []; static _currentPopup: Popup = null; constructor() { throw new Error('You cannot make an instance of PopupManager.'); } static create(options: PopupOptions): Popup { let [popupId, bindElement, params] = arguments; //compatible arguments let id = popupId; let compatMode = true; if (Type.isPlainObject(popupId) && !bindElement && !params) { compatMode = false; id = popupId.id; if (!Type.isStringFilled(id)) { throw new Error('BX.Main.Popup.Manager: "id" parameter is required.'); } } let popupWindow = this.getPopupById(id); if (popupWindow === null) { popupWindow = compatMode ? new Popup(popupId, bindElement, params) : new Popup(options); popupWindow.subscribe('onShow', this.handlePopupShow); popupWindow.subscribe('onClose', this.handlePopupClose); } return popupWindow; } /** * @private */ static handleOnAfterInit(event: BaseEvent) { event.getTarget().subscribeOnce('onDestroy', this.handlePopupDestroy); this._popups.forEach(popup => { if (popup.getId() === event.getTarget().getId()) { console.error(`Duplicate id (${popup.getId()}) for the BX.Main.Popup instance.`); } }); this._popups.push(event.getTarget()); } /** * @private */ static handlePopupDestroy(event: BaseEvent) { this._popups = this._popups.filter(popup => { return popup !== event.getTarget(); }); } /** * @private */ static handlePopupShow(event: BaseEvent) { if (this._currentPopup !== null) { this._currentPopup.close(); } this._currentPopup = event.getTarget(); } /** * @private */ static handlePopupClose() { this._currentPopup = null; } static getCurrentPopup(): Popup | null { return this._currentPopup; } static isPopupExists(id): boolean { return this.getPopupById(id) !== null; } static isAnyPopupShown(): boolean { for (let i = 0, length = this._popups.length; i < length; i++) { if (this._popups[i].isShown()) { return true; } } return false; } static getPopupById(id): Popup | null { for (let i = 0; i < this._popups.length; i++) { if (this._popups[i].getId() === id) { return this._popups[i]; } } return null; } static getMaxZIndex(): number { let zIndex = 0; this.getPopups().forEach((popup: Popup) => { zIndex = Math.max(zIndex, popup.getZindex()); }); return zIndex; } static getPopups(): Popup[] { return this._popups; } } PopupManager.handlePopupDestroy = PopupManager.handlePopupDestroy.bind(PopupManager); PopupManager.handlePopupShow = PopupManager.handlePopupShow.bind(PopupManager); PopupManager.handlePopupClose = PopupManager.handlePopupClose.bind(PopupManager); PopupManager.handleOnAfterInit = PopupManager.handleOnAfterInit.bind(PopupManager); EventEmitter.subscribe('BX.Main.Popup:onAfterInit', PopupManager.handleOnAfterInit);
/var/www/axolotl/data/www/axolotl.ru/www/bitrix/js/main/popup/src/popup/popup-manager.js