hwm_cgame_time

HWM mod - Prodolzhitel'nost' kartochnogo boja (by Demin)

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

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

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

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.

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

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

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

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

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

// ==UserScript==
// @name           hwm_cgame_time
// @namespace      Demin
// @description    HWM mod - Prodolzhitel'nost' kartochnogo boja (by Demin)
// @homepage       http://userscripts.org/users/263230/scripts
// @version        3.3
// @include        http://*heroeswm.ru/cgame*
// @include        http://178.248.235.15/cgame*
// @include        http://209.200.152.144/cgame*
// @include        http://*lordswm.com/cgame*
// ==/UserScript==

// (c) 2011-2013, demin  ( http://www.heroeswm.ru/pl_info.php?id=15091 )

var version = '3.3';


var time_begin = new Date().getTime();
if ( !window.sidebar ) {
setTimeout(function() { document.querySelector("object[id*='arcomag']").innerHTML += '<param name="wmode" value="opaque" />'; }, 200);
}

var div = document.createElement('div');
div.setAttribute('style', 'position: absolute; background-color: #77b5fa;');
document.body.appendChild(div);

if ( document.querySelector("embed[src*='arcomag']") ) { setTimeout(function() { update_div(div, time_begin); }, 999); } else { setTimeout(function() { update_div2(div, time_begin); }, 999); }


function update_div(div, time_begin) {
	var ct = Math.floor( ( new Date().getTime() - time_begin ) / 1000 );
	var dm = Math.floor( ct / 60 ) % 60;
	var ds = ct % 60;
	div.innerHTML = '<b>&nbsp;' + dm + ':' + ( (ds < 10) ? '0' : '' ) + ds + '&nbsp;</b>';

	var flash_war = document.querySelector("embed[src*='arcomag']").getBoundingClientRect();
	var flash_war_width = document.querySelector("object[id*='arcomag']").width;
	var flash_war_height = document.querySelector("object[id*='arcomag']").height;

	div.style.fontSize = Math.round( flash_war_width / 70 ) + 'px';

	div.style.left = flash_war.left + flash_war_width * 0.21 + 'px';
	div.style.top = flash_war.top + flash_war_height * 0.05 + 'px';

	setTimeout(function() { update_div(div, time_begin); }, 999);
}

function update_div2(div, time_begin) {
	var ct = Math.floor( ( new Date().getTime() - time_begin ) / 1000 );
	var dm = Math.floor( ct / 60 ) % 60;
	var ds = ct % 60;
	div.innerHTML = '<b>&nbsp;' + dm + ':' + ( (ds < 10) ? '0' : '' ) + ds + '&nbsp;</b>';

	var cl_w = ClientWidth();
	var cl_h = ClientHeight();

	if ( cl_w < 600 ) { cl_w = 600; }
	if ( cl_h < 366 ) { cl_h = 366; }

	if ( cl_w > ( cl_h * 600 / 366 ) ) {
		div.style.fontSize = Math.round( cl_h / 43 ) + 'px';

		div.style.left = Math.round( ( cl_w / 2 - cl_h * 600 / 366 * 0.29 ) ) + 'px';
		div.style.top = cl_h * 0.05 + 'px';
	} else {
		div.style.fontSize = Math.round( cl_w / 70 ) + 'px';

		div.style.left = cl_w * 0.21 + 'px';
		div.style.top = Math.round( ( cl_h / 2 - cl_w * 366 / 600 * 0.45 ) ) + 'px';
	}

	setTimeout(function() { update_div2(div, time_begin); }, 999);
}

function ClientHeight() {
	return document.compatMode=='CSS1Compat' && document.documentElement?document.documentElement.clientHeight:document.body.clientHeight;
}

function ClientWidth() {
	return document.compatMode=='CSS1Compat' && document.documentElement?document.documentElement.clientWidth:document.body.clientWidth;
}