Procházet zdrojové kódy

Only put Stock in Market Card once.

KeyMasterOfGozer před 8 měsíci
rodič
revize
e2f8d5143a
2 změnil soubory, kde provedl 16 přidání a 6 odebrání
  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');
                 }