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/yandex.market/ui/table/ |
Upload File : |
(function(BX, $, window) { var constructor; var Plugin = BX.namespace('YandexMarket.Plugin'); var UiTable = BX.namespace('YandexMarket.Ui.Table'); UiTable.LoadMore = constructor = Plugin.Base.extend({ defaults: { url: null, loaderTemplate: '<span class="yamarket-loader-dots"><span class="yamarket-loader-dots__content">...</span></span>', }, initVars: function() { this.callParent('initVars', constructor); this._isLoading = false; this._loader = null; }, activate: function() { if (this._isLoading) { return; } this._isLoading = true; this.showLoader(); this.query(this.loadEnd.bind(this), this.loadStop.bind(this)); }, query: function(resolve, reject) { BX.ajax({ url: this.options.url, dataType: 'html', onsuccess: resolve, onfailure: reject }); }, loadStop: function(reason, message) { this._isLoading = false; this.hideLoader(); this.showMessage(reason + ': ' + message); }, loadEnd: function(html) { this._isLoading = false; this.hideLoader(); this.insertPage(html); }, insertPage: function(html) { var parent = this.el.parentNode; this.el.insertAdjacentHTML('afterEnd', html); parent.removeChild(this.el); Plugin.manager.initializeContext(parent); this.destroy(); }, showMessage: function(message) { alert(message); }, showLoader: function() { if (this._loader != null) { return; } this._loader = this.el.insertAdjacentHTML('beforeEnd', this.options.loaderTemplate); }, hideLoader: function() { if (this._loader == null) { return; } this._loader.parentElement.removeChild(this._loader); this._loader = null; }, }, { dataName: 'uiTableLoadMore' }); })(BX, jQuery, window);