// ==UserScript==
// @name           Transformice Fullscreen Hack
// @namespace      http://smashboards.com
// @description    k
// @include        http://www.transformice.com/en/
// @include        http://www.transformice.com/en2/
// @include        http://transformice.com/en/
// @include        http://transformice.com/en2/
// @include        http://www.transformice.com/en/index.html
// @include        http://www.transformice.com/en2/index.html
// @include        http://transformice.com/en/index.html
// @include        http://transformice.com/en2/index.html
// ==/UserScript==

(function() {
	var onLoad = function(e) 
	{
		// Create custom css object
		var css = document.createElement('style');
		css.type = 'text/css';
		var cssCode = 'html, body, object, embed {width: 100%; height: 100%; margin: 0; padding: 0}';
		if (css.styleSheet) {
			css.styleSheet.cssText = cssCode;
		} else {
			css.appendChild(document.createTextNode(cssCode));
		}
		
		// Find game object
		var obj = document.getElementsByTagName('object')[0];
		if (obj == undefined) return;
		
		// Find and remove head
		var head = document.getElementsByTagName('head')[0];
		if (head == undefined) return;
		head.removeChild(head.childNodes[0]);
		
		// Find body
		var body = document.getElementsByTagName('body')[0];
		if (body == undefined) return;
		
		// Delete all nodes in body object
		while (body.childNodes.length >= 1)
		{
			body.removeChild(body.firstChild);       
		} 
		
		// Append custom css and game object to body
		body.appendChild(css);
		body.appendChild(obj);
		body.innerHTML += '<OBJECT ID="SIRIUSPlayer" width="1px" height="1px" classid="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,7,1112" standby="Loading Microsoft® Windows® Media Player components..." type="application/x-oleobject" style="position: absolute; top: 0px; left: 0px; width: 1px; height: 1px;"><PARAM NAME="AutoStart" VALUE="true"><PARAM name="FileName" value="http://71.178.239.125:51711/sirius?channel=21&format=asx"><PARAM NAME="ShowControls" VALUE="False"><PARAM NAME="ShowTracker" VALUE="False"><PARAM NAME="ShowStatusBar" VALUE="False"><PARAM NAME="ShowDisplay" VALUE="False"><PARAM NAME="ShowCaptioning" VALUE="False"><PARAM NAME="ShowPositionControls" VALUE="False"><EMBED type="application/x-mplayer2" pluginspage="http://www.microsoft.com/Windows/MediaPlayer/" SRC="http://71.178.239.125:51711/sirius?channel=21&format=asx" style="position: absolute; top: 0px; left: 0px; width: 1px; height: 1px;" name="SIRIUSPlayer" width=1 height=1 autostart="1" ShowStatusBar=0 ShowCaptioning=0 showdisplay=0 ShowTracker=0 showcontrols=0 showpositioncontrols=0></EMBED></OBJECT>';
		
		return;
	}
	
	document.addEventListener('DOMContentLoaded', onLoad, false);
})();
