NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name OGame.RU: Resources in flight // @namespace http://tampermonkey.net/ // @version 0.3 // @description OGame - resources in flight for version 6.6.1 RU - ресурсы в полёте // @author Deimos // @match https://*.ogame.gameforge.com/game/index.php?page=movement* // @grant none // @license MIT // ==/UserScript== (function() { 'use strict'; var menuTable = document.querySelector("ul#menuTable"); var menuTableEl = document.createElement('li'); menuTable.appendChild(menuTableEl); menuTableEl.innerHTML = '<a id="resourcesInFlight" class="menubutton " href="#" accesskey="" target="_self"><span class="textlabel">Ресурсы в полёте</span></a>'; document.querySelector("a#resourcesInFlight").onclick = calculateResources; function calculateResources() { var metal = 0; var crystal = 0; var deuterium = 0; var tdFleetInfo = document.querySelectorAll('table.fleetinfo td'); for (var i = 0; i < tdFleetInfo.length; i++) { var tdFirstText = tdFleetInfo[i].innerText; if (tdFirstText === 'Металл:') { var thisMetal = tdFleetInfo[i+1].innerText; thisMetal = Number(thisMetal.replace(/[^0-9]/gim,'')); metal += thisMetal; } if (tdFirstText === 'Кристалл:') { var thisCrystal = tdFleetInfo[i+1].innerText; thisCrystal = Number(thisCrystal.replace(/[^0-9]/gim,'')); crystal += thisCrystal; } if (tdFirstText === 'Дейтерий:') { var thisDeuterium = tdFleetInfo[i+1].innerText; thisDeuterium = Number(thisDeuterium.replace(/[^0-9]/gim,'')); deuterium += thisDeuterium; } } if(document.querySelector('div#resourcesInFlightResult') === null) { var menuLinks = document.querySelector("div#links"); var menuResult = document.createElement('div'); menuLinks.appendChild(menuResult); menuResult.id = 'resourcesInFlightResult'; menuResult.style = 'padding:3px; font: bold 10px/22px verdana,arial,helvetica,sans-serif;'; menuResult.innerHTML = '<p>Металл: ' + metal.toLocaleString('de-DE') + '</p><p>Кристалл: ' + crystal.toLocaleString('de-DE') + '</p><p>Дейтерий: ' + deuterium.toLocaleString('de-DE') + '</p>'; } } })();