Server IP : 80.87.202.40 / Your IP : 216.73.216.169 Web Server : Apache System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64 User : bitrix ( 600) PHP Version : 8.2.27 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/bitrix/ext_www/rospirotorg.ru/bitrix/js/landing/widget/src/ |
Upload File : |
import { Dom, Event } from 'main.core'; export class Widget { constructor(widgetElement, options) { this.element = widgetElement; this.isShowExtendButton = options.isShowExtendButton ?? false; this.mainContainer = options.mainContainer ?? null; this.sidebarContainer = options.sidebarContainer ?? null; this.extendButton = options.extendButton ?? null; this.viewAllButton = options.viewAllButton ?? null; this.grid = options.grid ?? null; this.gridExtendedClass = options.gridExtendedClass ?? ''; this.buttonHideClass = options.buttonHideClass ?? ''; } deleteContextDependentContainer() { const sidebarElements = document.querySelectorAll('.landing-sidebar'); let isInsideSidebar = false; sidebarElements.forEach((sidebarElement) => { if (sidebarElement.contains(this.element)) { isInsideSidebar = true; } }); if (isInsideSidebar && this.mainContainer) { this.mainContainer.remove(); } if (!isInsideSidebar && this.sidebarContainer) { this.sidebarContainer.remove(); } } toggleExtendViewButtonBehavior() { if (this.extendButton && this.viewAllButton) { if (this.isShowExtendButton) { Event.bind(this.extendButton, 'click', () => { if (this.grid) { Dom.addClass(this.grid, this.gridExtendedClass); setTimeout(() => { Dom.addClass(this.extendButton, this.buttonHideClass); Dom.removeClass(this.viewAllButton, this.buttonHideClass); }, 300); } }); } else { Dom.addClass(this.extendButton, this.buttonHideClass); Dom.removeClass(this.viewAllButton, this.buttonHideClass); } } } }