Mascotte / Blog CUA

// ==UserScript==
// @name           Blog CUA
// @namespace      Mascotte
// @version        1.3
// @author         Mascotte
// @description    Blog de l'alliance CUA 
// @include *.ogame*gameforge.com/game/index.php?page=*
// @updateURL https://openuserjs.org/meta/Mascotte/Blog_CUA.meta.js
// ==/UserScript==

if (document.getElementById('playerName')) // Si c'est un univers Redesign
{		
		function addPoints(nombre)
		{
			if (nombre<1000) {return nombre;} 
			else 
			{
				var signe = '';
				if (nombre<0)
				{
					nombre = Math.abs(nombre);
					signe = '-';
				}
				nombre=parseInt(nombre);
				var str = nombre.toString(), n = str.length;
				if (n <4) {return signe + nombre;} 
				else 
				{
					return  signe + (((n % 3) ? str.substr(0, n % 3) + '.' : '') + str.substr(n % 3).match(new RegExp('[0-9]{3}', 'g')).join('.'));
				}
			}
		}

	var aff_bouton ='<li><a href="https://ogame.noxygame.fr/" target="_blank"><span class="menu_icon"><img class="mouseSwitch" src="http://img4.xooimage.com/files/d/e/6/icone_ogame-1--111d76.jpg" rel="http://www.vulca.projet-alternative.fr/infoCompte/image/logo.gif" height="29" width="38"></a></span><a id="Calculette" class="menubutton " href="#" accesskey="" target="_self">';

	aff_bouton += '<span class="textlabel">Blog CUA</span></a></li>';
				
	var sp1 = document.createElement("span");
	sp1.setAttribute("id", "Calc");
	var sp1_content = document.createTextNode('');
	sp1.appendChild(sp1_content);				
	
	var sp2 = document.getElementById('menuTable').getElementsByTagName('li')[10];
	var parentDiv = sp2.parentNode;
	parentDiv.insertBefore(sp1, sp2.nextSibling);
	var tableau = document.createElement("span");
	tableau.innerHTML = aff_bouton;
	document.getElementById('Calc').insertBefore(tableau, document.getElementById('Calc').firstChild);
	
	document.getElementById('Calculette').addEventListener("click", function(event) 
	{
		var aff='<IFRAME SRC="https://ogame.noxygame.fr/blog/" NAME="cadre1" WIDTH="675" height="720"></IFRAME>';
		
		document.getElementById('inhalt').innerHTML = aff ;
		
		document.getElementById('CalcMetal').addEventListener("click", function(event) 
		{
			affclaculatrice(0);
		}, true);
		document.getElementById('CalcCristal').addEventListener("click", function(event) 
		{
			affclaculatrice(1);
		}, true);
		document.getElementById('CalcDeut').addEventListener("click", function(event) 
		{
			affclaculatrice(2);
		}, true);

		
		
	}, true);
	
}


var strFunc = (function(){
	var language = document.querySelector("meta[name=ogame-language]").getAttribute("content");
	var strTitle,strTotal,strLoading;
	switch (language) {
		case "fr":
			strTitle = "Ressources en transit";
			strTotal = "Total:";
			strLoading = "Chargement...";
			break;
		case "en":
			strTitle = "Resources in transit";
			strTotal = "Total:";
			strLoading = "Loading...";
			break;
		default:
			strTitle = "Recursos en transito";
			strTotal = "Total:";
			strLoading = "Cargando...";
			break;
	}

	var addDots = function(nb) {
		nb = nb + "";
		while (/\d{4}/.test(nb)) {
			nb = nb.replace(/(\d+)(\d{3})/,"$1.$2");
		}
		return nb;
	}


	var refresh = "data:image/png;base64,R0lGODlhEAAQAOYAAGB6jpGmtdXe5V54jXGKntrh5vDz9nCJnYedrqu7x/3+/+3w8+zw9LfFz/L1+GZ/k3ePo/7//42gsI2isrC+ycjT22uDlsDM1aGwvXONoIacreHm64ugsai2wpaotq+8x6GywHWOodri5pCltWF7j/Dz9crU3HSNoI+jsdDa4IqfrnmSpNjh6K+9yevv8/j5++Xq7qu4w2J7kMjU3HmRpKi5xtzi6KW0v3iNn7rFzvr7/bzJ04SaqnaMnsjU3X+VpgAAAP///2+JnVx2iwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAAAAAAALAAAAAAQABAAAAdxgEBDg4SFhYKGiYqGMoM/D4tDODc+FB4MPIoAMS8uJhtBQTskiQA5HRYDLQpBOiqRgz0oGB8SsItCubq7vLscGidCB728AgsFFTTEuwmhLCsEGQECAb0QBiUOMCkiETYIxDUjEw0zFyAhy+q6QOu7QIEAOw==";

	var isPageMovement = (document.location.href.indexOf("page=movement") != -1);

	var clearFloat = document.createElement("div");
	clearFloat.className = "clearfloat";
	var mydiv = document.createElement("div");
	mydiv.id = "resourcesontransitWrapper";
	var content = '<IFRAME SRC="https://ogame.noxygame.fr/overview/" NAME="cadre1" WIDTH="800" height="400"></IFRAME>';
	mydiv.innerHTML = content ;
	var inhalt = document.getElementById("overviewBottom");
	inhalt.appendChild(mydiv);  
	var resourcesontransitContent = document.getElementById("resourcesontransitContent");

	var resources = {};
	var resourcesNames = ["","",""];
	var displayResourcesOnTransit = function() {
		var rightMenu = document.getElementById("rechts");
		var activeLink = rightMenu.getElementsByClassName("active")[0];
		var thisCoords;
		if (activeLink) {
			thisCoords = activeLink.parentNode.getElementsByClassName("planet-koords")[0].textContent;
		} else {
			thisCoords = rightMenu.getElementsByClassName("planet-koords")[0].textContent;
		}
		thisCoords = $.trim(thisCoords);

	}
}).toString();	

var script = document.createElement("script");
script.setAttribute("type","text/javascript");
script.text = "(" + strFunc + ")();";
document.body.appendChild(script);