Heera/public/assets/js/pages/apps-nft-explore.init.js

1 line
6.9 KiB
JavaScript
Raw Normal View History

2024-05-16 03:46:08 +00:00
var url="assets/json/",allproductlist="",getJSON=function(e,t){var l=new XMLHttpRequest;l.open("GET",url+e,!0),l.responseType="json",l.onload=function(){var e=l.status;t(200===e?null:e,l.response)},l.send()};function loadProductData(e){document.querySelector("#explorecard-list").innerHTML="",Array.from(e).forEach(function(e,t){var l=e.like?"active":"";document.querySelector("#explorecard-list").innerHTML+='<div class="col list-element"> <div class="card explore-box card-animate"> <div class="explore-place-bid-img"> <input type="hidden" class="form-control" id="'+e.id+'"> <div class="d-none">'+e.salesType+'</div> <img src="'+e.productImg+'" alt="" class="card-img-top explore-img" /> <div class="bg-overlay"></div> <div class="place-bid-btn"> <a href="#!" class="btn btn-success"><i class="ri-auction-fill align-bottom me-1"></i> Place Bid</a> </div> </div> <div class="bookmark-icon position-absolute top-0 end-0 p-2"> <button type="button" class="btn btn-icon '+l+'" data-bs-toggle="button" aria-pressed="true"><i class="mdi mdi-cards-heart fs-16"></i></button> </div> <div class="card-body"> <p class="fw-medium mb-0 float-end"><i class="mdi mdi-heart text-danger align-middle"></i> '+e.totalLikes+' </p> <h5 class="mb-1"><a href="apps-nft-item-details.html">'+e.title+'</a></h5> <p class="text-muted mb-0">'+e.category+'</p> </div> <div class="card-footer border-top border-top-dashed"> <div class="d-flex align-items-center"> <div class="flex-grow-1 fs-14"> <i class="ri-price-tag-3-fill text-warning align-bottom me-1"></i> Highest: <span class="fw-medium">'+e.highBid+'</span> </div> <h5 class="flex-shrink-0 fs-14 text-primary mb-0">'+e.price+"ETH</h5> </div> </div> </div> </div>",loadMoreBtn()})}getJSON("nft-explore-product-list.json",function(e,t){null!==e?console.log("Something went wrong: "+e):loadProductData(allproductlist=t)});var searchProductList=document.getElementById("searchProductList"),productCategoryInput=(searchProductList.addEventListener("keyup",function(){var e=searchProductList.value.toLowerCase();t=e;var t,e=allproductlist.filter(function(e){return-1!==e.title.toLowerCase().indexOf(t.toLowerCase())});0==e.length?(document.getElementById("noresult").style.display="block",document.getElementById("loadmore").style.display="none"):(document.getElementById("noresult").style.display="none",document.getElementById("loadmore").style.display="block"),loadProductData(e)}),new Choices(document.getElementById("select-category"),{searchEnabled:!1})),productFileTypeInput=(productCategoryInput.passedElement.element.addEventListener("change",function(e){var t,l=e.detail.value;e.detail.value?0==(t=allproductlist.filter(e=>e.category===l)).length?(document.getElementById("noresult").style.display="block",document.getElementById("loadmore").style.display="none"):(document.getElementById("noresult").style.display="none",document.getElementById("loadmore").style.display="block"):t=allproductlist,loadProductData(t)},!1),new Choices(document.getElementById("file-type"),{searchEnabled:!1}));productFileTypeInput.passedElement.element.addEventListener("change",function(e){var t,l=e.detail.value;e.detail.value?0==(t=allproductlist.filter(e=>e.productImg.split(".").pop()==l)).length?(document.getElementById("noresult").style.display="block",document.getElementById("loadmore").style.display="none"):(document.getElementById("noresult").style.display="none",document.getElementById("loadmore").style.display="block"):t=allproductlist,loadProductData(t)},!1);(productCategoryInput=new Choices(document.getElementById("select-category"),{searchEnabled:!1})).passe