keyboard.js 937 B

1234567891011121314151617181920212223242526272829303132333435
  1. // XXX Pressing `?` should display a list of all shortcuts available.
  2. //
  3. // XXX There is no reason to define these shortcuts globally, they should be
  4. // attached to a template (most of them will go in the `board` template).
  5. Mousetrap.bind('w', function() {
  6. Sidebar.toogle();
  7. });
  8. Mousetrap.bind('q', function() {
  9. var currentBoardId = Session.get('currentBoard');
  10. var currentUserId = Meteor.userId();
  11. if (currentBoardId && currentUserId) {
  12. Filter.members.toogle(currentUserId);
  13. }
  14. });
  15. Mousetrap.bind('x', function() {
  16. if (Filter.isActive()) {
  17. Filter.reset();
  18. }
  19. });
  20. Mousetrap.bind(['down', 'up'], function(evt, key) {
  21. if (! Session.get('currentCard')) {
  22. return;
  23. }
  24. var nextFunc = (key === 'down' ? 'next' : 'prev');
  25. var nextCard = $('.js-minicard.is-selected')[nextFunc]('.js-minicard').get(0);
  26. if (nextCard) {
  27. var nextCardId = Blaze.getData(nextCard)._id;
  28. Utils.goCardId(nextCardId);
  29. }
  30. });