-
-
Notifications
You must be signed in to change notification settings - Fork 29
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:
isRepoRootstarts withgetRepoURLisRepoTreedoes not (but ends withgetRepoURL)- warning: if the repo is called
fregante/freganteand the folder isfregante, thentitlestarts withfregante/freganteand 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)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workinghelp wantedExtra attention is neededExtra attention is needed