Explorar el Código

Rearrange readme javascript scraps

Mike Greene hace 7 meses
padre
commit
95e03a9158
Se han modificado 1 ficheros con 87 adiciones y 81 borrados
  1. 87 81
      README.md

+ 87 - 81
README.md

@@ -73,7 +73,77 @@ hist(2)
 plot(2)
 ```
 
-### javascript to filter Market for needed cards
+### Javascript clips for console use to do things on pages.
+
+#### Player Page
+
+##### javascript to filter Player Page for salable cards
+```javascript
+sellThreshold = {};
+sellThreshold["2000"] = 10000;
+sellThreshold["350"] = 195;
+sellThreshold["250"] = 126;
+sellThreshold["200"] =  87;
+sellThreshold["150"] = 110;
+sellThreshold["115"] =  80;
+sellThreshold["75"]  =  32;
+sellThreshold["50"]  =  25;
+sellThreshold["40"]  =  32;
+sellThreshold["20"]  =  22;
+sellThreshold["15"]  =  12;
+sellThreshold["10"]  =   8;
+sellThreshold["4"]   =   9;
+sellThreshold["3"]   =   4;
+sellThreshold["2"]   =   4;
+sellThreshold["1"]   =   4;
+clist=[];
+for (var i = 0; i < 153; i++) {clist.push(0);}
+let market = document.createElement('div');
+market.id = 'market';
+market.innerHTML=await (await fetch('https://play.boobylegends.com/market/')).text();
+marketCards=market.getElementsByClassName('wrapper-market-card');
+for (var i = 0; i < marketCards.length; i++) {
+    try{
+    cardNum = parseInt(marketCards.item(i).getElementsByClassName('pornstar-number')[0].innerText);
+    price = parseInt(marketCards.item(i).getElementsByClassName('cost')[0].innerText.trim());
+    clist[cardNum]=price;
+    }catch(err){console.log('error on '+cardNum.toString());}
+};
+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){try{
+        stock = parseInt(cards.item(i).getElementsByClassName('nb-label')[0].outerText.trim());
+        var fuzed = cards.item(i).getElementsByClassName('nb-name')[0];
+        if (fuzed){stock = stock + 1;}
+        HTMLText = "Price: " + price;
+        var priceDiv = cardNB.getElementsByClassName('Price')[0];
+        if (priceDiv){priceDiv.innerText = HTMLText;}
+        else{
+            let qty = document.createElement('div');
+            qty.classList.add('Price');
+            qty.innerText = HTMLText;
+            cardNB.appendChild(qty);
+        }
+    }catch(err){stock=0;}}else{
+        stock=0;
+    }
+    if (stock<2){
+        cards.item(i).style.setProperty('Display','None');
+    }
+    if (price<sellThreshold[cardVal.toString()]){
+        cards.item(i).style.setProperty('Display','None');
+    }
+}
+```
+
+
+#### Market Page
+
+##### javascript to filter Market for needed cards
 ```javascript
 clist=[];
 for (var i = 0; i < 153; i++) {x={};x["extra"]=0;x["status"]="NORMAL";clist.push(x);}
@@ -129,7 +199,7 @@ for (var i = 0; i < cards.length; i++) {
 };
 ```
 
-### javascript to filter Market for uncrystalized cards
+##### javascript to filter Market for uncrystalized cards
 ```javascript
 clist=[];
 for (var i = 0; i < 153; i++) {clist.push(0);}
