var upEvent = new MouseEvent('mouseup', { view: window, bubbles: true, cancelable: true }); var downEvent = new MouseEvent('mousedown', { view: window, bubbles: true, cancelable: true }); var myClick = function(text, number = 0){ $(text)[number].dispatchEvent(downEvent); $(text)[number].dispatchEvent(upEvent); } var startChecking = function(){ var data = new Date(); console.log('Time:', data.getHours(), data.getMinutes(), data.getSeconds()); setTimeout(function(){ myClick('.btnSBC'); setTimeout(function(){ myClick('.btnTransfers'); setTimeout(function(){ if($('.sold .value').html() > 0){ myClick('.transferListTile'); setTimeout(function(){ myClick('#TradePile .btn-raised'); setTimeout(function(){ myClick('#TradePile .btn-raised', 1); setTimeout(function(){ myClick('.btn-flat',1); setTimeout(function(){ myClick('.btnTransfers'); },5000); }); }, 2000); },2000); } else if($('.textField.all .count').html() > $('.textField.active .value').html()){ myClick('.transferListTile'); setTimeout(function(){ myClick('#TradePile .btn-raised', 1); setTimeout(function(){ myClick('.btn-flat',1); setTimeout(function(){ myClick('.Dialog.ui-dialog-type-message .btn-flat',1); setTimeout(function(){ myClick('.btnTransfers'); }); },5000); }); },2000); } },2000) },2000); startChecking(); }, 50000); } var blur = new MouseEvent('blur', { view: window, bubbles: true, cancelable: true }); var myBlur = function(text, number = 0){ $(text)[number].dispatchEvent(blur); } function spr(){ var min = null; for(var i = 0; i<$('.auctionValue .label').length; i++){ if($('.auctionValue .label')[i].innerHTML === "Buy Now"){ var value = $('.auctionValue .coins.value')[i].innerHTML; value = value.replace(/,/g, ''); if(!min || parseInt(value) < min) min = parseInt(value); } } return min; } function go(){ myClick('.standard',5); setTimeout(function(){ var price = spr(); myClick('.btn-flat.back.headerButton'); setTimeout(function(){ myClick('.list.accordian'); if(parseInt($('.coins.bandingLabel')[0].innerHTML.substr(5)) > price-100){ $('.numericInput.filled')[0].value = parseInt($('.coins.bandingLabel')[0].innerHTML.substr(5)); } else { $('.numericInput.filled')[0].value = price - 100; } $('.numericInput.filled')[1].value = price; },1000); },1000); } $(document).keypress(function( event ) { if ( event.which === 96 ) { event.preventDefault(); go(); } });