diff -r 2a6033ca510e -r 00df963f91fb src/cm/media/js/client/c_icomments.js --- a/src/cm/media/js/client/c_icomments.js Tue Nov 02 16:31:20 2010 +0100 +++ b/src/cm/media/js/client/c_icomments.js Mon Nov 08 12:41:44 2010 +0100 @@ -172,6 +172,31 @@ } }, + setAnimationToPositionsAndFocus : function (y, focusCommentId) { + this._initAnimations(); + var lpad = (gPrefs.get('comments','threadpad') == '1') ? gConf['iCommentThreadPadding'] : 0 ; + + var nextY = y ; + for (var i = 0 ; i < this._c.length;i++) { + var iComment = this._c[i] ; + if (iComment.isfetched && iComment.isVisible()) { + var comment_path = gDb.getPath(gDb.getComment(iComment.commentId)) ; + var iCommentX = ((comment_path.length - 1) * lpad) + gConf['iCommentLeftPadding'] ; + + if (nextY == null) { + var xy = iComment.getPosition() ; + nextY = xy[1] ; + } + + if (iComment.commentId == focusCommentId) + this._a.push(iComment.setAnimationToPosition([iCommentX, nextY], focusCommentId)) ; + else + this._a.push(iComment.setAnimationToPosition([iCommentX, nextY])) ; + nextY += iComment.getHeight() ; + } + } + }, + // ANIMATION FUNCTIONS _initAnimations : function () { this._a = [] ; @@ -189,6 +214,17 @@ gSync.resume() ; }, + whenAnimationsEndFocus : function () { + gGETValues = CY.JSON.parse(sv_get_params); + if ("comment_id_key" in gGETValues) { + var id_key = gGETValues["comment_id_key"]; + var focusComment = gDb.getCommentByIdKey(id_key); + if (focusComment != null) + gIComments.getIComment(focusComment.id).overlay.focus(); + } + gSync.resume(); + }, + animationsEnded : function () { return ((this._a.length == 0) || (this._a.length == this._nbEndedAnim)) ; },