@@ -727,6 +727,70 @@ function initRepository() {
727727    } 
728728} 
729729
730+ function  initPullRequestReview ( )  { 
731+     if  ( $ ( '.repository.pull.diff' ) . length  ==  0 )  { 
732+         return ; 
733+     } 
734+ 
735+     $ ( '.diff-detail-box.ui.sticky' ) . sticky ( ) ; 
736+ 
737+     $ ( '.btn-review' ) . on ( 'click' ,  function ( e )  { 
738+         e . preventDefault ( ) ; 
739+         $ ( this ) . closest ( '.dropdown' ) . find ( '.menu' ) . toggle ( 'visible' ) ; 
740+     } ) ; 
741+ 
742+     $ ( '.code-view .lines-code,.code-view .lines-num' ) 
743+         . on ( 'mouseenter' ,  function ( )  { 
744+             var  parent  =  $ ( this ) . closest ( 'td' ) ; 
745+             $ ( this ) . closest ( 'tr' ) . addClass ( 
746+                 parent . hasClass ( 'lines-num-old' )  ||  parent . hasClass ( 'lines-code-old' ) 
747+                     ? 'focus-lines-old'  : 'focus-lines-new' 
748+             ) ; 
749+         } ) 
750+         . on ( 'mouseleave' ,  function ( )  { 
751+             $ ( this ) . closest ( 'tr' ) . removeClass ( 'focus-lines-new focus-lines-old' ) ; 
752+         } ) ; 
753+     $ ( '.add-code-comment' ) . on ( 'click' ,  function ( e )  { 
754+         e . preventDefault ( ) ; 
755+         var  isSplit  =  $ ( this ) . closest ( '.code-diff' ) . hasClass ( 'code-diff-split' ) ; 
756+         var  side  =  $ ( this ) . data ( 'side' ) ; 
757+         var  idx  =  $ ( this ) . data ( 'idx' ) ; 
758+         var  form  =  $ ( '#pull_review_add_comment' ) . html ( ) ; 
759+         var  tr  =  $ ( this ) . closest ( 'tr' ) ; 
760+         var  ntr  =  tr . next ( ) ; 
761+         if  ( ! ntr . hasClass ( 'add-comment' ) )  { 
762+             ntr  =  $ ( '<tr class="add-comment">' 
763+                     +  ( isSplit  ? '<td class="lines-num"></td><td class="add-comment-left"></td><td class="lines-num"></td><td class="add-comment-right"></td>' 
764+                                : '<td class="lines-num"></td><td class="lines-num"></td><td class="add-comment-left add-comment-right"></td>' ) 
765+                     +  '</tr>' ) ; 
766+             tr . after ( ntr ) ; 
767+         } 
768+         var  td  =  ntr . find ( '.add-comment-'  +  side ) ; 
769+         var  commentCloud  =  td . find ( '.comment-code-cloud' ) ; 
770+         if  ( commentCloud . length  ===  0 )  { 
771+             td . html ( form ) ; 
772+             commentCloud  =  td . find ( '.comment-code-cloud' ) ; 
773+ 
774+             var  id  =  Math . floor ( Math . random ( )  *  Math . floor ( 1000000 ) ) ; 
775+             var  menu  =  commentCloud . find ( '.menu' ) ; 
776+             menu . attr ( 'data-write' ,  menu . attr ( 'data-write' )  +  id ) ; 
777+             menu . attr ( 'data-preview' ,  menu . attr ( 'data-preview' )  +  id ) ; 
778+             menu . find ( '.item' ) . each ( function ( i ,  item )  { 
779+                 $ ( item ) . attr ( 'data-tab' ,  $ ( item ) . attr ( 'data-tab' )  +  id ) ; 
780+             } ) ; 
781+             commentCloud . find ( '.tab.segment' ) . each ( function ( i ,  item )  { 
782+                 $ ( item ) . attr ( 'data-tab' ,  $ ( item ) . attr ( 'data-tab' )  +  id ) ; 
783+             } ) ; 
784+ 
785+             initCommentPreviewTab ( commentCloud . find ( '.form' ) ) ; 
786+         } 
787+         commentCloud . find ( 'textarea' ) . focus ( ) ; 
788+ 
789+ 
790+         //alert($(this).data('side') + $(this).data('idx')); 
791+     } ) ; 
792+ } 
793+ 
730794function  initRepositoryCollaboration ( )  { 
731795    console . log ( 'initRepositoryCollaboration' ) ; 
732796
@@ -1609,6 +1673,7 @@ $(document).ready(function () {
16091673    initCtrlEnterSubmit ( ) ; 
16101674    initNavbarContentToggle ( ) ; 
16111675    initTopicbar ( ) ; 
1676+     initPullRequestReview ( ) ; 
16121677
16131678    // Repo clone url. 
16141679    if  ( $ ( '#repo-clone-url' ) . length  >  0 )  { 
0 commit comments