Advertisement
paolo-pv

Ogame Helper

Jan 22nd, 2020
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name Ogame Helper
  3. // @description none
  4. // @version  1
  5. // @grant    none
  6. // @include http://*/game/index.php?page=*
  7. // @include https://*/game/index.php?page=*
  8. // ==/UserScript==
  9.  
  10. (function () {
  11.  
  12.   function _getMeta(metaName) {
  13.     const metas = document.getElementsByTagName('meta');
  14.     for (let i = 0; i < metas.length; i++) {
  15.       if (metas[i].getAttribute('name') === metaName) {
  16.         return metas[i].getAttribute('content');
  17.       }
  18.     }
  19.     return '';
  20.   }
  21.  
  22.   function _setCookie(cname, cvalue, exdays) {
  23.     /*var d = new Date();
  24.     d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000));
  25.     var expires = "expires="+d.toUTCString();*/
  26.     var d1 = new Date();
  27.     d1.setHours(d1.getHours() + (23 - d1.getHours()));
  28.     d1.setMinutes(d1.getMinutes() + (59 - d1.getMinutes()));
  29.     d1.setSeconds(d1.getSeconds() + (59 - d1.getSeconds()));
  30.     var expires = "expires="+d1.toUTCString();
  31.     document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/";
  32.   }
  33.  
  34.   function _getCookie(cname) {
  35.     var name = cname + "=";
  36.     var ca = document.cookie.split(';');
  37.     for(var i = 0; i < ca.length; i++) {
  38.       var c = ca[i];
  39.       while (c.charAt(0) == ' ') {
  40.         c = c.substring(1);
  41.       }
  42.       if (c.indexOf(name) == 0) {
  43.         return c.substring(name.length, c.length);
  44.       }
  45.     }
  46.     return "";
  47.   }
  48.  
  49.   function _formatNumber(amount, decimalCount = 2, decimal = ".", thousands = ",") {
  50.     try {
  51.       decimalCount = Math.abs(decimalCount);
  52.       decimalCount = isNaN(decimalCount) ? 2 : decimalCount;
  53.  
  54.       const negativeSign = amount < 0 ? "-" : "";
  55.  
  56.       let i = parseInt(amount = Math.abs(Number(amount) || 0).toFixed(decimalCount)).toString();
  57.       let j = (i.length > 3) ? i.length % 3 : 0;
  58.  
  59.       return negativeSign + (j ? i.substr(0, j) + thousands : '') + i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + thousands) + (decimalCount ? decimal + Math.abs(amount - i).toFixed(decimalCount).slice(2) : "");
  60.     } catch (e) {
  61.       console.log(e)
  62.     }
  63.   }
  64.  
  65.   function _removeNumberPoints(str){
  66.     while(str.indexOf('.') != -1){
  67.       str = str.replace('.', '');
  68.     }
  69.     return str;
  70.   }
  71.  
  72.   function _showFlyingRes(oCell){
  73.     var tbl = document.createElement('table');
  74.     //tbl.setAttribute('width', '100%');
  75.     tbl.setAttribute('cellspacing', '0px');
  76.     tbl.setAttribute('cellpadding', '0px');
  77.     tbl.setAttribute('style', 'border: 1px solid white;');
  78.  
  79.     var row = tbl.insertRow(0);
  80.     var cell = row.insertCell(0);
  81.     cell.setAttribute('class', 'desc');
  82.     cell.setAttribute('align', 'center');
  83.     cell.setAttribute('style', 'border: 1px solid white;');
  84.     cell.innerHTML = 'Metallo';
  85.     cell = row.insertCell(1);
  86.     cell.setAttribute('class', 'desc');
  87.     cell.setAttribute('align', 'center');
  88.     cell.setAttribute('style', 'border: 1px solid white;');
  89.     cell.innerHTML = 'Cristallo';
  90.     cell = row.insertCell(2);
  91.     cell.setAttribute('class', 'desc');
  92.     cell.setAttribute('align', 'center');
  93.     cell.setAttribute('style', 'border: 1px solid white;');
  94.     cell.innerHTML = 'Deuterio';
  95.  
  96.  
  97.     var tbEvents = document.getElementById('eventContent');
  98.     var rowLength = tbEvents.rows.length;
  99.     var missionsCount=0;
  100.     var metalSum = 0;
  101.     var crystalSum = 0;
  102.     var deuteriumSum=0;
  103.     var iRow=0;
  104.     while(iRow < rowLength){    //Ciclo sul contenuto della tabella evenContent
  105.       var trMissionType = tbEvents.rows[iRow].getAttribute("data-mission-type");
  106.       if(trMissionType!=null && trMissionType!=''){
  107.         var returnFlight = tbEvents.rows[iRow].getAttribute("data-return-flight");
  108.  
  109.         if(trMissionType!='16'){ //market missions
  110.           if(
  111.           (trMissionType=='4') ||                           //Market deployment missions
  112.           (trMissionType=='1' && returnFlight == "true") ||     //Attack missions
  113.           (trMissionType=='3' && returnFlight == "true") ||     //Transport missions
  114.           (trMissionType=='6' && returnFlight == "true") ||     //????????
  115.           (trMissionType=='7' && returnFlight == "true") ||     //Colonization missions
  116.           (trMissionType=='8' && returnFlight == "true") || //Recycle debris field missions
  117.           (trMissionType=='15' && returnFlight == "true")       //Expeditions missions
  118.           ){
  119.             var icon_movement_index = tbEvents.rows[iRow].getElementsByTagName("TD").length;
  120.             var sTitle = tbEvents.rows[iRow].getElementsByTagName("TD")[icon_movement_index-5].getElementsByTagName("SPAN")[0].getAttribute("title").trim();
  121.             var start = sTitle.indexOf('<table');
  122.             var end = sTitle.indexOf('</table>', start);
  123.             sTitle = sTitle.slice(start, end) + '</table>';
  124.  
  125.             var table = document.createElement('table');
  126.             table.innerHTML = sTitle;
  127.             var metIdx = table.rows.length - 3;
  128.             var cryIdx = table.rows.length - 2;
  129.             var deuIdx = table.rows.length - 1;
  130.  
  131.             var sMetallo = _removeNumberPoints(table.rows[metIdx].getElementsByTagName("TD")[1].innerText);
  132.             var sCristallo = _removeNumberPoints(table.rows[cryIdx].getElementsByTagName("TD")[1].innerText);
  133.             var sDeuterio = _removeNumberPoints(table.rows[deuIdx].getElementsByTagName("TD")[1].innerText);
  134.  
  135.             metalSum += parseInt(sMetallo);
  136.             crystalSum += parseInt(sCristallo);
  137.             deuteriumSum += parseInt(sDeuterio);
  138.  
  139.             missionsCount++;
  140.           }
  141.         }
  142.       }
  143.       iRow++;
  144.     }
  145.  
  146.     _setCookie("fr_metal", metalSum, 1);
  147.     _setCookie("fr_crystal", crystalSum, 1);
  148.     _setCookie("fr_deuterium", deuteriumSum, 1);
  149.  
  150.     row = tbl.insertRow(1);
  151.     cell = row.insertCell(0);
  152.     cell.setAttribute('class', 'undermark');
  153.     cell.setAttribute('align', 'center');
  154.     cell.setAttribute('style', 'border: 1px solid white;');
  155.     cell.innerHTML = _formatNumber(metalSum, 0, ',', '.');
  156.     cell = row.insertCell(1);
  157.     cell.setAttribute('class', 'undermark');
  158.     cell.setAttribute('align', 'center');
  159.     cell.setAttribute('style', 'border: 1px solid white;');
  160.     cell.innerHTML = _formatNumber(crystalSum, 0, ',', '.');
  161.     cell = row.insertCell(2);
  162.     cell.setAttribute('class', 'undermark');
  163.     cell.setAttribute('align', 'center');
  164.     cell.setAttribute('style', 'border: 1px solid white;');
  165.     cell.innerHTML = _formatNumber(deuteriumSum, 0, ',', '.');
  166.  
  167.     oCell.appendChild(tbl);
  168.   }
  169.  
  170.   function _showTotRes(oCell){
  171.     var tbl = document.createElement('table');
  172.     //tbl.setAttribute('width', '100%');
  173.     tbl.setAttribute('cellspacing', '0px');
  174.     tbl.setAttribute('cellpadding', '0px');
  175.     tbl.setAttribute('style', 'border: 1px solid white;');
  176.  
  177.     var row = tbl.insertRow(0);
  178.     var cell = row.insertCell(0);
  179.     cell.setAttribute('class', 'desc');
  180.     cell.setAttribute('align', 'center');
  181.     cell.setAttribute('style', 'border: 1px solid white;');
  182.     cell.innerHTML = 'Metallo';
  183.     cell = row.insertCell(1);
  184.     cell.setAttribute('class', 'desc');
  185.     cell.setAttribute('align', 'center');
  186.     cell.setAttribute('style', 'border: 1px solid white;');
  187.     cell.innerHTML = 'Cristallo';
  188.     cell = row.insertCell(2);
  189.     cell.setAttribute('class', 'desc');
  190.     cell.setAttribute('align', 'center');
  191.     cell.setAttribute('style', 'border: 1px solid white;');
  192.     cell.innerHTML = 'Deuterio';
  193.  
  194.     var metalSum = parseInt(_getCookie('fr_metal'));
  195.     var crystalSum = parseInt(_getCookie('fr_crystal'));
  196.     var deuteriumSum = parseInt(_getCookie('fr_deuterium'));
  197.     var ca = document.cookie.split(';');
  198.     for(var i = 0; i < ca.length; i++) {
  199.       var c = ca[i];
  200.       while (c.charAt(0) == ' ') {
  201.         c = c.substring(1);
  202.       }
  203.       if((c.indexOf("_planet") != -1) || (c.indexOf("_moon") != -1)){
  204.         var cv = c.substring(c.indexOf("=")+1).split("_");
  205.         //console.log(parseInt(metalSum) + parseInt(cv[0]));
  206.         metalSum += parseInt(cv[0]);
  207.         crystalSum += parseInt(cv[1]);
  208.         deuteriumSum += parseInt(cv[2]);
  209.       }
  210.     }
  211.  
  212.     row = tbl.insertRow(1);
  213.     cell = row.insertCell(0);
  214.     cell.setAttribute('class', 'undermark');
  215.     cell.setAttribute('align', 'center');
  216.     cell.setAttribute('style', 'border: 1px solid white;');
  217.     cell.innerHTML = _formatNumber(metalSum, 0, ',', '.');
  218.     cell = row.insertCell(1);
  219.     cell.setAttribute('class', 'undermark');
  220.     cell.setAttribute('align', 'center');
  221.     cell.setAttribute('style', 'border: 1px solid white;');
  222.     cell.innerHTML = _formatNumber(crystalSum, 0, ',', '.');
  223.     cell = row.insertCell(2);
  224.     cell.setAttribute('class', 'undermark');
  225.     cell.setAttribute('align', 'center');
  226.     cell.setAttribute('style', 'border: 1px solid white;');
  227.     cell.innerHTML = _formatNumber(deuteriumSum, 0, ',', '.');
  228.  
  229.     oCell.appendChild(tbl);
  230.   }
  231.  
  232.   function showResources(){
  233.     var divInhalt = document.getElementById('middle');
  234.     var divResources = document.createElement('div');
  235.     var tblResources = document.createElement('table');
  236.  
  237.     divResources.setAttribute('class', 'maincontent');
  238.     divResources.setAttribute('style', 'margin-left:10px;');
  239.  
  240.     tblResources.setAttribute('width', '100%');
  241.     tblResources.setAttribute('cellspacing', '0');
  242.     tblResources.setAttribute('cellpadding', '0');
  243.     tblResources.setAttribute('border', '0');
  244.     var row = tblResources.insertRow(0);
  245.     var cell = row.insertCell(0);
  246.     cell.setAttribute('align', 'center');
  247.     cell.innerHTML = "<span style='font-size:18px;font-weight:bolder;'>Risorse in volo</span>";
  248.  
  249.     cell = row.insertCell(1)
  250.     cell.setAttribute('align', 'center');
  251.     cell.setAttribute('style', 'width:50%');
  252.     cell.innerHTML = "<span style='font-size:18px;font-weight:bolder;'>Risorse Totali</span>";
  253.  
  254.     row = tblResources.insertRow(1);
  255.     cell = row.insertCell(0);
  256.     cell.setAttribute('align', 'center');
  257.     cell.setAttribute('style', 'width:50%');
  258.     _showFlyingRes(cell);
  259.  
  260.     cell = row.insertCell(1);
  261.     cell.setAttribute('align', 'center');
  262.     _showTotRes(cell);
  263.  
  264.     divResources.appendChild(tblResources);
  265.     divInhalt.insertBefore(divResources, document.getElementById('overviewcomponent'));
  266.   }
  267.  
  268.   function showBuildingContdown(){
  269.     var iBuildingDays = 0;
  270.     var iBuildingHours = 0;
  271.     var iBuildingMinutes = 0;
  272.     var oSpanBuilding = document.getElementById('buildingCountdown');
  273.     var index;
  274.     if(oSpanBuilding != null){
  275.       var strTimeBuilding = oSpanBuilding.innerText.split(" ");
  276.       if(strTimeBuilding.length > 1){
  277.         for(index=0;index<strTimeBuilding.length;index++){
  278.           if(index==0 && (strTimeBuilding[index].endsWith("s") || strTimeBuilding[index].endsWith("w"))){
  279.             //Settimane di sviluppo
  280.             iBuildingDays += parseInt(strTimeBuilding[index].substr(0, strTimeBuilding[index].length-1))*7;
  281.           }
  282.           else{
  283.             if(strTimeBuilding[index].endsWith("g") || strTimeBuilding[index].endsWith("d")){
  284.               //giorni
  285.               iBuildingDays += parseInt(strTimeBuilding[index].substr(0, strTimeBuilding[index].length-1));
  286.             }
  287.             else if(strTimeBuilding[index].endsWith("o") || strTimeBuilding[index].endsWith("h")){
  288.               //ore
  289.               iBuildingHours += parseInt(strTimeBuilding[index].substr(0, strTimeBuilding[index].length-1));
  290.             }
  291.             else if(strTimeBuilding[index].endsWith("m")){
  292.               //minuti
  293.               iBuildingMinutes += parseInt(strTimeBuilding[index].substr(0, strTimeBuilding[index].length-1));
  294.             }
  295.           }
  296.         }
  297.  
  298.         iBuildingHours += iBuildingDays*24;
  299.         iBuildingMinutes += iBuildingHours*60;
  300.  
  301.         var dBuildDate = new Date();
  302.         dBuildDate.setMinutes(dBuildDate.getMinutes() + iBuildingMinutes);
  303.         var oTR = oSpanBuilding.parentElement.parentElement.parentElement.parentElement.insertRow(4);
  304.         oTR.setAttribute("class", "data");
  305.         var oTD = oTR.insertCell(0);
  306.         oTD.setAttribute("colspan", "2");
  307.         oTD.setAttribute("align", "center");
  308.         oTD.innerHTML = "<br><span class='undermark' style='width:100%'>" + dBuildDate.toLocaleDateString() + " " + dBuildDate.toLocaleTimeString() + "</span>";
  309.       }
  310.     }
  311.   }
  312.  
  313.   function showResearchContdown(){
  314.     var iBuildingDays = 0;
  315.     var iBuildingHours = 0;
  316.     var iBuildingMinutes = 0;
  317.     var oSpanResearch = document.getElementById('researchCountdown');
  318.     var index;
  319.     if(oSpanResearch != null){
  320.       var strTimeResearch = oSpanResearch.innerText.split(" ");
  321.       if(strTimeResearch.length > 1){
  322.         for(index=0;index<strTimeResearch.length;index++){
  323.           if(index==0 && (strTimeResearch[index].endsWith("s") || strTimeResearch[index].endsWith("w"))){
  324.             //Settimane di sviluppo
  325.             iBuildingDays += parseInt(strTimeResearch[index].substr(0, strTimeResearch[index].length-1))*7;
  326.           }
  327.           else{
  328.             if(strTimeResearch[index].endsWith("g") || strTimeResearch[index].endsWith("d")){
  329.               //giorni
  330.               iBuildingDays += parseInt(strTimeResearch[index].substr(0, strTimeResearch[index].length-1));
  331.             }
  332.             else if(strTimeResearch[index].endsWith("o") || strTimeResearch[index].endsWith("h")){
  333.               //ore
  334.               iBuildingHours += parseInt(strTimeResearch[index].substr(0, strTimeResearch[index].length-1));
  335.             }
  336.             else if(strTimeResearch[index].endsWith("m")){
  337.               //minuti
  338.               iBuildingMinutes += parseInt(strTimeResearch[index].substr(0, strTimeResearch[index].length-1));
  339.             }
  340.           }
  341.         }
  342.  
  343.         iBuildingHours += iBuildingDays*24;
  344.         iBuildingMinutes += iBuildingHours*60;
  345.  
  346.         var dResearchDate = new Date();
  347.         dResearchDate.setMinutes(dResearchDate.getMinutes() + iBuildingMinutes);
  348.         var oTR = oSpanResearch.parentElement.parentElement.parentElement.parentElement.insertRow(4);
  349.         oTR.setAttribute("class", "data");
  350.         var oTD = oTR.insertCell(0);
  351.         oTD.setAttribute("colspan", "2");
  352.         oTD.setAttribute("align", "center");
  353.         oTD.innerHTML = "<br><span class='undermark' style='width:100%'>" + dResearchDate.toLocaleDateString() + " " + dResearchDate.toLocaleTimeString() + "</span>";
  354.       }
  355.     }
  356.   }
  357.  
  358.   function showShipyardContdown(){
  359.     var iBuildingDays = 0;
  360.     var iBuildingHours = 0;
  361.     var iBuildingMinutes = 0;
  362.     var oSpanShipyard = document.getElementById('shipyardCountdown2');
  363.     var index;
  364.     if(oSpanShipyard != null){
  365.       var strTimeShupyard = oSpanShipyard.innerText.split(" ");
  366.       if(strTimeShupyard.length > 1){
  367.         for(index=0;index<strTimeShupyard.length;index++){
  368.           if(index==0 && (strTimeShupyard[index].endsWith("s") || strTimeShupyard[index].endsWith("w"))){
  369.             //Settimane di sviluppo
  370.             iBuildingDays += parseInt(strTimeShupyard[index].substr(0, strTimeShupyard[index].length-1))*7;
  371.           }
  372.           else{
  373.             if(strTimeShupyard[index].endsWith("g") || strTimeShupyard[index].endsWith("d")){
  374.               //giorni
  375.               iBuildingDays += parseInt(strTimeShupyard[index].substr(0, strTimeShupyard[index].length-1));
  376.             }
  377.             else if(strTimeShupyard[index].endsWith("o") || strTimeShupyard[index].endsWith("h")){
  378.               //ore
  379.               iBuildingHours += parseInt(strTimeShupyard[index].substr(0, strTimeShupyard[index].length-1));
  380.             }
  381.             else if(strTimeShupyard[index].endsWith("m")){
  382.               //minuti
  383.               iBuildingMinutes += parseInt(strTimeShupyard[index].substr(0, strTimeShupyard[index].length-1));
  384.             }
  385.           }
  386.         }
  387.  
  388.         iBuildingHours += iBuildingDays*24;
  389.         iBuildingMinutes += iBuildingHours*60;
  390.  
  391.         var dShipyardDate = new Date();
  392.         dShipyardDate.setMinutes(dShipyardDate.getMinutes() + iBuildingMinutes);
  393.         var oTR = oSpanShipyard.parentElement.parentElement.parentElement.parentElement.insertRow(6);
  394.         oTR.setAttribute("class", "data");
  395.         var oTD = oTR.insertCell(0);
  396.         oTD.setAttribute("colspan", "2");
  397.         oTD.setAttribute("align", "center");
  398.         oTD.innerHTML = "<br><span class='undermark' style='width:100%'>" + dShipyardDate.toLocaleDateString() + " " + dShipyardDate.toLocaleTimeString() + "</span>";
  399.       }
  400.     }
  401.   }
  402.  
  403.  
  404.   function manageFleet(){
  405.     var observer1 = new MutationObserver(function(mutations) {  //fleet2 div style change
  406.       mutations.forEach(function(mutationRecord) {
  407.         var metaOPT = _getMeta('ogame-planet-type');
  408.         if(metaOPT != ''){
  409.           var ownCoords = _getMeta('ogame-planet-coordinates');
  410.           var selCoords = document.getElementById('galaxy').getAttribute('value');
  411.           selCoords += ':' + document.getElementById('system').getAttribute('value');
  412.           selCoords += ':' + document.getElementById('position').getAttribute('value');
  413.           if(selCoords == ownCoords){
  414.             if(metaOPT=='planet'){
  415.               document.getElementById('mbutton').click();
  416.             }
  417.             else{
  418.               document.getElementById('pbutton').click();
  419.             }
  420.           }
  421.         }
  422.         observer1.disconnect();
  423.       });
  424.     });
  425.  
  426.     var observer2 = new MutationObserver(function(mutations) {  //fleet3 div style change
  427.       mutations.forEach(function(mutationRecord) {
  428.         var divStatBarFleet = document.getElementById('statusBarFleet');
  429.         var destCoords = divStatBarFleet.getElementsByClassName("targetName")[0].firstChild.nodeValue.trim();
  430.         var ownCoords = '';
  431.         var planetList = document.getElementById('planetList').getElementsByClassName('planet-koords');
  432.         var index=0;
  433.         for(index=0;index<planetList.length;index++){
  434.             ownCoords += planetList[index].innerHTML;
  435.         }
  436.         if(ownCoords.indexOf(destCoords) != -1){
  437.             document.getElementById('missionButton4').click();
  438.         }
  439.         observer2.disconnect();
  440.       });
  441.     });
  442.  
  443.     var observer3 = new MutationObserver(function(mutations) {
  444.       mutations.forEach(function(mutationRecord) {
  445.       });
  446.     });
  447.  
  448.     var target2 = document.getElementById('fleet2');
  449.     var target3 = document.getElementById('fleet3');
  450.     var target4 = document.getElementById('errorBoxDecisionContent');
  451.     observer1.observe(target2, { attributes : true, attributeFilter : ['style'] });
  452.     observer2.observe(target3, { attributes : true, attributeFilter : ['style'] });
  453.   }
  454.  
  455.   function refreshCurPlanetCookie(){
  456.     var metal = _removeNumberPoints(document.getElementById('resources_metal').innerHTML);
  457.     var crystal = _removeNumberPoints(document.getElementById('resources_crystal').innerHTML);
  458.     var deuterium = _removeNumberPoints(document.getElementById('resources_deuterium').innerHTML);
  459.     var ck = _getMeta('ogame-planet-id') + "_" + _getMeta('ogame-planet-type');
  460.  
  461.     //document.cookie = ck + "; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;"; //reset cookie befere update
  462.     _setCookie(ck, metal+"_"+crystal+"_"+deuterium, 1);
  463.   }
  464.  
  465.   function killPlanetsMoon_Tooltip(){
  466.     var divPlanets = document.getElementById('planetList');
  467.     var anchors = divPlanets.getElementsByClassName('planetlink');
  468.  
  469.     var index=0;
  470.     for(index=0;index<anchors.length;index++){
  471.       var anchorp = anchors[index];
  472.  
  473.       anchorp.setAttribute('title', '');
  474.     }
  475.  
  476.     anchors = divPlanets.getElementsByClassName('moonlink');
  477.     for(index=0;index<anchors.length;index++){
  478.       var anchorm = anchors[index];
  479.  
  480.       anchorm.setAttribute('title', '');
  481.     }
  482.   }
  483.  
  484.   function _changeTimes(dDelta){
  485.     var tbEvents = document.getElementById('eventContent');
  486.     var rowLength = tbEvents.rows.length;
  487.     var iRow=0;
  488.     while(iRow < rowLength){    //Ciclo sul contenuto della tabella evenContent
  489.         var dtArrivalTime = tbEvents.rows[iRow].getAttribute("data-arrival-time");
  490.         dtArrivalTime = new Date(dtArrivalTime*1000);
  491.         //console.log(dtArrivalTime);
  492.  
  493.         var str = dtArrivalTime.getHours()+':'+dtArrivalTime.getMinutes()+':'+dtArrivalTime.getSeconds();
  494.         console.log(str);
  495.         tbEvents.rows[iRow].getElementsByClassName("arrivalTime")[0].innerHTML = str;
  496.         iRow++;
  497.     }
  498.   }
  499.  
  500.   //*** MAIN ***
  501.   //Script runs only with ogame pages
  502.   if (location.href.indexOf('.ogame.gameforge.com') != -1) {
  503.     showBuildingContdown();
  504.     showResearchContdown();
  505.     showShipyardContdown()
  506.     refreshCurPlanetCookie();
  507.  
  508.     killPlanetsMoon_Tooltip();
  509.  
  510.     //var dDelta = new Date().getTime() - serverTime.getTime();
  511.     //console.log(Math.trunc(dDelta/3600));
  512.     //_changeTimes(dDelta);
  513.  
  514.  
  515.     if (location.href.indexOf('.ogame.gameforge.com/game/index.php?page=ingame&component=overview') != -1) {
  516.       //Overview page - showing all flighting resources
  517.       showResources();
  518.     }
  519.     else if (location.href.indexOf('.ogame.gameforge.com/game/index.php?page=ingame&component=fleetdispatch') != -1) {
  520.       //Fleet page - adding shortcut, preselect destination and preselect deployment missions
  521.       manageFleet();
  522.     }
  523.     else if (location.href.indexOf('.ogame.gameforge.com/game/index.php?page=ingame&component=movement') != -1) {
  524.       //Movements page - adding CR at the end of page.
  525.       var oDiv = document.getElementById('inhalt');
  526.       oDiv.innerHTML += "&nbsp;<br><br><br><br><br>&nbsp;";
  527.     }
  528.   }
  529. }) ()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement