PageSourceSearch

https://uzs.ru/bitrix/templates/universelite_s1/components/bitrix/…/catalog.list.1/script.js?161892218211140

js uzs.ru collected 2026-10-09 22:42:46 UTC 11,140 bytes, 342 lines download raw bytes

1(function() {
2    'use strict';
3
4    if (!!window.JCCatalogSectionComponent)
5        return;
6
7    window.JCCatalogSectionComponent = function(params) {
8        this.formPosting = false;
9        this.siteId = params.siteId || '';
10        this.ajaxId = params.ajaxId || '';
11        this.template = params.template || '';
12        this.componentPath = params.componentPath || '';
13        this.parameters = params.parameters || '';
14
15        if (params.navParams)
16        {
17            this.navParams = {
18                NavNum: params.navParams.NavNum || 1,
19                NavPageNomer: parseInt(params.navParams.NavPageNomer) || 1,
20                NavPageCount: parseInt(params.navParams.NavPageCount) || 1
21            };
22        }
23
24        this.bigData = params.bigData || {enabled: false};
25        this.container = document.querySelector('[data-entity="' + params.container + '"]');
26        this.showMoreButton = null;
27        this.showMoreButtonMessage = null;
28
29        if (this.bigData.enabled && BX.util.object_keys(this.bigData.rows).length > 0)
30        {
31            BX.cookie_prefix = this.bigData.js.cookiePrefix || '';
32            BX.cookie_domain = this.bigData.js.cookieDomain || '';
33            BX.current_server_time = this.bigData.js.serverTime;
34
35            BX.ready(BX.delegate(this.bigDataLoad, this));
36        }
37
38        if (params.initiallyShowHeader)
39        {
40            BX.ready(BX.delegate(this.showHeader, this));
41        }
42
43        if (params.deferredLoad)
44        {
45            BX.ready(BX.delegate(this.deferredLoad, this));
46        }
47
48        if (params.lazyLoad)
49        {
50            this.showMoreButton = document.querySelector('[data-use="show-more-' + this.navParams.NavNum + '"]');
51            this.showMoreButtonMessage = this.showMoreButton.innerHTML;
52            BX.bind(this.showMoreButton, 'click', BX.proxy(this.showMore, this));
53        }
54
55        if (params.loadOnScroll)
56        {
57            BX.bind(window, 'scroll', BX.proxy(this.loadOnScroll, this));
58        }
59    };
60
61    window.JCCatalogSectionComponent.prototype =
62    {
63        checkButton: function()
64        {
65            if (this.showMoreButton)
66            {
67                if (this.navParams.NavPageNomer == this.navParams.NavPageCount)
68                {
69                    BX.remove(this.showMoreButton);
70                }
71            }
72        },
73
74        enableButton: function()
75        {
76            if (this.showMoreButton)
77            {
78                BX.removeClass(this.showMoreButton, 'disabled');
79                this.showMoreButton.innerHTML = this.showMoreButtonMessage;
80            }
81        },
82
83        disableButton: function()
84        {
85            if (this.showMoreButton)
86            {
87                BX.addClass(this.showMoreButton, 'disabled');
88                this.showMoreButton.innerHTML = BX.message('BTN_MESSAGE_LAZY_LOAD_WAITER');
89            }
90        },
91
92        loadOnScroll: function()
93        {
94            var scrollTop = BX.GetWindowScrollPos().scrollTop,
95                containerBottom = BX.pos(this.container).bottom;
96
97            if (scrollTop + window.innerHeight > containerBottom)
98            {
99                this.showMore();
100            }
101        },
102
103        showMore: function()
104        {
105            if (this.navParams.NavPageNomer < this.navParams.NavPageCount)
106            {
107                var data = {};
108                data['action'] = 'showMore';
109                data['PAGEN_' + this.navParams.NavNum] = this.navParams.NavPageNomer + 1;
110
111                if (!this.formPosting)
112                {
113                    this.formPosting = true;
114                    this.disableButton();
115                    this.sendRequest(data);
116                }
117            }
118        },
119
120        bigDataLoad: function()
121        {
122            var url = 'https://analytics.bitrix.info/crecoms/v1_0/recoms.php',
123                data = BX.ajax.prepareData(this.bigData.params);
124
125            if (data)
126            {
127                url += (url.indexOf('?') !== -1 ? '&' : '?') + data;
128            }
129
130            var onReady = BX.delegate(function(result){
131                this.sendRequest({
132                    action: 'deferredLoad',
133                    bigData: 'Y',
134                    items: result && result.items || [],
135                    rid: result && result.id,
136                    count: this.bigData.count,
137                    rowsRange: this.bigData.rowsRange,
138                    shownIds: this.bigData.shownIds
139                });
140            }, this);
141
142            BX.ajax({
143                method: 'GET',
144                dataType: 'json',
145                url: url,
146                timeout: 3,
147                onsuccess: onReady,
148                onfailure: onReady
149            });
150        },
151
152        deferredLoad: function()
153        {
154            this.sendRequest({action: 'deferredLoad'});
155        },
156
157        sendRequest: function(data) {
158            var defaultData = {
159                siteId: this.siteId,
160                template: this.template,
161                parameters: this.parameters
162            };
163            if (this.ajaxId)
164            {
165                defaultData.AJAX_ID = this.ajaxId;
166            }
167            BX.ajax({
168                url: this.componentPath + '/ajax.php' + (document.location.href.indexOf('clear_cache=Y') !== -1 ? '?clear_cache=Y' : ''),
169                method: 'POST',
170                dataType: 'json',
171                timeout: 60,
172                data: BX.merge(defaultData, data),
173                onsuccess: BX.delegate(function(result){
174                    if (!result || !result.JS)
175                        return;
176
177                    BX.ajax.processScripts(
178                        BX.processHTML(result.JS).SCRIPT,
179                        false,
180                        BX.delegate(function(){this.showAction(result, data);}, this)
181                    );
182                }, this)
183            });
184        },
185
186        showAction: function(result, data)
187        {
188            if (!data)
189                return;
190
191            switch (data.action)
192            {
193                case 'showMore':
194                    this.processShowMoreAction(result);
195                    break;
196                case 'deferredLoad':
197                    this.processDeferredLoadAction(result, data.bigData === 'Y');
198                    break;
199            }
200        },
201
202        processShowMoreAction: function(result)
203        {
204            this.formPosting = false;
205            this.enableButton();
206
207            if (result)
208            {
209                this.navParams.NavPageNomer++;
210                this.processItems(result.items);
211                this.processPagination(result.pagination);
212                this.checkButton();
213            }
214        },
215
216        processDeferredLoadAction: function(result, bigData)
217        {
218            if (!result)
219                return;
220
221            var position = bigData ? this.bigData.rows : {};
222
223            this.processItems(result.items, BX.util.array_keys(position));
224        },
225
226        processItems: function(itemsHtml, position)
227        {
228            if (!itemsHtml)
229                return;
230
231            var processed = BX.processHTML(itemsHtml, false),
232                temporaryNode = BX.create('DIV');
233
234            var items, k, origRows;
235
236            temporaryNode.innerHTML = processed.HTML;
237            items = temporaryNode.querySelectorAll('[data-entity="items-row"]');
238
239            if (items.length)
240            {
241                this.showHeader(true);
242
243                for (k in items)
244                {
245                    if (items.hasOwnProperty(k))
246                    {
247                        origRows = position ? this.container.querySelectorAll('[data-entity="items-row"]') : false;
248                        //items[k].style.opacity = 0;
249
250                        if (origRows && BX.type.isDomNode(origRows[position[k]]))
251                        {
252                            origRows[position[k]].parentNode.insertBefore(items[k], origRows[position[k]]);
253                        }
254                        else
255                        {
256                            this.container.appendChild(items[k]);
257                        }
258                    }
259                }
260
261                /*new BX.easing({
262                    duration: 2000,
263                    start: {opacity: 0},
264                    finish: {opacity: 100},
265                    transition: BX.easing.makeEaseOut(BX.easing.transitions.quad),
266                    step: function(state){
267                        for (var k in items)
268                        {
269                            if (items.hasOwnProperty(k))
270                            {
271                                items[k].style.opacity = state.opacity / 100;
272                            }
273                        }
274                    },
275                    complete: function(){
276                        for (var k in items)
277                        {
278                            if (items.hasOwnProperty(k))
279                            {
280                                items[k].removeAttribute('style');
281                            }
282                        }
283                    }
284                }).animate();*/
285            }
286
287            BX.ajax.processScripts(processed.SCRIPT);
288        },
289
290        processPagination: function(paginationHtml)
291        {
292            if (!paginationHtml)
293                return;
294
295            var pagination = document.querySelectorAll('[data-pagination-num="' + this.navParams.NavNum + '"]');
296            for (var k in pagination)
297            {
298                if (pagination.hasOwnProperty(k))
299                {
300                    pagination[k].innerHTML = paginationHtml;
301                }
302            }
303        },
304
305        showHeader: function(animate)
306        {
307            var parentNode = BX.findParent(this.container, {attr: {'data-entity': 'parent-container'}}),
308                header;
309
310            if (parentNode && BX.type.isDomNode(parentNode))
311            {
312                header = parentNode.querySelector('[data-entity="header"');
313
314                if (header && header.getAttribute('data-showed') != 'true')
315                {
316                    header.style.display = '';
317
318                    if (animate)
319                    {
320                        new BX.easing({
321                            duration: 2000,
322                            start: {opacity: 0},
323                            finish: {opacity: 100},
324                            transition: BX.easing.makeEaseOut(BX.easing.transitions.quad),
325                            step: function(state){
326                                header.style.opacity = state.opacity / 100;
327                            },
328                            complete: function(){
329                                header.removeAttribute('style');
330                                header.setAttribute('data-showed', 'true');
331                            }
332                        }).animate();
333                    }
334                    else
335                    {
336                        header.style.opacity = 100;
337                    }
338                }
339            }
340        }
341    };
342})();

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.