hwm_cgame_time

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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey, Greasemonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्क्रिप्ट व्यवस्थापक एक्स्टेंशन इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्क्रिप्ट व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्टाईल व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

// ==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;
}