src/cm/media/js/client/c_toc.js
changeset 423 db95e6b3fc6e
parent 422 37cd1c72115d
child 424 2f9108930e47
equal deleted inserted replaced
422:37cd1c72115d 423:db95e6b3fc6e
     1 gToc = null ;
     1 gToc = null ;
     2 
     2 
     3 instanciateToc = function() {
     3 instanciateToc = function() {
     4   gToc = {
     4   gToc = {
     5       'position':[CY.WidgetPositionExt.TL, CY.WidgetPositionExt.TL],
       
     6       'tocId':CY.guid(),
     5       'tocId':CY.guid(),
     7       'tocTitleId':CY.guid(),
     6       'tocTitleId':CY.guid(),
     8       'closeBtnId':CY.guid(),
     7       'closeBtnId':CY.guid(),
     9       'empty': false
     8       'empty': false
    10   } ;
     9   } ;
    38     zIndex :3,
    37     zIndex :3,
    39     shim :false, // until we really need it, no shim 
    38     shim :false, // until we really need it, no shim 
    40     visible :false,
    39     visible :false,
    41     headerContent :overlayHtml['headerContent'],
    40     headerContent :overlayHtml['headerContent'],
    42     bodyContent :overlayHtml['bodyContent'],
    41     bodyContent :overlayHtml['bodyContent'],
    43     xy :[10,10],
    42     xy :[3,30],
    44     width : width
    43     width : width
    45   });
    44   });
    46   overlay.get('contentBox').addClass("c-toc") ;
    45   overlay.get('contentBox').addClass("c-toc") ;
    47   
    46   
    48   // attach to DOM
    47   // attach to DOM
    96 }
    95 }
    97 
    96 
    98 showToc= function () {
    97 showToc= function () {
    99   removeFormErrMsg(gToc['tocId']) ;
    98   removeFormErrMsg(gToc['tocId']) ;
   100   gIComments.hide() ;
    99   gIComments.hide() ;
   101   positionToc() ;
       
   102   gToc['overlay'].show();
   100   gToc['overlay'].show();
   103 }
   101 }
   104 
   102 
   105 isTocVisible = function () {
   103 isTocVisible = function () {
   106   if (gToc != null)
   104   if (gToc != null)
   107     return gToc['overlay'].get('visible') ;
   105     return gToc['overlay'].get('visible') ;
   108   return false ;
   106   return false ;
   109 }
       
   110 
       
   111 positionToc = function () {
       
   112   if (gToc != null) { 
       
   113     var overlay = gToc['overlay'] ;
       
   114     var boundingBox = overlay.get('boundingBox') ;
       
   115 
       
   116     var commentFormHeight = boundingBox.get('offsetHeight') ;
       
   117     var windowHeight = boundingBox.get('winHeight') ;
       
   118 
       
   119     var pos = gToc['position'] ;
       
   120     if (commentFormHeight > windowHeight) // trying to have save comment visible ... :
       
   121       pos = [CY.WidgetPositionExt.BL, CY.WidgetPositionExt.BL] ;
       
   122     
       
   123     overlay.set("align", {points:pos});
       
   124     if (commentFormHeight <= windowHeight)
       
   125       overlay.set("y", overlay.get("y") + 30);
       
   126     boundingBox.setX(boundingBox.getX() + gConf['iCommentLeftPadding']);
       
   127   }
       
   128 }
   107 }
   129 
   108 
   130 function getElementsByTagNames(list,obj) {
   109 function getElementsByTagNames(list,obj) {
   131 	if (!obj) var obj = document;
   110 	if (!obj) var obj = document;
   132 	var tagNames = list.split(',');
   111 	var tagNames = list.split(',');