1
2
Fork
You've already forked userscripts
1

Userscript sometimes does not notice page changes #14

Open
opened 2026年02月24日 02:45:21 +01:00 by jacksonchen666 · 5 comments
  • GitHub is kind of an Single-Page-Application, so navigating to repos might not trigger this script to run. Only (re)loading a repo front-page will do it 100%.
    • Navigating from a user profile to a repository seems to work.
    • Navigating from a repo’s commits to another repo (via a link in the commit message) will not work.
    • Other cases not tested.

https://jacksonchen666.com/ai-instructions-file-detector/#technical-caveats

> - GitHub is kind of an Single-Page-Application, so navigating to repos _might_ not trigger this script to run. Only (re)loading a repo front-page will do it 100%. > - Navigating from a user profile to a repository seems to work. > - Navigating from a repo’s commits to another repo (via a link in the commit message) will not work. > - Other cases not tested. https://jacksonchen666.com/ai-instructions-file-detector/#technical-caveats
Author
Owner
Copy link

Currently implementing this. Using the extremely new Navigation API works, but I haven't been able to figure out a fallback implementation that works on GitHub's repo pages (fallback is being made because the navigation API is only available since Firefox 147 (ESR is 140), and Liquid Ass on Safari, which is extremely new)

The solution in https://stackoverflow.com/a/52809105 doesn't work, specifically.

Currently implementing this. Using the extremely new [Navigation API](https://developer.mozilla.org/en-US/docs/Web/API/Navigation_API) works, but I haven't been able to figure out a fallback implementation that works on GitHub's repo pages (fallback is being made because the navigation API is [only available](https://caniuse.com/wf-navigation) since Firefox 147 (ESR is 140), and Liquid Ass on Safari, which is extremely new) The solution in https://stackoverflow.com/a/52809105 doesn't work, specifically.
Author
Owner
Copy link

The non-navigator API solution in the stackoverflow answer does not do anything, even on a browser that doesn't support the navigation API. Except when the user navigates in the browser history, which is not really useful.

The non-navigator API solution in the stackoverflow answer does not do anything, even on a browser that doesn't support the navigation API. Except when the user navigates in the browser history, which is not really useful.
jacksonchen666 added reference navigation-api 2026年06月29日 03:36:15 +02:00
Author
Owner
Copy link

Tried to make this into something actually usable. Ran into 2 problems:

  1. Sometimes there's duplicate events: Fixed by debouncing based on URL not changing
  2. There is no go-import meta tags, because the page isn't reloaded, so repo homepage detection is null. This is unfixed and I'm not sure how to proceed, as I'm not sure what to rely on then
Tried to make this into something actually usable. Ran into 2 problems: 1. Sometimes there's duplicate events: Fixed by debouncing based on URL not changing 2. There is no `go-import` meta tags, because the page isn't reloaded, so repo homepage detection is `null`. This is unfixed and I'm not sure how to proceed, as I'm not sure what to rely on then
Author
Owner
Copy link

I forgot to post the above comment earlier, but just found now that at the issues page, the go-import meta tags exist when I use a private window (i.e. signed out), but not when I use it with my account signed in. GitHub, what????

I forgot to post the above comment earlier, but just found now that at the issues page, the `go-import` meta tags exist when I use a private window (i.e. signed out), but not when I use it with my account signed in. GitHub, what????
Author
Owner
Copy link

My new idea with the home page detection is dissecting the URL manually, then verifying by making sure there's at least one occurrence of username/repo.git somewhere, which should only be present on the code page, i.e. the "repo homepage".

Though, I didn't figure out how to search within an entire page like Firefox devtools can do.

My new idea with the home page detection is dissecting the URL manually, then verifying by making sure there's at least one occurrence of `username/repo.git` somewhere, which should only be present on the code page, i.e. the "repo homepage". Though, I didn't figure out how to search within an entire page like Firefox devtools can do.
Sign in to join this conversation.
navigation-api
main
navigation-api
dialog-box
dev
ai-files-gitignore-check
github-ai-use-0.4.0
github-ai-use-0.1
github-ai-use-0.1.1
github-ai-use-0.1.2
github-ai-use-0.1.3
github-ai-use-0.1.4
github-ai-use-0.1.5
github-ai-use-0.1.6
github-ai-use-0.1.7
github-ai-use-0.1.8
github-ai-use-0.1.9
github-ai-use-0.1.10
github-ai-use-0.2.0
github-ai-use-0.3.0
github-ai-use-0.3.1
github-ai-use-0.3.2
github-ai-use-0.3.3
Milestone
Clear milestone
No items
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
jacksonchen666/userscripts#14
Reference in a new issue
jacksonchen666/userscripts
No description provided.
Delete branch "%!s()"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?