PageSourceSearch

https://www.trustedshops.it/hubfs/hub_generated/module_assets/1/20…/module_content-fake-shop-list_v2.min.js

js trustedshops.it collected 2026-09-25 18:37:59 UTC 5,834 bytes, 2 lines download raw bytes

1var module_207172499540=function(){function isUpvoted(rowId){return JSON.parse(localStorage.getItem("upvotedIds")||"[]").includes(rowId)}document.querySelectorAll(".upvote-button").forEach(button=>{const rowId=button.dataset.rowId;isUpvoted(rowId)&&button.classList.add("active"),button.addEventListener("click",async function(){const currentlyUpvoted=isUpvoted(rowId);button.classList.add("loading");try{const response=await fetch("/hs/serverless/api/vote-fake-shop",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tableId:"142728486",rowId:rowId,action:currentlyUpvoted?"remove":"add"})});if("success"!==(204===response.status?{status:"success",message:"No content but success"}:await response.json()).status)throw new Error("API-Fehler");{const upvoteSpan=document.querySelector(`.upvote-count[data-row-id="${rowId}"]`);let count=upvoteSpan&&parseInt(upvoteSpan.textContent,10)||0;currentlyUpvoted?(button.classList.remove("active","loading"),function(rowId){const newIds=JSON.parse(localStorage.getItem("upvotedIds")||"[]").filter(id=>id!==rowId);localStorage.setItem("upvotedIds",JSON.stringify(newIds))}(rowId),upvoteSpan&&(upvoteSpan.textContent=Math.max(count-1,0))):(button.classList.add("active"),button.classList.remove("loading"),function(rowId){const upvotedIds=JSON.parse(localStorage.getItem("upvotedIds")||"[]");upvotedIds.includes(rowId)||(upvotedIds.push(rowId),localStorage.setItem("upvotedIds",JSON.stringify(upvotedIds)))}(rowId),upvoteSpan&&(upvoteSpan.textContent=count+1))}}catch(err){console.error("Fehler beim API-Call:",err),alert("Fehler beim Upvote-Update"),button.classList.remove("loading")}})}),document.getElementById("filter-select").addEventListener("change",function(){var selected=this.value;document.querySelectorAll("#results-list .shop").forEach(function(item){"all"===selected||item.getAttribute("data-type")===selected?(item.classList.add("d-grid"),item.classList.remove("d-none")):(item.classList.add("d-none"),item.classList.remove("d-grid"))})}),document.addEventListener("DOMContentLoaded",function(){const searchInput=document.getElementById("hubdb-search-input"),allItems=Array.from(document.querySelectorAll(".result-item")),noResultsMsg=document.getElementById("no-results-msg"),pagination=document.getElementById("pagination"),prevBtn=document.getElementById("page-prev"),nextBtn=document.getElementById("page-next"),pageNumbers=document.getElementById("page-numbers");let currentPage=1,visibleItems=[];function update(){!function(){const term=searchInput.value.toLowerCase();visibleItems=allItems.filter(item=>item.getAttribute("data-search-term").includes(term))}();const totalPages=Math.ceil(visibleItems.length/10);currentPage>totalPages&&totalPages>0&&(currentPage=totalPages),function(){allItems.forEach(item=>item.classList.add("hidden"));const start=10*(currentPage-1),end=start+10;visibleItems.slice(start,end).forEach(item=>{item.classList.remove("hidden")}),noResultsMsg.classList.toggle("hidden",visibleItems.length>0)}(),function(){const totalPages=Math.max(1,Math.ceil(visibleItems.length/10));pagination.classList.toggle("hidden",totalPages<=1),prevBtn.disabled=currentPage<=1,nextBtn.disabled=currentPage>=totalPages,pageNumbers.innerHTML="";for(let p=1;p<=totalPages;p++){const btn=document.createElement("button");
1btn.type="button",btn.textContent=String(p),btn.classList.add("page-btn","button-b2c","button-secondary","button-md"),p===currentPage&&(btn.classList.remove("button-secondary"),btn.classList.add("active","button-primary"),btn.setAttribute("aria-current","page")),btn.addEventListener("click",()=>{currentPage=p,update()}),pageNumbers.appendChild(btn)}}()}searchInput.addEventListener("input",()=>{currentPage=1,update()}),prevBtn.addEventListener("click",()=>{currentPage>1&&(currentPage--,update())}),nextBtn.addEventListener("click",()=>{const totalPages=Math.ceil(visibleItems.length/10);currentPage<totalPages&&(currentPage++,update())}),update()}),document.querySelectorAll(".trustedshops-rating").forEach(container=>{const tsid=container.dataset.tsid;fetch(`https://shop-search-api.trustedshops.com/shopsearch?searchTerm=${tsid}`).then(response=>response.json()).then(data=>{if(!data.shops||0===data.shops.length)throw new Error("Kein Shop mit dieser TSID gefunden.",tsid);const shop=data.shops[0],rating=shop.averageRating,reviewCount=shop.reviewCount;const{starsHtml:starsHtml,formattedCount:formattedCount}=function(rating,reviewCount){const pathSegments=window.location.pathname.split("/").filter(Boolean),locale=pathSegments.length?pathSegments[0]:"de";let formattedCount=reviewCount;try{Intl.NumberFormat.supportedLocalesOf(locale),formattedCount=new Intl.NumberFormat(locale).format(reviewCount).replace(/\s/g," ")}catch{formattedCount=new Intl.NumberFormat("de").format(reviewCount).replace(/\s/g," ")}const fullStars=Math.floor(rating),decimal=rating-fullStars;let starsHtml="",totalStars=0;for(let i=0;i<fullStars;i++)starsHtml+='<i class="fas fa-star"></i>',totalStars++;decimal>=.25&&decimal<.75&&(starsHtml+='<i class="fas fa-star-half-alt"></i>',totalStars++),decimal>=.75&&(starsHtml+='<i class="fas fa-star"></i>',totalStars++);for(let i=totalStars;i<5;i++)starsHtml+='<i class="far fa-star"></i>';return{starsHtml:`<span class="stars">${starsHtml}</span>`,formattedCount:formattedCount}}(rating,reviewCount),ratingHtml=`\n          <strong>${rating.toFixed(2)}</strong>\n          ${starsHtml}\n          <span>(<span class="review-count">${formattedCount}</span>)</span>\n        `;container.innerHTML=ratingHtml}).catch(error=>{console.error("Fehler beim Laden der TrustedShops-Daten:",error),container.innerHTML="n/a"})})}();
2//# sourceURL=https://603347.fs1.hubspotusercontent-na1.net/hubfs/603347/hub_generated/module_assets/1/207172499540/1787822935524/module_content-fake-shop-list_v2.js

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.