jerone / UserScripts

🐵 My UserScripts
https://github.com/jerone/UserScripts#readme
GNU General Public License v3.0
339 stars 39 forks source link

Github Comment Enhancer doesn't work when making new issues #66

Closed ghost closed 9 years ago

ghost commented 9 years ago

It only works in comments. I understand that the name is comment enhancer, but couldn't you still make it work for all text input fields on Github?

jerone commented 9 years ago

It should work on comments, issues, pull requests, inline comments, the wiki and comments on Gist.

Can you provide in clear steps where it doesn't work for you.

ghost commented 9 years ago

It works now for some reason.

jerone commented 9 years ago

I noticed that in specific cases (particular sequence of steps) the script won't attach, but I haven't found a way to produce it yet :disappointed:

The problem is that GitHub uses pjax for page navigation, making it very hard to attach this script. If it doesn't work, a refresh should always work.

ghost commented 9 years ago

It works for me now, not sure why it doesn't work for you.

Tailszefox commented 9 years ago

I've just got the same issue when trying to make a new issue. Indeed, refreshing worked. Perhaps the script should force a reload in cases like this?

jerone commented 9 years ago

Again, I really would like to fix this issue too, but the way GitHub page navigation works (pjax) makes it really hard to detect real navigation actions.

Without clear and reproducible steps I can't fix this issue :(

Tailszefox commented 9 years ago

I think I caught one of the causes of the issue. It happens when navigation starts on a page where the script isn't set to run. Note that I'm using Firefox, perhaps it works differently with other browsers.

For example, if I start navigation on https://github.com/jerone/UserScripts/issues , the script gets triggered and everything works well. However, if I start navigation on https://github.com/jerone/UserScripts , or on https://github.com/jerone/UserScripts/issues?q=is%3Aissue+is%3Aclosed , the script isn't run, and thus doesn't attach to the pjax event. Hence, going anywhere from there means the script never triggers on any comment box.

One way I've found to solve this is to include the script on every page on GitHub: // @include https://github.com/*/*

Obviously, though, that may be a tad overkill, so it can probably be tweaked. In any case, with that, the script triggers consistently and is attaching every time.

jerone commented 9 years ago

if I start navigation on https://github.com/jerone/UserScripts , or on https://github.com/jerone/UserScripts/issues?q=is%3Aissue+is%3Aclosed , the script isn't run

Awesome, just confirmed. Will soon release a fix for this.