define( function() {
"use strict";
function C_FullScreenButton()
{
};
C_FullScreenButton.prototype.draw = function( oControlHost )
{
this.m_sControlName = oControlHost.configuration ? oControlHost.configuration.controlName : "";
var elContainer = oControlHost.container;
elContainer.innerHTML =
'' +
'';
this.m_btn = elContainer.lastChild;
this.m_btn.onclick = this.onClick.bind( this, oControlHost );
};
C_FullScreenButton.prototype.onClick = function( oControlHost )
{
var el = this.m_sControlName ? oControlHost.page.getControlByName( this.m_sControlName ).element : document.body;
this.requestFullScreen( el );
};
C_FullScreenButton.prototype.requestFullScreen = function( el )
{
var elFullScreenElement = document.fullScreenElement || document.msFullscreenElement || document.mozFullScreenElement || document.webkitFullscreenElement;
if ( elFullScreenElement && ( elFullScreenElement == el ) )
{
if ( !document.cancelFullScreen )
{
document.cancelFullScreen = document.msExitFullscreen || document.mozCancelFullScreen || document.webkitCancelFullScreen;
}
document.cancelFullScreen();
}
else
{
if ( !el.requestFullscreen )
{
el.requestFullscreen = el.msRequestFullscreen || el.mozRequestFullScreen || el.webkitRequestFullscreen;
}
el.requestFullscreen();
}
};
return C_FullScreenButton;
});