projetFER

projetFER Timer à resu

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

ستحتاج إلى تثبيت إضافة مثل Stylus لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتتمكن من تثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

(لدي بالفعل مثبت أنماط للمستخدم، دعني أقم بتثبيته!)

// ==UserScript==
// @name        projetFER
// @namespace   projetFER
// @description projetFER Timer à resu
// @include     http://www.worldofstargate.fr/*
// @version     1.5
// ==/UserScript==    

$(document).keyup(function (event) {
	if(event.keyCode == 82 ){
		var tabResu = $('div[class^="resu_bar_"]');
		var j = 0;
		var h = 0;
		var m = 0;
		var s = 0;
		var globalTime = 0;
		var timeAfficher = "";
		if(tabResu.length > 0){
			tabResu.each(function(res){
				globalTime += parseInt($(this).find("span:nth-child(4)").text());
			});
			console.log(globalTime);
			var tmp = 0;
			j = (globalTime - globalTime % 86400)/86400;
			tmp += j*86400;
			h = (globalTime - tmp - ((globalTime-tmp)%3600))/3600;
			tmp += h*3600;
			m = (globalTime - tmp - ((globalTime-tmp)%60))/60;
			tmp += m*60;
			s = globalTime - tmp;
		}
		if($("#timerresu").size() > 0){
			timeAfficher = "Temps résurrection : "+j+"j"+h+"h"+m+"m"+s+"s";
			$("#timerresu").text(timeAfficher);
		}
		else{
			timeAfficher += "\t<p id=\"timerresu\" class=\"awesome\"> Temps résurrection : "+j+"j"+h+"h"+m+"m"+s+"s" +"</p>";
			var lien = $(".medium.lightblue.awesome");
			if(lien.text().indexOf("planification") != -1){
				lien.after(timeAfficher);
			}
		}
	}
});