Browse Source

Only put Stock in Market Card once.

KeyMasterOfGozer 8 tháng trước cách đây
mục cha
commit
e2f8d5143a
2 tập tin đã thay đổi với 16 bổ sung6 xóa
  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');
                 }