src/cm/media/js/client/c_sync.js
changeset 600 fda73ac53450
parent 558 5ba711a2bd06
equal deleted inserted replaced
599:6c2ef083d89f 600:fda73ac53450
   395     if (comment != null) {
   395     if (comment != null) {
   396       var path = gDb.getPath(comment) ;
   396       var path = gDb.getPath(comment) ;
   397       var topAncestorComment = path[path.length - 1] ;
   397       var topAncestorComment = path[path.length - 1] ;
   398       var topY = 0 ;
   398       var topY = 0 ;
   399       if (comment['start_wrapper'] != -1) 
   399       if (comment['start_wrapper'] != -1) 
   400         topY = CY.get(".c-id-"+topAncestorComment.id).getY() ;
   400         topY = CY.one(".c-id-"+topAncestorComment.id).getY() ;
   401       else 
   401       else 
   402         topY = CY.get(the_scrolling_part).get('scrollTop') ;
   402         topY = CY.one(the_scrolling_part).get('scrollTop') ;
   403      
   403      
   404       this._showComments([topAncestorComment.id], topY, false) ;
   404       this._showComments([topAncestorComment.id], topY, false) ;
   405       // optim when browsing comments with no reply     
   405       // optim when browsing comments with no reply     
   406       if (topAncestorComment.replies.length > 0)
   406       if (topAncestorComment.replies.length > 0)
   407 	    // SID: let topY param be null to force Y acquisition from comment that
   407 	    // SID: let topY param be null to force Y acquisition from comment that
   411   },
   411   },
   412   _showFocusSingleComment : function(topComment, focusComment, reply) {
   412   _showFocusSingleComment : function(topComment, focusComment, reply) {
   413     if (topComment != null) {
   413     if (topComment != null) {
   414       var topY = 0 ;
   414       var topY = 0 ;
   415       if (topComment['start_wrapper'] != -1) 
   415       if (topComment['start_wrapper'] != -1) 
   416         topY = CY.get(".c-id-"+topComment.id).getY() ;
   416         topY = CY.one(".c-id-"+topComment.id).getY() ;
   417       else 
   417       else 
   418         topY = CY.get(the_scrolling_part).get('scrollTop') ;
   418         topY = CY.one(the_scrolling_part).get('scrollTop') ;
   419       
   419       
   420       this._showComments([topComment.id], topY, false) ;
   420       this._showComments([topComment.id], topY, false) ;
   421       // optim when browsing comments with no reply     
   421       // optim when browsing comments with no reply     
   422       if (topComment.replies.length > 0 || reply)
   422       if (topComment.replies.length > 0 || reply)
   423         this._animateToAndFocus(topY, focusComment.id, reply) ;
   423         this._animateToAndFocus(topY, focusComment.id, reply) ;
   454         var comments = gDb.getThreads(cs) ;
   454         var comments = gDb.getThreads(cs) ;
   455         gIComments.fetch(comments) ;
   455         gIComments.fetch(comments) ;
   456   
   456   
   457         if (commentDbIds.length > 0) {
   457         if (commentDbIds.length > 0) {
   458           if (atDocumentTop) {
   458           if (atDocumentTop) {
   459             CY.get(the_scrolling_part).set('scrollTop', 0) ; 
   459             CY.one(the_scrolling_part).set('scrollTop', 0) ; 
   460           }
   460           }
   461           else {
   461           else {
   462             gIComments.activate(commentDbIds[0]) ;
   462             gIComments.activate(commentDbIds[0]) ;
   463             var scopeStart = CY.get(".c-id-"+commentDbIds[0]) ;
   463             var scopeStart = CY.one(".c-id-"+commentDbIds[0]) ;
   464 
   464 
   465 			// scopeStart could be null when comment has no scope
   465 			// scopeStart could be null when comment has no scope
   466 			if (scopeStart && !scopeStart.inViewportRegion()) {
   466 			if (scopeStart && !scopeStart.inViewportRegion()) {
   467               scopeStart.scrollIntoView(true) ;
   467               scopeStart.scrollIntoView(true) ;
   468 
   468