src/cm/media/js/client/c_sync.js
changeset 329 00df963f91fb
parent 106 36165e7cd1f0
child 337 614669e0e313
equal deleted inserted replaced
328:2a6033ca510e 329:00df963f91fb
   385 			// optim when browsing comments with no reply			
   385 			// optim when browsing comments with no reply			
   386 			if (topAncestorComment.replies.length > 0)
   386 			if (topAncestorComment.replies.length > 0)
   387 				this._animateTo(topY) ;
   387 				this._animateTo(topY) ;
   388 		}
   388 		}
   389 	},
   389 	},
       
   390 	_showFocusSingleComment : function(topComment, focusComment) {
       
   391 		if (topComment != null) {
       
   392 			var topY = 0 ;
       
   393 			if (topComment['start_wrapper'] != -1) 
       
   394 				topY = CY.get(".c-id-"+topComment.id).getY() ;
       
   395 			else 
       
   396 				topY = CY.get('document').get('scrollTop') ;
       
   397 			
       
   398 			this._showComments([topComment.id], topY, false) ;
       
   399 			// optim when browsing comments with no reply			
       
   400 			if (topComment.replies.length > 0)
       
   401 				this._animateToAndFocus(topY, focusComment.id) ;
       
   402 		}
       
   403 	},
   390 
   404 
   391 	showSingleComment : function(comment) {
   405 	showSingleComment : function(comment) {
   392 		this._q.add({fn:CY.bind(this.setPreventClickOn, this)}) ;
   406 		this._q.add({fn:CY.bind(this.setPreventClickOn, this)}) ;
   393 		this._showSingleComment(comment) ;
   407 		this._showSingleComment(comment) ;
       
   408 		this._q.add({fn:CY.bind(this.setPreventClickOff, this)}) ;
       
   409 		this._q.run();
       
   410 	},
       
   411 	
       
   412 	showFocusSingleComment : function(topComment, focusComment) {
       
   413 		this._q.add({fn:CY.bind(this.setPreventClickOn, this)}) ;
       
   414 		this._showFocusSingleComment(topComment, focusComment) ;
   394 		this._q.add({fn:CY.bind(this.setPreventClickOff, this)}) ;
   415 		this._q.add({fn:CY.bind(this.setPreventClickOff, this)}) ;
   395 		this._q.run();
   416 		this._q.run();
   396 	},
   417 	},
   397 	
   418 	
   398 	browse : function(order, whereto) { 
   419 	browse : function(order, whereto) { 
   434 						}},
   455 						}},
   435 					{id:"animationRun", autoContinue:false, fn:CY.bind(gIComments.runAnimations, gIComments)}
   456 					{id:"animationRun", autoContinue:false, fn:CY.bind(gIComments.runAnimations, gIComments)}
   436 	            ) ;
   457 	            ) ;
   437 	},
   458 	},
   438 	
   459 	
       
   460 	_animateToAndFocus : function(topY, focusCommentId) {
       
   461 		this._q.add({fn:function() {
       
   462 						gIComments.setAnimationToPositionsAndFocus(topY, focusCommentId) ;
       
   463 						}},
       
   464 					{id:"animationRun", autoContinue:false, fn:CY.bind(gIComments.runAnimations, gIComments)}
       
   465 	            ) ;
       
   466 	},
       
   467 	
   439 	_animateToTop : function() {
   468 	_animateToTop : function() {
   440 		var topPos = gIComments.getTopPosition() ;
   469 		var topPos = gIComments.getTopPosition() ;
   441 		if (topPos != null)
   470 		if (topPos != null)
   442 			this._animateTo(topPos[1]) ;
   471 			this._animateTo(topPos[1]) ;
   443 	},
   472 	},