1 2 3//var categoriesProperties; 4var orderByDdl; 5var categoryPageProductsPreviewContainer; 6var pageLoader; 7var sliderPrice, sliderPriceAmount; 8var categoryPageFilterBarContainer, categoryFilterTopRow, categoryMobileOrderByRadioInputs; 9var filterByInventory; 10 11jQuery(document).ready(function () { 12 13 //var sliderRef; 14 //if (isMobile) { 15 // sliderRef = $("#category-banner-mobile-slider[data-slider='1']"); 16 //} 17 //else { 18 // sliderRef = $("#category-banner-slider[data-slider='1']"); 19 //} 20 21 22 categoryPageFilterBarContainer = $("#category-page-filter-bar-container"); 23 categoryFilterTopRow = $("#category-filter-top-row"); 24 categoryMobileOrderByRadioInputs = $("#category-mobile-order-by-radio input"); 25 26 27 //if (sliderRef.length > 0) { 28 // $(sliderRef).bxSlider({ pager: true }); 29 //} 30 31 categoryPageProductsPreviewContainer = $("#category-page-products-preview-container"); 32 pageLoader = $("#page-inner-loader-container"); 33 34 //var colorBlock = ""; 35 //if (typeof (selectedColorsIds) == "undefined") 36 //{ 37 // selectedColorsIds = ","; 38 //} 39 //$(colorsArray).each(function () { 40 // colorBlock += "<label>" + this.Name + " <input class=\"category-property-option\" " + 41 // " type=\"checkbox\" data-property-id=\"-2\" data-value-id=\"" + this.Id + "\" "; 42 // if (selectedColorsIds.indexOf("," + this.Id + ",") >= 0) 43 // { 44 // colorBlock += " checked "; 45 // } 46 // colorBlock += " data-type-id=\"109\"><span></span></label>"; 47 //}); 48 //$(colorBlock).prependTo("#sort-by-colors-container"); 49 // 50 //$("#sort-by-colors-toggle").click(function () { 51 // $("#sort-by-colors-container").slideToggle(); 52 // $(this).toggleClass("open"); 53 //}).click(); 54 55 //categoriesProperties = $(".category-property-option"); 56 //$(categoriesProperties).change(function () { 57 $(document.body).on("change", ".category-property-option", function () { 58 filterBy(false, false); 59 }); 60 61 //$(".clear-property-checked").click(function () { 62 $(document.body).on("click", ".clear-property-checked", function () { 63 var options = $(this).parents(".category-property-options-container").find(".category-property-option"); 64 $(options).each(function () { 65 $(this)[0].checked = false; 66 }); 67 filterBy(false, false); 68 }); 69 70 $(".clear-price-range").click(function () { 71 resetSliderPrice(); 72 }); 73 74 $(".clear-express-cities").click(function () { 75 clearExpressCities(); 76 }); 77 78 if (typeof (filterPriceMin) != "undefined" && typeof (filterPriceMax) != "undefined") { 79 sliderPrice = $("#slider-range"); 80 sliderPriceAmount = $("#amount"); 81 $(sliderPrice).slider({ 82 range: true, 83 min: filterPriceMin, 84 max: filterPriceMax, 85 values: [filterPriceMinSelected, filterPriceMaxSelected], 86 slide: function (event, ui) { 87 $(sliderPriceAmount).html("<span><input data-values='1' type='number' value='" + ui.values[1] + "'/> âª</span> <span><input data-values='0' type='number' value='" + ui.values[0] + "'/> âª</span>"); 88 } 89 //, 90 //change: onSliderRangeChanged 91 }); 92 $(sliderPrice).on("slidechange", onSliderRangeChanged); 93 $(sliderPriceAmount).html("<span><input data-values='1' type='number' value='" + $(sliderPrice).slider("values", 1) + 94 "'/><x>âª</x></span><span><input data-values='0' type='number' value='" + $(sliderPrice).slider("values", 0) + "'/><x>âª</x></span>"); 95 $(sliderPriceAmount).on("change", "input[type='number']", function () { 96 $(sliderPrice).slider("values", $(this).attr("data-values"), $(this).val()); 97 }); 98 } 99 100 orderByDdl = $("#products-filter-order-by"); 101 $(orderByDdl).change(function () { 102 filterBy(false, false); 103 }); 104 if (typeof (orderByValue) != "undefined") { 105 $(orderByDdl).val(orderByValue); 106 if (isMobile) { 107 var rdOps = $(categoryMobileOrderByRadioInputs).filter(function () { 108 console.log($(this).val()); 109 return $(this).val() == orderByValue; 110 }); 111 if ($(rdOps).length > 0) { 112 $(rdOps)[0].checked = true; 113 } 114 } 115 } 116 117 //$(".product-cube-inner-2").each(function () {
118 // $(this).find(".bordered-product").height($(this).height()); 119 //}); 120 121 if (isMobile) { 122 $("#mobile-show-filter-bar").click(function () { 123 $(categoryPageFilterBarContainer).addClass("open"); 124 }); 125 $(".mobile-hide-filter-bar").click(function () { 126 $(categoryPageFilterBarContainer).removeClass("open"); 127 }); 128 $("#mobile-show-sort-bar").click(function () { 129 $(categoryFilterTopRow).addClass("open"); 130 }); 131 $(".mobile-hide-sort-bar").click(function () { 132 $(categoryFilterTopRow).removeClass("open"); 133 }); 134 135 $(categoryMobileOrderByRadioInputs).change(function () { 136 $(orderByDdl).val($(this).val()).trigger("change"); 137 $(categoryFilterTopRow).removeClass("open"); 138 }); 139 } 140 141 filterByInventory = $("#products-filter-inventory"); 142 /*if ($(filterByInventory).length > 0) 143 { 144 var date = new Date(); 145 $.getScript("/Elements/branchJArray.js?v=" + date.getHours() + date.getSeconds(), function () { 146 $(branchesArray).filter(function () { 147 return this.IsExpressDelivery; 148 }).each(function () { 149 $("<option value='" + this.Id + "'>" + this.Name.replace(/- ס××ר ××× ×ת/gi,"") + "</option>").appendTo(filterByInventory); 150 }); 151 $(filterByInventory).change(function () { 152 filterBy(false, false); 153 }); 154 if (typeof (inventoryValue) != "undefined" && inventoryValue != "") { 155 $(filterByInventory).val(inventoryValue); 156 } 157 }); 158 }*/ 159 160 161 categoryFilterToTop(); 162}); 163 164 165function onSliderRangeChanged(event, ui) { 166 filterPriceMinSelected = ui.values[0]; 167 filterPriceMaxSelected = ui.values[1]; 168 var clear = false; 169 if ($(sliderPrice).hasClass("cleared")) { 170 clear = true; 171 $(sliderPrice).removeClass("cleared") 172 } 173 filterBy(true, clear); 174} 175 176function filterBy(fromPriceSlider, clearPricesParameter) { 177 178 blockPage(); 179 180 var filters = "?filter=,"; 181 //$(categoriesProperties).each(function () { 182 $(".category-property-option").each(function () { 183 if ($(this)[0].checked) { 184 filters += $(this).attr("data-property-id") + "_" + $(this).attr("data-value-id") + "_" + $(this).attr("data-type-id") + "_" + ($(this).attr("data-category-id") || "") + "_" + ($(this).attr("data-inherited-from-category-id") || "") + ","; 185 } 186 }); 187 188 if (filters == "?filter=,") { 189 filters = "?"; 190 } 191 else { 192 filters += "&"; 193 } 194 if (fromPriceSlider || document.URL.indexOf("&fp=") >= 0) {//!!docs at @filter-with-prices 195 if (typeof (filterPriceMinSelected) != "undefined" && typeof (filterPriceMaxSelected) != "undefined") { 196 if (!clearPricesParameter) { 197 filters += "fp=" + filterPriceMinSelected + "&tp=" + filterPriceMaxSelected; 198 } 199 } 200 } 201 //var orderByValue = $("#products-filter-order-by").val(); 202 var orderByOption = $("#products-filter-order-by > option:selected"); 203 //if (orderByValue != "n") { 204 if ($(orderByOption).index() != 0) { 205 filters += "&orderby=" + $(orderByOption).val();// orderByValue; 206 } 207 208 //if ($(filterByInventory).length > 0) 209 //{ 210 // if ($(filterByInventory).val() != "") { 211 // filters += "&inventory=" + $(filterByInventory).val(); 212 // } 213 //} 214 215 216 var filter_category_by_express_cities = $("#filter_category_by_express_cities").attr("data-value-id-selected"); 217 if (filter_category_by_express_cities != "") { 218 filters += "&express-by-city=" + filter_category_by_express_cities + ""; 219 } 220 221 222 var redirect2url = window.location.pathname; 223 if (redirect2url[0] == "/" && redirect2url[1] == "/") { 224 redirect2url = redirect2url.substring(1, redirect2url.length - 1); 225 } 226 227 if (typeof (searchFilter) != "undefined") { 228 redirect2url += "?" + searchFilter.replace(/&/gi, "&") + filters.replace("?", "&"); 229 redirect2url = redirect2url.replace("&&", "&"); 230 } 231 else { 232 redirect2url += filters; 233 } 234 235 redirect2url = redirect2url.replace("&&", "&"); 236 redirect2url = redirect2url.replace("?&", "?"); 237 if (redirect2url[redirect2url.length - 1] == "?") { 238 redirect2url = redirect2url.substring(0, redirect2url.length - 1); 239 } 240 if (redirect2url[redirect2url.length - 1] == "&") { 241 redirect2url = redirect2url.substring(0, redirect2url.length - 1); 242 } 243 244 $.get(redirect2url + (redirect2url.indexOf("?") > 0 ? "&" : "?") + "partial=true", function (resp) { 245 setTimeout(function () { 246 unblockPage(); 247 }, 100); 248 $(categoryPageProductsPreviewContainer).find("style").remove(); 249 250 const refResp = $("<div/>").append(resp); 251 const propertiesBarToReplace = $(refResp).find(".properties-bar-to-replace"); 252 if ($(propertiesBarToReplace).length > 0) { 253 const propertiesBarToBeReplaced = $(".properties-bar-to-be-replace").html(""); 254 $(propertiesBarToReplace).appendTo(propertiesBarToBeReplaced).show(); 255 } 256 257 $(categoryPageProductsPreviewContainer).html($(refResp).html()); 258 //jquery.lazyload ×¢×©× preload+swap - 404 ×× ×פע×× onerror. ××××¤× × ×-IntersectionObserver ש×צ×× src ×ש×ר×ת. 259 var lazyObs = new IntersectionObserver(function (entries, obs) {
260 entries.forEach(function (entry) { 261 if (entry.isIntersecting) { 262 $(entry.target).prop("src", $(entry.target).attr("data-original")); 263 obs.unobserve(entry.target); 264 } 265 }); 266 }); 267 $(categoryPageProductsPreviewContainer).find("img.img-lazy-load").each(function () { 268 lazyObs.observe(this); 269 }); 270 271 categoryFilterToTop(); 272 273 window.history.pushState("", "", redirect2url); 274 275 if (!isMobile) { 276 //$("html,body").animate({ scrollTop: 0 }); 277 //$("html,body").animate({ scrollTop: $("#category-filter-top-row").offset().top - 150 }); 278 var scrollTo = $(".container.category"); 279 if ($(scrollTo).length == 0) { 280 scrollTo = $("#category-filter-top-row"); 281 } 282 if ($(scrollTo).length > 0) { 283 $("html,body").animate({ scrollTop: $(scrollTo).offset().top - 150 }); 284 } 285 else { 286 $("html,body").animate({ scrollTop: 0 }); 287 } 288 } 289 }); 290 291 //window.location = redirect2url; 292} 293 294 295function blockPage() { 296 $(pageLoader).css("display", "block"); 297} 298 299function unblockPage() { 300 $(pageLoader).css("display", "none"); 301} 302 303function resetSliderPrice() { 304 var min = $(sliderPrice).slider("option", "min"); 305 var max = $(sliderPrice).slider("option", "max"); 306 $(sliderPriceAmount).html("<span><input data-values='1' type='number' value='" + max + "'/> âª</span> <span><input data-values='0' type='number' value='" + min + "'/> âª</span>"); 307 $(sliderPrice).addClass("cleared"); 308 $(sliderPrice).off("slidechange"); 309 $(sliderPrice).slider("values", 0, min); 310 $(sliderPrice).on("slidechange", onSliderRangeChanged); 311 $(sliderPrice).slider("values", 1, max); 312} 313 314function clearExpressCities() { 315 $("#filter_category_by_express_cities").val("").attr("data-value-id-selected", "").attr("data-value-text-selected", "").trigger("change"); 316 filterBy(); 317} 318 319/*function showFilterGroupsIfOneFilterIsAvailable(){ 320 $(".category-property-option:checked").each(function(){ 321 if ($(this).attr("data-property-id") != "-1") { 322 $(this).parents(".category-property-options-container").find("label").show(); 323 } 324 }); 325}*/ 326 327function categoryFilterToTop() { 328 var container = $("#filter-category-bar-container"); 329 var topFilterContainer = $(".inner-page-title-container"); 330 if ($(container).length > 0 && $(topFilterContainer).length > 0) { 331 var container2 = $(topFilterContainer).find(".categoty-filter-top"); 332 if ($(container2).length == 0) { 333 container2 = $("<div></div>").addClass("categoty-filter-top").appendTo(topFilterContainer); 334 } 335 else { 336 $(container2).children().remove(); 337 } 338 $(container).find("input.category-property-option:checked").each(function () { 339 var input = this; 340 var label = $(input).parent("label[data-value-id]"); 341 var name = $(label).find(".name").text(); 342 $("<button></button>").html(["× ", name].join("")).appendTo(container2).click(function () { 343 $(input)[0].checked = false; 344 $(input).trigger("change"); 345 }); 346 }); 347 } 348}
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.