PageSourceSearch

https://decoflora.biz/bitrix/cache/js/s1/decoflora/page_e7612c51fb…3bfd152e9f035ffcde7ce_v1.js?178878609513622

js decoflora.biz collected 2026-10-07 18:03:06 UTC 13,622 bytes, 149 lines download raw bytes

1
2; /* Start:"a:4:{s:4:"full";s:113:"/local/templates/decoflora/components/bitrix/catalog.section/section_block_main_page/script.min.js?17832697436331";s:6:"source";s:94:"/local/templates/decoflora/components/bitrix/catalog.section/section_block_main_page/script.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
3(function(){"use strict";if(!!window.JCCatalogSectionComponent)return;window.JCCatalogSectionComponent=function(params){this.formPosting=false;this.siteId=params.siteId||"";this.ajaxId=params.ajaxId||"";this.template=params.template||"";this.componentPath=params.componentPath||"";this.parameters=params.parameters||"";if(params.navParams){this.navParams={NavNum:params.navParams.NavNum||1,NavPageNomer:parseInt(params.navParams.NavPageNomer)||1,NavPageCount:parseInt(params.navParams.NavPageCount)||1}}this.bigData=params.bigData||{enabled:false};this.container=document.querySelector('[data-entity="'+params.container+'"]');this.showMoreButton=null;this.showMoreButtonMessage=null;if(this.bigData.enabled&&BX.util.object_keys(this.bigData.rows).length>0){BX.cookie_prefix=this.bigData.js.cookiePrefix||"";BX.cookie_domain=this.bigData.js.cookieDomain||"";BX.current_server_time=this.bigData.js.serverTime;BX.ready(BX.delegate(this.bigDataLoad,this))}if(params.initiallyShowHeader){BX.ready(BX.delegate(this.showHeader,this))}if(params.deferredLoad){BX.ready(BX.delegate(this.deferredLoad,this))}if(params.lazyLoad){this.showMoreButton=document.querySelector('[data-use="show-more-'+this.navParams.NavNum+'"]');this.showMoreButtonMessage=this.showMoreButton.innerHTML;BX.bind(this.showMoreButton,"click",BX.proxy(this.showMore,this))}if(params.loadOnScroll){BX.bind(window,"scroll",BX.proxy(this.loadOnScroll,this))}};window.JCCatalogSectionComponent.prototype={checkButton:function(){if(this.showMoreButton){if(this.navParams.NavPageNomer==this.navParams.NavPageCount){BX.remove(this.showMoreButton)}else{this.container.appendChild(this.showMoreButton)}}},enableButton:function(){if(this.showMoreButton){BX.removeClass(this.showMoreButton,"disabled");this.showMoreButton.innerHTML=this.showMoreButtonMessage}},disableButton:function(){if(this.showMoreButton){BX.addClass(this.showMoreButton,"disabled");this.showMoreButton.innerHTML=BX.message("BTN_MESSAGE_LAZY_LOAD_WAITER")}},loadOnScroll:function(){var scrollTop=BX.GetWindowScrollPos().scrollTop,containerBottom=BX.pos(this.container).bottom;if(scrollTop+window.innerHeight>containerBottom){this.showMore()}},showMore:function(){if(this.navParams.NavPageNomer<this.navParams.NavPageCount){var data={};data["action"]="showMore";data["PAGEN_"+this.navParams.NavNum]=this.navParams.NavPageNomer+1;if(!this.formPosting){this.formPosting=true;this.disableButton();this.sendRequest(data)}}},bigDataLoad:function(){var url="https://analytics.bitrix.info/crecoms/v1_0/recoms.php",data=BX.ajax.prepareData(this.bigData.params);if(data){url+=(url.indexOf("?")!==-1?"&":"?")+data}var onReady=BX.delegate(function(result){this.sendRequest({action:"deferredLoad",bigData:"Y",items:result&&result.items||[],rid:result&&result.id,count:this.bigData.count,rowsRange:this.bigData.rowsRange,shownIds:this.bigData.shownIds})},this);BX.ajax({method:"GET",dataType:"json",url:url,timeout:3,onsuccess:onReady,onfailure:onReady})},deferredLoad:function(){this.sendRequest({action:"deferredLoad"})},sendRequest:function(data){var defaultData={siteId:this.siteId,template:this.template,parameters:this.parameters};if(this.ajaxId){defaultData.AJAX_ID=this.ajaxId}BX.ajax({url:this.componentPath+"/ajax.php"+(document.location.href.indexOf("clear_cache=Y")!==-1?"?clear_cache=Y":""),method:"POST",dataType:"json",timeout:60,data:BX.merge(defaultData,data),onsuccess:BX.delegate(function(result){if(!result||!result.JS)return;BX.ajax.processScripts(BX.processHTML(result.JS).SCRIPT,false,BX.delegate(function(){this.showAction(result,data)},this))},this)})},showAction:function(result,data){if(!data)return;switch(data.action){case"showMore":this.processShowMoreAction(result);break;case"deferredLoad":this.processDeferredLoadAction(result,data.bigData==="Y");break}},processShowMoreAction:function(result){this.formPosting=false;this.enableButton();if(result){this.navParams.NavPageNomer++;this.processItems(result.items);this.processPagination(result.pagination);this.processEpilogue(result.epilogue);this.checkButton()}},processDeferredLoadAction:function(result,bigData){if(!result)return;var position=bigData?this.bigData.rows:{};this.processItems(result.items,BX.util.array_keys(position))},processItems:function(itemsHtml,position){if(!itemsHtml)return;var processed=BX.processHTML(itemsHtml,false),temporaryNode=BX.create("DIV");var items,k,origRows;temporaryNode.innerHTML=processed.HTML;items=temporaryNode.querySelectorAll('[data-entity="items-row"]');if(items.length){this.showHeader(true);for(k in items){if(items.hasOwnProperty(k)){origRows=position?this.container.querySelectorAll('[data-entity="items-row"]'):false;items[k].style.opacity=0;if(origRows&&BX.type.isDomNode(origRows[position[k]])){origRows[position[k]].parentNode.insertBefore(items[k],origRows[position[k]])}else{this.container.appendChild(items[k])}}}
3new BX.easing({duration:2e3,start:{opacity:0},finish:{opacity:100},transition:BX.easing.makeEaseOut(BX.easing.transitions.quad),step:function(state){for(var k in items){if(items.hasOwnProperty(k)){items[k].style.opacity=state.opacity/100}}},complete:function(){for(var k in items){if(items.hasOwnProperty(k)){items[k].removeAttribute("style")}}}}).animate()}BX.ajax.processScripts(processed.SCRIPT)},processPagination:function(paginationHtml){if(!paginationHtml)return;var pagination=document.querySelectorAll('[data-pagination-num="'+this.navParams.NavNum+'"]');for(var k in pagination){if(pagination.hasOwnProperty(k)){pagination[k].innerHTML=paginationHtml}}},processEpilogue:function(epilogueHtml){if(!epilogueHtml)return;var processed=BX.processHTML(epilogueHtml,false);BX.ajax.processScripts(processed.SCRIPT)},showHeader:function(animate){var parentNode=BX.findParent(this.container,{attr:{"data-entity":"parent-container"}}),header;if(parentNode&&BX.type.isDomNode(parentNode)){header=parentNode.querySelector('[data-entity="header"]');if(header&&header.getAttribute("data-showed")!="true"){header.style.display="";if(animate){new BX.easing({duration:2e3,start:{opacity:0}
3,finish:{opacity:100},transition:BX.easing.makeEaseOut(BX.easing.transitions.quad),step:function(state){header.style.opacity=state.opacity/100},complete:function(){header.removeAttribute("style");header.setAttribute("data-showed","true")}}).animate()}else{header.style.opacity=100}}}}}})();
4/* End */
5;
6; /* Start:"a:4:{s:4:"full";s:93:"/local/templates/decoflora/components/bitrix/catalog.item/card_block/script.js?17887860864901";s:6:"source";s:78:"/local/templates/decoflora/components/bitrix/catalog.item/card_block/script.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
7document.addEventListener("DOMContentLoaded", function () {
8  document.addEventListener("click", function (event) {
9    // Проверяем клик
10    const button = event.target.closest(".js-add-to-cart");
11    if (!button) return;
12
13    event.preventDefault();
14
15    if (button.classList.contains("is-loading")) return;
16    button.classList.add("is-loading");
17
18    const productId = button.dataset.productId;
19
20    // 1. Ищем самый верхний общий контейнер ВСЕЙ карточки товара
21    const cardContainer = button.closest(".card-base");
22
23    // 2. Ищем инпут ТОЛЬКО внутри этой конкретной карточки
24    const input = cardContainer
25      ? cardContainer.querySelector(".js-quantity")
26      : null;
27
28    // 3. Считываем значение. Если инпут найден, принудительно берем его текущее value
29    const quantity = input ? input.value : 1;
30
31    // НАЙДИТЕ В ВАШЕМ СКРИПТЕ СТРОКУ КОНСОЛИ И ДОБАВЬТЕ ЭТОТ ЛОГ ДЛЯ ПРОВЕРКИ:
32    console.log("Добавляем товар ID:", productId, "Количество:", quantity);
33
34    // --- ИЗМЕНЕНИЯ ЗДЕСЬ ---
35
36    // Мы отправляем запрос на текущую страницу (window.location.href),
37    // а не на отдельный файл.
38    BX.ajax({
39      method: "POST",
40      dataType: "json", // Стандартный экшен обычно возвращает JSON, если передан ajax_basket=Y
41      url: window.location.href,
42      data: {
43        action: "ADD2BASKET", // Магическое слово для Битрикса
44        id: productId, // ID товара
45        quantity: quantity, // Количество
46        ajax_basket: "Y", // Говорим битриксу вернуть JSON, а не HTML страницы
47        sessid: BX.bitrix_sessid(),
48        via_ajax: "Y",
49        custom_action: "Y",
50      },
51      onsuccess: function (response) {
52        button.classList.remove("is-loading");
53
54        // Стандартный ответ Битрикса выглядит примерно так:
55        // { STATUS: "OK", MESSAGE: "Товар успешно добавлен...", ... }
56
57        if (response.STATUS === "OK") {
58          // 1. Уведомление
59          if (BX.UI && BX.UI.Notification) {
60            BX.UI.Notification.Center.notify({
61              content: response.MESSAGE, // Сообщение берем из ответа битрикса
62              position: "top-center",
63              autoHideDelay: 1500,
64              closeButton: true,
65            });
66          } else {
67            // Если сообщение пришло HTML-ем, вырезаем теги для alert
68            var msg = response.MESSAGE.replace(/<[^>]*>?/gm, "");
69            alert(msg);
70          }
71
72          // 2. Системное событие
73          // Т.к. запрос обработал стандартный компонент, он сам сбросил кэш.
74          // Теперь это событие гарантированно обновит малую корзину.
75          BX.onCustomEvent(window, "OnBasketChange");
76        } else {
77          // Обработка ошибки
78          console.error(response);
79          var errorMsg = response.MESSAGE
80            ? response.MESSAGE
81            : "Ошибка добавления";
82          // alert(errorMsg);
83          if (BX.UI && BX.UI.Notification) {
84            BX.UI.Notification.Center.notify({
85              content: errorMsg, // Сообщение берем из ответа битрикса
86              position: "top-center",
87              autoHideDelay: 1500,
88              closeButton: true,
89            });
90          } else {
91            // Если сообщение пришло HTML-ем, вырезаем теги для alert
92            var msg = errorMsg.replace(/<[^>]*>?/gm, "");
93            alert(msg);
94          }
95        }
96      },
97      onfailure: function () {
98        // Если сервер вернул HTML вместо JSON (бывает при ошибках PHP),
99        // JS может попасть сюда или в success с кривым форматом.
100        button.classList.remove("is-loading");
101        console.error("Ошибка запроса");
102        // Иногда Битрикс при ajax_basket=Y возвращает невалидный JSON если есть варниÐ
102½Ð³Ð¸,
103        // поэтому просто перезагрузим страницу в крайнем случае, или покажем алерт.
104        alert("Товар добавлен (проверьте корзину)");
105        BX.onCustomEvent(window, "OnBasketChange");
106      },
107    });
108  });
109});
110
111/* End */
112;
113; /* Start:"a:4:{s:4:"full";s:93:"/local/templates/decoflora/components/bitrix/news.list/block_reviews/script.js?17832697431190";s:6:"source";s:78:"/local/templates/decoflora/components/bitrix/news.list/block_reviews/script.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
114document.addEventListener('DOMContentLoaded', function() {
115    const initReviewExpander = () => {
116        const reviewItems = document.querySelectorAll('.js-review-item');
117        reviewItems.forEach(item => {
118            if (item.dataset.expanderInit) return;
119            item.dataset.expanderInit = 'true';
120
121            item.addEventListener('click', function() {
122                this.classList.toggle('is-expanded');
123                const toggleBtn = this.querySelector('.js-review-toggle');
124                if (toggleBtn) {
125                    if (this.classList.contains('is-expanded')) {
126                        toggleBtn.textContent = 'Свернуть';
127                    } else {
128                        toggleBtn.textContent = 'Читать весь отзыв';
129                    }
130                }
131
132                const swiperContainer = this.closest('.swiper');
133                if (swiperContainer && swiperContainer.swiper) {
134                    swiperContainer.swiper.update();
135                }
136            });
137        });
138    };
139
140    initReviewExpander();
141
142    if (typeof BX !== 'undefined') {
143        BX.addCustomEvent('onAjaxSuccess', initReviewExpander);
144    }
145});
146/* End */
147;; /* /local/templates/decoflora/components/bitrix/catalog.section/section_block_main_page/script.min.js?17832697436331*/
148; /* /local/templates/decoflora/components/bitrix/catalog.item/card_block/script.js?17887860864901*/
149; /* /local/templates/decoflora/components/bitrix/news.list/block_reviews/script.js?17832697431190*/

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.