equal
deleted
inserted
replaced
385 if (comment != null) { |
385 if (comment != null) { |
386 var path = gDb.getPath(comment) ; |
386 var path = gDb.getPath(comment) ; |
387 var topAncestorComment = path[path.length - 1] ; |
387 var topAncestorComment = path[path.length - 1] ; |
388 var topY = 0 ; |
388 var topY = 0 ; |
389 if (comment['start_wrapper'] != -1) |
389 if (comment['start_wrapper'] != -1) |
390 topY = CY.one(".c-id-"+topAncestorComment.id).getY() ; |
390 topY = CY.get(".c-id-"+topAncestorComment.id).getY() ; |
391 else |
391 else |
392 topY = CY.one('document').get('scrollTop') ; |
392 topY = CY.get('document').get('scrollTop') ; |
393 |
393 |
394 this._showComments([topAncestorComment.id], topY, false) ; |
394 this._showComments([topAncestorComment.id], topY, false) ; |
395 // optim when browsing comments with no reply |
395 // optim when browsing comments with no reply |
396 if (topAncestorComment.replies.length > 0) |
396 if (topAncestorComment.replies.length > 0) |
397 this._animateTo(topY) ; |
397 this._animateTo(topY) ; |
399 }, |
399 }, |
400 _showFocusSingleComment : function(topComment, focusComment, reply) { |
400 _showFocusSingleComment : function(topComment, focusComment, reply) { |
401 if (topComment != null) { |
401 if (topComment != null) { |
402 var topY = 0 ; |
402 var topY = 0 ; |
403 if (topComment['start_wrapper'] != -1) |
403 if (topComment['start_wrapper'] != -1) |
404 topY = CY.one(".c-id-"+topComment.id).getY() ; |
404 topY = CY.get(".c-id-"+topComment.id).getY() ; |
405 else |
405 else |
406 topY = CY.one('document').get('scrollTop') ; |
406 topY = CY.get('document').get('scrollTop') ; |
407 |
407 |
408 this._showComments([topComment.id], topY, false) ; |
408 this._showComments([topComment.id], topY, false) ; |
409 // optim when browsing comments with no reply |
409 // optim when browsing comments with no reply |
410 if (topComment.replies.length > 0 || reply) |
410 if (topComment.replies.length > 0 || reply) |
411 this._animateToAndFocus(topY, focusComment.id, reply) ; |
411 this._animateToAndFocus(topY, focusComment.id, reply) ; |
442 var comments = gDb.getThreads(cs) ; |
442 var comments = gDb.getThreads(cs) ; |
443 gIComments.fetch(comments) ; |
443 gIComments.fetch(comments) ; |
444 |
444 |
445 if (commentDbIds.length > 0) { |
445 if (commentDbIds.length > 0) { |
446 if (atDocumentTop) { |
446 if (atDocumentTop) { |
447 CY.one('document').set('scrollTop', 0) ; |
447 CY.get('document').set('scrollTop', 0) ; |
448 } |
448 } |
449 else { |
449 else { |
450 gIComments.activate(commentDbIds[0]) ; |
450 gIComments.activate(commentDbIds[0]) ; |
451 var scopeStart = CY.one(".c-id-"+commentDbIds[0]) ; |
451 var scopeStart = CY.get(".c-id-"+commentDbIds[0]) ; |
452 if (scopeStart && !scopeStart.inViewportRegion()) { // scopeStart could be null when comment has no scope |
452 if (scopeStart && !scopeStart.inViewportRegion()) { // scopeStart could be null when comment has no scope |
453 scopeStart.scrollIntoView(true) ; |
453 scopeStart.scrollIntoView(true) ; |
454 // Since scrollIntoView scroll the embed ifram *and* the parent window |
454 // Since scrollIntoView scroll the embed ifram *and* the parent window |
455 // restore the position of the toolbar |
455 // restore the position of the toolbar |
456 if (parent) |
456 if (parent) |