Scrolling to selected story when re-opening hidden story titles pane. Thanks @afita.

This commit is contained in:
Samuel Clay 2012-09-01 14:05:24 -07:00
parent 9885e943bb
commit 95326cc835
3 changed files with 13 additions and 4 deletions

View file

@ -2448,6 +2448,7 @@
NEWSBLUR.reader.layout.rightLayout.open(story_anchor);
this.resize_window();
this.flags['story_titles_closed'] = false;
NEWSBLUR.app.story_titles.scroll_to_selected_story();
},
// =======================

View file

@ -221,7 +221,7 @@ NEWSBLUR.ReaderKeyboard.prototype = {
]),
$.make('div', { className: 'NB-keyboard-group' }, [
$.make('div', { className: 'NB-keyboard-shortcut' }, [
$.make('div', { className: 'NB-keyboard-shortcut-explanation' }, 'Hide Sidebar'),
$.make('div', { className: 'NB-keyboard-shortcut-explanation' }, 'Hide Sites'),
$.make('div', { className: 'NB-keyboard-shortcut-key' }, [
'shift',
$.make('span', '+'),
@ -229,9 +229,11 @@ NEWSBLUR.ReaderKeyboard.prototype = {
])
]),
$.make('div', { className: 'NB-keyboard-shortcut NB-last' }, [
$.make('div', { className: 'NB-keyboard-shortcut-explanation' }, 'View keyboard shortcuts'),
$.make('div', { className: 'NB-keyboard-shortcut-explanation' }, 'Hide Story titles'),
$.make('div', { className: 'NB-keyboard-shortcut-key' }, [
'?'
'shift',
$.make('span', '+'),
't'
])
])
]),
@ -244,6 +246,12 @@ NEWSBLUR.ReaderKeyboard.prototype = {
$.make('div', { className: 'NB-keyboard-shortcut-key' }, [
'-'
])
]),
$.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

@ -176,7 +176,7 @@ NEWSBLUR.Views.StoryTitlesView = Backbone.View.extend({
// ============
scroll_to_selected_story: function(story) {
var story_title_view = story.story_title_view || this.collection.active_story.story_title_view;
var story_title_view = story && story.story_title_view || this.collection.active_story.story_title_view;
var story_title_visisble = NEWSBLUR.reader.$s.$story_titles.isScrollVisible(story_title_view.$el);
if (!story_title_visisble) {
var container_offset = NEWSBLUR.reader.$s.$story_titles.position().top;