Adding 'f' and 'u' keyboard shortcuts for fullscreen/sidebar. Also fixed the keyboard shortcuts modal to not wrap incorrectly on small screens.

This commit is contained in:
Samuel Clay 2011-02-23 18:09:09 -05:00
parent 3bdf5ed308
commit 87b5eac123
3 changed files with 23 additions and 3 deletions

View file

@ -2532,7 +2532,8 @@ a.NB-splash-link:hover {
} }
.simplemodal-wrap { .simplemodal-wrap {
overflow: auto; overflow-y: auto;
overflow-x: hidden;
} }
/* ====================== */ /* ====================== */
@ -4348,6 +4349,7 @@ background: transparent;
overflow: hidden; overflow: hidden;
background-color: #F0F0F0; background-color: #F0F0F0;
padding: 8px; padding: 8px;
width: 570px;
} }
.NB-modal-keyboard .NB-keyboard-shortcut { .NB-modal-keyboard .NB-keyboard-shortcut {
width: 270px; width: 270px;

View file

@ -3366,6 +3366,7 @@
close_sidebar: function() { close_sidebar: function() {
this.$s.$body.layout().close('west'); this.$s.$body.layout().close('west');
this.resize_window(); this.resize_window();
this.flags['sidebar_closed'] = true;
$('.NB-taskbar-sidebar-toggle-open').stop().animate({ $('.NB-taskbar-sidebar-toggle-open').stop().animate({
'left': -1 'left': -1
}, { }, {
@ -3378,6 +3379,7 @@
open_sidebar: function() { open_sidebar: function() {
this.$s.$body.layout().open('west'); this.$s.$body.layout().open('west');
this.resize_window(); this.resize_window();
this.flags['sidebar_closed'] = false;
$('.NB-taskbar-sidebar-toggle-open').stop().css({ $('.NB-taskbar-sidebar-toggle-open').stop().css({
'left': -24 'left': -24
}); });
@ -5390,6 +5392,22 @@
e.preventDefault(); e.preventDefault();
self.page_in_story(0.4, -1); self.page_in_story(0.4, -1);
}); });
$document.bind('keydown', 'f', function(e) {
e.preventDefault();
if (self.flags['sidebar_closed']) {
self.open_sidebar();
} else {
self.close_sidebar();
}
});
$document.bind('keydown', 'u', function(e) {
e.preventDefault();
if (self.flags['sidebar_closed']) {
self.open_sidebar();
} else {
self.close_sidebar();
}
});
} }
}; };

View file

@ -126,8 +126,8 @@ NEWSBLUR.ReaderKeyboard.prototype = {
var self = this; var self = this;
this.$modal.modal({ this.$modal.modal({
'minWidth': 600, 'minWidth': 620,
'maxWidth': 600, 'maxWidth': 620,
'overlayClose': true, 'overlayClose': true,
'onOpen': function (dialog) { 'onOpen': function (dialog) {
dialog.overlay.fadeIn(200, function () { dialog.overlay.fadeIn(200, function () {