NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @namespace https://openuserjs.org/users/username // @name Ogame fix armor values scale // @description Reduces armor values shown in descriptions to match scale used in attack and shields // @version 0.0.1 // @license MIT // @include https://*.ogame.gameforge.com/game/index.php* // @grant none // ==/UserScript== // ==OpenUserJS== // @author username // @copyright 2019, username (https://openuserjs.org/users/username) // ==/OpenUserJS== // ==Changelog== // 0.0.1 // updated for Ogame v7 // disabled for tooltip // 0.0.0 // Initial release // Select the node that will be observed for mutations const targetNode = document.body; // Options for the observer (which mutations to observe) const config = { childList: true, subtree: true }; var globalids = new Set(); // Callback function to execute when mutations are observed const callback = function(mutationsList, observer) { for(let mutation of mutationsList) { if(mutation.type === 'childList' && mutation.addedNodes.length !== 0) { if(mutation.target.classList.contains('overlayDiv')){ //console.log(mutation) //console.log(mutation.target.querySelector('.structural_integrity span').textContent) let elem = mutation.target.querySelector('.structural_integrity span'); elem.textContent = (elem.textContent.trim().replace(/\./g,'') / 10).toLocaleString({useGrouping:true}); } /* if(mutation.target.classList.contains('t_Content')) { globalids.forEach(id => { let elem = document.getElementById(id); if(elem != null) { globalids.delete(id); let celdas = elem.querySelectorAll('td'); Array.from(celdas).filter((_,index)=>index==1||index==3||index==5).forEach(celda => { celda.textContent = (celda.textContent.replace(/\./g,'') / 10).toLocaleString({useGrouping:true}); }); celdas[2].innerHTML = celdas[2].innerHTML.replace(/x.+[\d\.]+/, match => 'x '+(match.slice(2).replace('.','')/10).toLocaleString({useGrouping:true})); } }); } */ } } }; // Create an observer instance linked to the callback function const observer = new MutationObserver(callback); // Start observing the target node for configured mutations observer.observe(targetNode, config);