Advertisement
Guest User

unixcoin v2

a guest
Dec 14th, 2017
852
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /** Дата начала ICO по вашему локальному времени **/
  2.  
  3. var icoTime = ' 22:00:00';
  4.  
  5. /** Дата начала ICO по вашему локальному времени **/
  6.  
  7.  
  8. function toTimestamp(strDate){
  9.    var datum = Date.parse(strDate);
  10.    return datum;
  11. }
  12.  
  13. var readyToBuy = false;
  14. var wait = Math.floor(500 + (Math.random()*500));
  15.  
  16. // устанавливаем куки
  17. function setCookie(cname, cvalue) {
  18.     var d = new Date();
  19.     d.setTime(d.getTime() + (30 * 24 * 60 * 60 * 1000));
  20.     var expires = "expires="+d.toUTCString();
  21.     document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/";
  22. }
  23. // получаем куки
  24. function getCookie(cname) {
  25.     var name = cname + "=";
  26.     var ca = document.cookie.split(';');
  27.     for(var i = 0; i < ca.length; i++) {
  28.         var c = ca[i];
  29.         while (c.charAt(0) === ' ') {
  30.             c = c.substring(1);
  31.         }
  32.         if (c.indexOf(name) === 0) {
  33.             return c.substring(name.length, c.length);
  34.         }
  35.     }
  36.     return "";
  37. }
  38.  
  39. var panel = '<div id="choico_setting_panel" style="display: block; position: fixed; box-shadow: 0 2px 20px rgba(0,0,0,0.2); bottom: 20px; right: 20px; width: 280px; margin-bottom: 0; border-top: 5px solid #6b15a1; overflow: hidden; padding: 10px; font-size: 14px; z-index: 999; -webkit-animation-name: bounceInUp; animation-name: bounceInUp; -webkit-animation-delay: .5s; animation-delay: .5s; -webkit-animation-duration: 1.2s; animation-duration: 1.2s; background-color: #fff; border: 1px solid transparent; border-color: #ddd; border-radius: 4px;"> <div style="padding: 0"> <small style="color: #697176; text-transform: uppercase; font-weight: 400; padding-left: 5px;">ICO Extension</small><p style="color: #697176" id="extension_mess">Tài khoản không được hỗ trợ bởi UnixCoin Extension. Vui lòng vào group Chợ ICO để đăng ký.</p> </div></div>';
  40.        
  41. if($("#extension_mess").length){
  42.     var form = '<span>Tự động mua trước(milliseconds):</span><input style="width:100%; height: 40px; padding: 0 14px; font-size: 16px;" id="wait" type="number" value="' + wait + '" min="1" max="10000">';
  43.     $("#extension_mess").html(form);
  44. }
  45.  
  46. // берем время ожидания из кук    
  47. function updateWait(){
  48.     var userWait = getCookie('waitfor');
  49.     if(userWait !== undefined && $.isNumeric(userWait)){
  50.         wait = userWait;
  51.     }
  52. }
  53.  
  54. $(panel).appendTo("body");
  55. if($("#extension_mess").length){
  56.     var form = '<span>Tự động mua trước(milliseconds):</span><input style="width:100%; height: 40px; padding: 0 14px; font-size: 16px;" id="wait" type="number" value="' + wait + '" min="1" max="10000">';
  57.     $("#extension_mess").html(form);
  58. }
  59.  
  60.  
  61. // заполняем максимальное количество монет для покупки
  62. var linkClick = setInterval(function(){
  63.     if($("a[data-fill]").length){
  64.         if($("span.app-buy-all").html() !== '...'){
  65.             $("a[data-fill]").click();
  66.             readyToBuy = true;
  67.             clearInterval(linkClick);
  68.         }
  69.     }
  70. }, 100);
  71.  
  72. var next_ico_date;
  73. //var dtime = toTimestamp("2017-12-14" + ' 1:00:00');
  74. var curDate = new Date();
  75. var dtime = toTimestamp(curDate.toISOString().substring(0, 10) + icoTime);
  76. next_ico_date = {"from_timestamp":dtime};
  77. $(document).on({
  78.     ajaxSend: function(e, g, r){
  79.     },
  80.     ajaxComplete: function(e, g, r) {
  81.         console.log('Ajax Completed');
  82.         if(r.url.indexOf('/ico/info') > -1 && g.status === 200){
  83.             next_ico_date = g.responseJSON.next_ico_date;
  84.             console.log('Init Completed');
  85.         }
  86.         /*
  87.         if(r.url.indexOf('/user/info') > -1 && g.status === 200){
  88.             user = g.responseJSON.ref_url.replace(/.*referrer=([^\#]+)/g, "$1");
  89.             updateWait();
  90.         }
  91.         */
  92.     },
  93.     ajaxStop: function() {
  94.         console.log('Ajax Stop');
  95.     },
  96.     ajaxError: function(e, g, r, a) {
  97.         console.log('Ajax Error');
  98.     }
  99. });
  100.  
  101. var timeCount = 0;
  102. var buyInt = setInterval(function(){
  103.     var tmpwait = $("#wait").val();
  104.     if(tmpwait!==undefined && $.isNumeric(tmpwait) && tmpwait > 0){
  105.         wait = tmpwait;
  106.     }
  107.     if(next_ico_date !== undefined && next_ico_date!==null){
  108.         var distance = next_ico_date.from_timestamp - new Date().getTime();
  109.         //console.log(distance);
  110.         if(distance < wait && distance > -30000){
  111.             if(($("input[name=captcha_key2]").val()!== undefined && $("input[name=captcha_key2]").val() !== '') || ($("input[name=captcha_key2]").val() !== undefined && $("input[name=captcha_key]").val() !== '')){
  112.                 if($("#unx_amount").val()===''){
  113.                     $("a[data-fill]").click();
  114.                 }
  115.                 $("button[type=submit]").click();
  116.                 loopBuy();
  117.                 clearInterval(buyInt);
  118.                 setCookie('waitfor', wait);
  119.             }
  120.         }
  121.     }else{
  122.         timeCount++;
  123.         var curDate = new Date();
  124.         if(timeCount > 7){
  125.             //var dtime = toTimestamp("2017-12-14" + ' 1:00:00');
  126.             var dtime = toTimestamp(curDate.toISOString().substring(0, 10) + icoTime);
  127.             next_ico_date = {"from_timestamp":dtime};
  128.         }
  129.     }
  130. }, 500);
  131. function loopBuy(){
  132.     var count = 1;
  133.     var loopInt = setInterval(function(){
  134.         if($("#unx_amount").val()===''){
  135.             $("a[data-fill]").click();
  136.         }
  137.         $("button[type=submit]").removeAttr("disabled");
  138.         $("button[type=submit]").click();
  139.         count++;
  140.         if(count>15){
  141.             clearInterval(loopInt);
  142.         }
  143.     }, 800);
  144. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement