NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name lf research // @namespace http://tampermonkey.net/ // @version 1.1.4 // @description display lifeform time research on each planet in planet list // @author You // @license MIT // @match https://*.ogame.gameforge.com/game/* // @updateURL https://openuserjs.org/meta/benneb/lf_research.meta.js // @downloadURL https://openuserjs.org/install/benneb/lf_research.user.js // ==/UserScript== var lfsearch = (function(){ var actuelDate = Math.round((new Date().getTime())/1000); var idplanet = document.getElementsByName('ogame-planet-id')[0].content; var IsMoon = document.getElementsByName('ogame-planet-type')[0].content == 'moon' ; var idPlanetes = []; var planetList = window.$('#planetList [id^="planet-"]'); for(var i=0;i < planetList.length;i++) { var htmle = planetList[i]; var planetid = htmle.id; idPlanetes.push(planetid.substring(7,planetid.length)); } function createCookie(name,value,days) { var expires; if (days) { var date = new Date(); date.setTime(date.getTime()+(days*24*60*60*1000)); expires = "; expires="+date.toGMTString(); } else expires = ""; document.cookie = name+"="+value+expires+"; path=/"; } function readCookie(name){ var nameEQ = name + "="; 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,c.length); } if (c.indexOf(nameEQ) == 0) { return c.substring(nameEQ.length,c.length).split(','); } } return null; } function setCookie(cname, cvalue, exdays) { var d = new Date(); d.setTime(d.getTime() + (exdays*24*60*60*1000)); var expires = "expires="+ d.toUTCString(); document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/"; } function parseIntFormat(a) { return "string" === typeof a ? +a.replace(/[^\d\-]/g, "") || 0 : "number" === typeof a ? Math.floor(a) : 0;} function d(a) {return 0 > a || 9 < a ? a : "0" + a;} function format(a) { var datemm = new Date(a*1000); var datestring = d(datemm.getDate()) +"/" + d((datemm.getMonth()+1)) + "/" + datemm.getFullYear() + " " + datemm.getHours() + ":" + datemm.getMinutes(); return datestring; } if(!IsMoon) { if(document.getElementById("countdownlfresearchDetails")) { var countdownlfresearchDetails = document.getElementById("countdownlfresearchDetails"); var end = countdownlfresearchDetails.dataset.end; var productionboxbuildingcomponent = document.getElementById("productionboxlfresearchcomponent"); var contentWrapper = productionboxbuildingcomponent.getElementsByClassName("footer")[0]; contentWrapper.style.marginTop = "0px"; contentWrapper.style.marginBottom = "10px"; contentWrapper.style.textAlign = "center"; var adate = parseIntFormat(end); contentWrapper.innerHTML += format(adate); createCookie( 'clfd'+idplanet , end , 10); } } for(var k =0 ; k< idPlanetes.length ; k++) { var idPlanete = idPlanetes[k]; var pend = readCookie('clfd'+idPlanete); if(pend) { var diffSec = pend-actuelDate; //console.log(idLunes[k]+"--"+timestampFin); var diffMin = Math.round(diffSec/60); var diffHeure = Math.round(diffSec*100/(60*60))/100; //console.log("reste "+diffMin); if(diffMin > 0) { var planetCode = document.getElementById("planet-"+idPlanete); var moonlink = planetCode.getElementsByClassName("moonlink")[0]; var idslkdfjls = "timelfr"+idPlanete; var test = format(parseIntFormat(pend-0)); var color = "yellow"; if(diffSec < 3600*10) { color = "tomato"; } var result_html = "<span title='"+test+"' style='z-index: 1; color:"+color+"; position: relative; font-size: 10pt; background-color: black;' class='lffdv' id='"+idslkdfjls+"'>"+Math.round(diffHeure)+"</span>"; moonlink.innerHTML += result_html; if(diffSec < 3600 ) { new window.simpleCountdown(window.$("#"+idslkdfjls), diffSec); window.$("#"+idslkdfjls).css("color","red"); } } } } }).toString(); var script = document.createElement("script"); script.text = "(" + lfsearch + ")();"; document.body.appendChild(script);