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> загÑÑзка...</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>×</span> ÐоказаÑÑ: <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.