Skip to content

Commit 8dc61dc

Browse files
committed
GitHub: Fix breakage when on a repository home page; e.g. github.com/nvaccess/axSGrease.
1 parent 77d761b commit 8dc61dc

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

GitHubA11yFixes.user.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@ var idCounter = 0;
2424

2525
function onNodeAdded(target) {
2626
var elem;
27-
var res = document.location.href.match(/github.com\/[^\/]+\/[^\/]+\/([^\/]+)(\/?)/);
27+
var res = document.location.href.match(/github.com\/[^\/]+\/[^\/]+(?:\/([^\/]+)(\/?))?/);
28+
// res[1] will be "issues", "pull", "commit", etc.
29+
// res[2] will be "/" if we're dealing with a single issue, pull, commit, etc.
30+
// but it won't be if this is an issue listing, commit listing, etc.
2831
if (["issues", "pull"].indexOf(res[1]) >= 0 && res[2] == "/") {
2932
// Issue or pull request.
3033
// Comment headers.

0 commit comments

Comments
 (0)