');else if(action == "hide") obj_table.parent("div").find(".datables_preloader_custom").remove();}} // ======= PRELOADER FUNCTION ============= $(document).ready(function() {// =================== INIT DATATABLES =========if ( !$.fn.dataTable.isDataTable( ".tableid40259" ) ) {var tableid40259 = $(".tableid40259").DataTable({"language": {/*"url": "//cdn.datatables.net/plug-ins/1.10.16/i18n/German.json",*/"search": " ","searchPlaceholder": "Tabelle durchsuchen...","EmptyTable": "Keine Daten in der Tabelle vorhanden","sInfo": "_START_ bis _END_ von _TOTAL_ Einträgen","sInfoEmpty": "0 bis 0 von 0 Einträgen","sInfoFiltered": "(gefiltert von _MAX_ Einträgen)","sInfoPostFix": "","sInfoThousands": ".","sLengthMenu": "_MENU_ Einträge anzeigen","sLoadingRecords": "Wird geladen...","sProcessing": "Bitte warten...","sZeroRecords": "Keine Einträge vorhanden.","oPaginate": {"sFirst": "Erste","sPrevious": "Zurück","sNext": "Nächste","sLast": "Letzte"},"oAria": {"SortAscending": ": aktivieren, um Spalte aufsteigend zu sortieren","SortDescending": ": aktivieren, um Spalte absteigend zu sortieren"}},"paging": true,"pageLength": 10000, //20,"ordering": false,"info":false,"blankCells": true,searching: true,fixedHeader: true,"autoWidth": false });}// ============================ FIXED HEADER ===================================================// Disabled if small then LG display$(window).on("resize",function(){if(window.innerWidth >= 1200)tableid40259.fixedHeader.enable();else tableid40259.fixedHeader.disable(); });// Fixed Header - HIDE/SHOWtableid40259.on( "draw", function () {// OnInitif(window.innerWidth >= 1200) tableid40259.fixedHeader.enable();elsetableid40259.fixedHeader.disable(); // Hide if lesser then XY Variantsif($(".tableid40259 tbody tr").length <= 10) tableid40259.fixedHeader.disable();else tableid40259.fixedHeader.enable();// preloaderobj_this = $(this);datables_preloader("show","tableid40259");window.setTimeout(function() { datables_preloader("hide","tableid40259") }, 500);// after any search, update count how much variants shown => jq_count_shown_rowsrecountLoadmoreNumbers();} );// Enable/Disabled FixedHeader dynamic $(document).on("click",function(){ if($(".tableid40259").closest("#home").is(":visible") == true && $( window ).width() >= 1200 && $(".tableid40259 tbody tr").length > 10) tableid40259.fixedHeader.enable();else tableid40259.fixedHeader.disable(); });// need for dropdown selected "XY gew....", otherwise select-dropdown expand// ===== reset all th inline-styles from datatable causes in display issues width table-layout:fixed and FixedHeader Pluginconst ua = window.navigator.userAgent; //Check the userAgent property of the window.navigator objectconst msie = ua.indexOf("MSIE "); // IE 10 or olderconst trident = ua.indexOf("Trident/"); //IE 11//console.log( (msie === -1),(trident === -1), window.navigator.userAgent);$( window ).scroll(function() {//var fixed_header = $( ".tableid40259.fixedHeader-floating > thead > tr:nth-child(1) > th" );if( $( ".tableid40259.fixedHeader-floating" ).is(":visible") == true && $( ".tableid40259.fixedHeader-floating" ).data("style-fixed") != "true") {//console.log("fixedHeader-floating: set fixed");$( ".tableid40259.fixedHeader-floating" ).data("style-fixed","true");$( ".tableid40259 > thead > tr > th" ).each(function(index,value){$(this).attr("style","")});}// only check/fix head cols//if(msie === -1 && trident === -1) datables_fix_th_width(); mobileOptimizePricetable();});// ===== reset all th inline-styles from datatable causes in display issues width table-layout:fixed and FixedHeader Plugin// ===== check each row/content if any is bigger then head-row, if yes set fixed width of content =============if(typeof datables_fix_th_width !== "function"){function datables_fix_th_width() {//console.log( "datables_fix_th_width()");head_row = $( ".tableid40259:not(.fixedHeader-floating) > thead > tr:nth(0) > th" );head_row_content = $( ".tableid40259:not(.fixedHeader-floating) > thead > tr:nth(2) > th" );head_row_fixed = $( ".tableid40259.fixedHeader-floating > thead > tr:nth(0) > th" );tolerance_padding = 5; //pxcol_width_maximum = 110;// only check td / cols once because of performance lack on big tablesif(tableid40259_datables_fix_th_width_ary_cols_to_fix.length == 0) { //console.log("datables_fix_th_width(): fixed");$( ".tableid40259 > tbody > tr" ).each(function(index_tr,value){$(this).find("td").each(function(index_td,value){width_thead_col = $(head_row[index_td]).width();width_body_content = $(this).find("span").width();// td larger then thif(width_body_content > (width_thead_col+tolerance_padding) && typeof width_body_content !== undefined) { // get max width-content and write to array if((typeof tableid40259_datables_fix_th_width_ary_cols_to_fix[index_td] === "undefined") || tableid40259_datables_fix_th_width_ary_cols_to_fix[index_td] < (width_body_content+tolerance_padding)) { tableid40259_datables_fix_th_width_ary_cols_to_fix[index_td] = (width_body_content+tolerance_padding); }}});});}// Apply changes to cols (width)$.each( tableid40259_datables_fix_th_width_ary_cols_to_fix,function(index,value){ if(value !== undefined) {//console.log( " col_" + index + " : " + value + " > th-width: " + ($(head_row[index]).width()+tolerance_padding) );if(col_width_maximum < value) value = col_width_maximum;if($(head_row_fixed[index]).length > 0) $(head_row_fixed[index]).width( value ); // fix fixed_header$(head_row[index]).width( value ); // fix initial_header}});}}var tableid40259_datables_fix_th_width_ary_cols_to_fix = [];datables_fix_th_width();// ===== check each row/content if any is bigger then head-row, if yes set fixed width of content =============// =========== HIDDEN ATTRIBUTES - FILER DATATABLE ===============if(typeof datables_filter_hidden_attr !== "function"){function datables_filter_hidden_attr(obj_hidden_search_values) {if(js_des_debug) console.log( "function called: datables_filter_hidden_attr(obj_hidden_search_values)" );hidden_search_regex = "";var ary_build_regex = [];if(Object.keys(obj_hidden_search_values).length>0) {$.each(obj_hidden_search_values,function(k,value){var key = k;// check for regex signs & escape them//\-\.\/\[\]\\ **always** need escaping//\*\+\?\)\{\}\| need escaping when **not** in a character class- [a-z*+{}()?]value_escaped = value.toString().replace("-","\\\-");value_escaped = value_escaped.toString().replace("+","\\\+");value_escaped = value_escaped.toString().replace(".","\\\.");value_escaped = value_escaped.toString().replace("/","\\\/");value_escaped = value_escaped.toString().replace("[","\\\[");value_escaped = value_escaped.toString().replace("]","\\\]");value_escaped = value_escaped.toString().replace("*","\\\*");value_escaped = value_escaped.toString().replace("?","\\\?");value_escaped = value_escaped.toString().replace(")","\\\)");value_escaped = value_escaped.toString().replace("(","\\\(");value_escaped = value_escaped.toString().replace("{","\\\{");value_escaped = value_escaped.toString().replace("}","\\\}");value_escaped = value_escaped.toString().replace("|","\\\|");value = value_escaped;if(js_des_debug) console.log( "value_escaped: " +value_escaped );// RangeSlider value - who not exists in table(hidden_search_value)if(obj_hidden_search_values[key].indexOf("[to]") > 0 && $(".bootstrap_slider[data-identifier='" + k + "']").length == 0) { ary_hidden_range_slider[k] = value; }// selectpickerelse if($(".bootstrap_slider[data-identifier='" + k + "']").length == 0 && $(".selectpicker[data-identifier='" + k + "']").length == 0){tmp_ary_val = value.split("::");tmp_regex_multi = "(((.*?), )?" + tmp_ary_val.join("(,.*?)?|((.*?), )?") + "(,.*?)?)"; // e.g. (((.*?), )?C-Welle(,.*?)?|((.*?), )?EB-Welle(,.*?)?)//if(js_des_debug) console.log(tmp_regex_multi);//$.each(tmp_ary_val,function(k,val){ ary_build_regex.push(key+"="+val); });ary_build_regex.push(key+"="+tmp_regex_multi);}});// https://regex101.com/r/t5EFNK/1// ^(?=.*(^|#) 9034=(((.*?), )?1-wellig (,.*?)?)(#|$))(?=.*(^|#) 9035=(((.*?), )?C-Welle(,.*?)?|((.*?), )?EB-Welle(,.*?)?) (#|$)).+var hidden_search_regex = "^(?=.*(^|#) " + ary_build_regex.join(" (#|$))(?=.*(^|#) ") + " (#|$)).+"; // fetch values and build regex//var hidden_search_regex = "# " + ary_build_regex.join(" #|# ") + " #"; // fetch values and build regex}if(ary_build_regex.length < 1) hidden_search_regex = "";/* Escape the expression so we can perform a regex matchvar val = $.fn.dataTable.util.escapeRegex($(this).val());*///console.log(ary_build_regex);//console.log( "hidden_search_regex: " + hidden_search_regex + " Search-Row-index(begin at 0): " + ($(".tableid40259 thead > tr:nth(0) > th").length-1) );if(js_des_debug) console.log("hidden_search_regex: ", hidden_search_regex );// Add placeholders to filter searchsetTimeout(function() {$(document).find(".bootstrap-select .bs-searchbox input").attr("placeholder", "Suchen");}, 2000);//tmp = $(".tableid40259 thead > tr:nth(0) > th");//console.log( tmp[($(".tableid40259 thead > tr:nth(0) > th").length-1)] );//console.log( tmp[$(".tableid40259 thead > tr:nth(0) > th").length] );}}var tableid40259_obj_hidden_search_values = {};tableid40259_obj_hidden_search_values = [];// =========== HIDDEN ATTRIBUTES - FILER DATATABLE ===============// =========== BUILD DYNAMIC FILTER BUTTONS ======================if(typeof boostrap_select_horizontal_filter !== "function"){function boostrap_select_horizontal_filter(attr_key,attr_value,action,obj_size_attributes,obj_hidden_search_values) {if(js_des_debug) console.log( "function called: boostrap_select_horizontal_filter(attr_key,attr_value,action,obj_size_attributes,obj_hidden_search_values)" );if(action == "add") {//console.log("add-filter");// declare content multiselect/rangesliderif($('.bootstrap_slider[data-identifier="'+attr_key+'"]').length > 0){var range_values = attr_value.split(" - ");val_min = range_values[0].toString().replace(".",",");val_max = range_values[1].toString().replace(".",",");var filter_content = tableid40259_obj_size_attributes[attr_key] + ": " + val_min + "-" + val_max;var filter_title = "Filter aufheben \"" + tableid40259_obj_size_attributes[attr_key] + "\"";}else{attr_value = attr_value.replace(/::/g,", ").replace(/\|/g,", ").replace(/empty/g,"Keine Angabe").replace(/\[to\]/g,"-").replace(/^(\d+)\.(\d{1,2})$/g,"$1,$2");if(attr_value.match(/(.*?)\-(.*?)/)) attr_value = attr_value.replace(/^(\d+)\.(\d{1,2})$/g,",");var filter_content = tableid40259_obj_size_attributes[attr_key] + ": " + attr_value;var filter_title = "Filter aufheben \"" + tableid40259_obj_size_attributes[attr_key] + "\": " + attr_value;}//console.log(attr_value);//console.log(range_values);// check if exists do not create new filterif($(".tableid40259 .datatable_holder_active_filters").find(".filter_active.attr_"+attr_key).length == 0) {// CLONE$(".tableid40259 .datatable_holder_active_filters .placeholder_to_copy:first").clone().appendTo( $(".tableid40259 .datatable_holder_active_filters") );// ADD CONTENT $(".tableid40259 .datatable_holder_active_filters").find(".placeholder_to_copy:last").removeClass("hide placeholder_to_copy").addClass("inline filter_active attr_" + attr_key ).find("button .text").html( filter_content ); //.parent().attr("title", "Wert: " + attr_value);// Create Hidden-Attribute-Filtersif($(".selectpicker[data-identifier='" + attr_key + "']").length == 0 && $(".bootstrap_slider[data-identifier='" + attr_key + "']").length == 0) {$(".tableid40259 .datatable_holder_active_filters").find(".filter_active.attr_"+attr_key+" .jq_filter_clear").attr("data-filter-type","hidden_attribute").attr("data-identifier",attr_key);}// Create Bootstrap-Select-Filtersif($(".selectpicker[data-identifier='" + attr_key + "']").length > 0) {$(".tableid40259 .datatable_holder_active_filters").find(".filter_active.attr_"+attr_key+" .jq_filter_clear").attr("data-filter-type","bootstrap_select").attr("data-identifier",attr_key);//delete tableid40259_obj_hidden_search_values[attr_key]; // remove from hidden search attributes - !!! deactivated because of ASN URI Para}// Create Bootstrap-Range-Filtersif($(".bootstrap_slider[data-identifier='" + attr_key + "']").length > 0){$(".tableid40259 .datatable_holder_active_filters").find(".filter_active.attr_"+attr_key+" .jq_filter_clear").attr("data-filter-type","bootstrap_slider").attr("data-identifier",attr_key);//delete tableid40259_obj_hidden_search_values[attr_key]; // remove from hidden search attributes - !!! deactivated because of ASN URI Para}}// just update value/Titleelse {$(".tableid40259 .datatable_holder_active_filters").find(".filter_active.attr_"+attr_key+ " button").attr("title", "Wert: " + attr_value).find(".text").html( filter_content );}$(".tableid40259 .jq_filter_clear_all,.tableid40259 .datatable_active_filters_desc").removeClass("hide");// show Clear-all-filter button}else if(action == "remove") {//console.log("remove-filter");$(".tableid40259 .datatable_holder_active_filters").find(".filter_active.attr_"+attr_key).remove();if($(".tableid40259 .datatable_holder_active_filters .filter_active").length == 0) $(".tableid40259 .jq_filter_clear_all,.tableid40259 .datatable_active_filters_desc").addClass("hide");// show Clear-all-filter buttondelete tableid40259_obj_hidden_search_values[attr_key]; // remove from hidden search attributes - }$("[name=filters_changed]").val(1);}}// From category parameters(hidden) and selected colsvar tableid40259_obj_size_attributes = {};tableid40259_obj_size_attributes = {"9023":"Länge außen (mm)","9032":"Material","9033":"Farbe","9042":"Typ","9144":"Raumgewicht (kg\/m³)","9145":"Abmessung A (mm)","9146":"Abmessung B (mm)","9147":"Abmessung C (mm)","9148":"Abmessung D (mm)","9178":"VE (St.)","9182":"PE (St.)","9261":"Gewicht p. Einheit (kg)"};// create filters over category/hidden,range-filter,boostrap-select$.each(tableid40259_obj_hidden_search_values, function (key, val) {if($(".selectpicker[data-identifier='" + key + "']").length == 0 && $(".bootstrap_slider[data-identifier='" + key + "']").length == 0) { boostrap_select_horizontal_filter(key,val,"add",tableid40259_obj_size_attributes,tableid40259_obj_hidden_search_values);}});// =========== BUILD DYNAMIC FILTER BUTTONS ======================// =========== FILTER REMOVE EVENTS(Horizontal) ==============================if(typeof clear_horizontal_filter !== "function"){function clear_horizontal_filter(func_identifier) {if(js_des_debug) console.log( "function called: clear_horizontal_filter(func_identifier)" );// clear Bootstrap-Select-Filtersif($(".selectpicker[data-identifier='" + func_identifier + "']").length > 0) {bootstrap_select_filter($(".selectpicker[data-identifier='" + func_identifier + "']"),tableid40259,1,[""]);}// clear Bootstrap-Range-Filterselse if($(".bootstrap_slider[data-identifier='" + func_identifier + "']").length > 0) {$(".bootstrap_slider[data-identifier='" + func_identifier + "'] [class*=pricetable-slider-input-min-]").val( $(".bootstrap_slider[data-identifier='" + func_identifier + "'] [class*=pricetable-slider-input-min-]").data("start-value") );$(".bootstrap_slider[data-identifier='" + func_identifier + "'] [class*=pricetable-slider-input-max-]").val( $(".bootstrap_slider[data-identifier='" + func_identifier + "'] [class*=pricetable-slider-input-max-]").data("start-value") );bootstrap_slider_filter_update( $(".bootstrap_slider[data-identifier='" + func_identifier + "'] [class*=pricetable-slider-input-min-]"), "script" );bootstrap_slider_filter_activate( $(".bootstrap_slider[data-identifier='" + func_identifier + "'] .pricetable-slider-btn-push") );}// Remove Hidden-Filterdelete tableid40259_obj_hidden_search_values[func_identifier]; delete ary_hidden_range_slider[func_identifier];datables_filter_hidden_attr(tableid40259_obj_hidden_search_values);boostrap_select_horizontal_filter(func_identifier,"","remove",tableid40259_obj_size_attributes,tableid40259_obj_hidden_search_values);}}$(document).on("click",".tableid40259 .jq_filter_clear",function(){clear_horizontal_filter($(this).data("identifier"));renewPricetable();//console.log(tableid40259_obj_hidden_search_values);});$(document).on("click",".tableid40259 .jq_filter_clear_all",function(){$(".tableid40259 .datatable_holder_active_filters .jq_filter_clear").each(function(){clear_horizontal_filter( $(this).data("identifier") );});$(this).addClass("hide");renewPricetable();});// =========== FILTER REMOVE EVENTS(Horizontal) ============================== // =========== SELECT BOOTSTRAP - FILTER DATATABLE ===============var ary_select_old_val = [];if(typeof bootstrap_select_filter !== "function"){function bootstrap_select_filter(func_this,func_datatable_obj,func_col_offset,func_val,no_changes=false) {if(js_des_debug) console.log( "function called: bootstrap_select_filter(func_this,func_datatable_obj,func_col_offset,func_val)" );// do something...var col_nr = (func_col_offset + func_this.data("col-nr")) -1; // cols begin at key "0"var val_current = func_this.val();if(func_val.length > 0) val_current = func_val;if(typeof ary_select_old_val[col_nr] == "undefined" || ary_select_old_val[col_nr] === null) {ary_select_old_val[col_nr] = {};ary_select_old_val[col_nr] = Array("");}//console.log( ary_select_old_val[col_nr] );//console.log( func_val );// When set val to specific value/selected optionif(func_val != "") func_this.selectpicker("val", func_val);// Handle-Placeholder, first Alle...if(val_current === null){//console.log("NULL select #ALL#");func_this.selectpicker("val", [""]);if (!no_changes) boostrap_select_horizontal_filter(func_this.data("identifier"),"","remove",tableid40259_obj_size_attributes,tableid40259_obj_hidden_search_values);}else if(val_current[0] == "" && ary_select_old_val[col_nr][0] == ""){//console.log("delelect #ALL#");func_this.find("option:first").attr("selected",false);}else if(val_current[0] == "" && ary_select_old_val[col_nr][0] != ""){//console.log("select #ALL# and deselect all other");//func_this.find(":selected:not(:first)").attr("selected",false);func_this.selectpicker("val", [""]);if (!no_changes) boostrap_select_horizontal_filter(func_this.data("identifier"),"","remove",tableid40259_obj_size_attributes,tableid40259_obj_hidden_search_values);}ary_select_old_val[col_nr] = func_this.val();func_this.selectpicker("refresh");var val_selected = func_val.length > 0 ? func_val : func_this.val();var replc = new RegExp(",", "g");val_selected = val_selected ? val_selected : "";var expl_search_term = val_selected.toString().split(",");var impl_regex = "";if(expl_search_term.length > 0) {$.each( expl_search_term, function( key, value ) {if(value == "") return true;if(impl_regex != "") impl_regex += "|";value_new = value.replace("+", "\\\+");impl_regex += "((^"+value_new+"$)|(^"+value_new+",)|(, "+value_new+"))";});}var val_regex = val_selected != null ? val_selected.toString().replace(replc, "|") : "";//console.log( col_nr + ": " + val_selected + " Regex: " + val_regex );//console.log( "new-regex:" + impl_regex );if(js_des_debug) console.log( "bootstrap_select_filter() => val_regex: " +val_regex );// "^"+val_regex+"$" // for exact match, but if multiple values searched like Blue, Red "Red"datables_filter_hidden_attr(tableid40259_obj_hidden_search_values); // important if hidden value is also active filter// horizontal filtersif(val_regex != "" && !no_changes) boostrap_select_horizontal_filter(func_this.data("identifier"),val_regex,"add",tableid40259_obj_size_attributes,tableid40259_obj_hidden_search_values);// set CSS-State for filter iconif(val_selected[0] != "" ) func_this.closest(".product-filter").find(".dropdown-toggle").addClass("is-selected");else func_this.closest(".product-filter").find(".dropdown-toggle").removeClass("is-selected");}}// Fetch all FilterDropdowns which BootstrapSelect Instances and trigger filter$.each(tableid40259_obj_hidden_search_values, function (key, val) {if($(".selectpicker[data-identifier='" + key + "']").length > 0){// anfuerungszeichen maskieren//tmp_val = val.replace("quote",'\\\\"');ary_set_val = val.split("::");bootstrap_select_filter($(".selectpicker[data-identifier='" + key + "']"),tableid40259,1,ary_set_val);//console.log("trigger filter: " + key + " Val: " + val, ary_set_val);}});$(document).on("change", ".content-asn.product-filters .selectpicker", function (e) {bootstrap_select_filter($(this),tableid40259,1,"",true);});// =========== SELECT BOOTSTRAP - FILTER DATATABLE ===============// =========================================// Range-Slider Filtering-Options$(".pricetable-slider-40259").each(function() {try {$(this).slider();} catch(err) {console.log('Slider Error: ' + err.message);}});//var pricetable_slider_40259 = $(".pricetable-slider-40259").slider();// ****** Range-Slider Fill InputOnSlide$(document).on("slide slideStop", ".pricetable-slider-40259", function(slideEvt) {slideValue = slideEvt.value;// check if inputs are focused then no additional filtering//if(!$(".pricetable-slider-input-min-" + $(this).data("target-output") ).is(":focus") && !$(".pricetable-slider-input-max-" + $(this).data("target-output") ).is(":focus"))$(".pricetable-slider-input-min-" + $(this).data("target-output") ).val(slideValue[0]).parent().removeClass("has-error");$(".pricetable-slider-input-max-" + $(this).data("target-output") ).val(slideValue[1]).parent().removeClass("has-error");// set array for check filter-vals in datatables filter functionary_key = $(this).data("col-nr");ary_data_filters[ary_key] = {};ary_data_filters[ary_key]["target_identifier"] = $(this).data("target-output");ary_data_filters[ary_key]["col_nr"] = (1 + $(this).data("col-nr")) -1; // cols begin at key "0"//tableid40259.draw();});// ====== Range-Slider set over Input$(document).on("keydown", "[class*=pricetable-slider-input-min-], [class*=pricetable-slider-input-max-]", function(e){-1!==$.inArray(e.keyCode,[46,8,9,27,13,110,188,190])||(/65|67|86|88/.test(e.keyCode)&&(e.ctrlKey===true||e.metaKey===true))&&(!0===e.ctrlKey||!0===e.metaKey)||35<=e.keyCode&&40>=e.keyCode||(e.shiftKey||48>e.keyCode||57e.keyCode||105 0) {if(input_min_incomplete != null) return true;if(input_max_incomplete != null) return true;var val_min = parseFloat(input_min.val().replace(",","."),10);var val_max = parseFloat(input_max.val().replace(",","."),10);var val_min_limit = parseFloat( $("#slider-" + input_min.data("identifier") ).data("slider-min") ,10);var val_max_limit = parseFloat( $("#slider-" + input_min.data("identifier") ).data("slider-max") ,10)}else{var val_min = parseInt(input_min.val(),10);var val_max = parseInt(input_max.val(),10);var val_min_limit = parseInt( $("#slider-" + input_min.data("identifier") ).data("slider-min") ,10);var val_max_limit = parseInt( $("#slider-" + input_min.data("identifier") ).data("slider-max") ,10);}//console.log( "filter " + func_event.type + " min: " + val_min + " max: " + val_max );// validate input valuesvar err_type = [];if(isNaN(val_min)) err_type["min"] = true;else if((val_min > val_max || val_min > val_max_limit) && val_max > val_min_limit) val_min = val_max;else if((val_min > val_max || val_min > val_max_limit) && val_max < val_min_limit) val_min = val_min_limit;else if(val_min < val_min_limit && func_event.type == "blur") val_min = val_min_limit;else if(val_min < val_min_limit) err_type["min"] = true;if(isNaN(val_max)) err_type["max"] = true;else if(val_max < val_min_limit && func_event.type == "blur") val_max = val_min_limit+10;else if(val_max < val_min_limit) err_type["max"] = true;else if(val_max > val_max_limit) val_max = val_max_limit;var new_input_ary = Array( val_min, val_max );//console.log( new_input_ary );if(err_type["max"] != true && err_type["min"] != true){// set slider values$("#slider-" + input_min.data("identifier") ).slider( "setValue", new_input_ary ); // set input values (because datatable use this values for filtering tableinput_min.val(val_min); input_max.val(val_max);// set array for check filter-vals in datatables filter functionary_key = $("#slider-" + input_min.data("identifier") ).data("col-nr");ary_data_filters[ary_key] = {};ary_data_filters[ary_key]["target_identifier"] = $("#slider-" + input_min.data("identifier") ).data("target-output");ary_data_filters[ary_key]["col_nr"] = (1 + $("#slider-" + input_min.data("identifier") ).data("col-nr")) -1; // cols begin at key "0"}if(err_type["max"] == true) input_max.parent().addClass("has-error");elseinput_max.parent().removeClass("has-error");if(err_type["min"] == true) input_min.parent().addClass("has-error"); elseinput_min.parent().removeClass("has-error");}}$(document).on("keyup blur", "[class*=pricetable-slider-input-min-], [class*=pricetable-slider-input-max-]", function(event){bootstrap_slider_filter_update( $(this), event );});// ====== Range-Slider set over Input// ====== ACTIVATE RANGE-FILTERif(typeof bootstrap_slider_filter_activate !== "function"){function bootstrap_slider_filter_activate(func_this) {if(js_des_debug) console.log( "function called: bootstrap_slider_filter_activate(func_this)" );dropdown_element = func_this.closest("ul").parent().find(".dropdown-toggle");dropdown_element.toggle();//console.log("start-value: " + func_this.closest("ul").find("input[name='min']").data("start-value") + " input[name=min]: "+ func_this.closest("ul").find("input[name='min']").val());// Set selected Dropdown Text/Icon(if filter is not default)if(func_this.closest("ul").find("input[name='min']").data("start-value") != func_this.closest("ul").find("input[name='min']").val()||func_this.closest("ul").find("input[name='max']").data("start-value") != func_this.closest("ul").find("input[name='max']").val() ) {dropdown_element.addClass("is-selected");// horizontal filtersval_title_filter = func_this.closest("ul").find("input[name='min']").val() + " - " + func_this.closest("ul").find("input[name='max']").val();boostrap_select_horizontal_filter(dropdown_element.parent().data("identifier"),val_title_filter,"add",tableid40259_obj_size_attributes,tableid40259_obj_hidden_search_values);}else {dropdown_element.removeClass("is-selected")// horizontal filtersboostrap_select_horizontal_filter(dropdown_element.parent().data("identifier"),"","remove",tableid40259_obj_size_attributes,tableid40259_obj_hidden_search_values);}}}var filterOpen = false;$(document).on("click", ".pricetable-slider-btn-push", function(){sendSliderFilter($(this).closest('.bootstrap_slider.product-filter'));filterOpen = false;});function sendSliderFilter(select) {bootstrap_slider_filter_activate( select.find('.pricetable-slider-btn-push').first() );boostrap_select_horizontal_filter(select.attr("data-identifier"),"","remove",tableid40259_obj_size_attributes,tableid40259_obj_hidden_search_values);boostrap_select_horizontal_filter(select.attr("data-identifier"),select.find(".slider + input").val().replace(",", " - "),"add",tableid40259_obj_size_attributes,tableid40259_obj_hidden_search_values);if(typeof renewPricetable === "function"){ renewPricetable(); }}//$(document).on("change", ".content-asn.product-filters .product-filter", function(){//if ($(this).find('input:not([aria-label="Search"])').length) {//boostrap_select_horizontal_filter($(this).attr("data-identifier"),"","remove",tableid40259_obj_size_attributes,tableid40259_obj_hidden_search_values);//boostrap_select_horizontal_filter($(this).attr("data-identifier"),$(this).find("input").val().replace(",", " - "),"add",tableid40259_obj_size_attributes,tableid40259_obj_hidden_search_values);//}//});$(document).on('click', '.btn-close-filter', function(){sendSelectFilter($(this).closest('.bootstrap-select'));filterOpen = false;});function sendSelectFilter(select) {bootstrap_select_filter(select.find('select').first(),tableid40259,1,"");if(typeof renewPricetable === "function"){ renewPricetable(); }}// Renew on filter closevar filterSubmitOnClose;$(document).on('click', '.bootstrap_slider.product-filter button, .bootstrap-select.product-filter button', function(){filterOpen = true;filterSubmitOnClose = $(this).closest('.product-filter');});//$(document).on('click', function(e){//if (filterOpen) {//filterOpen = false;//if (filterSubmitOnClose.hasClass('bootstrap_slider')) {//sendSliderFilter(filterSubmitOnClose);//} else {//sendSelectFilter(filterSubmitOnClose);//}//}//});// ====== ACTIVATE RANGE-FILTER// ====== INIT FILTERSif(typeof bootstrap_init_filters !== "function"){function bootstrap_init_filters() {// Fetch all FilterDropdowns which BootstrapRange Instances and trigger filter$.each(tableid40259_obj_hidden_search_values, function (key, val) {if($(".bootstrap_slider[data-identifier='" + key + "']").length > 0){ary_values = val.split("[to]");// check if out of range, from ASN SEARCHif($(".bootstrap_slider[data-identifier='" + key + "'] [class*=pricetable-slider-input-min-]").data("start-value") > ary_values[0]) ary_values[0] = $(".bootstrap_slider[data-identifier='" + key + "'] [class*=pricetable-slider-input-min-]").data("start-value");if($(".bootstrap_slider[data-identifier='" + key + "'] [class*=pricetable-slider-input-max-]").data("start-value") < ary_values[1]) ary_values[1] = $(".bootstrap_slider[data-identifier='" + key + "'] [class*=pricetable-slider-input-max-]").data("start-value");// SET Values to inputs$(".bootstrap_slider[data-identifier='" + key + "'] [class*=pricetable-slider-input-min-]").val( ary_values[0] );$(".bootstrap_slider[data-identifier='" + key + "'] [class*=pricetable-slider-input-max-]").val( ary_values[1] );// $("[class*=pricetable-slider-input-min-], [class*=pricetable-slider-input-max-]").bootstrap_slider_filter_update( $(".bootstrap_slider[data-identifier='" + key + "'] [class*=pricetable-slider-input-min-]"), "script" );bootstrap_slider_filter_activate( $(".bootstrap_slider[data-identifier='" + key + "'] .pricetable-slider-btn-push") );$(".bootstrap_slider[data-identifier='" + key + "']").removeClass("open");//console.log("trigger filter: " + key + " Val: " + val);}});// ****** Stop Hiding Dropdown on filter-slider$(document).on("click", ".content-asn.product-filters .dropdown-menu", function (event) {if (!$(event.target).is('input, .btn')) {$(this).prev().dropdown('toggle');}});// ****** Load icons$(".content-asn .show-icon").each(function(){var image_url = $(this).data("icon");var target = $(this).find("button").children("span").first();target.prepend(" ");});// ****** Add buttonsconst addButtonsInterval = setInterval(function(){$('.bootstrap-select').addClass('product-filter');if ($(".bootstrap-select.product-filter .dropdown-menu").length) {$(".bootstrap-select.product-filter .dropdown-menu").append('Anwenden
');// Add line under Alle/Keine angabelet doLine = false;$('.bootstrap-select.product-filter ul.dropdown-menu.inner li').each(function(){if($(this).text() == 'Alle' || $(this).text() == 'Keine Angabe') {doLine = true;} else if (doLine) {$(this).addClass('border-top');doLine = false;}});clearInterval(addButtonsInterval);}}, 500);$(".content-asn.product-filters .product-filter").on("hide.bs.dropdown", function (e) {if ($("[name=filters_changed]").val() == 1) {renewPricetable();}});}}bootstrap_init_filters();// =========================================//console.log( tableid40259_obj_hidden_search_values ) ;// Important filter Datatable after clear filter-attrb which only hiddendatables_filter_hidden_attr(tableid40259_obj_hidden_search_values);// ==================== Sorting ========================$(document).on("click", "[name=sort_table]", function(e){e.preventDefault();var sortBy = $(this).data("by");var sortByValInput = $("[name='sort_by[" + sortBy + "]']");var sortByVal = sortByValInput.val();// Delete other sort values$("[name^='sort_by[']").val("");$(".jq_datatables_pricelist .sorting-icons").removeClass("sort-ASC").removeClass("sort-DESC");// Reset new sorting valueif (sortByVal == "" || sortByVal == "DESC") {sortByVal = "ASC"} else {sortByVal = "DESC"}sortByValInput.val(sortByVal);sortByValInput.closest("[name=sort_table]").find(".sorting-icons").addClass("sort-" + sortByVal);renewPricetable();});// ==================== Sorting ========================// ==================== Mobile optimization ========================function mobileOptimizePricetable() {$(".jq_datatables_pricelist tr .cols_attribute").css("display", "");$(".jq_datatables_pricelist tr .th_col_price_width, .jq_datatables_pricelist tr .single-price, .jq_datatables_pricelist tr .price_value, .jq_datatables_pricelist tr .price_value_last").css("display", "");$(".jq_datatables_pricelist tr .cols_attribute").css("width", "");var columns = 0;var columns_actual = 0;$(".jq_datatables_pricelist tbody tr").each(function(){columns_actual = $(this).find("td:visible").length;if (columns_actual > columns) {columns = columns_actual;}});$(".mobile_recount_total").attr("colspan", columns);if ($(window).width() <= 1199) {$(".jq_datatables_pricelist .countwidth").attr("colspan", 1);$(".jq_datatables_pricelist .variant_query").closest("td").attr("colspan", 2);} else {var columns_price = 0;var columns_price_actual = 0;$(".jq_datatables_pricelist tbody tr").each(function(){columns_price_actual = $(this).find(".price_value").length + 1;if (columns_price_actual > columns_price) {columns_price = columns_price_actual;}});//console.log(columns_price);$(".jq_datatables_pricelist .countwidth").attr("colspan", columns_price);$(".jq_datatables_pricelist .variant_query").closest("td").attr("colspan", columns_price + 1);}if ($(window).width() <= 600) {$(".jq_datatables_pricelist .variant_query").closest("td").attr("colspan", 1);}// Price widthvar priceWidth = 0;$(".jq_datatables_pricelist .price_value > span, .jq_datatables_pricelist .price_value_last > span").each(function(){priceWidth = $(this).width() > priceWidth ? $(this).width() : priceWidth;});if (priceWidth) {$(".jq_datatables_pricelist .th_col_price_width, .jq_datatables_pricelist .single-price").attr("style", "width:" + (priceWidth + 9) + "px !important;");}// Art.-Nr. widthvar artnrWidth = 0;var actualWidth = 0;$(".jq_datatables_pricelist .sku-col a, .jq_datatables_pricelist .badge-last-td, .jq_datatables_pricelist .mpn-last-td span").each(function(){if ($(this).hasClass("badge-last-td")) {actualWidth = $(this).width() + 10;} else {actualWidth = $(this).width()}artnrWidth = actualWidth > artnrWidth ? actualWidth : artnrWidth;});if ($(window).width() > 990) {$(".jq_datatables_pricelist .sku-col").width(artnrWidth + 5);} else {$(".jq_datatables_pricelist .sku-col").width(artnrWidth + 15);}// --------------------- Cols attribute width - hide price -----------------------------------------------if ($(window).width() > 990) {//console.log("Cols");var colsCount = $(".jq_datatables_pricelist > tbody > tr:nth-of-type(2) .cols_attribute").size();var priceCount = $(".jq_datatables_pricelist > tbody > tr:nth-of-type(2) .price_value, .jq_datatables_pricelist > tbody > tr:nth-of-type(2) .price_value_last").size();var actualPriceCol = 1;var insufficientSpace = false;for (let j = 0; j < priceCount; j++) {var colsWidths = [0];$(".jq_datatables_pricelist:not(.fixedHeader-floating) > thead > tr:first-of-type .cols_attribute").each(function(){colsWidths.push($(this).width());});insufficientSpace = false;for (let i = 1; i <= colsCount; i++) {$("\n\.jq_datatables_pricelist:not(.fixedHeader-floating) tr .cols_attribute:nth-of-type(" + i + ") a,\n\.jq_datatables_pricelist:not(.fixedHeader-floating) tr .cols_attribute:nth-of-type(" + i + ") span\n\").each(function(){if($(this).width() > colsWidths[i]) {insufficientSpace = true;}});}if (insufficientSpace && actualPriceCol != priceCount) {// Hide cols (nth-of-type does not work$(".jq_datatables_pricelist").each(function(){$(this).find("tr").each(function(){var i = 1;$(this).find(".th_col_price_width").each(function(){if (i == actualPriceCol) {$(this).css("display", "none");}i++;});let first = true;let hidden = false;$(this).find(".price_value:visible").each(function(){if (hidden) {// Do nothing} else if ($(this).text().trim() == '') {$(this).css("display", "none");hidden = true;} else if (first) {// Skip firstfirst = false;// Add hidden prices markif (!$(this).find('.hidden_prices').length) {$(this).find('> span').append(' ');}} else {$(this).css("display", "none");hidden = true;}});});});// Resize price head$(".jq_datatables_pricelist tr .countwidth").attr("colspan", priceCount - actualPriceCol);$(".jq_datatables_pricelist tr .variant_query").closest("td").attr("colspan", priceCount - actualPriceCol + 1);//console.log(priceCount - actualPriceCol);// Recount rows over tablevar mobile_recount_total_cols = $(".jq_datatables_pricelist > tbody > tr:nth-of-type(2) td:visible").size();$(".jq_datatables_pricelist .mobile_recount_total").attr("colspan", mobile_recount_total_cols);actualPriceCol++;} else {return;}}}// --------------------- END: Cols attribute width --------------------------------------------------}mobileOptimizePricetable();$(window).on("resize", function(e){ mobileOptimizePricetable();});// ==================== Mobile optimization ========================// Load moreif (0) {$("#loadMoreSizes").on("click", function(e){e.preventDefault();var top = $(document).scrollTop();var visibleRows = $(".jq_datatables_pricelist > tbody > tr").length;var i = visibleRows + 20;tableid40259.page.len( i ).draw();$(document).scrollTop(top);recountLoadmoreNumbers();});$("#loadAllSizes").on("click", function(e){e.preventDefault();var top = $(document).scrollTop();var i = 10000;tableid40259.page.len( i ).draw();$(document).scrollTop(top);recountLoadmoreNumbers();});}$("#loadMoreSizes, #loadAllSizes").on("click", function(e){e.preventDefault();if ($(this).attr("id") == "loadMoreSizes") {var limit = 20;} else {var limit = 10000;}var offset = $(".jq_datatables_pricelist > tbody > tr").length;renewPricetable(offset, limit);});$(document).on("scroll", function(e){if ($("[name='loadMoreFunction']").val() == 1) {var pageBottom = $(document).scrollTop() + $(window).height();var table = $("#tableid40259_wrapper .jq_datatables_pricelist");var tableBottom = table.offset().top + table.height();if (pageBottom > tableBottom) {var visibleRows = $(".jq_datatables_pricelist > tbody > tr").length;var i = visibleRows + 20;tableid40259.page.len( i ).draw();var visibleRowsAfter = $(".jq_datatables_pricelist > tbody > tr").length;if (visibleRowsAfter - visibleRows < 20) {$("[name='loadMoreFunction']").val(0);}$("#loadMoreButtons .shown").text(visibleRowsAfter);}}});// ======= Load new rows ============= if(typeof renewPricetable !== "function"){function renewPricetable(offset, limit) {datables_preloader("show","tableid40259");if (!offset) {offset = 0}if (!limit) {limit = 20}if(js_des_debug) console.log( "function called: renewPricetable(" + offset + ", " + limit + ")" );var url = "/includes/artikelansicht_pricetable_ajax.php?id_artikel=40259&start=" + offset + "&limit=" + limit;var baseurl = $(".tableid40259").data("url");var filters = [];$(".content-asn.product-filters .bootstrap_slider").each(function(){var identifier = $(this).data("identifier");var min = $(this).find("[name=min]");var max = $(this).find("[name=max]");if (min.val() != min.attr("data-start-value") || max.val() != max.attr("data-start-value")) {filters.push(identifier + "==" + min.val() + "[to]" + max.val());}});$(".content-asn.product-filters .bootstrap-select").each(function(){var identifier = $(this).find("select").data("identifier");var selectValues = $(this).find("select").val();if (selectValues && selectValues[0]) {filters.push(identifier + "==" + selectValues.join("::"));}});// Hidden filtersif (tableid40259_obj_hidden_search_values) {for (var identifier in tableid40259_obj_hidden_search_values) {filters.push(identifier + "==" + tableid40259_obj_hidden_search_values[identifier]);}}if (filters.length) {url += "&var_attributes=" + encodeURIComponent(filters.join("|"));baseurl += "?var_attributes=" + encodeURIComponent(filters.join("|"));}// Sorting$("#tableid40259 [name^='sort_by[']").each(function(){if ($(this).val()) {url += "&sort_by=" + encodeURIComponent($(this).closest("[name=sort_table]").data("by") + "|" + $(this).val());//console.log(url);}});// Searchvar search = $("#tableid40259").data("search");if(search) {url += "&search_js=" + encodeURIComponent(search)}url += "&baseurl=" + encodeURIComponent(baseurl);last_get_data = new Date();var wait_for = 100;setTimeout(function(){var current_time = new Date();if ((current_time.getTime() - last_get_data.getTime()) >= wait_for) {$.ajax({url: url,contentType: "Content-type: text/plain; charset=iso-8859-1",// This is the imporant part!!!beforeSend: function(jqXHR) {jqXHR.overrideMimeType("text/html;charset=iso-8859-1");}}).done(function(response){var rowsTotal = $(response).find(".jq_datatables_pricelist").data("filter-count");var data = $(response).find(".jq_datatables_pricelist tbody tr");var productFilters = $(response).find(".product-filters-container").first();var i;$(".product-filters").html(productFilters);$(".bootstrap_slider [class^=pricetable-slider-]").each(function(){var slider_default_values = $(this).data("slider-value");// Only sliders with default valuesif (slider_default_values.length > 0) {$(this).slider();}});$(".selectpicker").selectpicker("render");bootstrap_init_filters();if (!offset) {tableid40259.clear();//$(document).scrollTop($("#preistabelle").offset().top);}//console.log(data);//tableid40259.rows.add(data);for (i = 0; i < data.length; i++) {tableid40259.row.add(data[i]);}tableid40259.draw();$(".jq_count_shown_rows").text(rowsTotal);recountLoadmoreNumbers();mobileOptimizePricetable();}).always(function(){datables_preloader("hide","tableid40259");});} }, wait_for);}}// ======= Load new rows ============= } );function recountLoadmoreNumbers() {var rowsShown = $(".jq_datatables_pricelist > tbody > tr").length;var allRows = parseInt($(".jq_datatables_pricelist .jq_count_shown_rows").html());if (rowsShown >= allRows) {$("#loadMoreButtons").hide();} else {$("#loadMoreButtons").show();}$("#loadMoreButtons .shown").text(rowsShown);$("#loadMoreButtons .total").text(allRows);var tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]'))var tooltipList = tooltipTriggerList.map(function (tooltipTriggerEl) { return new bootstrap.Tooltip(tooltipTriggerEl)})}