Jelajahi Sumber

Bug Fixes to JS for filter

KeyMasterOfGozer 7 bulan lalu
induk
melakukan
c725e90093
1 mengubah file dengan 12 tambahan dan 5 penghapusan
  1. 12 5
      README.md

+ 12 - 5
README.md

@@ -148,22 +148,29 @@ for (var i = 0; i < marketCards.length; i++) {
 cards=document.getElementsByClassName('wrapper-card');
 for (var i = 0; i < cards.length; i++) {
     cardNum = parseInt(cards.item(i).getElementsByClassName('pornstar-number')[0].outerText);
+    cardVal = parseInt(cards.item(i).getElementsByClassName('score-card')[0].outerText);
+    price = clist[cardNum];
     var cardNB = cards.item(i).getElementsByClassName('card-nb')[0];
-    if (cardNB){
+    if (cardNB){try{
         stock = parseInt(cards.item(i).getElementsByClassName('nb-label')[0].outerText.trim());
-        var price = cardNB.getElementsByClassName('Price')[0];
-        if (price){price.innerText = "Price: " + clist[cardNum]}
+        var fuzed = cards.item(i).getElementsByClassName('nb-name')[0];
+        if (fuzed){stock = stock + 1;}
+        var priceDiv = cardNB.getElementsByClassName('Price')[0];
+        if (priceDiv){priceDiv.innerText = "Price: " + price;}
         else{
             let qty = document.createElement('div');
             qty.classList.add('Price');
-            qty.innerText = "Price: " + clist[cardNum];
+            qty.innerText = "Price: " + price;
             cardNB.appendChild(qty);
         }
-    }else{
+    }catch(err){stock=0;}}else{
         stock=0;
     }
     if (stock<2){
         cards.item(i).style.setProperty('Display','None');
     }
+    if (price<4){
+        cards.item(i).style.setProperty('Display','None');
+    }
 }
 ```