Created
May 6, 2013 13:17
-
-
Save ryo1kato/5525055 to your computer and use it in GitHub Desktop.
Disable annoying Chrome webapp shortcut for Emacs users!
(e.g. MacOSX + Chrome + Google Spreadsheet.)
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
| //Use https://chrome.google.com/webstore/detail/shortcut-manager/mgjjeipcdnnjhgodgjpfkffcejoljijf | |
| //to assign key-shortcut to this JS snippet | |
| function moveCaret(win, charCount) { | |
| var sel; | |
| sel = win.getSelection(); | |
| if (sel.rangeCount > 0) { | |
| var textNode = sel.focusNode; | |
| console.log(textNode) | |
| var newOffset = sel.focusOffset + charCount; | |
| sel.collapse(textNode, Math.min(textNode.length, newOffset)); | |
| } | |
| } | |
| moveCaret(window, 1) // 1 for Ctrl-F, -1 for Ctrl-B |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment