%PDF- %PDF-
Server IP : 37.220.80.31 / Your IP : 3.128.171.243 Web Server : Apache/2.4.52 (Ubuntu) System : Linux 3051455-guretool.twc1.net 5.15.0-107-generic #117-Ubuntu SMP Fri Apr 26 12:26:49 UTC 2024 x86_64 User : www-root ( 1010) PHP Version : 7.4.33 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, MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /var/www/www-root/data/www/dev.artlot24.ru/bitrix/components/bitrix/landing.pub/templates/.default/src/js/ |
Upload File : |
import {Event, Cache, Dom, Type} from 'main.core'; import {SliderHacks} from 'landing.sliderhacks'; const onEditButtonClick = Symbol('onEditButtonClick'); const onBackButtonClick = Symbol('onBackButtonClick'); const onForwardButtonClick = Symbol('onForwardButtonClick'); export class TopPanel { static cache = new Cache.MemoryCache(); constructor() { Event.bind(TopPanel.getEditButton(), 'click', this[onEditButtonClick]); Event.bind(TopPanel.getBackButton(), 'click', this[onBackButtonClick]); Event.bind(TopPanel.getForwardButton(), 'click', this[onForwardButtonClick]); TopPanel.pushHistory(window.location.toString()); TopPanel.checkNavButtonsActivity(); } static getLayout(): HTMLDivElement { return TopPanel.cache.remember('layout', () => { return document.querySelector('.landing-pub-top-panel'); }); } static getEditButton(): HTMLAnchorElement { return TopPanel.cache.remember('editButton', () => { return TopPanel.getLayout().querySelector('.landing-pub-top-panel-edit-button'); }); } [onEditButtonClick](event) { event.preventDefault(); const href = Dom.attr(event.currentTarget, 'href'); const landingId = Dom.attr(event.currentTarget, 'data-landingId'); if (Type.isString(href) && href !== '') { TopPanel.openSlider(href, landingId); } } static openSlider(url, landingId) { BX.SidePanel.Instance.open(url, { cacheable: false, customLeftBoundary: 240, allowChangeHistory: false, events: { onClose() { void SliderHacks.reloadSlider( window.location.toString().split('#')[0] + '#landingId' + landingId ); }, }, }); } // HISTORY save static history = []; static historyState; static pushHistory(url) { if (!Type.isNumber(TopPanel.historyState)) { TopPanel.historyState = -1; // will increase later } if (TopPanel.historyState < TopPanel.history.length - 1) { TopPanel.history.splice(TopPanel.historyState + 1); } TopPanel.history.push(url); TopPanel.historyState++; } static checkNavButtonsActivity() { Dom.removeClass(TopPanel.getForwardButton(), 'ui-btn-disabled'); Dom.removeClass(TopPanel.getBackButton(), 'ui-btn-disabled'); if ( !Type.isArrayFilled(TopPanel.history) || !Type.isNumber(TopPanel.historyState) || TopPanel.history.length === 1 ) { Dom.addClass(TopPanel.getForwardButton(), 'ui-btn-disabled'); Dom.addClass(TopPanel.getBackButton(), 'ui-btn-disabled'); return; } if (TopPanel.historyState === 0) { Dom.addClass(TopPanel.getBackButton(), 'ui-btn-disabled'); } if (TopPanel.historyState >= TopPanel.history.length - 1) { Dom.addClass(TopPanel.getForwardButton(), 'ui-btn-disabled'); } } static getBackButton(): HTMLAnchorElement { return TopPanel.cache.remember('backButton', () => { const layout = TopPanel.getLayout(); return layout ? layout.querySelector('.landing-pub-top-panel-back') : null; }); } static getForwardButton(): HTMLAnchorElement { return TopPanel.cache.remember('forwardButton', () => { const layout = TopPanel.getLayout(); return layout ? layout.querySelector('.landing-pub-top-panel-forward') : null; }); } [onBackButtonClick](event) { event.preventDefault(); if ( Type.isArrayFilled(TopPanel.history) && Type.isNumber(TopPanel.historyState) && TopPanel.historyState > 0 ) { void SliderHacks.reloadSlider(TopPanel.history[--TopPanel.historyState]); TopPanel.checkNavButtonsActivity(); } } [onForwardButtonClick](event) { event.preventDefault(); if ( Type.isArrayFilled(TopPanel.history) && Type.isNumber(TopPanel.historyState) && (TopPanel.historyState < TopPanel.history.length - 1) ) { void SliderHacks.reloadSlider(TopPanel.history[++TopPanel.historyState]); TopPanel.checkNavButtonsActivity(); } } }