var trv_ob_fileteredProductIDKeys = []; var trv_ob_searchTextIDKeys = []; function trv_ob_filterProducts(currentCheckbox) { var dropDownMenu = $(currentCheckbox).parents(".dropdown-menu"); if ($(dropDownMenu).hasClass("trv_ob_radioTypeSelect")) { $(".dropdown-item input",dropDownMenu).each(function() { if ($(this).val() != currentCheckbox.val()) { $(this).prop("checked",false); } }); } trv_ob_enableSubMenu(currentCheckbox); trv_ob_fileteredProductIDKeys = []; $(".ob_navigation_item:visible").each(function() { var fileteredProductIDKeysTemp = []; if ($("input:checked", this).length) { $("input:checked", this).each(function() { var elementTags = [] if (trv_ob_filterToProductsData[$(this).val()] != null) { elementTags = trv_ob_filterToProductsData[$(this).val()]; } fileteredProductIDKeysTemp = fileteredProductIDKeysTemp.concat(elementTags.filter(v =>!fileteredProductIDKeysTemp.includes(v))); }); if (trv_ob_fileteredProductIDKeys.length) { trv_ob_fileteredProductIDKeys = fileteredProductIDKeysTemp.filter(v =>trv_ob_fileteredProductIDKeys.includes(v)); } else { trv_ob_fileteredProductIDKeys = fileteredProductIDKeysTemp; } } }); trv_ob_displayFilteredProducts(false); } function trv_ob_enableSubMenu(setCheckboxElement) { var menuMasterIDs = []; if ($(setCheckboxElement).parents(".dropdown-menu").hasClass("trv_ob_radioTypeSelect")) { $(setCheckboxElement).parents(".dropdown-menu").find(".trv_ob_filterInput").each(function () { menuMasterIDs.push($(this).data("search_filter_id")); }); } else { menuMasterIDs.push(setCheckboxElement.val()); } $(menuMasterIDs).each(function(index,menuMasterID) { if ($(".trv_ob_child_dropdown_"+menuMasterID).length) { $(".trv_ob_child_dropdown_"+menuMasterID).hide(); $(".trv_ob_child_dropdown_"+menuMasterID+" .trv_ob_filterInput").prop("checked",false); if (setCheckboxElement.is(":checked")) { $(".trv_ob_child_dropdown_"+menuMasterID+"[data-child-of-master-id="+setCheckboxElement.val()+"]").show(); } } }); } function trv_ob_displayFilteredProducts(isCalledFromRestore) { var enabledSearchFilter = []; if (!isCalledFromRestore) { $("#trv_ob_searchBar").val(""); } if (trv_ob_fileteredProductIDKeys.length > 0) { $(".ob_product_box").each(function() { if (trv_ob_fileteredProductIDKeys.includes($(this).data("idkey"))) { $(this).show(); if (enabledSearchFilter.length) { enabledSearchFilter = enabledSearchFilter.concat(allIDKeysWithTags[$(this).data("idkey")].filter(v => !enabledSearchFilter.includes(v))); } else { enabledSearchFilter = allIDKeysWithTags[$(this).data("idkey")]; } } else { $(this).hide(); } }); } else { if ($(".ob_navigation_item input:checked").length) { $(".ob_product_box").hide(); } else { $(".ob_product_box").show(); } } if (enabledSearchFilter.length) { $(".trv_ob_filterInput").each(function() { if (!$(".trv_ob_child_dropdown_"+$(this).val()).length) { enabledSearchFilter.includes($(this).val()) ? $(this).prop("disabled", false) : $(this).prop("disabled", true); if(!enabledSearchFilter.includes($(this).val())) { $(this).parent().addClass("row_disabled"); } else { $(this).parent().removeClass("row_disabled"); } } }); } else { trv_ob_enableAlleFilter(); } if (!isCalledFromRestore) { trv_ob_setAllCount(); trv_ob_storeAllFiltersAndSearch(); } trv_ob_displayBreadcrumbs(); trv_ob_showRegistrationInfo(); } function trv_ob_enableAlleFilter() { $(".trv_ob_filterInput").prop("disabled", false); $(".dropdown-item label").removeClass("row_disabled"); } function trv_ob_searchText(searchText, isCalledFromRestore) { if(searchText == null) { searchText = ""; } if(searchText.length && !isCalledFromRestore) { if (searchText.trim().length < 3) { infoDialog("FEHLER","Sie müssen mindestens 3 Zeichen zum suchen eintippen!",null,null,"$('#trv_ob_searchBar').focus();"); } else { $.trv_postJson({ blockScreen: false, showSavingInfoIn: $('.trv_ob_search_container'), alternativeSavingInfoText: "Suchen ...", url: "/offener_bereich/ajax/ajax.php", ajax_type: "GET_VOLLTEXT_SUCHE", parameter: { partnerID: trv_ob_partnerID, searchText: searchText }, onSuccess: function(data) { trv_ob_searchTextIDKeys = data.search; trv_ob_setSearchTextResults(searchText,isCalledFromRestore); } }); } } else { trv_ob_setSearchTextResults(searchText,isCalledFromRestore); } } function trv_ob_setSearchTextResults(searchText,isCalledFromRestore) { if (searchText != "") { if (trv_ob_searchTextIDKeys.length) { $(".ob_product_box").each(function() { if (trv_ob_searchTextIDKeys.includes($(this).data("idkey")) && (trv_ob_fileteredProductIDKeys.length == 0 || trv_ob_fileteredProductIDKeys.includes($(this).data("idkey")))) { $(this).show(); } else { $(this).hide(); } }); } else { $(".ob_product_box").hide(); } } else { if(!trv_ob_fileteredProductIDKeys.length) { $(".ob_product_box").show(); } else { trv_ob_displayFilteredProducts(true); } } if (!isCalledFromRestore) { trv_ob_setAllCount(); trv_ob_showRegistrationInfo(); trv_ob_storeAllFiltersAndSearch(); } } function trv_ob_resetSearch() { $("#trv_ob_searchBar").val(""); trv_ob_searchText("",false); } function trv_ob_setAllCount() { var countResults = $(".ob_product_box:visible").length; $("#navbarSupportedContent .dropdown-menu").each(function (index, dropdownItem) { var dropdownActiveCount = $("input:checked",dropdownItem).length; $(dropdownItem).parents(".dropdown").find(".ob_filter_counter").text(dropdownActiveCount); }); $(".trv_ob_count_products").text(countResults); if(!countResults) { if($("#notFound").length == 0) { $(".trv_ob_grid").append('

Keine Ergebnisse vorhanden

'); } } else { $("#notFound").remove(); } } function trv_ob_displayBreadcrumbs() { var breadcrumbContent = ""; var subNavigationMarkerStarted = false; $(".ob_navigation_item .trv_ob_filterInput:checked").each(function() { var isSubNavigation = $(this).parents(".dropdown").hasClass("ob_navigation_item_is_child"); breadcrumbContent = breadcrumbContent + '
' + $(this).parent().text() + 'X
'; }); if (breadcrumbContent != "") { breadcrumbContent = breadcrumbContent + 'Alle Filter entfernen'; } $(".trv_ob_breadcrumbs_container").html(breadcrumbContent); } function trv_ob_removeBreadcrumb(filterID) { var inputElement = $(".trv_ob_filterInput[data-search_filter_id="+filterID+"]"); inputElement.prop("checked",false); trv_ob_filterProducts(inputElement); } function trv_ob_storeAllFiltersAndSearch() { var allCurreentSetSearchFilterIDs = []; $(".trv_ob_navigation input.trv_ob_filterInput:checked").each(function() { allCurreentSetSearchFilterIDs.push($(this).data("search_filter_id")); }); localStorage.setItem(trv_ob_sessionStoreTag, JSON.stringify({"setFilterIDs": allCurreentSetSearchFilterIDs,"fileteredProductIDKeys": trv_ob_fileteredProductIDKeys, "searchText": $('#trv_ob_searchBar').val(), "searcTextFoundIDKeys": trv_ob_searchTextIDKeys})); trv_ob_logSerch(allCurreentSetSearchFilterIDs); } function trv_ob_restoreFiltersAndSearchFromStorage() { var allCurreentSetSearchFilterIDs = []; $.trv_postJson({ blockScreen: false, url: "/offener_bereich/ajax/ajax.php", ajax_type: "GET_CLEAR_LOCAL_HISTORY", parameter: { sessionStoreTag: trv_ob_sessionStoreTag } ,onSuccess: function(data) { if (data.clear) { localStorage.removeItem(trv_ob_sessionStoreTag); } else { var storedSearchData = JSON.parse(localStorage.getItem(trv_ob_sessionStoreTag)); if (storedSearchData != null) { $.each(storedSearchData.setFilterIDs, function(index, searchFilterID) { var checkboxElement = $(".trv_ob_navigation input.trv_ob_filterInput[data-search_filter_id="+searchFilterID+"]"); checkboxElement.prop("checked", true); trv_ob_enableSubMenu(checkboxElement); }); trv_ob_fileteredProductIDKeys = storedSearchData.fileteredProductIDKeys; trv_ob_displayFilteredProducts(true); if (storedSearchData.searchText != "") { $('#trv_ob_searchBar').val(storedSearchData.searchText); trv_ob_searchTextIDKeys = storedSearchData.searcTextFoundIDKeys; trv_ob_searchText(storedSearchData.searchText,true); } allCurreentSetSearchFilterIDs = storedSearchData.setFilterIDs; } } trv_ob_setAllCount(); trv_ob_showRegistrationInfo(); } }); } function trv_ob_removeAllFilterAndSearch() { $('#trv_ob_searchBar').val(""); $(".trv_ob_navigation input.trv_ob_filterInput").prop("checked",false); $(".ob_navigation_item_is_child").hide(); $(".ob_product_box").show(); trv_ob_fileteredProductIDKeys = []; trv_ob_searchTextIDKeys = []; $(".trv_ob_breadcrumbs_container").html(""); trv_ob_enableAlleFilter(); trv_ob_setAllCount(); trv_ob_showRegistrationInfo(); localStorage.removeItem(trv_ob_sessionStoreTag); trv_ob_logSerch([]); } function trv_ob_getReference(companyID, productID, partnerID, vorlageID, referenceID, isPreview, app_language) { $(".trv_ob_model_container").load("/offener_bereich/dialog_reference.php?companyID="+companyID+"&productID="+productID+"&partnerID="+partnerID+"&vorlageID="+vorlageID+"&referenceID="+referenceID+"&isPreview="+isPreview+"&app_language="+app_language, function() { $('#trv_ob_referent_dialog').modal('show').on('hidden.bs.modal', function (e) { $(".trv_ob_model_container").html(""); }); }); } function trv_ob_stickyOverviewNavigation() { if (!$('#trv_ob_overview_navigation').hasClass('trv_ob_stick_details') && document.getElementById("trv_ob_box_container").getBoundingClientRect().top <= 137 + $("#trv_ob_overview_navigation").height()) { $('#trv_ob_overview_navigation').addClass('trv_ob_stick_details'); $(".trv_ob_wrapper .trv_ob_grid").css("paddingTop", "calc(1% + "+($("#trv_ob_overview_navigation").height()+5)+"px)"); } else if ($('#trv_ob_overview_navigation').hasClass('trv_ob_stick_details') && document.getElementById("trv_ob_box_container").getBoundingClientRect().top >= 138) { $(".trv_ob_wrapper .trv_ob_grid").css("paddingTop","1%"); $('#trv_ob_overview_navigation').removeClass('trv_ob_stick_details'); } } function trv_ob_setDetailsNavigationActive() { var checkAnker = ["trv_ob_product","trv_ob_company","trv_ob_kontakt","trv_ob_referenzen"]; var windowsPosition = $(window).scrollTop(); $(checkAnker).each(function (position, elementID) { var element = $("#"+elementID); var elementDimension = element.offset().top+element.height(); if (elementDimension - windowsPosition > $("#trv_ob_details_navigation_container").height()+$(".megamenupos").height()-5) { $(".trv_ob_details_navigation a").removeClass("ob_active"); $("#"+elementID+"_navi").addClass("ob_active"); return false; } }); } function trv_ob_showRegistrationInfo() { $("#trv_ob_box_container .trv_ob_box_registration").remove(); $("#trv_ob_box_container .ob_product_box:visible").each(function(index,box) { if ((index+1) % 6 === 0) { $(this).after(trv_ob_registration_box); } }); } function trv_ob_countExternalLink(pageUrl, callParameter) { $.trv_postJson({ blockScreen: false, module_name: "characteristics_open", ajax_type: "SET_LOG", parameter: { parameter: callParameter, pageUrl: pageUrl } }); } function trv_ob_logSerch(allCurreentSetSearchFilterIDs) { var searchData = JSON.stringify({"setFilterIDs": allCurreentSetSearchFilterIDs, "searchText": $('#trv_ob_searchBar').val()}); var sessionStoreTag = ""; var searchResults = []; if (allCurreentSetSearchFilterIDs.length == 0 && $('#trv_ob_searchBar').val() == "") { sessionStoreTag = trv_ob_sessionStoreTag; } if ($('#trv_ob_searchBar').val() != "") { $(".ob_product_box:visible").each(function(){ searchResults.push($(this).data("idkey")); }) } else { var searchResults = trv_ob_fileteredProductIDKeys; } $.trv_postJson({ blockScreen: false, url: "/offener_bereich/ajax/ajax.php", ajax_type: "LOG_SEARCH", parameter: { sessionStoreTag: sessionStoreTag, partnerID: trv_ob_partnerID, vorlageID: trv_ob_vorlageID, rootItemID: trv_ob_rootItemID, searchData: searchData, searchResults: JSON.stringify(searchResults) } }); } function trv_ob_displayRegistrationInfo(element) { if ($(".trv_ob_box_inner:visible", element).length) { $(".trv_ob_box_inner", element).fadeOut(200) } } function trv_ob_hideRegistrationInfo(element) { if (!$(".trv_ob_box_inner:visible", element).length) { $(".trv_ob_box_inner", element).fadeOut(200, function() { $(element).css("padding",10); $(".trv_ob_box_inner_registration", element).html(trv_ob_registration_box).find(".trv_ob_box_registration").css("margin",20); $(".trv_ob_box_inner_registration", element).fadeOut(200); }); } } function trv_ob_bind_hover_registration_info() { $(".trv_ob_registration_info").hover( function() { $(".trv_ob_box_inner",this).fadeOut(200); $(".trv_ob_box_inner_registration",this).html(trv_ob_registration_info).fadeIn(200); }, function() { $(".trv_ob_box_inner",this).fadeIn(200); $(".trv_ob_box_inner_registration",this).fadeOut(200).html(""); } ); } function trv_ob_details_scroll(ankerID) { $("body").animate({ scrollTop: $('#'+ankerID).position().top-($("#trv_ob_details_navigation_container").height()+$(".megamenupos").height()-5) }, 600); } function searchInDownloads(txt) { var txt = txt.toLowerCase(); $(".downloadcentercontent").each(function() { if ($(this).text().toLowerCase().includes(txt)) { var content = $(this).html(); // Get the HTML content of the div var highlightedContent = content.replace(new RegExp('(' + txt + ')', 'gi'), '$1'); // Wrap the search text with a element and add a CSS class for highlighting $(this).html(highlightedContent); // Update the HTML content of the div with the highlighted text $(this).show(); // Show the div } else { $(this).hide(); // Hide the div } }); count = $(".downloadcentercontent:visible").length; $('#trv_module_download_center_result_count').text(count); var targetDiv = $('#trv_module_download_center_result_count'); var targetOffset = targetDiv.offset().top; console.log(targetOffset); $('html, body').animate({ scrollTop: targetOffset-80 }, 1000); }