Kaynağa Gözat

More JS enhancements

KeyMasterOfGozer 6 ay önce
ebeveyn
işleme
8ab8a16b22
1 değiştirilmiş dosya ile 20 ekleme ve 6 silme
  1. 20 6
      README.md

+ 20 - 6
README.md

@@ -273,22 +273,36 @@ for (var i = 0; i < cards.length; i++) {
 
 ##### javascript to filter Market for good value cards
 ```javascript
+playerStock=[];
+for (var i = 0; i < 153; i++) {playerStock.push(0);}
+let player = document.createElement('div');
+player.id = 'player';
+player.innerHTML=await (await fetch('https://play.boobylegends.com/player/')).text();
+playerCards=player.getElementsByClassName('wrapper-card');
+for (var i = 0; i < playerCards.length; i++) {
+    try{
+    cardNum = parseInt(playerCards.item(i).getElementsByClassName('pornstar-number')[0].innerText);
+    stock = playerCards.item(i).getElementsByClassName('card-nb')[0].innerText.trim();
+    playerStock[cardNum]=stock;
+    }catch(err){console.log('hi');}
+};
 cards=document.getElementsByClassName('wrapper-market-card');
 for (var i = 0; i < cards.length; i++) {
     cardNum = cards.item(i).getElementsByClassName('pornstar-number')[0].outerText;
     cardVal = parseInt(cards.item(i).getElementsByClassName('score-card')[0].outerText);
     cardCost = parseInt(cards.item(i).getElementsByClassName('cost')[0].outerText);
     cardPPG = cardVal/cardCost;
-    HTMLText = "Points/<img src='https://play.boobylegends.com/wp-content/themes/child-roulette/img/gem.png' style='height:22px'>:<br/>" + cardPPG.toFixed(2);
+    HTMLText = "Stock: " + playerStock[cardNum]+"<br/>"+
+            "Points/<img src='https://play.boobylegends.com/wp-content/themes/child-roulette/img/gem.png' style='height:22px'>:<br/>" + cardPPG.toFixed(2);
     innerCard = cards.item(i).getElementsByClassName('inner-market-card')[0];
     var PPG = innerCard.getElementsByClassName('PPG')[0];
     if (PPG){PPG.innerHTML = HTMLText}
     else {
-        let qty = document.createElement('div');
-        qty.classList.add('PPG');
-        qty.innerHTML = HTMLText;
-        qty.setAttribute("align", "center");
-        innerCard.appendChild(qty);
+        let extraInfoDiv = document.createElement('div');
+        extraInfoDiv.classList.add('PPG');
+        extraInfoDiv.innerHTML = HTMLText;
+        extraInfoDiv.setAttribute("align", "center");
+        innerCard.appendChild(extraInfoDiv);
         }
     if (cardPPG < 2.5){
         cards.item(i).style.setProperty('Display','None');