Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /** Дата начала ICO по вашему локальному времени **/
- var icoTime = ' 22:00:00';
- /** Дата начала ICO по вашему локальному времени **/
- function toTimestamp(strDate){
- var datum = Date.parse(strDate);
- return datum;
- }
- var readyToBuy = false;
- var wait = Math.floor(500 + (Math.random()*500));
- // устанавливаем куки
- function setCookie(cname, cvalue) {
- var d = new Date();
- d.setTime(d.getTime() + (30 * 24 * 60 * 60 * 1000));
- var expires = "expires="+d.toUTCString();
- document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/";
- }
- // получаем куки
- function getCookie(cname) {
- var name = cname + "=";
- var ca = document.cookie.split(';');
- for(var i = 0; i < ca.length; i++) {
- var c = ca[i];
- while (c.charAt(0) === ' ') {
- c = c.substring(1);
- }
- if (c.indexOf(name) === 0) {
- return c.substring(name.length, c.length);
- }
- }
- return "";
- }
- 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>';
- if($("#extension_mess").length){
- 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">';
- $("#extension_mess").html(form);
- }
- // берем время ожидания из кук
- function updateWait(){
- var userWait = getCookie('waitfor');
- if(userWait !== undefined && $.isNumeric(userWait)){
- wait = userWait;
- }
- }
- $(panel).appendTo("body");
- if($("#extension_mess").length){
- 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">';
- $("#extension_mess").html(form);
- }
- // заполняем максимальное количество монет для покупки
- var linkClick = setInterval(function(){
- if($("a[data-fill]").length){
- if($("span.app-buy-all").html() !== '...'){
- $("a[data-fill]").click();
- readyToBuy = true;
- clearInterval(linkClick);
- }
- }
- }, 100);
- var next_ico_date;
- //var dtime = toTimestamp("2017-12-14" + ' 1:00:00');
- var curDate = new Date();
- var dtime = toTimestamp(curDate.toISOString().substring(0, 10) + icoTime);
- next_ico_date = {"from_timestamp":dtime};
- $(document).on({
- ajaxSend: function(e, g, r){
- },
- ajaxComplete: function(e, g, r) {
- console.log('Ajax Completed');
- if(r.url.indexOf('/ico/info') > -1 && g.status === 200){
- next_ico_date = g.responseJSON.next_ico_date;
- console.log('Init Completed');
- }
- /*
- if(r.url.indexOf('/user/info') > -1 && g.status === 200){
- user = g.responseJSON.ref_url.replace(/.*referrer=([^\#]+)/g, "$1");
- updateWait();
- }
- */
- },
- ajaxStop: function() {
- console.log('Ajax Stop');
- },
- ajaxError: function(e, g, r, a) {
- console.log('Ajax Error');
- }
- });
- var timeCount = 0;
- var buyInt = setInterval(function(){
- var tmpwait = $("#wait").val();
- if(tmpwait!==undefined && $.isNumeric(tmpwait) && tmpwait > 0){
- wait = tmpwait;
- }
- if(next_ico_date !== undefined && next_ico_date!==null){
- var distance = next_ico_date.from_timestamp - new Date().getTime();
- //console.log(distance);
- if(distance < wait && distance > -30000){
- if(($("input[name=captcha_key2]").val()!== undefined && $("input[name=captcha_key2]").val() !== '') || ($("input[name=captcha_key2]").val() !== undefined && $("input[name=captcha_key]").val() !== '')){
- if($("#unx_amount").val()===''){
- $("a[data-fill]").click();
- }
- $("button[type=submit]").click();
- loopBuy();
- clearInterval(buyInt);
- setCookie('waitfor', wait);
- }
- }
- }else{
- timeCount++;
- var curDate = new Date();
- if(timeCount > 7){
- //var dtime = toTimestamp("2017-12-14" + ' 1:00:00');
- var dtime = toTimestamp(curDate.toISOString().substring(0, 10) + icoTime);
- next_ico_date = {"from_timestamp":dtime};
- }
- }
- }, 500);
- function loopBuy(){
- var count = 1;
- var loopInt = setInterval(function(){
- if($("#unx_amount").val()===''){
- $("a[data-fill]").click();
- }
- $("button[type=submit]").removeAttr("disabled");
- $("button[type=submit]").click();
- count++;
- if(count>15){
- clearInterval(loopInt);
- }
- }, 800);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement