-
-
Notifications
You must be signed in to change notification settings - Fork 27
Closed
Labels
bugSomething isn't workingSomething isn't workinghelp wantedExtra attention is neededExtra attention is needed
Description
I think I found a way to determine isRepoRoot
: use the title
/fregante/github-url-detection | fregante/github-url-detection: Which GitHub page are you on? Is it an issue? Is it a list? Perfect for your WebExtension or userscript |
---|---|
/fregante/github-url-detection/tree/npm-test | fregante/github-url-detection at npm-test |
/fregante/github-url-detection/tree/npm-test/esm | github-url-detection/esm at npm-test · fregante/github-url-detection |
You can see 2 behaviors:
isRepoRoot
starts withgetRepoURL
isRepoTree
does not (but ends withgetRepoURL
)- warning: if the repo is called
fregante/fregante
and the folder isfregante
, thentitle
starts withfregante/fregante
and ends withfregante/fregante
- warning: if the repo is called
The code might be:
const isRepoRoot = (url) => /^(tree\/[^/]+)?$/.test(getRepoPath(url)!) || (!url && document.title.startsWith(getRepoURL()) && !document.title.endsWith(getRepoURL()))
Originally discussed at refined-github/refined-github#3254 (comment)
yakov116, notlmn and FloEdelmann
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workinghelp wantedExtra attention is neededExtra attention is needed