NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name KYS_FleetElapsed // @namespace http://tampermonkey.net/ // @version 0.1 // @description try to take over the world! // @author You // @match http://ogame1304.de/game/index.php?page=flotten2* // @grant none // ==/UserScript== function cc() { v = new Date(); n = new Date(); o = new Date(); var timestamp1 = (Math.floor(Date.now() / 1000)); // alert(timestamp1); var date = new Date(timestamp1 * 1000), datevalues = [ date.getFullYear(), date.getMonth()+1, date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), ]; var currentSec = datevalues[3]*3600 + datevalues[4]*60 + datevalues[5]; var eta = duration()+currentSec; var eta2 = duration()*2+currentSec; var durHTML = document.getElementById("eta1").innerHTML; durHTML = "<div id='bxx1' style='color: lime;' title='"+eta+"'></div><div id='bxx2' style='color: lime;' title='"+eta2+"'></div>"; document.getElementById("eta1").innerHTML = durHTML; // for (cn = 1; cn == 2; cn++) { bxx = document.getElementById('bxx1'); bxx2 = document.getElementById('bxx2'); ss = bxx.title; ss2 = bxx2.title; // alert(bxx.title); s = ss - Math.round((n.getTime() - v.getTime()) / 1000.); s2 = ss2 - Math.round((n.getTime() - v.getTime()) / 1000.); m = 0; m2 = 0; h = 0; h2 = 0; if (s < 0) { bxx.innerHTML = "-"; } else { if (s > 59) { m = Math.floor(s/60); s = s - m * 60; } if (m > 59) { h = Math.floor(m / 60); m = m - h * 60; } if (s < 10) { s = "0" + s; } if (m < 10) { m = "0" + m;} if (s2 < 0) { bxx2.innerHTML = "-"; } else { if (s2 > 59) { m2 = Math.floor(s2/60); s2 = s2 - m2 * 60; } if (m2 > 59) { h2 = Math.floor(m2 / 60); m2 = m2 - h2 * 60; } if (s2 < 10) { s2 = "0" + s2; } if (m2 < 10) { m2 = "0" + m2; } //bxx.innerHTML= "lololol"; bxx.innerHTML = (h % 24) + ":" + m + ":" + s + ""; bxx2.innerHTML =" (" + (h2 % 24) + ":" + m2 + ":" + s2 + ")"; } bxx.title = Number(bxx.title) + 1; bxx2.title = Number(bxx2.title) + 1; } setTimeout(function() { cc(); }, 999); }} ///////////////////////////////////////////////////////////////////////////// (function() { 'use strict'; var ETAdiv = document.createElement("tr"); ETAdiv.height = "20"; ETAdiv.innerHTML = '<th>ETA</th><th><div id="eta1">-</div></th>'; // list.insertBefore(newItem, list.childNodes[0]); // alert( document.getElementById("content").children[0].children[4].children[0].children[29].innerHTML); document.getElementById("content").children[0].children[4].children[0].getElementsByTagName('tbody')[0].insertBefore(ETAdiv, document.getElementById("content").children[0].children[4].children[0].getElementsByTagName('tbody')[0].children[5]); //// var origHTML = document.getElementById("content").innerHTML; // origHTML.replace(('<div id="duration">-</div></th> \ //</tr>'), ('<div id="duration">-</div></th> \ // </tr> \ //<tr height="20"> \ // <th>ETA</th><th><div id="eta">-</div></th> \ // </tr> ')); // document.getElementById("content").innerHTML = origHTML; var script = document.createElement("script"); script.innerHTML = '' ; document.body.appendChild(script); var test1 = document.createElement("div"); test1.innerHTML = "blabla"; document.body.appendChild(test1); var current1 = Math.floor(Date.now() / 1000); //alert(current1); var timestamp1 = (Math.floor(Date.now() / 1000)); // alert(timestamp1); var date = new Date(timestamp1 * 1000), datevalues = [ date.getFullYear(), date.getMonth()+1, date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), ]; var currentSec = datevalues[3]*3600 + datevalues[4]*60 + datevalues[5]; var eta = duration()+currentSec; var durHTML = document.getElementById("eta1").innerHTML; durHTML = "<div id='bxx1' style='color: lime;' title='"+eta+"'></div><div id='bxx2' style='color: lime;' title='"+eta*2+"'></div>"; document.getElementById("eta1").innerHTML = durHTML; //alert(duration()); // alert( document.getElementById("bxx1").innerHTML); cc(); //counter1(); })(); function duration() { var speedfactor; speedfactor = document.getElementsByName("speedfactor")[0].value; msp = maxspeed(); sp = speed(); dist = distance(); ret = Math.round(((35000 / sp * Math.sqrt(dist * 10 / msp) + 10) / speedfactor )); return ret; }