Created
December 30, 2013 22:01
-
-
Save ahollenbach/8188989 to your computer and use it in GitHub Desktop.
Revisions
-
ahollenbach created this gist
Dec 30, 2013 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,25 @@ // 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; });