PageSourceSearch

https://technofactor.ru/local/templates/techno/components/bitrix/c…/script.js?176656996212333

js technofactor.ru collected 2026-09-26 09:41:17 UTC 12,333 bytes, 292 lines download raw bytes

1$(document).ready(function () {
2
3    /**
4     * icheck
5     */
6    $('.filter-icheck').iCheck({
7        checkboxClass: 'icheckbox_minimal-orange',
8        increaseArea: '20%' // optional
9    });
10    /**
11     * Выбранное значение в checkbox
12     */
13    $('.filter-icheck').on('ifToggled', function(event){
14        var elementId = $(event.target).data("id");
15        var value = $(event.target).data("value");
16
17        // ставлю точно такое же значение в выпадающий список.
18        // из за адаптивности стоит 2 фильтра
19        var $option = $("#option_" + elementId);
20        if ($option.length > 0) {
21            $option.prop("selected",$("#icheck_" + elementId).prop("checked"));
22            var select = $option.closest("select");
23            $(select).selectpicker('refresh');
24        }
25
26        changeFilterBtnValue($("#icheck_" + elementId).closest(".checkbox"));
27    });
28
29    /**
30     * Скрытие фильтра
31     */
32    $(document).on("click",".js_btn_filter_toggle",function(){
33        $(".js_filter_form").toggle();
34    });
35
36    /**
37     * Выбранное значение в select
38     */
39    $(document).on("changed.bs.select", '.selectpicker', function (event, clickedIndex, newValue, oldValue) {
40        // подставляю значение в скрытый checkbox
41        if (clickedIndex != undefined && $(this).closest("form").hasClass("js_filter_form")) {
42            var $option = $(this).find("option:eq(" + clickedIndex + ")");
43            var elementId = $option.data("id");
44
45            var $checkbox = $("#hidden_checkbox_" + $option.data("id"));
46
47            if (!$checkbox.prop("checked")) {
48                $("#icheck_" + elementId).iCheck('check');
49            } else {
50                $("#icheck_" + elementId).iCheck('uncheck');
51            }
52
53            // checkbox toggle
54            $checkbox.prop("checked", !$checkbox.prop("checked"));
55
56            changeFilterBtnValue($(event.target).closest(".bootstrap-select"));
57        }
58    });
59    /**
60     * Выбранное значение в select Mobile
61     */
62    $(document).on("change", '.selectpicker', function (event) {
63
64        if (isMobDevice) {
65            if ($(this).closest("form").hasClass("js_filter_form")) {
66
67                $.each($(event.target).find(":selected"),function(clickedIndex,el){
68                    var $option = $(el);
69                    var elementId = $option.data("id");
70
71                    var $checkbox = $("#hidden_checkbox_" + $option.data("id"));
72
73                    if (!$checkbox.prop("checked")) {
74                        $("#icheck_" + elementId).iCheck('check');
75                    } else {
76                        $("#icheck_" + elementId).iCheck('uncheck');
77                    }
78
79                    // checkbox toggle
80                    $checkbox.prop("checked", !$checkbox.prop("checked"));
81                });
82
83                changeFilterBtnValue($(event.target).closest(".bootstrap-select"));
84            }
85        }
86    });
87
88
89    /**
90     * Кнопка "Применить" в фильтре
91     */
92    $(document).on("click", '.js_btn_filter_apply', function () {
93        $('.bootstrap-select').removeClass('open');
94
95        if ($(this).attr("data-url") != "" && $(this).attr("data-url") != undefined) {
96            window.location.href = $(this).attr("data-url");
97        }
98
99        // меня название на кнопке "Показать"
100//        $(".js_btn_filter_apply .btn-text").text("загрузка...");
101//        $(".js_btn_filter_apply .glyphicon").addClass("fa fa-spin fa-cog").removeClass("glyphicon glyphicon-filter");
102
103
104//        $('#js_catalog_products').addClass('fadeOutDownBig animated').one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function () {
105//            $(this).removeClass("fadeOutDownBig animated");
106//            $("#js_catalog_products > div").remove();// очищаю все что было
107//
108//            // Добавляю прелоадер
109//            $("#js_catalog_products").append('<div class="text-center preloader preloader-h"><span class="fa fa-spin fa-cog"></span>&nbsp;загрузка...</div>');
110//
111
112//            $.ajax({
113//                url: window.location.pathname,
114//                type: "GET",
115//                data: "del_filter=Y&FILTER_NAME=" + $(".js_filter_form").attr("name"), // serializes the form's elements.
116//                success: function (data) {
117//                    // делаю запрос на обновление контента
118//                    $.ajax({
119//                        url: window.location.pathname,
120//                        type: "GET",
121//                        data: $('form.js_filter_form').serialize(), // serializes the form's elements.
122//                        success: function (html) {
123//
124//                            $("#js_catalog_products > div").remove();// очищаю все что было
125//                            $("#js_catalog_products").append($(html).find("#js_catalog_products > div"));// добавляю контент
126//                            $("#js_catalog_header_row").html($(html).find("#js_catalog_header_row").html());// меняю форму с выбором сортировки, вида, и постр. навигации
127//
128//                            $('#js_catalog_products').addClass('fadeInUpBig animated').one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function () {
129//                                $(this).removeClass("fadeInUpBig animated");
130//                                Holder.run({use_canvas: true});// обновляю изображения товаров
131//                                $("input.touchspin").TouchSpin({max: 9999, verticalbuttons: true});// Обновляю кнопки увелечения и уменьшения количества товара
132//                                $("img.lazy").lazyload();// Обновление lazyload
133//                            });
134//
135//                            // Возращаю название кнопки "показать"
136//                            $(".js_btn_filter_apply .btn-text").text("Показать");
137//                            $(".js_btn_filter_apply .fa").addClass("glyphicon glyphicon-filter").removeClass("fa fa-spin fa-cog");
138//
139//                        }
140//                    });
141//                }
142//            });
143//        });
144
145        return false;
146    });
147
148
149    /**
150     * Отмена фильтра
151     */
152    $(document).on("click", '#js_btn_reset_filter', function () {
153        $btn = $(this);
154
155        $('.bootstrap-select').removeClass('open');
156        // Запрос на отмену фильтра
157        $.ajax({
158            url: window.location.pathname,
159            type: "GET",
160            data: "del_filter=Y&FILTER_NAME=" + $(".js_filter_form").attr("name"), // serializes the form's elements.
161            success: function (data) {
162                // делаю запрос на обновление контента
163                $.ajax({
164                    url: window.location.pathname,
165                    type: "GET",
166                    data: window.location.pathname, // serializes the form's elements.
167                    success: function (html) {
168                        if ($btn.attr("data-url") != "") {
169                            window.location.href = $btn.attr("data-url");
170                        }
171                    }
172                });
173            }
174        });
175
176        return false;
177    });
178
179});
180
181/**
182 * Выбор "любой" в выпадающем списке
183 */
184$(document).on("click",".bootstrap-select .popover-title",function(){
185    var $selectpicker = $(this).closest(".bootstrap-select").find(".selectpicker");
186    $selectpicker.selectpicker('deselectAll');
187
188
189    var $options = $selectpicker.find("option");
190    $.each($options, function (id, objElement) {
191        var $checkbox = $($(objElement).data("id"));
192        // checkbox toggle
193        $checkbox.prop("checked", false);
194    });
195
196    changeFilterBtnValue($selectpicker.closest(".bootstrap-select"));
197
198});
199
200
201/**
202 * Удаление filter-popover по кнопке закрытия
203 */
204$(document).on("click",".filter-popover > span",function(){
205    $(this).closest(".popover").popover('destroy');
206});
207$(document).on("click",".js_popover_link",function(){
208    $(".js_btn_filter_apply").click();
209    return false;
210});
211
212/**
213 * Изменение значения на кнопке "Применить"
214 * @returns {undefined}
215 */
216function changeFilterBtnValue($obj) {
217    // Сколько вариантов выбранно
218    $.ajax({
219        url: window.location.pathname,
220        data: $($(".js_filter_form").get(0)).serialize() + "&ajax=y",
221        beforeSend: function () {
222            $(".js_btn_filter_apply .btn-text").text("загрузка...");
223            $(".js_btn_filter_apply .glyphicon").addClass("fa fa-spin fa-cog").removeClass("glyphicon glyphicon-filter");
224        },
225        complete: function (responce) {
226            responce = responce.responseText.replace(/\'/g, '"');
227            responce = responce.replace(/\t/g, ' ');
228            var objData = $.parseJSON(responce);
229
230            if (objData.ELEMENT_COUNT > 0) {
231
232                $(".popover").popover('destroy');
233
234                $($obj).popover({
235                    template: '<div class="popover" role="tooltip"><div class="arrow"></div><div class="popover-content"></div></div>',
236                    html: true,
237                    content: function () {
238                        return '<div class="filter-popover"><span>&times;</span>&nbsp;&nbsp;Показать:&nbsp;<a href="" class="js_popover_link">' + objData.ELEMENT_COUNT + " " + declOfNum(['товар', 'товара', 'товаров'],parseInt(objData.ELEMENT_COUNT)) + '</a></div>';
239                    }
240                }).popover('show');
241
242                setTimeout(function(){
243                    $(".popover").popover('destroy');
244                },4000);
245
246                $(".js_btn_filter_apply .btn-text").text("Показать " + objData.ELEMENT_COUNT + " " + declOfNum(['товар', 'товара', 'товаров'],parseInt(objData.ELEMENT_COUNT)));
247                $(".js_btn_filter_apply .fa").removeClass("fa fa-spin fa-cog").addClass("glyphicon glyphicon-filter");
248
249                $(".js_btn_filter_apply").prop('disabled', false);
250                $(".js_btn_filter_apply").attr("data-url", objData.FILTER_URL);
251            } else {
252                $(".js_btn_filter_apply .btn-text").text("Ничего не найдено");
253                $(".js_btn_filter_apply .fa").removeClass("fa fa-spin fa-cog").addClass("glyphicon glyphicon-filter");
254
255                $(".js_btn_filter_apply").prop('disabled', true);
256                $(".js_btn_filter_apply").attr("data-url", "");
257            }
258
259            $.each(objData.ITEMS, function (id, objElement) {
260                if (id > 0) {
261                    var $element = $("#prop_" + id);
262
263                    // если выпадающий список
264                    if (objElement.PROPERTY_TYPE == "L"
265                            || objElement.PROPERTY_TYPE == "S") {
266
267                        $.each(objElement.VALUES, function (valueId, objValue) {
268                            var $checkbox = $("#" + objValue.CONTROL_ID);
269                            var $option = $("#option_" + objValue.CONTROL_ID);
270                            var $icheckbox = $("#icheck_" + objValue.CONTROL_ID);
271
272                            if (objValue.DISABLED) {
273                                $checkbox.prop("disabled", "disabled");
274                                $option.attr("disabled", "disabled");
275                                $icheckbox.iCheck('disable');
276                            } else {
277                                $checkbox.prop("disabled", false);
278                                $option.attr("disabled", false);
279                                $icheckbox.iCheck('enable');
280                            }
281
282                        });
283
284                        $element.selectpicker('refresh');
285                    }
286                }
287            });
288
289
290        }
291    });
292}

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.