@@ -41,22 +41,22 @@ var idCounter = 0;
4141
4242function onNodeAdded ( target ) {
4343 var elem ;
44- var res = document . location . href . match ( / g i t h u b .c o m \/ [ ^ \/ ] + \/ [ ^ \/ ] + (?: \/ ( [ ^ \/ ] + ) ( \/ ? ) ) ? / ) ;
44+ var res = document . location . href . match ( / g i t h u b .c o m \/ [ ^ \/ ] + \/ [ ^ \/ ] + (?: \/ ( [ ^ \/ ] + ) ) ? (?: \/ ( [ ^ \/ ] + ) ) ? (?: \/ ( [ ^ \/ ] + ) ) ? (?: \/ ( [ ^ \/ ] + ) ) ? / ) ;
45+ // res[1] to res[4] are 4 path components of the URL after the project.
4546 // res[1] will be "issues", "pull", "commit", etc.
46- // res[2] will be "/" if we're dealing with a single issue, pull, commit, etc.
47- // but it won't be if this is an issue listing, commit listing, etc.
48- if ( [ "issues" , "pull" , "commit" ] . indexOf ( res [ 1 ] ) >= 0 && res [ 2 ] == "/" ) {
47+ // Empty path components will be undefined.
48+ if ( [ "issues" , "pull" , "commit" ] . indexOf ( res [ 1 ] ) >= 0 && res [ 2 ] ) {
4949 // Issue, pull request or commit.
5050 // Comment headers.
5151 for ( elem of target . querySelectorAll ( ".timeline-comment-header-text, .discussion-item-header" ) )
5252 makeHeading ( elem , 3 ) ;
5353 }
54- if ( res [ 1 ] == "commits" ) {
54+ if ( res [ 1 ] == "commits" || ( res [ 1 ] == "pull" && res [ 3 ] == "commits" && ! res [ 4 ] ) ) {
5555 // Commit listing.
5656 // Commit group headers.
5757 for ( elem of target . querySelectorAll ( ".commit-group-title" ) )
5858 makeHeading ( elem , 2 ) ;
59- } else if ( res [ 1 ] == "commit" && res [ 2 ] == "/" ) {
59+ } else if ( ( res [ 1 ] == "commit" && res [ 2 ] ) || ( res [ 1 ] == "pull" && res [ 3 ] == "commits" && res [ 4 ] ) ) {
6060 // Single commit.
6161 if ( elem = target . querySelector ( ".commit-title" ) )
6262 makeHeading ( elem , 2 ) ;
@@ -71,7 +71,7 @@ function onNodeAdded(target) {
7171 if ( elem = target . querySelector ( ".files" ) )
7272 elem . setAttribute ( "role" , "table" ) ;
7373 }
74- if ( [ "pull" , "commit" ] . indexOf ( res [ 1 ] ) >= 0 && res [ 2 ] == "/" ) {
74+ if ( [ "pull" , "commit" ] . indexOf ( res [ 1 ] ) >= 0 && res [ 2 ] ) {
7575 // Pull request or commit.
7676 // Header for each changed file.
7777 for ( elem of target . querySelectorAll ( ".file-info" ) )
0 commit comments