Created
December 30, 2013 22:01
-
-
Save ahollenbach/8188989 to your computer and use it in GitHub Desktop.
Adding the standard keyboard ctrl+c/v shortcuts to Noteflight
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Noteflight (http://www.noteflight.com/), a music annotation software for the web, | |
| // has an awesome new HTML5 editor that they are working on. Unfortunately, it doesn't | |
| // support ctrl+c and ctrl+v operations for some reason, (at least on my Windows/Chrome | |
| // configuration), so I wrote a short script to fix that. | |
| var cpy=$(".headerMenuItem:contains('Copy')").first(), | |
| pst=$(".headerMenuItem:contains('Paste')").first(); | |
| var CTRL_KEY = 17, | |
| V_KEY = 86, | |
| C_KEY = 67; | |
| var ctrl = false; | |
| $(document).keydown(function(e) { | |
| if (e.keyCode == CTRL_KEY) ctrl = true; | |
| if (ctrl && e.keyCode == C_KEY) { | |
| cpy.click(); | |
| } else if(ctrl && e.keyCode == V_KEY) { | |
| pst.click(); | |
| } | |
| }).keyup(function(e) { | |
| if (e.keyCode == CTRL_KEY) ctrl = false; | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment