| Age | Commit message (Collapse) | Author |
|
I guess I didn't bother with this when I first wrote the script.
|
|
|
|
Recently I noticed that sometimes the shortcut didn't work. The CSS
classes and HTML structure didn't change. The shortcut stopped working
after a navigation action. Maybe Turbolinks replaces `<body>` now?
Regardless, attaching the event listener to an element higher in the
tree allows the shortcut to continue working even after navigation.
|
|
Include a description of the problem and script, installation
instructions, and license information.
|
|
|
|
The keyboard shortcut now works on all comment fields, including those
that are created after page load.
Thanks to this Stack Overflow answer from 'adeneo' and Suraj Jain:
https://stackoverflow.com/questions/20330945/how-to-addeventlistener-to-future-dom-elements/20331016#20331016
It takes advantage of the fact that JavaScript events bubble. We attach
an event to `<body>`, which we can be sure will always be there (even
across GitHub's Turbolinks), and in the keydown event listener check to
see whether we were called on the right element.
|
|
Use Apple-Option-P to open the preview pane and toggle it closed.
GitHub uses Apple-Shift-P by default to toggle the Preview pane. I need
this new shortcut because Firefox uses Apple-Shift-P to open new private
browsing windows, shadowing it from GitHub.
This is the initial working version of this script. It doesn't currently
support comment fields that are added to the page after page load.
|