src/cm/media/js/site/c_text_view_comments_to_frame.js
changeset 0 40c8f766c9b8
child 341 053551f213fb
equal deleted inserted replaced
-1:000000000000 0:40c8f766c9b8
       
     1 // contains code that proposed by the text_view_comment frame to its parent frame
       
     2 
       
     3 
       
     4 c_persistPreference = function(key1, key2, val) {
       
     5 	gPrefs.persist(key1, key2, val) ;
       
     6 }
       
     7 
       
     8 c_readDefaultPreference = function(key1, key2) {
       
     9 	return gConf['defaultPrefs'][key1][key2] ;
       
    10 }
       
    11 
       
    12 c_readPreference = function(key1, key2) {
       
    13 	return gPrefs.get(key1,key2) ;
       
    14 }
       
    15 
       
    16 c_resetPreferences = function(entries) {
       
    17 	gPrefs.reset(entries) ;
       
    18 }
       
    19 
       
    20 c_applyTextStyle = function(val) {
       
    21 	CY.use(val) ;
       
    22 }
       
    23 
       
    24 sliderValToPx = function (val) {
       
    25 	var winWidth = CY.DOM.winWidth() ;
       
    26 	if (gLayout.isInFrame()) 
       
    27 		 winWidth = parent.$(parent).width() ;		
       
    28 	var theta = val / 100 ;
       
    29 	theta = Math.min(theta, gConf['sliderFixedMin']) ;
       
    30 	theta = Math.max(theta, gConf['sliderFixedMax']) ;
       
    31 	var colWidth = theta * winWidth ;
       
    32 	return Math.floor(colWidth) ;
       
    33 }
       
    34 
       
    35 
       
    36 c_setCommentsColWidth = function(val) {
       
    37 	var colWidth = sliderValToPx(val) ;
       
    38 	gLayout.setLeftColumnWidth(colWidth) ;
       
    39 
       
    40 	var iCommentWidth = gLayout.getTopICommentsWidthFromWidth(colWidth) ;
       
    41 
       
    42 	// icomments
       
    43 	gIComments.setWidth(iCommentWidth) ;	
       
    44 
       
    45 	//forms
       
    46 	gICommentForm['overlay'].get('boundingBox').setStyle('width', iCommentWidth + 'px') ;
       
    47 	changeFormFieldsWidth(gICommentForm['formId'], iCommentWidth) ;
       
    48 	
       
    49 	if (gNewReply) 
       
    50 		changeFormFieldsWidth(gNewReply['ids']['formId'], iCommentWidth) ; 
       
    51 	if (gEdit) 
       
    52 		changeFormFieldsWidth(gEdit['ids']['formId'], iCommentWidth) ; 
       
    53 }