Sfoglia il codice sorgente

Only put Stock in Market Card once.

KeyMasterOfGozer 8 mesi fa
parent
commit
e2f8d5143a
2 ha cambiato i file con 16 aggiunte e 6 eliminazioni
  1. 8 3
      README.md
  2. 8 3
      market.py

+ 8 - 3
README.md

@@ -90,9 +90,14 @@ cards=document.getElementsByClassName('wrapper-market-card')
 for (var i = 0; i < cards.length; i++) {
     cardNum = cards.item(i).getElementsByClassName('pornstar-number')[0].outerText;
     innerCard = cards.item(i).getElementsByClassName('inner-market-card')[0]
-    let qty = document.createElement('div');
-    qty.innerText = "Stock: " + clist[cardNum]
-    innerCard.appendChild(qty)
+    var stock = innerCard.getElementsByClassName('Stock')[0]
+    if (stock){stock.innerText = "Stock: " + clist[cardNum]}
+    else {
+        let qty = document.createElement('div');
+        qty.classList.add('Stock')
+        qty.innerText = "Stock: " + clist[cardNum]
+        innerCard.appendChild(qty)
+        }
     if (clist[cardNum].includes('CRYSTAL')){
         cards.item(i).style.setProperty('Display','None');
     }

+ 8 - 3
market.py

@@ -92,9 +92,14 @@ class Market():
             for (var i = 0; i < cards.length; i++) {
                 cardNum = cards.item(i).getElementsByClassName('pornstar-number')[0].outerText;
                 innerCard = cards.item(i).getElementsByClassName('inner-market-card')[0]
-                let qty = document.createElement('div');
-                qty.innerText = "Stock: " + clist[cardNum]
-                innerCard.appendChild(qty)
+                var stock = innerCard.getElementsByClassName('Stock')[0]
+                if (stock){stock.innerText = "Stock: " + clist[cardNum]}
+                else {
+                    let qty = document.createElement('div');
+                    qty.classList.add('Stock')
+                    qty.innerText = "Stock: " + clist[cardNum]
+                    innerCard.appendChild(qty)
+                    }
                 if (clist[cardNum].includes('CRYSTAL')){
                     cards.item(i).style.setProperty('Display','None');
                 }