Adding keyboard shortcut 'e' for emailing a story. Also adding 'command+enter' as a way to send the email once you're in the dialog.

This commit is contained in:
Samuel Clay 2012-07-01 14:20:21 -07:00
parent 11f5fadc9d
commit f80e6d7272
3 changed files with 24 additions and 2 deletions

View file

@ -4913,6 +4913,10 @@
e.preventDefault();
self.open_keyboard_shortcuts_modal();
});
$document.bind('keydown', '/', function(e) {
e.preventDefault();
self.open_keyboard_shortcuts_modal();
});
$document.bind('keydown', 'down', function(e) {
e.preventDefault();
self.show_next_story(1);
@ -5047,6 +5051,12 @@
var story = self.model.get_story(story_id);
story.story_view.open_story_in_new_tab();
});
$document.bind('keypress', 'e', function(e) {
e.preventDefault();
var story_id = self.active_story;
if (!story_id) return;
self.send_story_to_email(story_id);
});
$document.bind('keydown', 'shift+a', function(e) {
e.preventDefault();
if (self.flags.river_view) {

View file

@ -192,9 +192,9 @@ NEWSBLUR.ReaderKeyboard.prototype = {
]),
$.make('div', { className: 'NB-keyboard-group' }, [
$.make('div', { className: 'NB-keyboard-shortcut' }, [
$.make('div', { className: 'NB-keyboard-shortcut-explanation' }, 'View keyboard shortcuts'),
$.make('div', { className: 'NB-keyboard-shortcut-explanation' }, 'Email story'),
$.make('div', { className: 'NB-keyboard-shortcut-key' }, [
'?'
'e'
])
]),
$.make('div', { className: 'NB-keyboard-shortcut NB-last' }, [
@ -230,6 +230,12 @@ NEWSBLUR.ReaderKeyboard.prototype = {
$.make('span', '+'),
'u'
])
]),
$.make('div', { className: 'NB-keyboard-shortcut NB-last' }, [
$.make('div', { className: 'NB-keyboard-shortcut-explanation' }, 'View keyboard shortcuts'),
$.make('div', { className: 'NB-keyboard-shortcut-key' }, [
'?'
])
])
])
]);

View file

@ -18,6 +18,10 @@ NEWSBLUR.ReaderSendEmail.prototype = new NEWSBLUR.Modal;
_.extend(NEWSBLUR.ReaderSendEmail.prototype, {
runner: function() {
_.bindAll(this, 'save');
this.options.onOpen = _.bind(function() {
$('input[name=to]', this.$modal).focus();
}, this);
this.make_modal();
this.open_modal();
@ -26,6 +30,8 @@ _.extend(NEWSBLUR.ReaderSendEmail.prototype, {
}
this.$modal.bind('click', $.rescope(this.handle_click, this));
$('input, textarea', this.$modal).bind('keydown', 'ctrl+return', this.save);
$('input, textarea', this.$modal).bind('keydown', 'meta+return', this.save);
},
make_modal: function() {