Skip to content

Instantly share code, notes, and snippets.

@mi-lee
Last active March 30, 2018 01:57
Show Gist options
  • Save mi-lee/c0bb604f678c10dc143705dc9473c2e1 to your computer and use it in GitHub Desktop.
Save mi-lee/c0bb604f678c10dc143705dc9473c2e1 to your computer and use it in GitHub Desktop.
Bookmarklet: Vim bindings for Piazza [draft]
// jj: select post below
// kk: select post above
// checks to see if you're not typing/focused on any element. click outside to activate
javascript:var previous; var arrowKey = function(event) { if ($(document.activeElement)[0].tagName === "BODY") { if (event.keyCode == 74 && previous == 74) { $('.feed_item.selected').next().click(); previous = null; } if (event.keyCode == 75 && previous == 75) { $('.feed_item.selected').prev().click(); previous = null; } else { previous = event.keyCode; } } }; $(document).on('keydown', arrowKey);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment