Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Так как меня кинул заказчик на бабки, а конкретно на 10$, я решил выложить это в паблик. Открываем консоль в браузере Ctrl + Shift + i, вставляем скрипт ниже, настраиваем, можно создавать автоматическое создание заездов и прохождение с нужной их скоростью и ошибками, в иксах чтобы заработало, нужно зайти, перезагрузить страницу и опять зайти ну или можете допилить сами. (с) un4given
- var kg = {
- isRemoveAds: false,
- isAddMyPanel: false,
- myPanel: document.createElement('div'),
- initMyPanel: function(){
- var setStyleBlock = function(block){
- block.style.float = 'left';
- block.style.height = '140px';
- block.style.padding = '0 10px';
- };
- var setStyleH4 = function(block){
- block.style.width = '100%';
- block.style.margin = '5px 0 0 0';
- block.style.padding = '0px';
- block.style.font = 'bold 14px sans-serif';
- block.style.borderBottom = '1px solid #cccccc';
- block.style.color = '#555';
- block.style.textAlign = 'left';
- };
- var setStyleTextBlock = function(block, width){
- block.style.width = width;
- block.style.height = '24px';
- block.style.font = '13px sans-serif';
- block.style.color = '#000000';
- block.style.lineHeight = '22px';
- };
- var setStyleInput = function(block, width){
- block.style.width = width;
- block.style.border = '1px solid #aaaaaa';
- block.style.padding = '1px 2px';
- block.style.margin = '0px';
- block.style.font = '12px sans-serif';
- };
- kg.myPanel.style.background = '#ffffff';
- kg.myPanel.style.width = '100%';
- kg.myPanel.style.height = '120px';
- var blockInf = document.createElement('div');
- setStyleBlock(blockInf);
- var blockAutoType = document.createElement('div');
- setStyleBlock(blockAutoType);
- var enableAutoType = document.createElement('div');
- setStyleTextBlock(enableAutoType, '140px');
- enableAutoType.innerHTML = 'Включить <input id="kh_autotype" type="checkbox">';
- var speedAutoType = document.createElement('div');
- setStyleTextBlock(speedAutoType);
- var inputAutoTypeStart = document.createElement('input');
- inputAutoTypeStart.setAttribute('type','text');
- inputAutoTypeStart.id = 'kh_autotype_speed_s';
- setStyleInput(inputAutoTypeStart, '40px');
- var inputAutoTypeEnd = document.createElement('input');
- inputAutoTypeEnd.setAttribute('type','text');
- inputAutoTypeEnd.id = 'kh_autotype_speed_e';
- setStyleInput(inputAutoTypeEnd, '40px');
- speedAutoType.innerHTML = 'Скорость от ';
- speedAutoType.appendChild(inputAutoTypeStart);
- speedAutoType.innerHTML += ' до ';
- speedAutoType.appendChild(inputAutoTypeEnd);
- var errorAutoType = document.createElement('div');
- setStyleTextBlock(errorAutoType);
- var inputAutoTypeErorrStart = document.createElement('input');
- inputAutoTypeErorrStart.setAttribute('type','text');
- inputAutoTypeErorrStart.id = 'kh_autotype_error_s';
- setStyleInput(inputAutoTypeErorrStart, '40px');
- var inputAutoTypeErorrEnd = document.createElement('input');
- inputAutoTypeErorrEnd.setAttribute('type','text');
- inputAutoTypeErorrEnd.id = 'kh_autotype_error_e';
- setStyleInput(inputAutoTypeErorrEnd, '40px');
- errorAutoType.innerHTML = 'Ошибки   от ';
- errorAutoType.appendChild(inputAutoTypeErorrStart);
- errorAutoType.innerHTML += ' до ';
- errorAutoType.appendChild(inputAutoTypeErorrEnd);
- var restartAutoType = document.createElement('div');
- setStyleTextBlock(restartAutoType);
- var startAutoType = document.createElement('div');
- setStyleTextBlock(startAutoType);
- blockAutoType.appendChild(enableAutoType);
- blockAutoType.appendChild(speedAutoType);
- blockAutoType.appendChild(errorAutoType);
- blockAutoType.appendChild(startAutoType);
- kg.myPanel.appendChild(blockInf);
- kg.myPanel.appendChild(blockAutoType);
- kg.myPanel.innerHTML += '';
- },
- clear: function(){
- kg.isRemoveAds = false;
- kg.isAddMyPanel = false;
- },
- removeAds: function(){
- if(kh.fdoc.getElementsByClassName('ownbanner-back').length != 0){
- var ownbanner = kh.fdoc.getElementsByClassName('ownbanner-back')[0];
- ownbanner.innerHTML = '';
- ownbanner.style.background = '#ffffff';
- ownbanner.style.padding = '0px';
- kg.isRemoveAds = true;
- }
- },
- addMyPanel: function(){
- if(kh.fdoc.getElementsByClassName('ownbanner-back').length != 0){
- kh.fdoc.getElementsByClassName('ownbanner-back')[0].appendChild(kg.myPanel);
- kg.isAddMyPanel = true;
- }
- if(kh.fdoc.getElementsByClassName('userpanel')[0].length != 0){
- var userpanel = kh.fdoc.getElementsByClassName('userpanel')[0];
- userpanel.parentNode.insertBefore(kg.myPanel, userpanel.nextSibling);
- kg.isAddMyPanel = true;
- }
- if(kg.isAddMyPanel){
- kh.fwnd.document.getElementById('kh_autotype').checked = kh.autotype.enable;
- kh.fwnd.document.getElementById('kh_autotype').onchange = function(){
- kh.autotype.enable = this.checked;
- };
- kh.fwnd.document.getElementById('kh_autotype_speed_s').value = kh.autotype.minSpeed;
- kh.fwnd.document.getElementById('kh_autotype_speed_s').onchange = function(){
- kh.autotype.minSpeed = parseInt(this.value);
- };
- kh.fwnd.document.getElementById('kh_autotype_speed_e').value = kh.autotype.maxSpeed;
- kh.fwnd.document.getElementById('kh_autotype_speed_e').onchange = function(){
- kh.autotype.maxSpeed = parseInt(this.value);
- };
- kh.fwnd.document.getElementById('kh_autotype_error_s').value = kh.autotype.minError;
- kh.fwnd.document.getElementById('kh_autotype_error_s').onchange = function(){
- kh.autotype.minError = parseInt(this.value);
- };
- kh.fwnd.document.getElementById('kh_autotype_error_e').value = kh.autotype.maxError;
- kh.fwnd.document.getElementById('kh_autotype_error_e').onchange = function(){
- kh.autotype.maxError = parseInt(this.value);
- };
- kh.fwnd.document.getElementById('kh_autotype_autostart').checked = kh.autotype.autostart;
- kh.fwnd.document.getElementById('kh_autotype_autostart').onchange = function(){
- kh.autotype.autostart = this.checked;
- };
- }
- }
- };
- var kh = {
- iframe: null,
- fwnd: null,
- fdoc: null,
- oldLocation: null,
- startTime: null,
- hiddenIframe: null,
- init: function(){
- setInterval(kh.checkUnloadChange, 1000);
- this.startTime = new Date();
- setInterval(kh.refreshTime, 1000);
- document.head.innerHTML = '';
- document.body.innerHTML = '';
- this.hiddenIframe = document.createElement('iframe');
- this.hiddenIframe.style.display = 'none';
- document.body.appendChild(this.hiddenIframe);
- this.iframe = document.createElement('iframe');
- this.iframe.style.width = '100%';
- this.iframe.style.height = '100%';
- this.iframe.style.border = 'none';
- this.iframe.src = 'http://www.klavogonki.ru/gamelist/';
- kg.initMyPanel();
- this.iframe.onload = function(){
- kh.checkLoad();
- kg.clear();
- clearInterval(kh.intervalID);
- this.contentWindow.onbeforeunload = kh.wndUnload;
- };
- document.body.style.margin = '0';
- document.body.style.height = '100%';
- document.documentElement.style.height = '100%';
- document.body.appendChild(this.iframe);
- },
- wndUnload: function(){
- kh.oldLocation = kh.fwnd.location;
- kh.intervalID = setInterval(kh.checkLoad, 100);
- kh.autotype.isRace = false;
- clearTimeout(kh.autotype._timer);
- },
- checkUnloadChange: function(){
- if(kh.fwnd){
- if(kh.fwnd.onbeforeunload != kh.wndUnload){
- kh.fwnd.onbeforeunload = kh.wndUnload;
- }
- }
- },
- checkLoad: function(){
- kh.fwnd = kh.iframe.contentWindow;
- if(kh.fwnd) kh.fdoc = kh.fwnd.document;
- if(kh.fwnd.location != kh.oldLocation){
- if(!kg.isRemoveAds) kg.removeAds();
- if(!kg.isAddMyPanel) kg.addMyPanel();
- if(!kh.autotype.isRace) kh.autotype.checkRace();
- }
- },
- refreshTime: function(){
- var tmpTime = new Date();
- tmpTime = tmpTime.getTime() - kh.startTime.getTime();
- var seconds = parseInt(tmpTime/1000);
- while(seconds >= 60) seconds -= 60;
- var minutes = parseInt(tmpTime/1000/60);
- while(minutes >= 60) minutes -= 60;
- var hours = parseInt(tmpTime/1000/60/60);
- if(kh.fdoc && kh.fdoc.getElementById('kh_time')) {
- kh.fdoc.getElementById('kh_time').innerHTML = ((hours < 10)?'0':'')+hours+':'+((minutes<10)?'0':'')+minutes+':'+((seconds<10)?'0':'')+seconds;
- }
- },
- autotype: {
- isRace: false,
- enable: true,
- autostart: false,
- autorestart: false,
- minSpeed: 478,
- maxSpeed: 503,
- minError: 0,
- maxError: 2,
- _speedNow: -1,
- _speed: -1,
- _error: -1,
- _i: 0,
- _tspeed: 0,
- _timer: null,
- checkRace: function(){
- if(kh.fwnd.game) {
- kh.autotype.isRace = true;
- kh.autotype.checkStart();
- }
- },
- checkStart: function(){
- if(kh.autotype.enable && kh.autotype.isRace){
- if(kh.fwnd.game.gamestatus == 'racing'){
- setTimeout(kh.autotype.start, 200);
- } else {
- if(kh.autotype.autostart && kh.fwnd.game.gamestatus == 'paused'){
- kh.fwnd.game.hostStart();
- }
- kh.autotype._timer = setTimeout(kh.autotype.checkStart, 100);
- }
- }
- },
- start: function(){
- kh.autotype._speed = kh.autotype.minSpeed + parseInt(Math.random()*(kh.autotype.maxSpeed - kh.autotype.minSpeed));
- kh.autotype._error = kh.autotype.minError + parseInt(Math.random()*(kh.autotype.maxError - kh.autotype.minError));
- kh.autotype._speedNow = 0;
- kh.autotype._i = 0;
- kh.autotype._tspeed = (60/kh.autotype._speed)*1000;
- kh.autotype._startSpeed = kh.autotype._tspeed;
- setTimeout(kh.autotype.loop, 100);
- },
- loop: function(){
- if(kh.autotype._error > 0){
- kh.autotype._error--;
- kh.fdoc.getElementById("inputtext").value += "/";
- kh.fwnd.change(kh.fdoc.getElementById("inputtext"));
- kh.fwnd.change(kh.fdoc.getElementById("inputtext"));
- kh.fdoc.getElementById("inputtext").value = "";
- kh.fwnd.change(kh.fdoc.getElementById("inputtext"));
- kh.autotype._timer = setTimeout(kh.autotype.loop, 0);
- } else {
- kh.fdoc.getElementById("inputtext").value += kh.fwnd.game.text[kh.autotype._i];
- kh.fwnd.change(kh.fdoc.getElementById("inputtext"));
- kh.autotype._i++;
- if(kh.autotype._i < kh.fwnd.game.text.length){
- var speednow = (new Date().getTime()) - kh.fwnd.game.begintime;
- if(kh.autotype._i < (kh.autotype._speed/60*(speednow/1000))){
- if(kh.autotype._startSpeed-10 < kh.autotype._tspeed) kh.autotype._tspeed -= 1;
- } else {
- if(kh.autotype._startSpeed+10 > kh.autotype._tspeed) kh.autotype._tspeed += 1;
- }
- kh.autotype._timer = setTimeout(kh.autotype.loop, kh.autotype._tspeed);
- }
- }
- if(player && player.info.speed){
- kh.wndUnload();
- kh.fwnd.location = '/g/'+kh.fwnd.game.id+'.replay';
- } else {
- kh.autotype._timer = setTimeout(kh.autotype.loop, 100);
- }
- }
- },
- };
- kh.init();
Advertisement
Add Comment
Please, Sign In to add comment