src/cm/media/js/client/c_icomments.js
changeset 329 00df963f91fb
parent 217 613b2f29be54
child 331 7ddb9fa9c3f2
equal deleted inserted replaced
328:2a6033ca510e 329:00df963f91fb
   170 					nextY += iComment.getHeight() ;
   170 					nextY += iComment.getHeight() ;
   171 				}
   171 				}
   172 			}
   172 			}
   173 		},
   173 		},
   174 		
   174 		
       
   175 		setAnimationToPositionsAndFocus : function (y, focusCommentId) {
       
   176 			this._initAnimations();
       
   177 			var lpad = (gPrefs.get('comments','threadpad') == '1') ? gConf['iCommentThreadPadding'] : 0 ;
       
   178 
       
   179 			var nextY = y ;
       
   180 			for (var i = 0 ; i < this._c.length;i++) {
       
   181 				var iComment = this._c[i] ;
       
   182 				if (iComment.isfetched && iComment.isVisible()) {
       
   183 					var comment_path = gDb.getPath(gDb.getComment(iComment.commentId)) ;
       
   184 					var iCommentX = ((comment_path.length - 1) * lpad) + gConf['iCommentLeftPadding'] ;
       
   185 
       
   186 					if (nextY == null) {
       
   187 						var xy = iComment.getPosition() ;
       
   188 						nextY = xy[1] ;
       
   189 					}
       
   190 					
       
   191           if (iComment.commentId == focusCommentId)
       
   192   					this._a.push(iComment.setAnimationToPosition([iCommentX, nextY], focusCommentId)) ;
       
   193           else
       
   194   					this._a.push(iComment.setAnimationToPosition([iCommentX, nextY])) ;
       
   195 					nextY += iComment.getHeight() ;
       
   196 				}
       
   197 			}
       
   198 		},
       
   199 		
   175 // ANIMATION FUNCTIONS		
   200 // ANIMATION FUNCTIONS		
   176 		_initAnimations : function () {
   201 		_initAnimations : function () {
   177 			this._a = [] ;
   202 			this._a = [] ;
   178 			this._nbEndedAnim = 0 ; 		
   203 			this._nbEndedAnim = 0 ; 		
   179 		},
   204 		},
   185 				CY.each(this._a, function (animation) { animation.run() ; }) ;
   210 				CY.each(this._a, function (animation) { animation.run() ; }) ;
   186 		},
   211 		},
   187 		
   212 		
   188 		whenAnimationsEnd : function () {
   213 		whenAnimationsEnd : function () {
   189 			gSync.resume() ; 		
   214 			gSync.resume() ; 		
       
   215 		},
       
   216 		
       
   217 		whenAnimationsEndFocus : function () {
       
   218       gGETValues = CY.JSON.parse(sv_get_params);
       
   219       if ("comment_id_key" in gGETValues) {
       
   220         var id_key = gGETValues["comment_id_key"];
       
   221         var focusComment = gDb.getCommentByIdKey(id_key);
       
   222         if (focusComment != null)
       
   223           gIComments.getIComment(focusComment.id).overlay.focus();
       
   224       }
       
   225 			gSync.resume();
   190 		},
   226 		},
   191 		
   227 		
   192 		animationsEnded : function () {
   228 		animationsEnded : function () {
   193 			return ((this._a.length == 0) || (this._a.length == this._nbEndedAnim)) ; 		
   229 			return ((this._a.length == 0) || (this._a.length == this._nbEndedAnim)) ; 		
   194 		},
   230 		},