SHARE
TWEET

Untitled

a guest Feb 17th, 2019 76 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. javascript:(function() {
  2.    
  3.   var script = document.createElement('script');
  4.   script.src = 'https://code.jquery.com/jquery-3.3.1.min.js';
  5.  
  6.   script.type = 'text/javascript';
  7.   document.getElementsByTagName('head')[0].appendChild(script);
  8.  
  9.  
  10.   var locatie=window.location.href;
  11.  
  12.   if(!(locatie.includes("screen=market&mode=exchange")))
  13.   {
  14.     alert("Scriptul trebui rulat la market->exchange \n Te redirectionez acum");
  15.     window.location.href=location+"&screen=market&mode=exchange";
  16.   }
  17.    
  18.  
  19.   window.setTimeout(function()
  20.   {
  21.     $(".content-border").append('<link rel="stylesheet"href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/css/bootstrap.min.css" />');
  22.  
  23.     $(".content-border").append('<p style="font-size: 20px;padding: 10px;font-weight: bold;text-align: center;background-color: #F5F5DC;">Introdu valorile pentru a vinde/cumpara resurse:</p ><br>');
  24.  
  25.     $(".content-border").append(`<div class="container" style="width: 100%;">
  26.   <table class="table table-hover" >
  27.     <tr>
  28.       <td> </td>
  29.       <td> <p style="font-weight: bold;position: relative;left: 25px;">Vinde</p></td>
  30.       <td> <p style="font-weight: bold;position: relative;left: 5px;">Avertiseaza</p></td>
  31.     </tr>
  32.     <tr>
  33.       <td><p style="font-weight: bold";>Lemn : </p></td>
  34.       <td><input type="text" id="lemn_vinde" style="text-align:center;width: 30%;"></td>
  35.       <td><input type="text" id="lemn_avert" style="text-align:center;width: 30%;"></td>
  36.   </tr>
  37.   <tr>
  38.     <td><p style="font-weight: bold";>Argila : </p></td>
  39.     <td><input type="text" id="argila_vinde" style="text-align:center;width: 30%;"></td>
  40.     <td><input type="text" id="argila_avert" style="text-align:center;width: 30%;"></td>
  41.   </tr>
  42.   <tr>
  43.   <td><p style="font-weight: bold";>Fier : </p></td>
  44.   <td><input type="text" id="fier_vinde" style="text-align:center;width: 30%;"></td>
  45.   <td><input type="text" id="fier_avert" style="text-align:center;width: 30%;"></td>
  46.   </tr>
  47.   <tr>
  48.   <td><p style="font-weight: bold";>Refresh pagina :</p></td>
  49.   <td><input type="text" style="text-align:center;width: 30%;" id="refresh" placeholder="secunde"></td>
  50.   <td><p style="font-weight: bold;font-size:16px; position: relative;left: 35px;" id="nr_refresh"></p></td>
  51.   </tr>
  52.   </table>
  53.   </div>`);
  54.    
  55.  
  56.  
  57.  
  58.     $(".content-border").append(`
  59.     <div class="jumbotron text-center" style="background-color: transparent">
  60.       <div class="btn-group"style="position: center" >
  61.         <button type="button" class="btn btn-primary" id="btn1">Start</button>
  62.         <button type="button" class="btn btn-primary" id="btn2">Stop</button>
  63.       </div>
  64.     </div>`);
  65.    
  66.  
  67.  
  68.     var id=0;
  69.     var secunde=0;
  70.     $("#btn1").click(function()
  71.     {
  72.       $("#btn1").css('pointer-events', 'none');
  73.       var refresh=$("#refresh").val()*1000;
  74.  
  75.     if(refresh>0)
  76.     {
  77.       id=window.setInterval(function()
  78.       {
  79.         var lemn_premium=$("#premium_exchange_rate_wood").text().replace(/ /g,'').split("\n")[1];
  80.         var argila_premium=$("#premium_exchange_rate_stone").text().replace(/ /g,'').split("\n")[1];
  81.         var fier_premium=$("#premium_exchange_rate_iron").text().replace(/ /g,'').split("\n")[1];
  82.  
  83.         var lemn_stoc=parseInt($("#premium_exchange_capacity_wood").text())-parseInt($("#premium_exchange_stock_wood").text());
  84.         var argila_stoc=parseInt($("#premium_exchange_capacity_stone").text())-parseInt($("#premium_exchange_stock_stone").text());
  85.         var fier_stoc=parseInt($("#premium_exchange_capacity_iron").text())-parseInt($("#premium_exchange_stock_iron").text());
  86.        
  87.         console.log("secunde: "+secunde);
  88.         console.log("lemn: "+lemn_premium);
  89.         console.log("argila: "+argila_premium);
  90.         console.log("fier: "+fier_premium);
  91.         console.log("\n");
  92.         secunde=secunde+1;
  93.  
  94.         var lemn_total=$("#wood").text();
  95.         var argila_total=$("#stone").text();
  96.         var fier_total=$("#iron").text();
  97.  
  98.         var lemn_vinde=$("#lemn_vinde").val();
  99.         var lemn_avert=$("#lemn_avert").val();
  100.  
  101.         var argila_vinde=$("#argila_vinde").val();
  102.         var argila_avert=$("#argila_avert").val();
  103.  
  104.         var fier_vinde=$("#fier_vinde").val();
  105.         var fier_avert=$("#fier_avert").val();
  106.  
  107.         $("#nr_refresh").text(secunde);
  108.  
  109.         if(parseInt(lemn_premium)<parseInt(lemn_vinde) && parseInt(lemn_total)>parseInt(lemn_premium) && parseInt(lemn_stoc)!=0)
  110.         {
  111.  
  112.           if(parseInt(lemn_total)>parseInt(lemn_stoc))
  113.             $('input[name*="sell_wood"]').val(Math.abs(lemn_stoc-lemn_vinde));
  114.           else
  115.             $('input[name*="sell_wood"]').val(Math.abs(lemn_total-lemn_vinde));
  116.  
  117.           $("input[type*=submit]").click();
  118.           window.setTimeout(function()
  119.           {
  120.             $("button:contains('Confirm')").get(0).click();
  121.            
  122.           },500)
  123.         }
  124.         else if(parseInt(lemn_premium)<parseInt(lemn_avert))
  125.         {
  126.           var melodie =new Audio("http://codeskulptor-demos.commondatastorage.googleapis.com/GalaxyInvaders/alien_shoot.wav");
  127.           melodie.play();
  128.         }
  129.          
  130.  
  131.  
  132.  
  133.  
  134.         if(parseInt(argila_premium)<parseInt(argila_vinde) && parseInt(argila_total)>parseInt(argila_premium)  && parseInt(argila_stoc)!=0)
  135.         {
  136.  
  137.           if(parseInt(argila_total)>parseInt(argila_stoc))
  138.             $('input[name*="sell_stone"]').val(Math.abs(argila_stoc-argila_vinde));
  139.           else
  140.             $('input[name*="sell_stone"]').val(Math.abs(argila_total-argila_vinde));
  141.  
  142.           $("input[type*=submit]").click();
  143.           window.setTimeout(function()
  144.           {
  145.             $("button:contains('Confirm')").get(0).click();
  146.           },500)
  147.         }
  148.         else if(parseInt(argila_premium)<parseInt(argila_avert))
  149.         {
  150.           var melodie =new Audio("http://codeskulptor-demos.commondatastorage.googleapis.com/GalaxyInvaders/alien_shoot.wav");
  151.           melodie.play();
  152.         }
  153.        
  154.  
  155.  
  156.         if(parseInt(fier_premium)<parseInt(fier_vinde) && parseInt(fier_total)>parseInt(fier_premium) && parseInt(fier_stoc)!=0)
  157.         {
  158.           if(parseInt(fier_total)>(parseInt(fier_stoc)))
  159.             $('input[name*="sell_iron"]').val(Math.abs(fier_stoc-fier_vinde));
  160.           else
  161.             $('input[name*="sell_iron"]').val(Math.abs(fier_total-fier_vinde));
  162.  
  163.           $("input[type*=submit]").click();
  164.           window.setTimeout(function()
  165.           {
  166.             $("button:contains('Confirm')").get(0).click();
  167.            
  168.           },500)
  169.         }
  170.         else if(parseInt(fier_premium)<parseInt(fier_avert))
  171.         {
  172.           var melodie =new Audio("http://codeskulptor-demos.commondatastorage.googleapis.com/GalaxyInvaders/alien_shoot.wav");
  173.           melodie.play();
  174.         }
  175.       },refresh);
  176.     }
  177.     else
  178.     {
  179.       alert("seteaza refresh pagina!");
  180.       $("#btn1").css('pointer-events', 'all');
  181.     }
  182.  
  183.     });
  184.  
  185.  
  186.     $("#btn2").click(function()
  187.     {
  188.       window.clearInterval(id);
  189.       $("#btn1").css('pointer-events', 'all');
  190.     });
  191.   },1000);
  192.      
  193.    
  194.  
  195.  
  196.   })();
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top