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