1var pushStatData=""; 2var popStateEvent=0; 3function product_filter_history_state(action,url,prefix,clicked_param_id,clicked_param_value) { 4 5 if (action=="replace") history.replaceState("", "", url); 6 7 if (action=="push") { 8 if (popStateEvent!=1) { 9 pushStatData = new Array(); 10 pushStatData["prefix"] = prefix; 11 pushStatData["clicked_param_id"] = clicked_param_id; 12 pushStatData["clicked_param_value"] = clicked_param_value; 13 14 pushStatData["checkbox"] = new Array(); 15 $("#"+prefix+"box_filter_content input[type=checkbox]").each(function(){ 16 if ($(this).prop("checked")==true) { 17 pushStatData["checkbox"].push($(this).attr("id")); 18 } 19 }); 20 21 pushStatData["slider"] = new Array(); 22 $("#"+prefix+"box_filter_content .product_filter_num").each(function(){ 23 pushStatData["slider"][$(this).attr("id")]=$(this).slider("values"); 24 }); 25 26 history.pushState(pushStatData, "", url); 27 } 28 popStateEvent=0; 29 } 30 31 if (action=="pop") { 32 window.addEventListener("popstate", function(event){ 33 pushStatData=event.state; 34 if (event.state===undefined || event.state==="" || event.state === null) { 35 if (window.location.hash==="" && (typeof cat_art_list_filter_loaded == "undefined" || cat_art_list_filter_loaded!==1 || event.state === null)) product_filter_delete_all(""); 36 } else { 37 popStateEvent=1; 38 $("#"+event.state.prefix+"box_filter_content input[type=checkbox]").each(function(){ 39 if (event.state.checkbox.indexOf($(this).attr("id"))!=-1) { 40 if ($(this).prop("checked")!=true) { 41 $(this).prop("checked",true).trigger('change'); 42 if (typeof input_checkbox_alter_reload === "function") input_checkbox_alter_reload($(this).parent()); 43 } 44 } else { 45 if ($(this).prop("checked")!=false) { 46 $(this).prop("checked",false).trigger('change'); 47 if (typeof input_checkbox_alter_reload === "function") input_checkbox_alter_reload($(this).parent()); 48 } 49 } 50 }); 51 52 $("#"+event.state.prefix+"box_filter_content .product_filter_num").each(function(){ 53 product_filter_slider($(this),event.state.slider[$(this).attr("id")][0],event.state.slider[$(this).attr("id")][1]); 54 if ($(this).closest('.product_filter_group').find('.product_filter_num_from').length) { 55 $(this).closest('.product_filter_group').find('.product_filter_num_from').val(event.state.slider[$(this).attr("id")][0]); 56 } 57 if ($(this).closest('.product_filter_group').find('.product_filter_num_to').length) { 58 $(this).closest('.product_filter_group').find('.product_filter_num_to').val(event.state.slider[$(this).attr("id")][1]); 59 } 60 }); 61 62 clicked_param_id=event.state.clicked_param_id; 63 clicked_param_value=event.state.clicked_param_value; 64 65 filter_activate_delay(event.state.prefix); 66 } 67 }); 68 } 69} 70function product_filter_slider(obj,akt_min,akt_max) { 71 var min = obj.slider("option", "min"); 72 var max = obj.slider("option", "max"); 73 obj.parent().find('.akt_min').val(akt_min); 74 obj.parent().find('.akt_max').val(akt_max); 75 obj.slider("values", [akt_min, akt_max]); 76 77 var text_before = obj.parent().find('.text_before').val(); 78 var text_after = obj.parent().find('.text_after').val(); 79 text = text_before+String(akt_min).replace(".",money_dec)+text_after+" - "+text_before+String(akt_max).replace(".",money_dec)+text_after; 80 obj.parent().find('.product_filter_num_text').html(text); 81 82 if (akt_min==min && akt_max==max) { 83 obj.parents(".product_filter_content").removeClass("product_filter_content_checked"); 84 obj.parents(".product_filter_group").removeClass("product_filter_group_checked"); 85 } else { 86 obj.parents(".product_filter_content").addClass("product_filter_content_checked"); 87 obj.parents(".product_filter_group").addClass("product_filter_group_checked"); 88 } 89} 90function product_filter_delete_all(prefix) { 91 if (unas_design_ver>=4) { 92 $('.js-selected-filters').empty(); 93 $('.js-filtered-tags--2').find('label').remove(); 94 $(".product_filter_content input[type='checkbox']").prop("checked",false); 95 96 $(".product_filter_content .product_filter_icon").each(function() { 97 if ($(this).hasClass("product_filter_icon_checked")) { 98 filter_icon($(this)); 99 } 100 }); 101 } else { 102 $(".product_filter_content .text_input_checkbox").each(function() { 103 $(this).children("input").prop("checked",false); 104 if ($(this).hasClass("text_input_checkbox_checked")) { 105 $(this).addClass("text_input_checkbox_unchecked"); 106 $(this).removeClass("text_input_checkbox_checked"); 107 } 108 $(this).attr("rel_checked",0); 109 }); 110 111 $(".product_filter_content .product_filter_icon").each(function() { 112 if ($(this).hasClass("product_filter_icon_checked")) { 113 filter_icon_click($(this));filter_icon($(this)); 114 } 115 }); 116 } 117 118 $(".product_filter_content.product_filter_content_checked .ui-slider").each(function() { 119 $(this).addClass('reset'); 120 var min = $(this).slider("option", "min"); 121 var max = $(this).slider("option", "max"); 122 $(this).parent().find('.akt_min').val(min); 123 $(this).parent().find('.akt_max').val(max); 124 if ($(this).closest('.product_filter_group').attr('data-id') === 'price'){ 125 $(this).closest('.product_filter_group').find('.product_filter_num_from').val(number_format((min * parseFloat(UNAS.shop.currency_rate)),money_len,'.','')); 126 $(this).closest('.product_filter_group').find('.product_filter_num_to').val(number_format((max * parseFloat(UNAS.shop.currency_rate)),money_len,'.','')); 127 } else { 128 $(this).closest('.product_filter_group').find('.product_filter_num_from').val(number_format(min,$(this).parent().find('.decimal_length').val(),'.','')); 129 $(this).closest('.product_filter_group').find('.product_filter_num_to').val(number_format(max,$(this).parent().find('.decimal_length').val(),'.','')); 130 } 131 $(this).slider("values", [min, max]); 132 133 var text_before = $(this).parent().find('.text_before').val(); 134 var text_after = $(this).parent().find('.text_after').val(); 135 text = text_before+String(min).replace(".",money_dec)+text_after+" - "+text_before+String(max).replace(".",money_dec)+text_after; 136 $(this).parent().find('.product_filter_num_text').html(text); 137 138 $(this).parents(".product_filter_content").removeClass("product_filter_content_checked"); 139 $(this).parents(".product_filter_group").removeClass("product_filter_group_checked"); 140 $(this).removeClass('reset'); 141 }); 142 filter_activate_delay(prefix); 143 $(document).trigger("productFilterDeleted"); 144} 145 146//BOX-FILTER (FILTER-SAVE) 147function product_filter_save_filter_overlay() { 148 if ($("#overlay_save_filter").attr("data-inited")==1) { 149 $("#overlay_save_filter").overlay().load(); 150 } else { 151 $(document).on("overlayInited",function(event, params) { 152 if (params['id']=='save_filter') { 153 $("#overlay_save_filter").overlay().load(); 154 } 155 }); 156 } 157} 158function product_filter_save () { 159 var filter_name = $("#filter_name").val(); 160 var filter_page_id = $("#filter_page_id").val(); 161 var filter_name_check=filter_name.replace(/\s/g, ""); 162 163 if (filter_name_check=="") { 164 if (unas_design_ver >= 5) { 165 const filter_name_input = $("#filter_name"); 166 const invalid_feedback = filter_name_input.siblings('.invali
166d-feedback'); 167 filter_name_input.addClass('is-invalid').removeClass('is-valid'); 168 invalid_feedback.html(invalid_feedback.attr('data-text-error-name-required')); 169 } else { 170 $("#filter_save_errors").removeClass("d-none").addClass("d-block"); 171 $("#filter_save_errors .error_empty_input").removeClass("d-none").addClass("d-block"); 172 } 173 } else { 174 var data = { 175 action: "save_filter", 176 shop_id: shop_id, 177 get_ajax: 1, 178 filter_name: filter_name, 179 page: UNAS.design.page, 180 page_id: filter_page_id 181 }; 182 183 data['filter'] = filter_get; 184 if (UNAS.design.page==="search" || UNAS.design.page==="search_result") data['page_data'] = JSON.stringify(search_parameters); 185 if (UNAS.design.page==="artspec" || UNAS.design.page==="product_list_spec") data['page_data'] = JSON.stringify(artspec_parameters); 186 187 $.ajax({ 188 type: "GET", 189 url: UNAS.shop.base_url+"/shop_ajax/ajax_save_filter.php?change_lang="+actual_lang, 190 dataType: "JSON", 191 data: data, 192 success: function (response) { 193 if (response.success) { 194 if (UNAS.design.page!=="search" && UNAS.design.page!=="artspec" && UNAS.design.page!=="search_result" && UNAS.design.page!=="product_list_spec" ) { 195 $(".saved_filters_wrapper").html(response.content); 196 } 197 198 if (unas_design_ver >= 5) { 199 $("#filter_name").removeClass('is-invalid').addClass('is-valid'); 200 } else { 201 $("#overlay_save_filter #filter_name").val(""); 202 $("#overlay_save_filter").overlay().close(); 203 $("#filter_save_errors").removeClass("d-block").addClass("d-none"); 204 $("#filter_save_errors .error").removeClass("d-block").addClass("d-none"); 205 } 206 $(document).trigger("savedFilterAdded"); 207 } 208 209 if (response.error) { 210 if (unas_design_ver >= 5) { 211 const filter_name_input = $("#filter_name"); 212 filter_name_input.addClass('is-invalid').removeClass('is-valid'); 213 filter_name_input.siblings('.invalid-feedback').html(response.message); 214 } else { 215 $("#filter_save_errors").removeClass("d-none").addClass("d-block"); 216 $(".error_"+response.error_code).removeClass("d-none").addClass("d-block"); 217 } 218 } 219 } 220 }); 221 } 222} 223$(document).ready(function () { 224 $(document).on("overlayAjaxLoaded",function(event, params) { 225 if (params['id']=='save_filter') { 226 $("#overlay_save_filter #filter_page_id").val(UNAS.shop.category_id); 227 } 228 }); 229 if (location.hash=="#filter_save") { 230 if (UNAS.customer['email']!="") product_filter_save_filter_overlay(); 231 } 232}); 233$(document).ajaxStop(function () { 234 $("#filter_name").on('click', function () { 235 if (unas_design_ver >= 5) { 236 $(this).removeClass('is-invalid is-valid'); 237 } else { 238 $("#filter_save_errors").removeClass("d-block").addClass("d-none"); 239 $("#filter_save_errors .error").removeClass("d-block").addClass("d-none"); 240 } 241 }); 242});
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.