Merge branch 'full_view'

* full_view:
  Fixing text view.
  Fixing esc key to close popovers and menus without closing current feed.
  Clearing selected story notifier.
  Normaling user agents between feed/page/icon fetchers. Adding full site permalink.
  Fixing empty story explainer (for single story mode).
  Positioning mouse indicator correctly.
  Turning off progress bar on river. Fixing Show Hidden Stories indicator to show when there are either hidden stories or a negative unread count.
  Working on the kicks. Now scrolls river feed header smoothly. Also toggling shift+enter and enter to return from temp story/text view.
  New view: full view, the opposite of list view.
This commit is contained in:
Samuel Clay 2013-07-10 14:14:55 -07:00
commit 0cb504e91b
24 changed files with 370 additions and 175 deletions

View file

@ -96,7 +96,9 @@ def dashboard(request, **kwargs):
url = "https://%s%s" % (Site.objects.get_current().domain,
reverse('stripe-form'))
return HttpResponseRedirect(url)
logging.user(request, "~FBLoading dashboard")
return {
'user_profile' : user.profile,
'feed_count' : feed_count,
@ -125,6 +127,7 @@ def welcome(request, **kwargs):
login_form = LoginForm(prefix='login')
signup_form = SignupForm(prefix='signup')
logging.user(request, "~FBLoading welcome")
return {
'user_profile' : hasattr(user, 'profile') and user.profile,

View file

@ -23,14 +23,12 @@ class TextImporter:
}
def fetch(self, skip_save=False):
try:
html = requests.get(self.story.story_permalink, headers=self.headers)
if html.encoding != 'utf-8':
text = html.text.encode(html.encoding)
original_text_doc = readability.Document(text, url=html.url, debug=settings.DEBUG)
content = original_text_doc.summary(html_partial=True)
except:
content = None
html = requests.get(self.story.story_permalink, headers=self.headers)
text = html.text
if html.encoding != 'utf-8':
text = text.encode(html.encoding)
original_text_doc = readability.Document(text, url=html.url, debug=settings.DEBUG)
content = original_text_doc.summary(html_partial=True)
if content:
if not skip_save:

View file

@ -1098,7 +1098,7 @@ background: transparent;
margin-left: 220px;
}
#story_titles .NB-feedbar {
.NB-feedbar {
font-weight: bold;
font-size: 16px;
padding: 2px 208px 2px 4px;
@ -1109,36 +1109,36 @@ background: transparent;
position: relative;
overflow: hidden;
}
.NB-story-pane-west #story_titles .NB-feedbar {
.NB-story-pane-west .NB-feedbar {
padding-right: 4px;
}
#story_titles .NB-feedbar .feed .feed_favicon {
.NB-feedbar .feed .feed_favicon {
margin: 2px 4px 0 2px;
vertical-align: top;
float: left;
width: 16px;
height: 16px;
}
#story_titles .NB-feedbar .feed.NB-feed-social .feed_favicon {
.NB-feedbar .feed.NB-feed-social .feed_favicon {
border-radius: 3px;
}
#story_titles .NB-feedbar .feed .feed_title {
.NB-feedbar .feed .feed_title {
/* float: left;*/
display: block;
margin-left: 24px;
color: #40413E;
text-shadow: 0 1px 0 rgba(255, 255, 255, .8);
}
#story_titles .NB-feedbar .NB-feedbar-options-container {
.NB-feedbar .NB-feedbar-options-container {
position: absolute;
right: 0;
width: 206px;
top: 2px;
}
.NB-story-pane-west #story_titles .NB-feedbar .NB-feedbar-options-container {
.NB-story-pane-west .NB-feedbar .NB-feedbar-options-container {
position: static;
}
#story_titles .NB-feedbar .NB-feedbar-options {
.NB-feedbar .NB-feedbar-options {
cursor: pointer;
float: left;
color: rgba(0, 0, 0, .5);
@ -1155,11 +1155,11 @@ background: transparent;
-o-transition: all .12s ease-out;
-ms-transition: all .12s ease-out;
}
#story_titles .NB-feedbar .NB-feedbar-options:hover,
#story_titles .NB-feedbar .NB-feedbar-options.NB-active {
.NB-feedbar .NB-feedbar-options:hover,
.NB-feedbar .NB-feedbar-options.NB-active {
background-color: rgba(0, 0, 0, .1);
}
#story_titles .NB-feedbar .NB-feedbar-options .NB-icon {
.NB-feedbar .NB-feedbar-options .NB-icon {
float: right;
width: 16px;
height: 12px;
@ -1168,7 +1168,7 @@ background: transparent;
margin: 0 0 0 4px;
}
#story_titles .NB-feedbar .NB-feedbar-train-feed {
.NB-feedbar .NB-feedbar-train-feed {
background: transparent url("/media/embed/icons/circular/train.png") no-repeat center center;
background-size: 16px;
width: 16px;
@ -1176,7 +1176,7 @@ background: transparent;
cursor: pointer;
padding: 0 0 0 38px;
}
#story_titles .NB-feedbar .NB-feedbar-statistics {
.NB-feedbar .NB-feedbar-statistics {
background: transparent url("/media/embed/icons/circular/menu_icn_stats.png") no-repeat center center;
background-size: 16px;
width: 16px;
@ -1186,7 +1186,7 @@ background: transparent;
padding:0 24px 0 6px;
}
#story_titles .NB-feedbar .NB-feedbar-mark-feed-read {
.NB-feedbar .NB-feedbar-mark-feed-read {
cursor: pointer;
font-size: 9px;
line-height: 15px;
@ -1206,17 +1206,17 @@ background: transparent;
-o-transition: all .12s ease-out;
-ms-transition: all .12s ease-out;
}
#story_titles .NB-feedbar .NB-feedbar-mark-feed-read:hover {
.NB-feedbar .NB-feedbar-mark-feed-read:hover {
background-color: rgba(0, 0, 0, .1);
}
.NB-story-pane-west #story_titles .NB-feedbar .NB-feedbar-mark-feed-read {
.NB-story-pane-west .NB-feedbar .NB-feedbar-mark-feed-read {
position: static;
float: right;
margin: 4px 0 4px 4px;
}
#story_titles .NB-feedbar .NB-feedlist-manage-icon {
.NB-feedbar .NB-feedlist-manage-icon {
opacity: 0;
display: none;
position: absolute;
@ -1228,31 +1228,31 @@ background: transparent;
background: transparent url('/media/embed/icons/circular/g_icn_arrow_right.png') no-repeat 6px 7px;
background-size: 8px;
}
#story_titles .NB-feedbar .NB-feedlist-manage-icon:hover {
.NB-feedbar .NB-feedlist-manage-icon:hover {
background: transparent url('/media/embed/icons/circular/g_icn_arrow_down.png') no-repeat 6px 7px;
background-size: 8px;
}
#story_titles .NB-feedbar .NB-hover-inverse .NB-feedlist-manage-icon:hover {
.NB-feedbar .NB-hover-inverse .NB-feedlist-manage-icon:hover {
background: transparent url('/media/embed/icons/circular/g_icn_arrow_up.png') no-repeat 5px 7px;
background-size: 8px;
}
#story_titles .NB-feedbar:hover :not(.NB-no-hover) .NB-feedlist-manage-icon {
.NB-feedbar:hover :not(.NB-no-hover) .NB-feedlist-manage-icon {
display: block;
opacity: 1;
}
#story_titles .NB-feedbar:hover .feed_favicon,
#story_titles .NB-feedbar:hover :not(.NB-no-hover) .NB-folder-icon {
.NB-feedbar:hover .feed_favicon,
.NB-feedbar:hover :not(.NB-no-hover) .NB-folder-icon {
display: none;
}
#story_titles .NB-feedbar .folder_title .NB-feedlist-manage-icon {
.NB-feedbar .folder_title .NB-feedlist-manage-icon {
background-position: 3px 5px;
}
#story_titles .NB-feedbar .feed .feed_counts {
.NB-feedbar .feed .feed_counts {
width: 200px;
position: absolute;
top: -1px;
@ -1260,30 +1260,30 @@ background: transparent;
display: none;
}
#story_titles .NB-feedbar .feed .feed_counts .feed_counts_floater {
.NB-feedbar .feed .feed_counts .feed_counts_floater {
float: left;
}
#story_titles .NB-feedbar .feed .feed_counts .unread_count {
.NB-feedbar .feed .feed_counts .unread_count {
float: right;
}
#story_titles .NB-feedbar .NB-feedbar-intelligence {
.NB-feedbar .NB-feedbar-intelligence {
position: absolute;
right: 4px;
top: 3px;
}
#story_titles .NB-feedbar .unread_count {
.NB-feedbar .unread_count {
float: right;
padding: 0 8px;
}
#story_titles .NB-feedbar .NB-button-intelligence {
.NB-feedbar .NB-button-intelligence {
float: right;
}
#story_titles .NB-feedbar .NB-feed-sentiment {
.NB-feedbar .NB-feed-sentiment {
position: absolute;
width: 16px;
height: 16px;
@ -1292,18 +1292,18 @@ background: transparent;
cursor: pointer;
}
#story_titles .NB-feedbar:hover .NB-feed-sentiment {
.NB-feedbar:hover .NB-feed-sentiment {
display: block;
}
#story_titles .feed .unread_count.unread_count_full {
.NB-feedbar .feed .unread_count.unread_count_full {
display: block;
}
#story_titles .NB-feedbar .NB-folder {
.NB-feedbar .NB-folder {
padding-left: 24px;
}
#story_titles .NB-feedbar .NB-folder .NB-folder-title {
.NB-feedbar .NB-folder .NB-folder-title {
padding: 1px 0 1px 22px;
font-size: 14px;
font-weight: bold;
@ -1312,7 +1312,7 @@ background: transparent;
text-shadow: 1px 1px 0 rgba(255, 255, 255, .5);
}
#story_titles .NB-feedbar .NB-folder .NB-folder-icon {
.NB-feedbar .NB-folder .NB-folder-icon {
background: transparent url('/media/embed/icons/circular/g_icn_folder.png') no-repeat 0 0;
background-size: 16px;
width: 16px;
@ -1321,7 +1321,7 @@ background: transparent;
left: 4px;
top: 4px;
}
#story_titles .NB-feedbar .NB-folder .NB-starred-icon {
.NB-feedbar .NB-folder .NB-starred-icon {
background: transparent url('/media/embed/icons/circular/clock.png') no-repeat 0 0;
background-size: 16px;
width: 16px;
@ -1331,8 +1331,8 @@ background: transparent;
top: 4px;
}
#story_titles .NB-feedbar .folder ul.folder,
#story_titles .NB-feedbar .folder .NB-feedlist-collapse-icon,
.NB-feedbar .folder ul.folder,
.NB-feedbar .folder .NB-feedlist-collapse-icon,
.NB-feeds-header .NB-feedlist-collapse-icon {
display: none;
}
@ -1341,7 +1341,7 @@ background: transparent;
/* = Story Titles Hidden Count = */
/* ============================= */
#story_titles .NB-feedbar .NB-story-title-indicator {
.NB-feedbar .NB-story-title-indicator {
display: none;
position: absolute;
right: 206px;
@ -1361,47 +1361,47 @@ background: transparent;
-o-transition: all .12s ease-out;
-ms-transition: all .12s ease-out;
}
#story_titles .NB-story-title-indicator:hover {
.NB-feedbar .NB-story-title-indicator:hover {
background-color: rgba(0, 0, 0, .1);
}
.NB-story-pane-west #story_titles .NB-feedbar .NB-story-title-indicator {
.NB-story-pane-west .NB-feedbar .NB-story-title-indicator {
position: static;
float: left;
margin: 4px 4px 2px 0;
}
#story_titles .NB-story-title-indicator .NB-story-title-indicator-count {
.NB-feedbar .NB-story-title-indicator .NB-story-title-indicator-count {
float: left;
}
#story_titles .NB-story-title-indicator.unread_threshold_negative {
.NB-feedbar .NB-story-title-indicator.unread_threshold_negative {
display: none;
}
#story_titles .NB-story-title-indicator .feed_counts_floater {
.NB-feedbar .NB-story-title-indicator .feed_counts_floater {
float: left;
padding: 2px 0 0;
text-align: center;
}
#story_titles .NB-story-title-indicator .unread_count_positive.unread_count_full,
#story_titles .NB-story-title-indicator .unread_count_neutral.unread_count_full,
#story_titles .NB-story-title-indicator .unread_count_negative.unread_count_full {
.NB-feedbar .NB-story-title-indicator .unread_count_positive.unread_count_full,
.NB-feedbar .NB-story-title-indicator .unread_count_neutral.unread_count_full,
.NB-feedbar .NB-story-title-indicator .unread_count_negative.unread_count_full {
display: none;
opacity: .3;
}
#story_titles .NB-story-title-indicator.unread_threshold_positive .unread_count_neutral.unread_count_full,
#story_titles .NB-story-title-indicator.unread_threshold_positive .unread_count_negative.unread_count_full,
#story_titles .NB-story-title-indicator.unread_threshold_neutral .unread_count_negative.unread_count_full {
.NB-feedbar .NB-story-title-indicator.unread_threshold_positive .unread_count_neutral.unread_count_full,
.NB-feedbar .NB-story-title-indicator.unread_threshold_positive .unread_count_negative.unread_count_full,
.NB-feedbar .NB-story-title-indicator.unread_threshold_neutral .unread_count_negative.unread_count_full {
display: block;
}
#story_titles .NB-story-title-indicator.unread_threshold_positive:hover .unread_count_neutral {
.NB-feedbar .NB-story-title-indicator.unread_threshold_positive:hover .unread_count_neutral {
opacity: 1;
}
#story_titles .NB-story-title-indicator.unread_threshold_neutral:hover .unread_count_negative {
.NB-feedbar .NB-story-title-indicator.unread_threshold_neutral:hover .unread_count_negative {
opacity: 1;
}
#story_titles .NB-story-title-indicator .feed_counts_floater .unread_count {
.NB-feedbar .NB-story-title-indicator .feed_counts_floater .unread_count {
padding: 1px 3px 1px;
margin: 0 4px 0 0;
line-height: 8px;
@ -1417,13 +1417,13 @@ background: transparent;
opacity: .5;
}
#story_titles .NB-feed-story-premium-only .NB-feed-story-premium-only-divider {
.NB-feedbar .NB-feed-story-premium-only .NB-feed-story-premium-only-divider {
background: transparent url(/media/embed/reader/separator_small.png) no-repeat 50% 100%;
height: 20px;
width: 100%;
margin: 4px 0 0;
}
#story_titles .NB-feed-story-premium-only .NB-feed-story-premium-only-text {
.NB-feedbar .NB-feed-story-premium-only .NB-feed-story-premium-only-text {
text-align: center;
margin: 6px 0 8px 0;
color: #707070;
@ -1870,6 +1870,13 @@ background: transparent;
/* = Feed View Feed Title Floater = */
/* ================================ */
.NB-feed-stories-container {
overflow-x: hidden;
overflow-y: scroll;
height: 100%;
position: relative;
}
.NB-feed-story-view-floater {
position: absolute;
top: 0;
@ -1930,9 +1937,7 @@ background: transparent;
list-style: none;
background-color: white;
position: relative;
overflow-x: hidden;
overflow-y: auto;
height: 100%;
overflow: hidden;
}
.NB-feed-story .NB-feed-story-header {
@ -3678,6 +3683,16 @@ background: transparent;
background-size: 12px;
}
.NB-taskbar .NB-task-layout-full .NB-task-image {
left: 12px;
background: transparent url('/media/img/icons/circular/nav_story_full.png') no-repeat 0 0;
background-size: 18px 14px;
}
.NB-taskbar .NB-task-layout-full.NB-active .NB-task-image {
left: 12px;
background: transparent url('/media/img/icons/circular/nav_story_full_active.png') no-repeat 0 0;
background-size: 18px 14px;
}
.NB-taskbar .NB-task-layout-split .NB-task-image {
left: 12px;
background: transparent url('/media/img/icons/circular/nav_story_split.png') no-repeat 0 0;

Binary file not shown.

After

Width:  |  Height:  |  Size: 231 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 231 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 231 B

After

Width:  |  Height:  |  Size: 645 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 231 B

After

Width:  |  Height:  |  Size: 652 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 231 B

View file

@ -26,6 +26,7 @@
$story_taskbar: $('#story_taskbar'),
$story_pane: $('#story_pane .NB-story-pane-container'),
$feed_view: $('.NB-feed-story-view'),
$feed_scroll: $('.NB-feed-stories-container'),
$feed_stories: $('.NB-feed-stories'),
$feed_iframe: $('.NB-feed-iframe'),
$story_view: $('.NB-story-view'),
@ -126,7 +127,6 @@
this.load_intelligence_slider();
this.handle_mouse_indicator_hover();
this.position_mouse_indicator();
this.handle_login_and_signup_forms();
this.apply_story_styling();
this.load_recommended_feeds();
@ -201,12 +201,12 @@
if (story_layout == 'split') {
north = NEWSBLUR.reader.layout.contentLayout.panes.north;
center = NEWSBLUR.reader.layout.contentLayout.panes.center;
} else if (story_layout == 'list') {
} else {
center = NEWSBLUR.reader.layout.rightLayout.panes.center;
}
if ((north && north.width() < 600) ||
(center && center.width() < 720)) {
if ((north && north.width() < 640) ||
(center && center.width() < 780)) {
this.$s.$feed_view.addClass('NB-feed-story-view-narrow');
this.$s.$story_titles.addClass('NB-feed-story-view-narrow');
this.$s.$text_view.addClass('NB-feed-story-view-narrow');
@ -223,7 +223,6 @@
apply_resizable_layout: function(refresh) {
var story_anchor = this.model.preference('story_pane_anchor');
var story_pane_hidden = this.model.preference('story_pane_hidden');
if (refresh) {
this.layout.contentLayout && this.layout.contentLayout.destroy();
@ -305,7 +304,7 @@
togglerLength_open: 0
});
if (NEWSBLUR.assets.preference('story_layout') == 'split') {
if (_.contains(['split', 'full'], NEWSBLUR.assets.preference('story_layout'))) {
var rightLayoutOptions = {
resizeWhileDragging: true,
center__paneSelector: ".content-pane",
@ -333,9 +332,11 @@
enableCursorHotkey: false,
togglerLength_open: 0
};
if (story_pane_hidden) {
contentLayoutOptions[story_anchor+'__initClosed'] = true;
this.flags['story_titles_closed'] = true;
if (NEWSBLUR.assets.preference('story_layout') == 'full') {
contentLayoutOptions[story_anchor+'__initHidden'] = true;
this.flags['story_titles_closed'] = true;
} else {
this.flags['story_titles_closed'] = false;
}
contentLayoutOptions[story_anchor+'__paneSelector'] = '.right-north';
contentLayoutOptions[story_anchor+'__minSize'] = this.constants.MIN_STORY_LIST_SIZE;
@ -368,8 +369,8 @@
enableCursorHotkey: false,
togglerLength_open: 0
};
this.layout.contentLayout = this.$s.$content_pane.layout(contentLayoutOptions);
this.layout.contentLayout = this.$s.$content_pane.layout(contentLayoutOptions);
this.flags['story_titles_closed'] = false;
}
if (refresh) {
@ -1212,7 +1213,11 @@
NEWSBLUR.app.story_unread_counter.remove();
}
NEWSBLUR.app.story_titles.show_loading(options);
if (NEWSBLUR.assets.preference('story_layout') == 'full') {
NEWSBLUR.app.story_list.show_loading(options);
} else {
NEWSBLUR.app.story_titles.show_loading(options);
}
NEWSBLUR.app.taskbar_info.hide_stories_error();
// this.show_stories_progress_bar();
this.iframe_scroll = null;
@ -1227,7 +1232,7 @@
}
}, this), options.delay || 0);
if (NEWSBLUR.assets.preference('story_layout') == 'split' &&
if (_.contains(['split', 'full'], NEWSBLUR.assets.preference('story_layout')) &&
(!this.story_view || this.story_view == 'page')) {
_.delay(_.bind(function() {
if (!options.delay || feed.id == this.next_feed) {
@ -1281,10 +1286,11 @@
if (first_load) {
this.make_story_titles_pane_counter();
this.find_story_with_action_preference_on_open_feed();
this.position_mouse_indicator();
if (_.contains(['story', 'text'], this.story_view) &&
!this.active_story &&
NEWSBLUR.assets.preference('story_layout') == 'split' &&
_.contains(['split', 'full'], NEWSBLUR.assets.preference('story_layout')) &&
!this.counts['find_next_unread_on_page_of_feed_stories_load']) {
if (this.story_view == 'text') {
NEWSBLUR.app.text_tab_view.show_explainer_single_story_mode();
@ -1346,6 +1352,7 @@
var $split = $(".NB-task-layout-split");
var $list = $(".NB-task-layout-list");
var $full = $(".NB-task-layout-full");
var story_layout = NEWSBLUR.assets.preference('story_layout');
if (story_layout == 'list') {
@ -1353,6 +1360,7 @@
$('.NB-taskbar-button.task_view_feed').addClass('NB-first');
$('.NB-taskbar-button.task_view_story').addClass('NB-hidden');
$('.NB-taskbar-button.task_view_text').addClass('NB-last');
$full.removeClass('NB-active');
$split.removeClass('NB-active');
$list.addClass('NB-active');
} else if (story_layout == 'split') {
@ -1362,8 +1370,19 @@
}
$('.NB-taskbar-button.task_view_story').removeClass('NB-hidden');
$('.NB-taskbar-button.task_view_text').removeClass('NB-last');
$full.removeClass('NB-active');
$split.addClass('NB-active');
$list.removeClass('NB-active');
} else if (story_layout == 'full') {
if (!this.flags.river_view) {
$('.NB-taskbar-button.task_view_page').removeClass('NB-hidden');
$('.NB-taskbar-button.task_view_feed').removeClass('NB-first');
}
$('.NB-taskbar-button.task_view_story').removeClass('NB-hidden');
$('.NB-taskbar-button.task_view_text').removeClass('NB-last');
$full.addClass('NB-active');
$split.removeClass('NB-active');
$list.removeClass('NB-active');
}
if (feed_id == 'starred') {
@ -1397,13 +1416,20 @@
if (this.active_story) {
this.active_story.story_title_view.destroy_inline_story_detail();
}
} else if (story_layout == 'full') {
NEWSBLUR.app.story_list.render();
if (this.active_story) {
this.active_story.story_title_view.destroy_inline_story_detail();
}
}
this.switch_to_correct_view();
this.make_feed_title_in_stories();
_.defer(function() {
NEWSBLUR.app.story_titles.scroll_to_selected_story();
NEWSBLUR.app.story_list.scroll_to_selected_story();
NEWSBLUR.app.story_titles.fill_out();
});
},
@ -1451,7 +1477,11 @@
this.switch_taskbar_view(this.story_view);
this.setup_mousemove_on_views();
this.make_feed_title_in_stories();
NEWSBLUR.app.story_titles.show_loading();
if (NEWSBLUR.assets.preference('story_layout') == 'full') {
NEWSBLUR.app.story_list.show_loading(options);
} else {
NEWSBLUR.app.story_titles.show_loading(options);
}
NEWSBLUR.app.taskbar_info.hide_stories_error();
this.model.fetch_starred_stories(1, _.bind(this.post_open_starred_stories, this),
@ -1496,6 +1526,9 @@
}
this.active_folder = folder || NEWSBLUR.assets.folders;
if (NEWSBLUR.app.story_unread_counter) {
NEWSBLUR.app.story_unread_counter.remove();
}
this.iframe_scroll = null;
this.flags['opening_feed'] = true;
this.$s.$body.addClass('NB-view-river');
@ -1532,9 +1565,13 @@
feeds = this.active_folder.feed_ids_in_folder();
}
this.cache['river_feeds_with_unreads'] = feeds;
NEWSBLUR.app.story_titles.show_loading();
if (NEWSBLUR.assets.preference('story_layout') == 'full') {
NEWSBLUR.app.story_list.show_loading(options);
} else {
NEWSBLUR.app.story_titles.show_loading(options);
}
NEWSBLUR.app.taskbar_info.hide_stories_error();
NEWSBLUR.app.taskbar_info.show_stories_progress_bar(feeds.length);
// NEWSBLUR.app.taskbar_info.show_stories_progress_bar(feeds.length);
this.model.fetch_river_stories(this.active_feed, feeds, 1,
_.bind(this.post_open_river_stories, this), NEWSBLUR.app.taskbar_info.show_stories_error, true);
},
@ -1563,18 +1600,19 @@
} else if (this.counts['select_story_in_feed'] || this.flags['select_story_in_feed']) {
this.select_story_in_feed();
}
NEWSBLUR.app.taskbar_info.hide_stories_progress_bar(_.bind(function() {
// NEWSBLUR.app.taskbar_info.hide_stories_progress_bar(_.bind(function() {
if (first_load) {
this.position_mouse_indicator();
this.make_story_titles_pane_counter();
}
}, this));
// }, this));
if (NEWSBLUR.Globals.is_anonymous) {
this.show_tryout_signup_button();
} else if (first_load) {
this.find_story_with_action_preference_on_open_feed();
if (_.contains(['story', 'text'], this.story_view) &&
!this.active_story &&
NEWSBLUR.assets.preference('story_layout') == 'split' &&
_.contains(['split', 'full'], NEWSBLUR.assets.preference('story_layout')) &&
!this.counts['find_next_unread_on_page_of_feed_stories_load']) {
this.show_next_story(1);
}
@ -1635,7 +1673,11 @@
}
}
NEWSBLUR.app.story_titles.show_loading();
if (NEWSBLUR.assets.preference('story_layout') == 'full') {
NEWSBLUR.app.story_list.show_loading(options);
} else {
NEWSBLUR.app.story_titles.show_loading(options);
}
NEWSBLUR.app.taskbar_info.hide_stories_error();
NEWSBLUR.app.taskbar_info.show_stories_progress_bar(100); // Assume 100 followees for popular
this.model.fetch_river_blurblogs_stories(this.active_feed, 1,
@ -1671,6 +1713,7 @@
}
if (first_load) {
this.find_story_with_action_preference_on_open_feed();
this.position_mouse_indicator();
}
NEWSBLUR.app.taskbar_info.hide_stories_progress_bar();
if (NEWSBLUR.Globals.is_anonymous) {
@ -1724,7 +1767,11 @@
this.switch_taskbar_view(this.story_view);
this.setup_mousemove_on_views();
NEWSBLUR.app.story_titles.show_loading();
if (NEWSBLUR.assets.preference('story_layout') == 'full') {
NEWSBLUR.app.story_list.show_loading(options);
} else {
NEWSBLUR.app.story_titles.show_loading(options);
}
NEWSBLUR.app.taskbar_info.hide_stories_error();
NEWSBLUR.app.taskbar_info.show_stories_progress_bar();
this.model.fetch_social_stories(this.active_feed, 1,
@ -1776,8 +1823,11 @@
this.show_last_unread_story(true);
}
if (first_load) {
this.make_story_titles_pane_counter();
NEWSBLUR.app.taskbar_info.hide_stories_progress_bar(_.bind(function() {
this.make_story_titles_pane_counter();
}, this));
this.find_story_with_action_preference_on_open_feed();
this.position_mouse_indicator();
}
NEWSBLUR.app.taskbar_info.hide_stories_progress_bar();
if (NEWSBLUR.Globals.is_anonymous) {
@ -2182,7 +2232,11 @@
this.flags['opening_feed'] = true;
this.counts['page'] += 1;
NEWSBLUR.app.story_titles.show_loading(options);
if (NEWSBLUR.assets.preference('story_layout') == 'full') {
NEWSBLUR.app.story_list.show_loading(options);
} else {
NEWSBLUR.app.story_titles.show_loading(options);
}
if (this.active_feed == 'starred') {
this.model.fetch_starred_stories(this.counts['page'], _.bind(this.post_open_starred_stories, this),
@ -2218,7 +2272,8 @@
}
NEWSBLUR.app.story_titles_header = new NEWSBLUR.Views.StoryTitlesHeader({
feed_id: this.active_feed
feed_id: this.active_feed,
layout: NEWSBLUR.assets.preference('story_layout')
}).render();
},
@ -2446,7 +2501,7 @@
'duration': this.model.preference('animations') ? 550 : 0,
'queue': false
});
if (NEWSBLUR.assets.preference('story_layout') == 'split') {
if (_.contains(['split', 'full'], NEWSBLUR.assets.preference('story_layout'))) {
NEWSBLUR.app.text_tab_view.fetch_and_render();
if (!this.active_story) {
NEWSBLUR.app.text_tab_view.show_explainer_single_story_mode();
@ -3225,7 +3280,9 @@
});
// Hide menu on esc.
$('input,textarea', $manage_menu_container).bind('keydown.manage_menu', 'esc', function(e) {
$(document).add($('input,textarea', $manage_menu_container))
.unbind('keydown.manage_menu')
.bind('keydown.manage_menu', 'esc', function(e) {
e.preventDefault();
self.flags['showing_confirm_input_on_manage_menu'] = false;
self.hide_manage_menu(type, $item, true);
@ -3267,6 +3324,9 @@
this.flags['feed_list_showing_manage_menu'] = false;
$(document).unbind('click.menu');
$(document).unbind('mouseup.menu');
$(document).add($('input,textarea', $manage_menu_container))
.unbind('keydown.manage_menu');
if (this.model.preference('show_tooltips')) {
$('.NB-task-manage').tipsy('enable');
}
@ -4153,7 +4213,7 @@
},
position_mouse_indicator: function() {
if (NEWSBLUR.assets.preference('story_layout') != 'split') return;
if (!_.contains(['split', 'full'], NEWSBLUR.assets.preference('story_layout'))) return;
var position = this.model.preference('lock_mouse_indicator');
var container = this.layout.contentLayout.state.container.innerHeight - 30;
@ -5135,6 +5195,10 @@
e.preventDefault();
self.show_previous_story();
});
$.targetIs(e, { tagSelector: '.NB-taskbar-button.NB-task-layout-full' }, function($t, $p){
e.preventDefault();
self.switch_story_layout('full');
});
$.targetIs(e, { tagSelector: '.NB-taskbar-button.NB-task-layout-split' }, function($t, $p){
e.preventDefault();
self.switch_story_layout('split');
@ -5454,17 +5518,27 @@
});
$document.bind('keydown', 'enter', function(e) {
e.preventDefault();
NEWSBLUR.app.story_tab_view.open_story(null, true);
if (self.flags['feed_view_showing_story_view']) {
self.switch_to_correct_view();
} else {
NEWSBLUR.app.story_tab_view.open_story(null, true);
}
});
$document.bind('keydown', 'return', function(e) {
e.preventDefault();
NEWSBLUR.app.story_tab_view.open_story(null, true);
if (self.flags['feed_view_showing_story_view']) {
self.switch_to_correct_view();
} else {
NEWSBLUR.app.story_tab_view.open_story(null, true);
}
});
$document.bind('keydown', 'shift+enter', function(e) {
e.preventDefault();
if (NEWSBLUR.assets.preference('story_layout') == 'list') {
if (!self.active_story) NEWSBLUR.reader.show_next_story(1);
self.active_story.story_title_view.render_inline_story_detail(true);
} else if (self.flags['temporary_story_view']) {
self.switch_to_correct_view();
} else {
NEWSBLUR.app.text_tab_view.fetch_and_render(null, true);
}
@ -5474,6 +5548,8 @@
if (NEWSBLUR.assets.preference('story_layout') == 'list') {
if (!self.active_story) NEWSBLUR.reader.show_next_story(1);
self.active_story.story_title_view.render_inline_story_detail(true);
} else if (self.flags['temporary_story_view']) {
self.switch_to_correct_view();
} else {
NEWSBLUR.app.text_tab_view.fetch_and_render(null, true);
}
@ -5564,7 +5640,9 @@
});
$document.bind('keydown', 'esc', function(e) {
e.preventDefault();
if (!_.keys($.modal.impl.d).length) {
if (!_.keys($.modal.impl.d).length &&
!NEWSBLUR.ReaderPopover.is_open() &&
!self.flags['feed_list_showing_manage_menu']) {
self.show_splash_page();
}
});
@ -5639,7 +5717,7 @@
e.preventDefault();
if (self.active_story) {
var view = 'feed';
if (NEWSBLUR.assets.preference('story_layout') == 'split' &&
if (_.contains(['split', 'full'], NEWSBLUR.assets.preference('story_layout')) &&
_.contains(['page', 'story'], self.story_view)) {
view = 'title';
}

View file

@ -7,6 +7,7 @@ NEWSBLUR.ReaderPopover = Backbone.View.extend({
},
initialize: function(options) {
_.bindAll(this, 'handle_esc');
this.options = _.extend({}, {
width: 236,
animate: true,
@ -15,6 +16,7 @@ NEWSBLUR.ReaderPopover = Backbone.View.extend({
left: 0
}
}, this.options, options);
$(document).bind('keydown', 'esc', this.handle_esc);
},
render: function($content) {
@ -58,6 +60,7 @@ NEWSBLUR.ReaderPopover = Backbone.View.extend({
hide_callback = hide_callback || $.noop;
this.$popover.removeClass('in');
this.$overlay.removeClass('in');
$(document).unbind('keydown', this.handle_esc);
this.options.on_hide && this.options.on_hide();
function removeWithAnimation() {
@ -104,23 +107,38 @@ NEWSBLUR.ReaderPopover = Backbone.View.extend({
} else {
return $(this.options.anchor);
}
},
handle_esc: function(e) {
if (this._open) {
e.preventDefault();
e.stopPropagation();
this.close();
return false;
}
}
}, {
create: function(options) {
if (this._popover && this._popover._open) {
this._popover.close();
if (NEWSBLUR.ReaderPopover._popover && NEWSBLUR.ReaderPopover._popover._open) {
NEWSBLUR.ReaderPopover._popover.close();
} else {
this._popover = new this(options);
NEWSBLUR.ReaderPopover._popover = new this(options);
}
},
close: function() {
if (this._popover && this._popover._open) {
this._popover.close();
if (NEWSBLUR.ReaderPopover._popover && NEWSBLUR.ReaderPopover._popover._open) {
NEWSBLUR.ReaderPopover._popover.close();
}
},
is_open: function() {
return NEWSBLUR.ReaderPopover._popover && NEWSBLUR.ReaderPopover._popover._open;
}
});

View file

@ -366,13 +366,6 @@ _.extend(NEWSBLUR.ReaderPreferences.prototype, {
$.make('img', { src: NEWSBLUR.Globals.MEDIA_URL+'/img/reader/layout_bottom.png' }),
'Bottom'
])
]),
$.make('div', {style: 'margin-top: 12px; overflow: hidden; clear: both;'}, [
$.make('input', { id: 'NB-preference-story-pane-hidden', type: 'checkbox', name: 'story_pane_hidden' }),
$.make('label', { 'for': 'NB-preference-story-pane-hidden' }, [
$.make('img', { src: NEWSBLUR.Globals.MEDIA_URL+'/img/reader/layout_hidden.png' }),
'Hide the pane entirely (use shift+t to show)'
])
])
]),
$.make('div', { className: 'NB-preference-label'}, [
@ -752,13 +745,7 @@ _.extend(NEWSBLUR.ReaderPreferences.prototype, {
return false;
}
});
$('input[name=story_pane_hidden]', $modal).each(function() {
if (NEWSBLUR.Preferences.story_pane_hidden) {
$(this).attr('checked', true);
return false;
}
});
$('input[name=new_window]', $modal).each(function() {
$('input[name=new_window]', $modal).each(function() {
if ($(this).val() == NEWSBLUR.Preferences.new_window) {
$(this).attr('checked', true);
return false;
@ -986,8 +973,7 @@ _.extend(NEWSBLUR.ReaderPreferences.prototype, {
NEWSBLUR.app.feed_list.make_feeds();
NEWSBLUR.app.feed_list.make_social_feeds();
}
if (self.original_preferences['story_pane_anchor'] != form['story_pane_anchor'] ||
self.original_preferences['story_pane_hidden'] != form['story_pane_hidden']) {
if (self.original_preferences['story_pane_anchor'] != form['story_pane_anchor']) {
NEWSBLUR.reader.apply_resizable_layout(true);
}
if (self.original_preferences['ssl'] != form['ssl']) {

View file

@ -103,6 +103,7 @@ NEWSBLUR.Views.ReaderTaskbarInfo = Backbone.View.extend({
$error.animate({'opacity': 1}, {'duration': 500, 'queue': false});
NEWSBLUR.app.story_titles.end_loading();
NEWSBLUR.app.story_list.end_loading();
},
hide_stories_error: function() {

View file

@ -3,7 +3,7 @@ NEWSBLUR.Views.StoryListView = Backbone.View.extend({
el: '.NB-feed-stories',
initialize: function() {
_.bindAll(this, 'check_feed_view_scrolled_to_bottom');
_.bindAll(this, 'check_feed_view_scrolled_to_bottom', 'scroll');
this.collection.bind('reset', this.reset_flags, this);
this.collection.bind('reset', this.render, this);
this.collection.bind('reset', this.reset_story_positions, this);
@ -13,7 +13,7 @@ NEWSBLUR.Views.StoryListView = Backbone.View.extend({
this.collection.bind('change:selected', this.show_only_selected_story, this);
this.collection.bind('change:selected', this.check_feed_view_scrolled_to_bottom, this);
this.$el.bind('mousemove', _.bind(this.handle_mousemove_feed_view, this));
this.$el.scroll(_.bind(this.handle_scroll_feed_view, this));
NEWSBLUR.reader.$s.$feed_scroll.scroll(this.scroll);
this.reset_flags();
},
@ -40,7 +40,7 @@ NEWSBLUR.Views.StoryListView = Backbone.View.extend({
render: function() {
// console.log(["Rendering story list", NEWSBLUR.assets.preference('story_layout')]);
if (NEWSBLUR.assets.preference('story_layout') != 'split') return;
if (!_.contains(['split', 'full'], NEWSBLUR.assets.preference('story_layout'))) return;
var collection = this.collection;
var stories = this.collection.map(function(story) {
@ -58,10 +58,11 @@ NEWSBLUR.Views.StoryListView = Backbone.View.extend({
this.show_correct_feed_in_feed_title_floater();
this.stories = stories;
_.defer(this.check_feed_view_scrolled_to_bottom);
this.end_loading();
},
add: function(options) {
if (NEWSBLUR.assets.preference('story_layout') != 'split') return;
if (!_.contains(['split', 'full'], NEWSBLUR.assets.preference('story_layout'))) return;
if (options.added) {
var collection = this.collection;
@ -82,6 +83,8 @@ NEWSBLUR.Views.StoryListView = Backbone.View.extend({
} else {
this.show_no_more_stories();
}
this.end_loading();
},
clear: function() {
@ -91,11 +94,16 @@ NEWSBLUR.Views.StoryListView = Backbone.View.extend({
},
show_explainer_single_story_mode: function() {
var $container = this.$el.closest(".NB-feed-stories-container");
$(".NB-story-list-empty", $container).remove();
if (NEWSBLUR.reader.active_story) return;
var $empty = $.make("div", { className: "NB-story-list-empty" }, [
'Select a story to read'
]);
this.$el.append($empty);
$container.append($empty);
},
// ===========
@ -116,15 +124,15 @@ NEWSBLUR.Views.StoryListView = Backbone.View.extend({
$story = $('.NB-feed-story-comments', $story);
}
if (options.only_if_hidden && this.$el.isScrollVisible($story, true)) {
if (options.only_if_hidden && NEWSBLUR.reader.$s.$feed_scroll.isScrollVisible($story, true)) {
return;
}
clearTimeout(NEWSBLUR.reader.locks.scrolling);
NEWSBLUR.reader.flags.scrolling_by_selecting_story_title = true;
this.$el._scrollable().stop();
NEWSBLUR.reader.$s.$feed_scroll._scrollable().stop();
var scroll_to = options.scroll_to_top ? 0 : $story;
this.$el.scrollTo(scroll_to, {
NEWSBLUR.reader.$s.$feed_scroll.scrollTo(scroll_to, {
duration: options.immediate ? 0 : 340,
axis: 'y',
easing: 'easeInOutQuint',
@ -139,8 +147,11 @@ NEWSBLUR.Views.StoryListView = Backbone.View.extend({
},
show_only_selected_story: function() {
var $container = this.$el.closest(".NB-feed-stories-container");
$(".NB-story-list-empty", $container).remove();
if (!NEWSBLUR.assets.preference('feed_view_single_story')) return;
if (NEWSBLUR.assets.preference('story_layout') != 'split') return;
if (!_.contains(['split', 'full'], NEWSBLUR.assets.preference('story_layout'))) return;
this.collection.any(_.bind(function(story) {
if (story && story.get('selected') && story.story_view) {
@ -182,12 +193,12 @@ NEWSBLUR.Views.StoryListView = Backbone.View.extend({
this.$el.append($end_stories_line);
},
show_correct_feed_in_feed_title_floater: function(story) {
show_correct_feed_in_feed_title_floater: function(story, hide) {
var $story, $header;
var $feed_floater = NEWSBLUR.reader.$s.$feed_floater;
story = story || NEWSBLUR.reader.active_story;
if (story && story.get('story_feed_id') &&
if (!hide && story && story.get('story_feed_id') &&
this.cache.feed_title_floater_feed_id != story.get('story_feed_id')) {
var $story = story.story_view.$el;
$header = $('.NB-feed-story-header-feed', $story);
@ -204,7 +215,7 @@ NEWSBLUR.Views.StoryListView = Backbone.View.extend({
var feed = NEWSBLUR.assets.get_feed(story.get('story_feed_id'));
$feed_floater.toggleClass('NB-inverse', feed && feed.is_light());
$feed_floater.width($header.outerWidth());
} else if (!story || !story.get('story_feed_id')) {
} else if (hide || !story || !story.get('story_feed_id')) {
if (this.feed_title_floater) this.feed_title_floater.remove();
this.cache.feed_title_floater_feed_id = null;
}
@ -233,6 +244,62 @@ NEWSBLUR.Views.StoryListView = Backbone.View.extend({
this.cache.story_pane_position = NEWSBLUR.reader.$s.$story_pane.offset().top;;
},
fill_out: function(options) {
if (NEWSBLUR.assets.flags['no_more_stories'] ||
!NEWSBLUR.assets.stories.length ||
!NEWSBLUR.reader.flags.story_titles_closed) {
return;
}
options = options || {};
if (NEWSBLUR.reader.counts['page_fill_outs'] < NEWSBLUR.reader.constants.FILL_OUT_PAGES &&
!NEWSBLUR.assets.flags['no_more_stories']) {
// var $last = this.$('.NB-feed-story:visible:last');
// var container_height = NEWSBLUR.reader.$s.$story_titles.height();
// NEWSBLUR.log(["fill out", $last.length && $last.position().top, container_height, $last.length, NEWSBLUR.reader.$s.$story_titles.scrollTop()]);
NEWSBLUR.reader.counts['page_fill_outs'] += 1;
_.delay(_.bind(function() {
this.scroll();
}, this), 10);
} else {
this.show_no_more_stories();
}
},
show_loading: function(options) {
options = options || {};
if (NEWSBLUR.assets.flags['no_more_stories']) return;
var $feed_scroll = NEWSBLUR.reader.$s.$feed_scroll;
this.$('.NB-end-line').remove();
var $endline = $.make('div', { className: "NB-end-line NB-short" });
$endline.css({'background': '#E1EBFF'});
$feed_scroll.append($endline);
$endline.animate({'backgroundColor': '#5C89C9'}, {'duration': 650})
.animate({'backgroundColor': '#E1EBFF'}, 1050);
this.feed_stories_loading = setInterval(function() {
$endline.animate({'backgroundColor': '#5C89C9'}, {'duration': 650})
.animate({'backgroundColor': '#E1EBFF'}, 1050);
}, 1700);
},
check_premium_river: function() {
this.show_no_more_stories();
this.append_river_premium_only_notification();
},
end_loading: function() {
var $endbar = NEWSBLUR.reader.$s.$feed_scroll.find('.NB-end-line');
$endbar.remove();
clearInterval(this.feed_stories_loading);
if (NEWSBLUR.assets.flags['no_more_stories']) {
this.show_no_more_stories();
}
},
// =============
// = Positions =
// =============
@ -251,7 +318,7 @@ NEWSBLUR.Views.StoryListView = Backbone.View.extend({
prefetch_story_locations_in_feed_view: function() {
var self = this;
var stories = NEWSBLUR.assets.stories;
if (NEWSBLUR.assets.preference('story_layout') != 'split') return;
if (!_.contains(['split', 'full'], NEWSBLUR.assets.preference('story_layout'))) return;
// NEWSBLUR.log(['Prefetching Feed', this.flags['feed_view_positions_calculated'], this.flags.feed_view_images_loaded, (_.keys(this.flags.feed_view_images_loaded).length > 0 || this.cache.feed_view_story_positions_keys.length > 0), _.keys(this.flags.feed_view_images_loaded).length, _.values(this.flags.feed_view_images_loaded), this.is_feed_loaded_for_location_fetch()]);
@ -291,7 +358,7 @@ NEWSBLUR.Views.StoryListView = Backbone.View.extend({
fetch_story_locations_in_feed_view: function(options) {
options = options || {};
if (NEWSBLUR.assets.preference('story_layout') != 'split') return;
if (!_.contains(['split', 'full'], NEWSBLUR.assets.preference('story_layout'))) return;
var stories = NEWSBLUR.assets.stories;
if (!stories || !stories.length) return;
if (options.reset_timer) this.counts['positions_timer'] = 0;
@ -329,7 +396,7 @@ NEWSBLUR.Views.StoryListView = Backbone.View.extend({
},
check_feed_view_scrolled_to_bottom: function() {
if (NEWSBLUR.assets.preference('story_layout') != 'split') return;
if (!_.contains(['split', 'full'], NEWSBLUR.assets.preference('story_layout'))) return;
if (NEWSBLUR.assets.flags['no_more_stories']) return;
if (!NEWSBLUR.assets.stories.size()) return;
@ -341,10 +408,10 @@ NEWSBLUR.Views.StoryListView = Backbone.View.extend({
if (NEWSBLUR.assets.preference('feed_view_single_story')) return;
var $last_story = last_story.story_view.$el;
var container_offset = this.$el.position().top;
var container_offset = NEWSBLUR.reader.$s.$feed_scroll.position().top;
var full_height = ($last_story.length && $last_story.offset().top) + $last_story.height() - container_offset;
var visible_height = this.$el.height();
var scroll_y = this.$el.scrollTop();
var visible_height = NEWSBLUR.reader.$s.$feed_scroll.height() * 2;
var scroll_y = NEWSBLUR.reader.$s.$feed_scroll.scrollTop();
// Fudge factor is simply because it looks better at 64 pixels off.
// NEWSBLUR.log(['check_feed_view_scrolled_to_bottom', full_height, container_offset, visible_height, scroll_y, NEWSBLUR.reader.flags['opening_feed']]);
@ -355,7 +422,7 @@ NEWSBLUR.Views.StoryListView = Backbone.View.extend({
},
reset_story_positions: function(models) {
if (NEWSBLUR.assets.preference('story_layout') != 'split') return;
if (!_.contains(['split', 'full'], NEWSBLUR.assets.preference('story_layout'))) return;
if (!models || !models.length) {
models = NEWSBLUR.assets.stories;
@ -422,9 +489,12 @@ NEWSBLUR.Views.StoryListView = Backbone.View.extend({
return;
}
var from_top = NEWSBLUR.reader.cache.mouse_position_y + this.$el.scrollTop();
var offset = this.cache.story_pane_position;
var position = from_top; // - offset;
var from_top = NEWSBLUR.reader.cache.mouse_position_y + NEWSBLUR.reader.$s.$feed_scroll.scrollTop();
var offset = this.cache.offset || 0;
if (NEWSBLUR.assets.preference('story_layout') == 'full' && !this.cache.offset) {
offset = this.cache.offset = this.$el.siblings().height();
}
var position = from_top - offset;
var positions = this.cache.feed_view_story_positions_keys;
var closest = $.closest(position, positions);
var story = this.cache.feed_view_story_positions[positions[closest]];
@ -435,24 +505,26 @@ NEWSBLUR.Views.StoryListView = Backbone.View.extend({
}
},
handle_scroll_feed_view: function(elem, e) {
scroll: function(elem, e) {
var self = this;
var story_view = NEWSBLUR.reader.story_view;
var offset = this.cache.offset || 0;
if (NEWSBLUR.assets.preference('story_layout') == 'full' && !this.cache.offset) {
offset = this.cache.offset = $(".NB-feed-story-view-header").outerHeight();
}
// NEWSBLUR.log(['handle_scroll_feed_view', story_view, NEWSBLUR.reader.flags['switching_to_feed_view'], NEWSBLUR.reader.flags['scrolling_by_selecting_story_title']]);
if ((story_view == 'feed' ||
(story_view == 'page' && NEWSBLUR.reader.flags['page_view_showing_feed_view'])) &&
!NEWSBLUR.reader.flags['scrolling_by_selecting_story_title'] &&
!NEWSBLUR.assets.preference('feed_view_single_story')) {
var from_top = NEWSBLUR.reader.cache.mouse_position_y + this.$el.scrollTop();
var offset = this.cache.story_pane_position;
var position = from_top; // - offset;
var from_top = NEWSBLUR.reader.cache.mouse_position_y + NEWSBLUR.reader.$s.$feed_scroll.scrollTop();
var position = from_top - offset;
var positions = this.cache.feed_view_story_positions_keys;
var closest = $.closest(position, positions);
var story = this.cache.feed_view_story_positions[positions[closest]];
if (!story) return;
// NEWSBLUR.log(["Scroll Feed", NEWSBLUR.reader.cache.mouse_position_y, this.$el.scrollTop(), from_top, offset, position, closest, story.get('story_title')]);
// NEWSBLUR.log(["Scroll Feed", NEWSBLUR.reader.cache.mouse_position_y, NEWSBLUR.reader.$s.$feed_scroll.scrollTop(), from_top, offset, position, closest, story.get('story_title')]);
if (!story.get('selected')) {
story.set('selected', true, {selected_by_scrolling: true, mouse: true, immediate: true});
}
@ -466,13 +538,14 @@ NEWSBLUR.Views.StoryListView = Backbone.View.extend({
if (NEWSBLUR.reader.flags['scrolling_by_selecting_story_title']) {
story = this.active_story;
} else {
var from_top = Math.max(1, this.$el.scrollTop());
var from_top = Math.max(1, NEWSBLUR.reader.$s.$feed_scroll.scrollTop());
var positions = this.cache.feed_view_story_positions_keys;
var closest = $.closest(from_top, positions);
var closest = $.closest(from_top - offset, positions);
story = this.cache.feed_view_story_positions[positions[closest]];
}
this.show_correct_feed_in_feed_title_floater(story);
var hide = offset && (from_top < offset);
this.show_correct_feed_in_feed_title_floater(story, hide);
}
}

View file

@ -119,7 +119,7 @@ NEWSBLUR.Views.StoryShareView = Backbone.View.extend({
if (options.animate_scroll) {
var $scroll_container = NEWSBLUR.reader.$s.$story_titles;
if (NEWSBLUR.assets.preference('story_layout') == 'split') {
if (_.contains(['split', 'full'], NEWSBLUR.assets.preference('story_layout'))) {
$scroll_container = this.model.latest_story_detail_view.$el.parent();
}
$scroll_container.scrollTo(this.$el, {

View file

@ -210,7 +210,7 @@ NEWSBLUR.Views.StoryTitleView = Backbone.View.extend({
},
toggle_starred: function() {
var story_titles_visible = NEWSBLUR.assets.preference('story_layout') == 'split';
var story_titles_visible = _.contains(['split', 'full'], NEWSBLUR.assets.preference('story_layout'));
var pane_alignment = NEWSBLUR.assets.preference('story_pane_anchor');
var $star = this.$('.NB-storytitles-star');

View file

@ -1,16 +1,31 @@
NEWSBLUR.Views.StoryTitlesHeader = Backbone.View.extend({
options: {
'layout': 'split'
},
events: {
"click .NB-feedbar-options" : "open_options_popover",
"click .NB-story-title-indicator" : "show_hidden_story_titles"
},
el: $('.NB-feedbar'),
initialize: function() {
this.$story_titles_feedbar = $(".NB-story-titles-header");
this.$feed_view_feedbar = $(".NB-feed-story-view-header");
this.showing_fake_folder = NEWSBLUR.reader.flags['river_view'] &&
NEWSBLUR.reader.active_folder &&
(NEWSBLUR.reader.active_folder.get('fake') || !NEWSBLUR.reader.active_folder.get('folder_title'));
if (this.options.layout == 'split' || this.options.layout == 'list') {
this.$story_titles_feedbar.show();
this.$feed_view_feedbar.hide();
this.setElement(this.$story_titles_feedbar);
} else if (this.options.layout == 'full') {
this.$story_titles_feedbar.hide();
this.$feed_view_feedbar.show();
this.setElement(this.$feed_view_feedbar);
}
},
render: function() {
@ -108,11 +123,17 @@ NEWSBLUR.Views.StoryTitlesHeader = Backbone.View.extend({
if (!NEWSBLUR.reader.active_feed) return;
NEWSBLUR.reader.flags['unread_threshold_temporarily'] = null;
var $story_titles = NEWSBLUR.reader.$s.$story_titles;
var unread_view_name = NEWSBLUR.reader.get_unread_view_name();
var $indicator = $('.NB-story-title-indicator', $story_titles);
var hidden_stories = !!NEWSBLUR.assets.stories.hidden().length;
var $indicator = this.$('.NB-story-title-indicator');
var unread_hidden_stories;
if (NEWSBLUR.reader.flags['river_view']) {
unread_hidden_stories = NEWSBLUR.reader.active_folder.folders.unread_counts &&
NEWSBLUR.reader.active_folder.folders.unread_counts().ng;
} else {
unread_hidden_stories = NEWSBLUR.assets.active_feed.unread_counts().ng;
}
var hidden_stories = unread_hidden_stories || !!NEWSBLUR.assets.stories.hidden().length;
// console.log(["show_feed_hidden_story_title_indicator", unread_hidden_stories, hidden_stories, is_feed_load]);
if (!hidden_stories) {
$indicator.hide();
return;
@ -131,7 +152,7 @@ NEWSBLUR.Views.StoryTitlesHeader = Backbone.View.extend({
},
show_hidden_story_titles: function() {
var $indicator = $('.NB-story-title-indicator', NEWSBLUR.reader.$s.$story_titles);
var $indicator = this.$('.NB-story-title-indicator');
var unread_view_name = NEWSBLUR.reader.get_unread_view_name();
var hidden_stories_at_threshold = NEWSBLUR.assets.stories.any(function(story) {
var score = story.score();

View file

@ -77,11 +77,11 @@ NEWSBLUR.Views.StoryTitlesView = Backbone.View.extend({
}
options = options || {};
var $last = this.$('.NB-story-title:visible:last');
// var container_height = NEWSBLUR.reader.$s.$story_titles.height();
if (NEWSBLUR.reader.counts['page_fill_outs'] < NEWSBLUR.reader.constants.FILL_OUT_PAGES &&
!NEWSBLUR.assets.flags['no_more_stories']) {
// var $last = this.$('.NB-story-title:visible:last');
// var container_height = NEWSBLUR.reader.$s.$story_titles.height();
// NEWSBLUR.log(["fill out", $last.length && $last.position().top, container_height, $last.length, NEWSBLUR.reader.$s.$story_titles.scrollTop()]);
NEWSBLUR.reader.counts['page_fill_outs'] += 1;
_.delay(_.bind(function() {

View file

@ -31,7 +31,7 @@ NEWSBLUR.Views.TextTabView = Backbone.View.extend({
}
if (!story) return;
if (is_temporary && NEWSBLUR.assets.preference('story_layout') == 'split') {
if (is_temporary && _.contains(['split', 'full'], NEWSBLUR.assets.preference('story_layout'))) {
NEWSBLUR.reader.switch_taskbar_view('text', {
skip_save_type: is_temporary ? 'text' : false
});
@ -148,7 +148,7 @@ NEWSBLUR.Views.TextTabView = Backbone.View.extend({
select_story: function(story, selected) {
if (!selected) return;
if ((NEWSBLUR.reader.story_view == 'text' &&
NEWSBLUR.assets.preference('story_layout') == 'split')) {
_.contains(['split', 'full'], NEWSBLUR.assets.preference('story_layout')))) {
if (NEWSBLUR.reader.flags['temporary_story_view']) {
NEWSBLUR.reader.switch_to_correct_view();
}

View file

@ -184,13 +184,11 @@ NEWSBLUR.log = function(msg) {
if (!me._autohider) {
me.forceHide = function(e) {
console.log(["forceHide", e]);
if (!e && options.onHide) options.onHide();
me.hide();
me.removeHide();
};
me.removeHide = function() {
console.log(["remove autohide"]);
$(document).unbind('click.autohide', me._autohider);
$(document).unbind('keypress.autohide', me._autohider);
$(document).unbind('keyup.autohide', me._checkesc);
@ -199,7 +197,6 @@ NEWSBLUR.log = function(msg) {
me.forceHide = null;
};
me._autohider = function(e) {
console.log(["autohider", e, e.target]);
if (me._autoignore) return;
if (options.clickable && (me[0] == e.target || _.include($(e.target).parents(), me[0]))) return;
if (options.onHide && !options.onHide(e, _.bind(me.forceHide, me))) return;

View file

@ -582,8 +582,8 @@ REDIS_STORY_HASH_POOL2 = redis.ConnectionPool(host=REDIS3['host'], port=6379, db
JAMMIT = jammit.JammitAssets(NEWSBLUR_DIR)
if DEBUG:
MIDDLEWARE_CLASSES += ('utils.mongo_raw_log_middleware.SqldumpMiddleware',)
MIDDLEWARE_CLASSES += ('utils.redis_raw_log_middleware.SqldumpMiddleware',)
MIDDLEWARE_CLASSES += ('utils.mongo_raw_log_middleware.MongoDumpMiddleware',)
MIDDLEWARE_CLASSES += ('utils.redis_raw_log_middleware.RedisDumpMiddleware',)
MIDDLEWARE_CLASSES += ('utils.request_introspection_middleware.DumpRequestMiddleware',)
MIDDLEWARE_CLASSES += ('utils.exception_middleware.ConsoleExceptionMiddleware',)

View file

@ -41,7 +41,6 @@
'has_trained_intelligence': {{ user_profile.has_trained_intelligence|yesno:"true,false" }},
'story_titles_pane_size' : 168,
'story_pane_anchor' : 'south',
'story_pane_hidden' : false,
'new_window' : 1,
'default_view' : 'feed',
'default_order' : 'newest',

View file

@ -196,9 +196,12 @@
</ul>
<ul class="segmented-control NB-taskbar NB-taskbar-layout">
<li class="NB-taskbar-button NB-task-layout-full NB-tipsy" tipsy-title="Split">
<div class="NB-task-image"></div>
<span class="NB-task-title">Full</span>
</li>
<li class="NB-taskbar-button NB-task-layout-split NB-active NB-tipsy" tipsy-title="Split">
<div class="NB-task-image"></div>
<span class="NB-task-title">Split</span>
</li>
<li class="NB-taskbar-button NB-task-layout-list NB-tipsy" tipsy-title="List">
<div class="NB-task-image"></div>
@ -219,7 +222,7 @@
<div class="content-pane">
<div id="story_titles" class="right-north">
<div class="NB-feedbar"></div>
<div class="NB-story-titles-header NB-feedbar"></div>
<div class="NB-story-titles"></div>
</div>
@ -236,7 +239,10 @@
<iframe id="feed_iframe" class="NB-feed-iframe"></iframe>
<div class="NB-feed-story-view NB-view-hidden">
<div class="NB-feed-story-view-floater"></div>
<ul class="NB-feed-stories"></ul>
<div class="NB-feed-stories-container">
<div class="NB-feed-story-view-header NB-feedbar"></div>
<ul class="NB-feed-stories"></ul>
</div>
</div>
<div class="NB-text-view">
<div class="NB-text-view-detail"></div>

View file

@ -8,7 +8,7 @@ import struct
import bson
from bson.errors import InvalidBSON
class SqldumpMiddleware(object):
class MongoDumpMiddleware(object):
def __init__(self):
if not settings.DEBUG:
raise MiddlewareNotUsed()

View file

@ -4,7 +4,7 @@ from django.db import connection
from redis.connection import Connection
from time import time
class SqldumpMiddleware(object):
class RedisDumpMiddleware(object):
def __init__(self):
if not settings.DEBUG:
raise MiddlewareNotUsed()