@@ -163,7 +233,7 @@ for (var i = 0; i < cards.length; i++) {
 }
 ```
 
-### javascript to filter Market for good value cards
+##### javascript to filter Market for good value cards
 ```javascript
 cards=document.getElementsByClassName('wrapper-market-card');
 for (var i = 0; i < cards.length; i++) {
@@ -188,49 +258,30 @@ for (var i = 0; i < cards.length; i++) {
 }
 ```
 
-### javascript to filter Player Page for salable cards
+##### javascript to show number cards for sale
 ```javascript
-sellThreshold = {};
-sellThreshold["2000"] = 10000;
-sellThreshold["350"] = 195;
-sellThreshold["250"] = 126;
-sellThreshold["200"] =  87;
-sellThreshold["150"] = 110;
-sellThreshold["115"] =  80;
-sellThreshold["75"]  =  32;
-sellThreshold["50"]  =  25;
-sellThreshold["40"]  =  32;
-sellThreshold["20"]  =  22;
-sellThreshold["15"]  =  12;
-sellThreshold["10"]  =   8;
-sellThreshold["4"]   =   9;
-sellThreshold["3"]   =   4;
-sellThreshold["2"]   =   4;
-sellThreshold["1"]   =   4;
-clist=[];
-for (var i = 0; i < 153; i++) {clist.push(0);}
-let market = document.createElement('div');
-market.id = 'market';
-market.innerHTML=await (await fetch('https://play.boobylegends.com/market/')).text();
-marketCards=market.getElementsByClassName('wrapper-market-card');
+numForSale=[];
+for (var i = 0; i < 153; i++) {numForSale.push(0);}
+let marketSelling = document.createElement('div');
+marketSelling.id = 'market';
+marketSelling.innerHTML=await (await fetch('https://play.boobylegends.com/market/?tab=selling')).text();
+marketCards=marketSelling.getElementsByClassName('wrapper-market-card');
 for (var i = 0; i < marketCards.length; i++) {
     try{
     cardNum = parseInt(marketCards.item(i).getElementsByClassName('pornstar-number')[0].innerText);
     price = parseInt(marketCards.item(i).getElementsByClassName('cost')[0].innerText.trim());
-    clist[cardNum]=price;
+    numForSale[cardNum]=numForSale[cardNum]+1;
     }catch(err){console.log('error on '+cardNum.toString());}
 };
 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];
+    if (numForSale[cardNum] > 0){
+        HTMLText = " +" + numForSale[cardNum];
+    }else{HTMLText=""}
     var cardNB = cards.item(i).getElementsByClassName('card-nb')[0];
     if (cardNB){try{
-        stock = parseInt(cards.item(i).getElementsByClassName('nb-label')[0].outerText.trim());
-        var fuzed = cards.item(i).getElementsByClassName('nb-name')[0];
-        if (fuzed){stock = stock + 1;}
-        HTMLText = "Price: " + price;
         var priceDiv = cardNB.getElementsByClassName('Price')[0];
         if (priceDiv){priceDiv.innerText = HTMLText;}
         else{
@@ -242,16 +293,12 @@ for (var i = 0; i < cards.length; i++) {
     }catch(err){stock=0;}}else{
         stock=0;
     }
-    if (stock<2){
-        cards.item(i).style.setProperty('Display','None');
-    }
-    if (price<sellThreshold[cardVal.toString()]){
-        cards.item(i).style.setProperty('Display','None');
-    }
 }
 ```
 
-### javascript to show overbid cards for sale
+#### Market Selling Page
+
+##### javascript to show overbid cards for sale
 ```javascript
 sellThreshold = {};
 sellThreshold["2000"] = 10000;
@@ -310,44 +357,3 @@ for (var i = 0; i < cards.length; i++) {
 ```
 
 
-### javascript to show number cards for sale
-```javascript
-numForSale=[];
-for (var i = 0; i < 153; i++) {numForSale.push(0);}
-let marketSelling = document.createElement('div');
-marketSelling.id = 'market';
-marketSelling.innerHTML=await (await fetch('https://play.boobylegends.com/market/?tab=selling')).text();
-marketCards=marketSelling.getElementsByClassName('wrapper-market-card');
-for (var i = 0; i < marketCards.length; i++) {
-    try{
-    cardNum = parseInt(marketCards.item(i).getElementsByClassName('pornstar-number')[0].innerText);
-    price = parseInt(marketCards.item(i).getElementsByClassName('cost')[0].innerText.trim());
-    numForSale[cardNum]=numForSale[cardNum]+1;
-    }catch(err){console.log('error on '+cardNum.toString());}
-};
-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);
-    if (numForSale[cardNum] > 0){
-        HTMLText = " +" + numForSale[cardNum];
-    }else{HTMLText=""}
-    var cardNB = cards.item(i).getElementsByClassName('card-nb')[0];
-    if (cardNB){try{
-        var priceDiv = cardNB.getElementsByClassName('Price')[0];
-        if (priceDiv){priceDiv.innerText = HTMLText;}
-        else{
-            let qty = document.createElement('div');
-            qty.classList.add('Price');
-            qty.innerText = HTMLText;
-            cardNB.appendChild(qty);
-        }
-    }catch(err){stock=0;}}else{
-        stock=0;
-    }
-}
-```
-
-
-
-