src/cm/media/js/client/c_sync.js
changeset 337 614669e0e313
parent 329 00df963f91fb
child 339 0508284129cf
equal deleted inserted replaced
336:f7fb42d3f526 337:614669e0e313
   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) {
   390 	_showFocusSingleComment : function(topComment, focusComment, reply) {
   391 		if (topComment != null) {
   391 		if (topComment != null) {
   392 			var topY = 0 ;
   392 			var topY = 0 ;
   393 			if (topComment['start_wrapper'] != -1) 
   393 			if (topComment['start_wrapper'] != -1) 
   394 				topY = CY.get(".c-id-"+topComment.id).getY() ;
   394 				topY = CY.get(".c-id-"+topComment.id).getY() ;
   395 			else 
   395 			else 
   396 				topY = CY.get('document').get('scrollTop') ;
   396 				topY = CY.get('document').get('scrollTop') ;
   397 			
   397 			
   398 			this._showComments([topComment.id], topY, false) ;
   398 			this._showComments([topComment.id], topY, false) ;
   399 			// optim when browsing comments with no reply			
   399 			// optim when browsing comments with no reply			
   400 			if (topComment.replies.length > 0)
   400 			if (topComment.replies.length > 0)
   401 				this._animateToAndFocus(topY, focusComment.id) ;
   401 				this._animateToAndFocus(topY, focusComment.id, reply) ;
   402 		}
   402 		}
   403 	},
   403 	},
   404 
   404 
   405 	showSingleComment : function(comment) {
   405 	showSingleComment : function(comment) {
   406 		this._q.add({fn:CY.bind(this.setPreventClickOn, this)}) ;
   406 		this._q.add({fn:CY.bind(this.setPreventClickOn, this)}) ;
   407 		this._showSingleComment(comment) ;
   407 		this._showSingleComment(comment) ;
   408 		this._q.add({fn:CY.bind(this.setPreventClickOff, this)}) ;
   408 		this._q.add({fn:CY.bind(this.setPreventClickOff, this)}) ;
   409 		this._q.run();
   409 		this._q.run();
   410 	},
   410 	},
   411 	
   411 	
   412 	showFocusSingleComment : function(topComment, focusComment) {
   412 	showFocusSingleComment : function(topComment, focusComment, reply) {
   413 		this._q.add({fn:CY.bind(this.setPreventClickOn, this)}) ;
   413 		this._q.add({fn:CY.bind(this.setPreventClickOn, this)}) ;
   414 		this._showFocusSingleComment(topComment, focusComment) ;
   414 		this._showFocusSingleComment(topComment, focusComment, reply) ;
   415 		this._q.add({fn:CY.bind(this.setPreventClickOff, this)}) ;
   415 		this._q.add({fn:CY.bind(this.setPreventClickOff, this)}) ;
   416 		this._q.run();
   416 		this._q.run();
   417 	},
   417 	},
   418 	
   418 	
   419 	browse : function(order, whereto) { 
   419 	browse : function(order, whereto) { 
   455 						}},
   455 						}},
   456 					{id:"animationRun", autoContinue:false, fn:CY.bind(gIComments.runAnimations, gIComments)}
   456 					{id:"animationRun", autoContinue:false, fn:CY.bind(gIComments.runAnimations, gIComments)}
   457 	            ) ;
   457 	            ) ;
   458 	},
   458 	},
   459 	
   459 	
   460 	_animateToAndFocus : function(topY, focusCommentId) {
   460 	_animateToAndFocus : function(topY, focusCommentId, reply) {
   461 		this._q.add({fn:function() {
   461 		this._q.add({fn:function() {
   462 						gIComments.setAnimationToPositionsAndFocus(topY, focusCommentId) ;
   462 						gIComments.setAnimationToPositionsAndFocus(topY, focusCommentId, reply) ;
   463 						}},
   463 						}},
   464 					{id:"animationRun", autoContinue:false, fn:CY.bind(gIComments.runAnimations, gIComments)}
   464 					{id:"animationRun", autoContinue:false, fn:CY.bind(gIComments.runAnimations, gIComments)}
   465 	            ) ;
   465 	            ) ;
   466 	},
   466 	},
   467 	
   467