2012-05-24 17:32:01 -07:00
|
|
|
NEWSBLUR.Views.StoryTitleView = Backbone.View.extend({
|
|
|
|
|
2013-02-11 12:35:42 -08:00
|
|
|
className: 'NB-story-title-container',
|
2012-05-24 17:32:01 -07:00
|
|
|
|
2012-05-25 16:42:41 -07:00
|
|
|
events: {
|
2013-02-11 12:35:42 -08:00
|
|
|
"dblclick .NB-story-title" : "open_story_in_story_view",
|
|
|
|
"click .NB-story-title" : "select_story",
|
2013-07-12 15:21:11 -07:00
|
|
|
"contextmenu .NB-story-title" : "show_manage_menu_rightclick",
|
2012-07-12 15:13:51 -07:00
|
|
|
"click .NB-story-manage-icon" : "show_manage_menu",
|
2013-02-05 17:46:53 -08:00
|
|
|
"click .NB-storytitles-shares" : "select_story_shared",
|
2013-02-11 12:35:42 -08:00
|
|
|
"mouseenter .NB-story-title" : "mouseenter_manage_icon",
|
|
|
|
"mouseleave .NB-story-title" : "mouseleave_manage_icon"
|
2012-05-25 16:42:41 -07:00
|
|
|
},
|
|
|
|
|
2012-05-24 17:32:01 -07:00
|
|
|
initialize: function() {
|
2012-05-25 16:42:41 -07:00
|
|
|
this.model.bind('change', this.toggle_classes, this);
|
|
|
|
this.model.bind('change:read_status', this.toggle_read_status, this);
|
|
|
|
this.model.bind('change:selected', this.toggle_selected, this);
|
2012-05-25 20:52:30 -07:00
|
|
|
this.model.bind('change:starred', this.toggle_starred, this);
|
2012-06-12 16:13:34 -07:00
|
|
|
this.model.bind('change:intelligence', this.toggle_intelligence, this);
|
2013-04-25 13:01:36 -07:00
|
|
|
this.collection.bind('render:intelligence', this.render_intelligence, this);
|
2012-05-25 18:54:04 -07:00
|
|
|
this.model.story_title_view = this;
|
2012-05-24 17:32:01 -07:00
|
|
|
},
|
|
|
|
|
|
|
|
render: function() {
|
2014-12-18 21:17:32 -08:00
|
|
|
var template_name = !this.model.get('selected') && this.options.is_grid ?
|
|
|
|
'grid_template' : 'template';
|
|
|
|
this.$el.html(this[template_name]({
|
2012-06-02 16:33:44 -07:00
|
|
|
story : this.model,
|
2013-02-05 17:46:53 -08:00
|
|
|
feed : (NEWSBLUR.reader.flags.river_view || NEWSBLUR.reader.flags.social_view) &&
|
|
|
|
NEWSBLUR.assets.get_feed(this.model.get('story_feed_id')),
|
2014-04-07 16:55:08 -07:00
|
|
|
options : this.options,
|
2014-04-08 10:27:14 -07:00
|
|
|
show_content_preview : this.show_content_preview()
|
2012-06-02 16:33:44 -07:00
|
|
|
}));
|
2013-02-08 15:08:25 -08:00
|
|
|
this.$st = this.$(".NB-story-title");
|
2012-05-24 17:32:01 -07:00
|
|
|
this.toggle_classes();
|
|
|
|
this.toggle_read_status();
|
2013-02-14 15:36:21 -08:00
|
|
|
this.color_feedbar();
|
2012-05-24 17:32:01 -07:00
|
|
|
|
|
|
|
return this;
|
|
|
|
},
|
2014-12-18 21:17:32 -08:00
|
|
|
|
2012-06-02 16:33:44 -07:00
|
|
|
template: _.template('\
|
2013-02-08 15:08:25 -08:00
|
|
|
<div class="NB-story-title">\
|
2013-02-14 15:36:21 -08:00
|
|
|
<div class="NB-storytitles-feed-border-inner"></div>\
|
|
|
|
<div class="NB-storytitles-feed-border-outer"></div>\
|
2013-02-08 15:08:25 -08:00
|
|
|
<div class="NB-storytitles-sentiment"></div>\
|
2013-02-11 13:42:32 -08:00
|
|
|
<a href="<%= story.get("story_permalink") %>" class="story_title NB-hidden-fade">\
|
2013-02-08 15:08:25 -08:00
|
|
|
<% if (feed) { %>\
|
|
|
|
<div class="NB-story-feed">\
|
|
|
|
<img class="feed_favicon" src="<%= $.favicon(feed) %>">\
|
|
|
|
<span class="feed_title"><%= feed.get("feed_title") %></span>\
|
|
|
|
</div>\
|
|
|
|
<% } %>\
|
|
|
|
<div class="NB-storytitles-star"></div>\
|
|
|
|
<div class="NB-storytitles-share"></div>\
|
|
|
|
<span class="NB-storytitles-title"><%= story.get("story_title") %></span>\
|
|
|
|
<span class="NB-storytitles-author"><%= story.get("story_authors") %></span>\
|
2014-04-07 16:55:08 -07:00
|
|
|
<% if (show_content_preview) { %>\
|
2014-04-08 10:27:14 -07:00
|
|
|
<div class="NB-storytitles-content-preview"><%= show_content_preview %></div>\
|
2014-04-07 16:55:08 -07:00
|
|
|
<% } %>\
|
2013-02-08 15:08:25 -08:00
|
|
|
</a>\
|
2014-01-30 16:39:10 -08:00
|
|
|
<span class="story_date NB-hidden-fade"><%= story.formatted_short_date() %></span>\
|
2013-02-08 15:08:25 -08:00
|
|
|
<% if (story.get("comment_count_friends")) { %>\
|
|
|
|
<div class="NB-storytitles-shares">\
|
|
|
|
<% _.each(story.get("commented_by_friends"), function(user_id) { %>\
|
|
|
|
<img class="NB-user-avatar" src="<%= NEWSBLUR.assets.user_profiles.find(user_id).get("photo_url") %>">\
|
|
|
|
<% }) %>\
|
2012-06-02 16:33:44 -07:00
|
|
|
</div>\
|
|
|
|
<% } %>\
|
2013-02-08 15:08:25 -08:00
|
|
|
<div class="NB-story-manage-icon"></div>\
|
|
|
|
</div>\
|
|
|
|
<div class="NB-story-detail"></div>\
|
2012-06-02 16:33:44 -07:00
|
|
|
'),
|
2012-05-24 17:32:01 -07:00
|
|
|
|
2014-12-18 21:17:32 -08:00
|
|
|
grid_template: _.template('\
|
|
|
|
<div class="NB-story-title NB-story-grid">\
|
|
|
|
<div class="NB-storytitles-feed-border-inner"></div>\
|
|
|
|
<div class="NB-storytitles-feed-border-outer"></div>\
|
|
|
|
<% if (story.image_url()) { %>\
|
|
|
|
<div class="NB-storytitles-story-image-container">\
|
|
|
|
<div class="NB-storytitles-story-image" style="background-image: url(<%= story.image_url() %>);"></div>\
|
|
|
|
</div>\
|
|
|
|
<% } %>\
|
|
|
|
<div class="NB-storytitles-content">\
|
|
|
|
<% if (feed) { %>\
|
|
|
|
<div class="NB-story-feed">\
|
|
|
|
<img class="feed_favicon" src="<%= $.favicon(feed) %>">\
|
|
|
|
<span class="feed_title"><%= feed.get("feed_title") %></span>\
|
|
|
|
</div>\
|
|
|
|
<% } %>\
|
|
|
|
<a href="<%= story.get("story_permalink") %>" class="story_title NB-hidden-fade">\
|
|
|
|
<div class="NB-storytitles-star"></div>\
|
|
|
|
<div class="NB-storytitles-share"></div>\
|
|
|
|
<div class="NB-storytitles-sentiment"></div>\
|
|
|
|
<div class="NB-story-manage-icon"></div>\
|
|
|
|
<span class="NB-storytitles-title"><%= story.get("story_title") %></span>\
|
|
|
|
<span class="NB-storytitles-author"><%= story.get("story_authors") %></span>\
|
|
|
|
<% if (show_content_preview) { %>\
|
|
|
|
<div class="NB-storytitles-content-preview"><%= show_content_preview %></div>\
|
|
|
|
<% } %>\
|
|
|
|
</a>\
|
|
|
|
</div>\
|
|
|
|
<span class="story_date NB-hidden-fade"><%= story.formatted_short_date() %></span>\
|
|
|
|
<% if (story.get("comment_count_friends")) { %>\
|
|
|
|
<div class="NB-storytitles-shares">\
|
|
|
|
<% _.each(story.get("commented_by_friends"), function(user_id) { %>\
|
|
|
|
<img class="NB-user-avatar" src="<%= NEWSBLUR.assets.user_profiles.find(user_id).get("photo_url") %>">\
|
|
|
|
<% }) %>\
|
|
|
|
</div>\
|
|
|
|
<% } %>\
|
|
|
|
</div>\
|
|
|
|
<div class="NB-story-detail"></div>\
|
|
|
|
'),
|
|
|
|
|
2013-05-22 18:40:18 -07:00
|
|
|
render_inline_story_detail: function(temporary_text) {
|
|
|
|
if (NEWSBLUR.reader.story_view == 'text' || temporary_text) {
|
2013-02-12 13:15:14 -08:00
|
|
|
this.text_view = new NEWSBLUR.Views.TextTabView({
|
2013-07-06 13:34:36 -07:00
|
|
|
el: null,
|
|
|
|
inline_story_title: true,
|
|
|
|
temporary: !!temporary_text
|
2013-02-12 13:15:14 -08:00
|
|
|
});
|
2013-05-22 18:40:18 -07:00
|
|
|
this.text_view.fetch_and_render(this.model, temporary_text);
|
2013-02-12 13:15:14 -08:00
|
|
|
this.$(".NB-story-detail").html(this.text_view.$el);
|
2014-01-14 16:58:29 -08:00
|
|
|
this.text_view.story_detail.render_starred_tags();
|
2013-02-12 12:07:16 -08:00
|
|
|
} else {
|
|
|
|
this.story_detail = new NEWSBLUR.Views.StoryDetailView({
|
|
|
|
model: this.model,
|
|
|
|
collection: this.model.collection,
|
|
|
|
tagName: 'div',
|
|
|
|
inline_story_title: true
|
|
|
|
}).render();
|
2013-02-12 13:15:14 -08:00
|
|
|
this.$(".NB-story-detail").html(this.story_detail.$el);
|
2014-01-05 14:55:24 -08:00
|
|
|
this.story_detail.attach_handlers();
|
2013-02-12 12:07:16 -08:00
|
|
|
}
|
2013-02-08 15:08:25 -08:00
|
|
|
},
|
|
|
|
|
2013-12-16 12:11:16 -08:00
|
|
|
destroy: function() {
|
|
|
|
// console.log(["destroy story title", this.model.get('story_title')]);
|
|
|
|
if (this.text_view) {
|
|
|
|
this.text_view.destroy();
|
|
|
|
}
|
|
|
|
if (this.story_detail) {
|
|
|
|
this.story_detail.destroy();
|
|
|
|
}
|
|
|
|
this.model.unbind(null, null, this);
|
|
|
|
this.collection.unbind(null, null, this);
|
|
|
|
this.remove();
|
|
|
|
},
|
|
|
|
|
2013-02-08 15:08:25 -08:00
|
|
|
destroy_inline_story_detail: function() {
|
2013-02-12 13:15:14 -08:00
|
|
|
if (this.story_detail) {
|
|
|
|
this.story_detail.destroy();
|
2013-02-12 16:24:43 -08:00
|
|
|
}
|
|
|
|
if (this.text_view) {
|
2013-02-12 13:15:14 -08:00
|
|
|
this.text_view.destroy();
|
|
|
|
}
|
2013-07-06 13:34:36 -07:00
|
|
|
// this.$(".NB-story-detail").empty();
|
2013-02-08 15:08:25 -08:00
|
|
|
},
|
|
|
|
|
2013-04-25 13:01:36 -07:00
|
|
|
collapse_story: function() {
|
|
|
|
this.model.set('selected', false);
|
|
|
|
NEWSBLUR.app.story_titles.fill_out();
|
|
|
|
},
|
|
|
|
|
|
|
|
render_intelligence: function(options) {
|
|
|
|
options = options || {};
|
|
|
|
var score = this.model.score();
|
|
|
|
var unread_view = NEWSBLUR.reader.get_unread_view_score();
|
|
|
|
|
|
|
|
if (score >= unread_view || this.model.get('visible')) {
|
|
|
|
this.$st.removeClass('NB-hidden');
|
|
|
|
this.model.set('visible', true);
|
|
|
|
} else {
|
|
|
|
this.$st.addClass('NB-hidden');
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2014-04-08 10:27:14 -07:00
|
|
|
show_content_preview: function() {
|
2015-02-06 13:28:55 -08:00
|
|
|
if (NEWSBLUR.assets.view_setting(NEWSBLUR.reader.active_feed, 'layout') == 'grid') {
|
2014-12-18 21:17:32 -08:00
|
|
|
var pruned_description = this.model.content_preview('story_content', 500);
|
|
|
|
} else {
|
|
|
|
var preference = NEWSBLUR.assets.preference('show_content_preview');
|
|
|
|
if (!preference) return preference;
|
|
|
|
var pruned_description = this.model.content_preview();
|
|
|
|
}
|
2014-04-08 10:27:14 -07:00
|
|
|
|
|
|
|
var pruned_title = this.model.content_preview('story_title');
|
|
|
|
|
|
|
|
if (pruned_title.substr(0, 30) == pruned_description.substr(0, 30)) return false;
|
2014-04-16 16:06:39 -07:00
|
|
|
if (pruned_description.length < 30) return false;
|
2014-04-08 10:27:14 -07:00
|
|
|
|
|
|
|
return pruned_description;
|
|
|
|
},
|
|
|
|
|
2012-05-25 16:42:41 -07:00
|
|
|
// ============
|
|
|
|
// = Bindings =
|
|
|
|
// ============
|
2013-02-14 15:36:21 -08:00
|
|
|
|
|
|
|
color_feedbar: function() {
|
|
|
|
var $inner = this.$st.find(".NB-storytitles-feed-border-inner");
|
|
|
|
var $outer = this.$st.find(".NB-storytitles-feed-border-outer");
|
|
|
|
var feed = NEWSBLUR.assets.get_feed(this.model.get('story_feed_id'));
|
2013-02-14 15:40:10 -08:00
|
|
|
if (!feed) return;
|
2013-02-14 15:36:21 -08:00
|
|
|
|
|
|
|
$inner.css('background-color', '#' + feed.get('favicon_fade'));
|
|
|
|
$outer.css('background-color', '#' + feed.get('favicon_color'));
|
|
|
|
},
|
|
|
|
|
2012-05-24 17:32:01 -07:00
|
|
|
toggle_classes: function() {
|
2012-06-12 16:13:34 -07:00
|
|
|
var changes = this.model.changedAttributes();
|
|
|
|
|
|
|
|
if (changes && _.all(_.keys(changes), function(change) {
|
|
|
|
return _.contains(['intelligence', 'read_status', 'selected'], change);
|
|
|
|
})) return;
|
|
|
|
|
2012-05-24 17:32:01 -07:00
|
|
|
var story = this.model;
|
2012-10-23 15:38:44 -07:00
|
|
|
var unread_view = NEWSBLUR.reader.get_unread_view_score();
|
2012-05-24 17:32:01 -07:00
|
|
|
|
2013-02-08 15:08:25 -08:00
|
|
|
this.$st.toggleClass('NB-story-starred', !!story.get('starred'));
|
|
|
|
this.$st.toggleClass('NB-story-shared', !!story.get('shared'));
|
2013-04-25 13:01:36 -07:00
|
|
|
this.toggle_intelligence();
|
|
|
|
this.render_intelligence();
|
|
|
|
|
2012-05-24 17:32:01 -07:00
|
|
|
if (NEWSBLUR.assets.preference('show_tooltips')) {
|
|
|
|
this.$('.NB-story-sentiment').tipsy({
|
|
|
|
delayIn: 375,
|
|
|
|
gravity: 's'
|
|
|
|
});
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2012-06-12 16:13:34 -07:00
|
|
|
toggle_intelligence: function() {
|
|
|
|
var score = this.model.score();
|
2013-02-08 15:08:25 -08:00
|
|
|
this.$st.removeClass('NB-story-negative NB-story-neutral NB-story-postiive')
|
2012-06-12 16:13:34 -07:00
|
|
|
.addClass('NB-story-'+this.model.score_name(score));
|
|
|
|
},
|
|
|
|
|
2013-01-23 10:02:14 -08:00
|
|
|
toggle_read_status: function(model, read_status, options) {
|
|
|
|
options = options || {};
|
2013-02-08 15:08:25 -08:00
|
|
|
this.$st.toggleClass('read', !!this.model.get('read_status'));
|
2013-01-23 10:02:14 -08:00
|
|
|
|
|
|
|
if (options.error_marking_unread) {
|
|
|
|
var pane_alignment = NEWSBLUR.assets.preference('story_pane_anchor');
|
|
|
|
var $star = this.$('.NB-storytitles-sentiment');
|
|
|
|
|
|
|
|
$star.attr({'title': options.message || 'Failed to mark as unread'});
|
|
|
|
$star.tipsy({
|
|
|
|
gravity: pane_alignment == 'north' ? 'nw' : 'sw',
|
|
|
|
fade: true,
|
|
|
|
trigger: 'manual',
|
|
|
|
offsetOpposite: -1
|
|
|
|
});
|
|
|
|
var tipsy = $star.data('tipsy');
|
|
|
|
_.defer(function() {
|
|
|
|
tipsy.enable();
|
|
|
|
tipsy.show();
|
|
|
|
});
|
|
|
|
|
|
|
|
$star.animate({
|
|
|
|
'opacity': 1
|
|
|
|
}, {
|
|
|
|
'duration': 1850,
|
|
|
|
'queue': false,
|
|
|
|
'complete': function() {
|
|
|
|
if (tipsy.enabled) {
|
|
|
|
tipsy.hide();
|
|
|
|
tipsy.disable();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
2012-05-25 16:42:41 -07:00
|
|
|
},
|
|
|
|
|
|
|
|
toggle_selected: function(model, selected, options) {
|
2014-12-18 21:17:32 -08:00
|
|
|
if (this.options.is_grid) this.render();
|
|
|
|
|
2013-02-08 15:08:25 -08:00
|
|
|
this.$st.toggleClass('NB-selected', !!this.model.get('selected'));
|
2014-12-18 21:17:32 -08:00
|
|
|
this.$el.toggleClass('NB-selected', !!this.model.get('selected'));
|
2012-05-25 16:42:41 -07:00
|
|
|
|
2013-07-06 13:34:36 -07:00
|
|
|
if (selected) {
|
2015-02-06 13:28:55 -08:00
|
|
|
if (_.contains(['list', 'grid'], NEWSBLUR.assets.view_setting(NEWSBLUR.reader.active_feed, 'layout'))) {
|
2013-02-08 15:08:25 -08:00
|
|
|
this.render_inline_story_detail();
|
|
|
|
}
|
2015-02-03 20:18:29 -08:00
|
|
|
// NEWSBLUR.app.story_titles.scroll_to_selected_story(this.model, options);
|
2013-02-08 15:08:25 -08:00
|
|
|
} else {
|
|
|
|
this.destroy_inline_story_detail();
|
2012-05-25 16:42:41 -07:00
|
|
|
}
|
|
|
|
},
|
2012-05-25 20:52:30 -07:00
|
|
|
|
|
|
|
toggle_starred: function() {
|
2015-02-06 13:28:55 -08:00
|
|
|
var story_titles_visible = _.contains(['split', 'full'], NEWSBLUR.assets.view_setting(NEWSBLUR.reader.active_feed, 'layout'));
|
2012-07-12 15:20:29 -07:00
|
|
|
var pane_alignment = NEWSBLUR.assets.preference('story_pane_anchor');
|
2012-05-25 20:52:30 -07:00
|
|
|
var $star = this.$('.NB-storytitles-star');
|
2013-02-25 14:45:59 -08:00
|
|
|
|
|
|
|
if (story_titles_visible) {
|
|
|
|
NEWSBLUR.app.story_titles.scroll_to_selected_story(this.model);
|
|
|
|
}
|
2012-05-25 20:52:30 -07:00
|
|
|
|
|
|
|
if (this.model.get('starred')) {
|
|
|
|
$star.attr({'title': 'Saved!'});
|
|
|
|
$star.tipsy({
|
2012-07-12 15:20:29 -07:00
|
|
|
gravity: pane_alignment == 'north' ? 'nw' : 'sw',
|
2012-05-25 20:52:30 -07:00
|
|
|
fade: true,
|
|
|
|
trigger: 'manual',
|
|
|
|
offsetOpposite: -1
|
|
|
|
});
|
|
|
|
var tipsy = $star.data('tipsy');
|
|
|
|
_.defer(function() {
|
|
|
|
tipsy.enable();
|
|
|
|
tipsy.show();
|
|
|
|
});
|
|
|
|
|
|
|
|
$star.animate({
|
|
|
|
'opacity': 1
|
|
|
|
}, {
|
|
|
|
'duration': 850,
|
|
|
|
'queue': false,
|
|
|
|
'complete': function() {
|
|
|
|
if (tipsy.enabled) {
|
|
|
|
tipsy.hide();
|
|
|
|
tipsy.disable();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
} else {
|
2013-02-08 15:08:25 -08:00
|
|
|
this.$st.one('mouseout', _.bind(function() {
|
|
|
|
this.$st.removeClass('NB-unstarred');
|
2012-05-25 20:52:30 -07:00
|
|
|
}, this));
|
|
|
|
$star.attr({'title': 'Removed'});
|
|
|
|
|
|
|
|
$star.tipsy({
|
2012-07-12 15:20:29 -07:00
|
|
|
gravity: pane_alignment == 'north' ? 'nw' : 'sw',
|
2012-05-25 20:52:30 -07:00
|
|
|
fade: true,
|
|
|
|
trigger: 'manual',
|
|
|
|
offsetOpposite: -1
|
|
|
|
});
|
|
|
|
var tipsy = $star.data('tipsy');
|
|
|
|
tipsy.enable();
|
|
|
|
tipsy.show();
|
|
|
|
|
|
|
|
_.delay(function() {
|
|
|
|
if (tipsy.enabled) {
|
|
|
|
tipsy.hide();
|
|
|
|
tipsy.disable();
|
|
|
|
}
|
|
|
|
}, 850);
|
|
|
|
|
|
|
|
}
|
|
|
|
},
|
2012-05-25 16:42:41 -07:00
|
|
|
|
|
|
|
// ==========
|
|
|
|
// = Events =
|
|
|
|
// ==========
|
|
|
|
|
2012-05-25 20:52:30 -07:00
|
|
|
select_story: function(e) {
|
2013-06-03 14:42:22 -07:00
|
|
|
if (NEWSBLUR.hotkeys.shift) return;
|
|
|
|
|
2012-05-25 20:52:30 -07:00
|
|
|
e.preventDefault();
|
2012-08-30 15:08:24 -07:00
|
|
|
e.stopPropagation();
|
|
|
|
if (e.which == 1 && $('.NB-menu-manage-container:visible').length) return;
|
2013-02-11 12:35:42 -08:00
|
|
|
|
2015-02-06 13:28:55 -08:00
|
|
|
if (_.contains(['list', 'grid'], NEWSBLUR.assets.view_setting(NEWSBLUR.reader.active_feed, 'layout')) &&
|
2013-04-25 13:01:36 -07:00
|
|
|
this.model.get('selected')) {
|
|
|
|
this.collapse_story();
|
|
|
|
} else {
|
|
|
|
this.model.set('selected', true, {'click_on_story_title': true});
|
|
|
|
}
|
2012-05-25 20:52:30 -07:00
|
|
|
|
|
|
|
if (NEWSBLUR.hotkeys.command) {
|
2013-06-16 14:12:01 -07:00
|
|
|
this.model.open_story_in_new_tab(true);
|
2012-05-25 20:52:30 -07:00
|
|
|
}
|
2012-05-25 18:54:04 -07:00
|
|
|
},
|
2013-02-05 17:46:53 -08:00
|
|
|
|
|
|
|
select_story_shared: function(e) {
|
|
|
|
e.preventDefault();
|
|
|
|
e.stopPropagation();
|
|
|
|
|
|
|
|
this.model.set('selected', true, {'click_on_story_title': true});
|
|
|
|
if (NEWSBLUR.reader.story_view == 'page') {
|
|
|
|
NEWSBLUR.reader.switch_taskbar_view('feed', {skip_save_type: 'page'});
|
|
|
|
}
|
2012-05-25 18:54:04 -07:00
|
|
|
|
2013-02-05 17:46:53 -08:00
|
|
|
NEWSBLUR.app.story_list.scroll_to_selected_story(this.model, {
|
|
|
|
scroll_to_comments: true,
|
|
|
|
scroll_offset: -50
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
2013-07-12 15:21:11 -07:00
|
|
|
show_manage_menu_rightclick: function(e) {
|
|
|
|
if (!NEWSBLUR.assets.preference('show_contextmenus')) return;
|
|
|
|
|
|
|
|
return this.show_manage_menu(e);
|
|
|
|
},
|
|
|
|
|
2012-05-25 18:54:04 -07:00
|
|
|
show_manage_menu: function(e) {
|
|
|
|
e.preventDefault();
|
|
|
|
e.stopPropagation();
|
2012-07-10 15:26:34 -07:00
|
|
|
// NEWSBLUR.log(["showing manage menu", this.model.is_social() ? 'socialfeed' : 'feed', $(this.el), this]);
|
2013-02-08 15:08:25 -08:00
|
|
|
NEWSBLUR.reader.show_manage_menu('story', this.$st, {
|
2012-05-25 18:54:04 -07:00
|
|
|
story_id: this.model.id,
|
2012-08-30 18:31:44 -07:00
|
|
|
feed_id: this.model.get('story_feed_id'),
|
|
|
|
rightclick: e.which >= 2
|
2012-05-25 18:54:04 -07:00
|
|
|
});
|
|
|
|
return false;
|
|
|
|
},
|
|
|
|
|
|
|
|
mouseenter_manage_icon: function() {
|
|
|
|
var menu_height = 270;
|
2013-04-03 13:25:17 -07:00
|
|
|
// console.log(["mouseenter_manage_icon", this.$el.offset().top, $(window).height(), menu_height]);
|
2012-05-25 18:54:04 -07:00
|
|
|
if (this.$el.offset().top > $(window).height() - menu_height) {
|
2013-02-08 15:08:25 -08:00
|
|
|
this.$st.addClass('NB-hover-inverse');
|
2012-05-25 18:54:04 -07:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
mouseleave_manage_icon: function() {
|
2013-02-08 15:08:25 -08:00
|
|
|
this.$st.removeClass('NB-hover-inverse');
|
2012-07-12 15:13:51 -07:00
|
|
|
},
|
|
|
|
|
|
|
|
open_story_in_story_view: function(e) {
|
|
|
|
e.preventDefault();
|
|
|
|
e.stopPropagation();
|
2014-10-29 16:16:50 -07:00
|
|
|
NEWSBLUR.app.story_tab_view.prepare_story(this.model, true);
|
|
|
|
NEWSBLUR.app.story_tab_view.open_story(this.model);
|
2012-07-12 15:13:51 -07:00
|
|
|
return false;
|
2012-05-24 17:32:01 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
});
|