src/cm/media/js/site/text_view.js
changeset 0 40c8f766c9b8
child 341 053551f213fb
equal deleted inserted replaced
-1:000000000000 0:40c8f766c9b8
       
     1 gInFullScreen = false;
       
     2 
       
     3 _setFrameSize = function() {
       
     4 	if (gInFullScreen) {
       
     5 		// TODO test it seriously
       
     6 		var headerHeight = $("#header").height();
       
     7 		var windowHeight = $(window).height();
       
     8 		var frameHeight = (windowHeight - headerHeight - 2) + 'px'; // - 2 to prevent scrollbars ? --> TODO test it without -2
       
     9 
       
    10 		var windowWidth = $(window).width();
       
    11 		var frameWidth = (windowWidth - 2) + 'px'; // - 2 to prevent scrollbars ?// --> TODO test it without -2
       
    12 
       
    13 		// TODO test if we're embeded ! wont work otherwise anyway (frame security concerns)
       
    14 		$("#text_view_frame").css( {
       
    15 			'position' :'absolute',
       
    16 			'left' :'0px',
       
    17 			'top' :headerHeight,
       
    18 			'width' :frameWidth,
       
    19 			'height' :frameHeight
       
    20 		});
       
    21 	}
       
    22 	else {
       
    23 		// TODO test it seriously
       
    24 		var frameTop = Math.ceil($("#text_view_frame_container").position()["top"]);
       
    25 
       
    26 		var windowHeight = $(window).height();
       
    27 		var frameHeight = (windowHeight - frameTop - 2) + 'px'; // - 2 to prevent scrollbars // ? --> TODO test it without -2
       
    28 		
       
    29 		var windowWidth = $(window).width();
       
    30 		var frameWidth = (windowWidth - 2) + 'px'; // - 2 to prevent scrollbars ? // --> TODO test it without -2
       
    31 
       
    32 		// TODO test if we're embeded ! wont work otherwise anyway (frame security)
       
    33 		$("#text_view_frame").css( {
       
    34 			'position' :'relative',
       
    35 			'width' :'99.9%',
       
    36 			'height' :frameHeight,
       
    37 			'top' :'0px'
       
    38 		});
       
    39 	}
       
    40 }
       
    41 _toFullScreenSize = function() {
       
    42 	gInFullScreen = true;
       
    43 	_setFrameSize() ;
       
    44 
       
    45 	frames['text_view_frame'].$("#c_fullscreen_btn").attr('src', sv_media_url + '/img/arrow_in.png');
       
    46 
       
    47 	frames['text_view_frame'].f_setCookie('fullscreen', '1') ;
       
    48 };
       
    49 
       
    50 _toNormalSize = function() {
       
    51 	gInFullScreen = false;
       
    52 	_setFrameSize() ;
       
    53 
       
    54 	frames['text_view_frame'].$("#c_fullscreen_btn").attr('src', sv_media_url + 'img/arrow_out.png');
       
    55 	
       
    56 	frames['text_view_frame'].f_setCookie('fullscreen', '0') ;
       
    57 };
       
    58 
       
    59 _toInitialSize = function() {
       
    60 	//console.info('_toInitialSize') ; 
       
    61 	var fullscreen = ($.cookie('fullscreen') == '1');
       
    62 	if (fullscreen)
       
    63 		_toFullScreenSize() ;
       
    64 	else 
       
    65 		_toNormalSize() ;
       
    66 };