Selecting stories in discover popover.

This commit is contained in:
Samuel Clay 2023-10-12 08:56:05 -07:00
parent e93215fc46
commit 4e8637f97b
11 changed files with 2420 additions and 2365 deletions

View file

@ -1369,7 +1369,7 @@ img.feed_favicon {
margin-left: 36px;
}
.NB-story-titles-expand-sidebar {
background: url(/media/img/reader/chevron_sq_right.png) no-repeat center center;
background: url(/media/img/icons/nouns/nav-right.svg) no-repeat center center;
background-size: 16px;
width: 36px;
height: 36px;
@ -1713,7 +1713,7 @@ img.feed_favicon {
.NB-discover-feed-badges .NB-error {
clear: both;
font-size: 10px;
font-size: 12px;
color: #6A1000;
padding: 4px 0 0;
line-height: 14px;
@ -5349,6 +5349,9 @@ background: transparent;
display: none;
border-top: 1px solid #dbdbda;
}
#story_taskbar .NB-taskbar-flex {
display: flex;
}
#story_taskbar .NB-taskbar {
margin: 5px 0 0 0;
}
@ -5369,17 +5372,19 @@ background: transparent;
}
#story_taskbar .NB-taskbar-view {
float: left;
margin-left: 6px;
margin: 0 8px 0 6px;
}
#story_taskbar .NB-tryfeed-add,
#story_taskbar .NB-tryfeed-follow,
#story_taskbar .NB-tryfeed-signup {
display: none;
}
.NB-feedbar .NB-taskbar-nav {
float: right;
margin: 6px 18px 0 0;
font-weight: normal;
}
#story_taskbar .NB-taskbar-layout {
float: right;
margin-right: 18px;
}
.NB-taskbar .NB-task-title {
@ -5561,14 +5566,16 @@ background: transparent;
.NB-style-popover-container .popover-content {
padding: 0;
}
#story_taskbar .NB-modal-submit {
flex-grow: 1;
margin: 0 6px;
}
#story_taskbar .NB-taskbar-options-container {
float: right;
margin: 3px 24px 0 0;
flex-shrink: 1;
margin: 3px 0px;
}
#story_taskbar .NB-taskbar-options {
cursor: pointer;
float: right;
color: rgba(0, 0, 0, .5);
border: 1px solid rgba(0, 0, 0, .1);
border-radius: 16px;
@ -5578,6 +5585,8 @@ background: transparent;
padding: 1px 4px 1px 8px;
line-height: 14px;
margin: 6px 0 0;
display: flex;
flex-direction: row-reverse;
}
#story_taskbar .NB-taskbar-options:hover,
#story_taskbar .NB-taskbar-options.NB-active {

View file

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="150px" height="150px" viewBox="0 0 150 150" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>nav-left</title>
<g id="nav-left" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="noun-arrow-down-539125-95978E" transform="translate(75.4632, 75.4618) rotate(-270) translate(-75.4632, -75.4618)translate(6.3957, 36.6115)" fill="#95968E" fill-rule="nonzero">
<path d="M69.0678507,77.7005126 C66.8589658,77.7005126 64.6458723,76.8532176 62.9640378,75.171232 L2.53238309,14.7395773 C-0.844127698,11.3630665 -0.844127698,5.90835432 2.53238309,2.53238309 C5.90889388,-0.843588129 11.3636061,-0.844127698 14.7395773,2.53238309 L69.0676349,56.8604406 L123.395692,2.53238309 C126.772203,-0.844127698 132.226915,-0.844127698 135.602887,2.53238309 C138.978858,5.90889388 138.979397,11.3636061 135.602887,14.7395773 L75.171232,75.171232 C73.4892896,76.8531745 71.276196,77.7005126 69.0674191,77.7005126 L69.0678507,77.7005126 Z" id="Path"></path>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

View file

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="150px" height="150px" viewBox="0 0 150 150" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>nav-right</title>
<g id="nav-right" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="noun-arrow-down-539125-95978E" transform="translate(75.4632, 75.4618) rotate(-90) translate(-75.4632, -75.4618)translate(6.3957, 36.6115)" fill="#95968E" fill-rule="nonzero">
<path d="M69.0678507,77.7005126 C66.8589658,77.7005126 64.6458723,76.8532176 62.9640378,75.171232 L2.53238309,14.7395773 C-0.844127698,11.3630665 -0.844127698,5.90835432 2.53238309,2.53238309 C5.90889388,-0.843588129 11.3636061,-0.844127698 14.7395773,2.53238309 L69.0676349,56.8604406 L123.395692,2.53238309 C126.772203,-0.844127698 132.226915,-0.844127698 135.602887,2.53238309 C138.978858,5.90889388 138.979397,11.3636061 135.602887,14.7395773 L75.171232,75.171232 C73.4892896,76.8531745 71.276196,77.7005126 69.0674191,77.7005126 L69.0678507,77.7005126 Z" id="Path"></path>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

View file

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="150px" height="150px" viewBox="0 0 150 150" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>pulse</title>
<g id="pulse" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="noun-activity-1706408-95968E" transform="translate(1, 23)" fill="#95958E" fill-rule="nonzero">
<path d="M7.68345237,80.7864443 L29.5015995,80.7864443 L32.6205308,80.7864443 C35.1827689,80.7864443 38.0713825,79.3522056 39.2517145,76.9650934 C41.0174834,73.3940966 42.7832522,69.8037566 44.5633929,66.2327598 C47.3896058,60.5344919 50.1965334,54.8218088 53.0227462,49.1231712 C53.6657195,47.8141096 54.3135079,46.5050481 54.956432,45.1959865 C50.2733059,44.5799575 45.6045516,43.9639286 40.9211799,43.3623147 C41.6409257,45.1815714 42.3654867,46.9958999 43.0851833,48.8151567 C44.8222086,53.1899481 46.5543203,57.5647394 48.2913455,61.920557 C50.3929483,67.2338069 52.5138363,72.5470568 54.615439,77.8609227 C56.4292368,82.4329665 58.252493,87.0099386 60.0662907,91.582352 C60.9587687,93.815457 61.8320596,96.034147 62.7245867,98.267252 C62.7389806,98.296129 62.7533757,98.3298171 62.7533757,98.3586941 C63.0124862,98.9747231 63.2763873,99.5907521 63.5211013,100.192366 C63.9961331,101.08753 64.6582933,101.809442 65.5028161,102.348467 C66.7935777,103.349514 68.4682022,104.071377 70.1571985,103.994374 C73.5208193,103.840366 76.6684942,101.713095 77.5561078,98.344279 C78.3382298,95.3893113 79.1203027,92.4294153 79.9073135,89.4744475 C81.7642268,82.4189445 83.62114,75.3686161 85.4829667,68.327405 C87.7237427,59.8088331 89.983804,51.295436 92.2245801,42.7769873 C94.1726377,35.4134698 96.1112369,28.0403423 98.0592946,20.676332 C99.0093581,17.0859919 100.007352,13.5005801 100.899879,9.89582496 C100.914274,9.84769708 100.928668,9.80438285 100.928668,9.75625744 L86.1256906,9.75625744 C86.8022472,11.9267739 87.478853,14.0972904 88.1505208,16.2727351 C89.7627445,21.4801512 91.3893401,26.6970542 93.0015638,31.9050863 C94.9496214,38.1905531 96.9025925,44.4572926 98.8506501,50.7420202 C100.539646,56.1948622 102.228643,61.6477043 103.932011,67.0951253 C104.762113,69.7420785 105.529863,72.4083751 106.403105,75.0409133 C106.417499,75.0697891 106.417499,75.117917 106.431894,75.1467927 C107.444333,78.3953599 110.376038,80.7968872 113.830803,80.7968872 L122.765163,80.7968872 L137.030119,80.7968872 L140.316967,80.7968872 C142.28431,80.7968872 144.357169,79.9354077 145.753447,78.5493671 C147.087324,77.2114754 148.085368,75.0216156 147.994223,73.0965251 C147.903057,71.108846 147.25529,69.0441633 145.753447,67.643683 C144.24674,66.2576178 142.404198,65.3961629 140.316967,65.3961629 L131.382607,65.3961629 L117.117651,65.3961629 L113.830803,65.3961629 C116.301897,67.27308 118.758619,69.1693404 121.229712,71.0462575 C120.553156,68.875741 119.87655,66.7052245 119.204882,64.5297798 C117.592658,59.3223637 115.966063,54.1054607 114.353839,48.8974286 C112.405781,42.6119618 110.45281,36.3452223 108.504753,30.0604947 C106.815756,24.6076527 105.12676,19.1548106 103.423392,13.7073896 C102.59329,11.0604364 101.82554,8.39413976 100.952298,5.76160156 C100.937903,5.73272458 100.937903,5.68459793 100.923508,5.65572096 C100.414893,4.03864491 99.5128583,2.70075319 98.1740677,1.65153265 C96.883306,0.650485567 95.2086815,-0.0713771821 93.5196852,0.00562643932 C90.1560645,0.159633682 87.0083895,2.28690493 86.1207759,5.65572096 C85.3386539,8.61068873 84.5565811,11.5705847 83.7695702,14.5255525 C81.912657,21.5810555 80.0557437,28.6313839 78.1939171,35.672595 C75.953141,44.1911669 73.6930797,52.704564 71.4523037,61.2230127 C69.5042461,68.5865302 67.5656468,75.9596577 65.6175892,83.323668 C64.6675257,86.9140081 63.6695316,90.4994199 62.7770045,94.104175 C62.7626106,94.1523017 62.7482154,94.1956159 62.7482154,94.2437426 L77.5511932,94.2437426 C76.8314473,92.4244858 76.1068864,90.6101573 75.3871897,88.7909005 C73.6501645,84.4161092 71.9180527,80.0413178 70.1810275,75.6855002 C68.0794247,70.3722503 65.9585367,65.0590004 63.856934,59.7451345 C62.0431362,55.1730907 60.2198801,50.5961186 58.4060823,46.0237052 C57.5136044,43.7906002 56.6403134,41.5719102 55.7477864,39.3388052 C55.7333924,39.3099295 55.7189973,39.2762401 55.7189973,39.2473631 C55.2295691,38.0008901 54.7065576,36.8120774 53.7372826,35.8447887 C52.5377144,34.6416102 50.9878423,33.9485283 49.332503,33.7175174 C47.9362252,33.5346308 46.6598353,33.6886417 45.3547018,34.2421031 C43.910395,34.858132 42.4086009,35.9361827 41.6839908,37.3992516 C39.9182219,40.9702483 38.1524531,44.5605883 36.3723124,48.1315851 C33.5460995,53.8298531 30.7391719,59.5425361 27.9129591,65.2411737 C27.2699858,66.5502353 26.6221974,67.8592969 25.9792733,69.1683584 C28.1913056,67.888127 30.403338,66.6272389 32.610457,65.3470075 L10.7923099,65.3470075 L7.67337858,65.3470075 C5.70603569,65.3470075 3.6331766,66.2084871 2.23689871,67.5945276 C0.926974596,68.9757878 -0.0854404957,71.1607193 0.00570388644,73.0858099 C0.0968716075,75.0734889 0.744636697,77.1381716 2.24647992,78.5386519 C3.75318746,79.910302 5.6101007,80.786172 7.6829598,80.786172 L7.68345237,80.7864443 Z" id="Path"></path>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

File diff suppressed because it is too large Load diff

View file

@ -90,7 +90,7 @@ NEWSBLUR.DiscoverFeedsPopover = NEWSBLUR.ReaderPopover.extend({
collection: discover_feed.get("stories"),
$story_titles: $story_titles,
override_layout: 'split',
on_dashboard: discover_feed
on_discover: self
});
return [
new NEWSBLUR.Views.FeedBadge({

View file

@ -1,47 +1,47 @@
NEWSBLUR.Views.FeedList = Backbone.View.extend({
tagName: 'ul',
className: 'folder NB-feedlist',
options: {
sorting: "alphabetical"
},
initialize: function() {
initialize: function () {
this.$s = NEWSBLUR.reader.$s;
if (!this.$el.length) return;
if (this.options.feed_chooser) {
this.$el.addClass('NB-feedchooser');
this.$el.addClass('unread_view_positive');
if (this.options.organizer) {
if (this.options.organizer) {
this.$el.attr('id', 'NB-organizer-feeds');
} else {
this.$el.attr('id', 'NB-feedchooser-feeds');
}
return;
}
$('.NB-callout-ftux .NB-callout-text').text('Loading feeds...');
this.$s.$feed_link_loader.css({'display': 'block'});
this.$s.$feed_link_error.css({'display': 'none'});
NEWSBLUR.assets.feeds.bind('reset', _.bind(function(options) {
this.$s.$feed_link_loader.css({ 'display': 'block' });
this.$s.$feed_link_error.css({ 'display': 'none' });
NEWSBLUR.assets.feeds.bind('reset', _.bind(function (options) {
this.make_feeds(options);
// TODO: Refactor this to load after both feeds and social feeds load.
this.load_router();
this.show_read_stories_header();
this.update_dashboard_count();
this.scroll_to_selected();
}, this));
NEWSBLUR.assets.social_feeds.bind('reset', _.bind(function() {
NEWSBLUR.assets.social_feeds.bind('reset', _.bind(function () {
this.make_social_feeds();
}, this));
NEWSBLUR.assets.starred_feeds.bind('reset', _.bind(function(models, options) {
NEWSBLUR.assets.starred_feeds.bind('reset', _.bind(function (models, options) {
this.make_starred_tags(options);
}, this));
NEWSBLUR.assets.searches_feeds.bind('reset', _.bind(function(models, options) {
NEWSBLUR.assets.searches_feeds.bind('reset', _.bind(function (models, options) {
this.make_saved_searches(options);
}, this));
NEWSBLUR.assets.social_feeds.bind('change:selected', this.scroll_to_selected, this);
@ -53,7 +53,7 @@ NEWSBLUR.Views.FeedList = Backbone.View.extend({
}
NEWSBLUR.assets.feeds.bind('add', this.update_dashboard_count, this);
NEWSBLUR.assets.feeds.bind('remove', this.update_dashboard_count, this);
$('.NB-feeds-header-river-global .NB-feeds-header-icon').attr('src', $.favicon('river:global'));
$('.NB-feeds-header-river-blurblogs .NB-feeds-header-icon').attr('src', $.favicon('river:blurblogs'));
$('.NB-feeds-header-river-infrequent .NB-feeds-header-icon').attr('src', $.favicon('river:infrequent'));
@ -63,50 +63,50 @@ NEWSBLUR.Views.FeedList = Backbone.View.extend({
$('.NB-feeds-header-read .NB-feeds-header-icon').attr('src', $.favicon('read'));
$('.NB-feeds-header-starred .NB-feeds-header-icon').attr('src', $.favicon('starred'));
},
make_feeds: function(options) {
make_feeds: function (options) {
options = options || {};
var self = this;
var folders = options.folders || NEWSBLUR.assets.folders;
var feeds = NEWSBLUR.assets.feeds;
this.$el.empty();
this.$s.$story_taskbar.css({'display': 'block'});
this.$s.$story_taskbar.css({ 'display': 'flex' });
this.folder_view = new NEWSBLUR.Views.Folder({
collection: folders,
collection: folders,
root: true,
hierarchy: this.options.hierarchy,
feed_chooser: this.options.feed_chooser,
organizer: this.options.organizer
}).render();
this.$el.css({
'display': 'block',
'display': 'block',
'opacity': 0
});
this.$el.addClass("NB-sort-" + this.options.sorting);
this.$el.html(this.folder_view.el);
this.$el.animate({'opacity': 1}, {'duration': 700});
this.$el.animate({ 'opacity': 1 }, { 'duration': 700 });
// this.count_collapsed_unread_stories();
this.$s.$feed_link_error.css({'display': 'none'});
this.$s.$feed_link_loader.fadeOut(250, _.bind(function() {
this.$s.$feed_link_loader.css({'display': 'none'});
this.$s.$feed_link_error.css({ 'display': 'none' });
this.$s.$feed_link_loader.fadeOut(250, _.bind(function () {
this.$s.$feed_link_loader.css({ 'display': 'none' });
}, this));
if (!this.options.feed_chooser && !options.feed_selector) {
if (NEWSBLUR.Globals.is_authenticated &&
if (NEWSBLUR.Globals.is_authenticated &&
NEWSBLUR.assets.flags['has_chosen_feeds']) {
_.delay(function() {
_.delay(function () {
if (!NEWSBLUR.reader.flags['refresh_inline_feed_delay']) return;
NEWSBLUR.reader.start_count_unreads_after_import();
}, 1000);
NEWSBLUR.reader.flags['refresh_inline_feed_delay'] = true;
NEWSBLUR.reader.force_feeds_refresh(function() {
NEWSBLUR.reader.force_feeds_refresh(function () {
NEWSBLUR.reader.flags['refresh_inline_feed_delay'] = false;
NEWSBLUR.reader.finish_count_unreads_after_import();
}, true, null, function() {
}, true, null, function () {
NEWSBLUR.reader.flags['refresh_inline_feed_delay'] = false;
NEWSBLUR.reader.finish_count_unreads_after_import({error: true});
NEWSBLUR.reader.finish_count_unreads_after_import({ error: true });
});
}
@ -122,18 +122,18 @@ NEWSBLUR.Views.FeedList = Backbone.View.extend({
$('.NB-feeds-header-river-sites-container').css({
'display': 'block',
'opacity': 0
}).animate({'opacity': 1}, {'duration': 700});
}).animate({ 'opacity': 1 }, { 'duration': 700 });
}
if (NEWSBLUR.reader.flags['showing_feed_in_tryfeed_view'] ||
NEWSBLUR.reader.flags['showing_social_feed_in_tryfeed_view']) {
NEWSBLUR.reader.hide_tryfeed_view();
NEWSBLUR.reader.force_feed_refresh();
}
this.toggle_filter_feeds();
_.defer(_.bind(function() {
_.defer(_.bind(function () {
NEWSBLUR.reader.open_dialog_after_feeds_loaded();
NEWSBLUR.reader.toggle_focus_in_slider();
this.scroll_to_selected();
@ -145,32 +145,32 @@ NEWSBLUR.Views.FeedList = Backbone.View.extend({
}
}, this));
}
return this;
},
handle_error: function (model, resp, options) {
console.log(['Error loading feeds', model, resp, options]);
this.$s.$feed_link_error.css({ 'display': 'block' });
this.$s.$feed_link_loader.css({'display': 'none'});
this.$s.$feed_link_loader.css({ 'display': 'none' });
},
retry: function () {
if (!NEWSBLUR.assets.folders.size()) {
this.$s.$feed_link_loader.css({'display': 'block'});
this.$s.$feed_link_error.css({'display': 'none'});
this.$s.$feed_link_loader.css({ 'display': 'block' });
this.$s.$feed_link_error.css({ 'display': 'none' });
NEWSBLUR.assets.load_feeds(null, _.bind(this.handle_error, this));
}
},
toggle_filter_feeds: function() {
toggle_filter_feeds: function () {
if (NEWSBLUR.assets.preference('show_global_shared_stories')) {
$('.NB-feeds-header-river-global-container').css({
'display': 'block',
'opacity': 0
}).animate({'opacity': 1}, {'duration': 700});
}).animate({ 'opacity': 1 }, { 'duration': 700 });
} else {
$('.NB-feeds-header-river-global-container').css({
'display': 'none',
@ -182,7 +182,7 @@ NEWSBLUR.Views.FeedList = Backbone.View.extend({
$('.NB-feeds-header-river-infrequent-container').css({
'display': 'block',
'opacity': 0
}).animate({'opacity': 1}, {'duration': 700});
}).animate({ 'opacity': 1 }, { 'duration': 700 });
} else {
$('.NB-feeds-header-river-infrequent-container').css({
'display': 'none',
@ -190,14 +190,14 @@ NEWSBLUR.Views.FeedList = Backbone.View.extend({
});
}
},
make_social_feeds: function() {
make_social_feeds: function () {
var $social_feeds = $('.NB-socialfeeds', this.$s.$social_feeds);
var profile = NEWSBLUR.assets.user_profile;
var $feeds = NEWSBLUR.assets.social_feeds.map(function(feed) {
var $feeds = NEWSBLUR.assets.social_feeds.map(function (feed) {
var feed_view = new NEWSBLUR.Views.FeedTitleView({
model: feed,
type: 'feed',
model: feed,
type: 'feed',
depth: 0
}).render();
feed.views.push(feed_view);
@ -205,37 +205,37 @@ NEWSBLUR.Views.FeedList = Backbone.View.extend({
});
$social_feeds.empty().css({
'display': 'block',
'display': 'block',
'opacity': 0
});
});
$social_feeds.html($feeds);
if (NEWSBLUR.assets.social_feeds.length) {
$('.NB-feeds-header-river-blurblogs-container').css({
'display': 'block',
'opacity': 0
}).animate({'opacity': 1}, {'duration': 700});
}).animate({ 'opacity': 1 }, { 'duration': 700 });
}
var collapsed = NEWSBLUR.app.sidebar.check_river_blurblog_collapsed({skip_animation: true});
$social_feeds.animate({'opacity': 1}, {'duration': collapsed ? 0 : 700});
var collapsed = NEWSBLUR.app.sidebar.check_river_blurblog_collapsed({ skip_animation: true });
$social_feeds.animate({ 'opacity': 1 }, { 'duration': collapsed ? 0 : 700 });
// if (this.socket) {
// this.send_socket_active_feeds();
// }
$('.NB-module-stats-count-shared-stories .NB-module-stats-count-number').text(profile.get('shared_stories_count'));
$('.NB-module-stats-count-followers .NB-module-stats-count-number').text(profile.get('follower_count'));
$('.NB-module-stats-count-following .NB-module-stats-count-number').text(profile.get('following_count'));
},
make_starred_tags: function(options) {
make_starred_tags: function (options) {
options = options || {};
var $starred_feeds = $('.NB-starred-feeds', this.$s.$starred_feeds);
var $feeds = _.compact(NEWSBLUR.assets.starred_feeds.map(function(feed) {
var $feeds = _.compact(NEWSBLUR.assets.starred_feeds.map(function (feed) {
if (!feed.get('is_highlights') && (feed.get('tag') == "" || !feed.get('tag'))) return;
var feed_view = new NEWSBLUR.Views.FeedTitleView({
model: feed,
type: 'feed',
model: feed,
type: 'feed',
depth: 0,
starred_tag: true
}).render();
@ -244,28 +244,28 @@ NEWSBLUR.Views.FeedList = Backbone.View.extend({
}));
$starred_feeds.empty().css({
'display': 'block',
'display': 'block',
'opacity': options.update ? 1 : 0
});
});
$starred_feeds.html($feeds);
if (NEWSBLUR.assets.starred_feeds.length) {
$('.NB-feeds-header-starred-container').css({
'display': 'block',
'opacity': 0
}).animate({'opacity': 1}, {'duration': options.update ? 0 : 700});
}).animate({ 'opacity': 1 }, { 'duration': options.update ? 0 : 700 });
}
var collapsed = NEWSBLUR.app.sidebar.check_starred_collapsed({skip_animation: true});
$starred_feeds.animate({'opacity': 1}, {'duration': (collapsed || options.update) ? 0 : 700});
var collapsed = NEWSBLUR.app.sidebar.check_starred_collapsed({ skip_animation: true });
$starred_feeds.animate({ 'opacity': 1 }, { 'duration': (collapsed || options.update) ? 0 : 700 });
},
make_saved_searches: function(options) {
make_saved_searches: function (options) {
options = options || {};
var $searches_feeds = $('.NB-searches-feeds', this.$s.$searches_feeds);
var $feeds = _.compact(NEWSBLUR.assets.searches_feeds.map(function(feed) {
var $feeds = _.compact(NEWSBLUR.assets.searches_feeds.map(function (feed) {
var feed_view = new NEWSBLUR.Views.FeedTitleView({
model: feed,
type: 'feed',
model: feed,
type: 'feed',
depth: 0,
saved_search: true
}).render();
@ -274,25 +274,25 @@ NEWSBLUR.Views.FeedList = Backbone.View.extend({
}));
$searches_feeds.empty().css({
'display': 'block',
'display': 'block',
'opacity': options.update ? 1 : 0
});
});
$searches_feeds.html($feeds);
if (NEWSBLUR.assets.searches_feeds.length) {
$('.NB-feeds-header-searches-container').css({
'display': 'block',
'opacity': 0
}).animate({'opacity': 1}, {'duration': options.update ? 0 : 700});
}).animate({ 'opacity': 1 }, { 'duration': options.update ? 0 : 700 });
}
var collapsed = NEWSBLUR.app.sidebar.check_searches_collapsed({skip_animation: true});
$searches_feeds.animate({'opacity': 1}, {'duration': (collapsed || options.update) ? 0 : 700});
var collapsed = NEWSBLUR.app.sidebar.check_searches_collapsed({ skip_animation: true });
$searches_feeds.animate({ 'opacity': 1 }, { 'duration': (collapsed || options.update) ? 0 : 700 });
},
load_router: function() {
load_router: function () {
if (!NEWSBLUR.router) {
NEWSBLUR.router = new NEWSBLUR.Router;
var route_found = Backbone.history.start({pushState: true});
var route_found = Backbone.history.start({ pushState: true });
var next = this.load_url_next_param(route_found);
if (!next && !route_found && NEWSBLUR.assets.preference("autoopen_folder")) {
this.load_default_folder();
@ -300,11 +300,11 @@ NEWSBLUR.Views.FeedList = Backbone.View.extend({
}
},
load_url_next_param: function(route_found) {
load_url_next_param: function (route_found) {
var next = $.getQueryString('next') || $.getQueryString('test');
if (next) console.log(['load_url_next_param', next, route_found]);
if (next == 'optout') {
NEWSBLUR.reader.open_account_modal({'animate_email': true});
NEWSBLUR.reader.open_account_modal({ 'animate_email': true });
} else if (next == 'goodies') {
NEWSBLUR.reader.open_goodies_modal();
} else if (next == 'newsletters') {
@ -316,29 +316,29 @@ NEWSBLUR.Views.FeedList = Backbone.View.extend({
} else if (next == 'account') {
NEWSBLUR.reader.open_account_modal();
} else if (next == 'payments') {
NEWSBLUR.reader.open_account_modal({'tab': 'premium'});
NEWSBLUR.reader.open_account_modal({ 'tab': 'premium' });
} else if (next == 'opml') {
NEWSBLUR.reader.open_intro_modal({page_number: 2});
NEWSBLUR.reader.open_intro_modal({ page_number: 2 });
} else if (next == 'organizer') {
NEWSBLUR.reader.open_organizer_modal();
} else if (next == 'chooser') {
NEWSBLUR.reader.open_feedchooser_modal();
} else if (next == 'premium') {
NEWSBLUR.reader.open_feedchooser_modal({'premium_only': true});
NEWSBLUR.reader.open_feedchooser_modal({ 'premium_only': true });
} else if (next == 'renew') {
NEWSBLUR.reader.open_feedchooser_modal({'premium_only': true});
NEWSBLUR.reader.open_feedchooser_modal({ 'premium_only': true });
} else if (next == 'password') {
NEWSBLUR.reader.open_account_modal({'change_password': true});
NEWSBLUR.reader.open_account_modal({ 'change_password': true });
} else if (next == 'notifications') {
_.delay(function() {
_.delay(function () {
NEWSBLUR.reader.open_notifications_modal(NEWSBLUR.assets.active_feed && NEWSBLUR.assets.active_feed.id);
}, 200);
}
var url = $.getQueryString('url') || $.getQueryString('add');
if (url) {
NEWSBLUR.reader.open_add_feed_modal({url: url});
NEWSBLUR.reader.open_add_feed_modal({ url: url });
// Only trim the ?add=url if authenticated, otherwise keep it
if (!NEWSBLUR.Globals.is_authenticated) {
route_found = true;
@ -350,13 +350,13 @@ NEWSBLUR.Views.FeedList = Backbone.View.extend({
// In case this needs to be found again: window.location.href = BACKBONE
window.history.replaceState({}, null, '/');
}
return next;
},
load_default_folder: function() {
load_default_folder: function () {
var default_folder = NEWSBLUR.assets.preference('default_folder');
if (!default_folder || default_folder == "" || default_folder == "river:") {
NEWSBLUR.reader.open_river_stories();
} else {
@ -366,61 +366,61 @@ NEWSBLUR.Views.FeedList = Backbone.View.extend({
}
}
},
update_dashboard_count: function() {
update_dashboard_count: function () {
var feed_count = _.unique(NEWSBLUR.assets.folders.feed_ids_in_folder()).length;
$(".NB-module-stats-count-number-sites").html(Inflector.commas(feed_count));
},
// ===========
// = Actions =
// ===========
scroll_to_show_selected_feed: function() {
scroll_to_show_selected_feed: function () {
var $feed_lists = this.$s.$feed_lists;
var model = NEWSBLUR.assets.feeds.selected() ||
NEWSBLUR.assets.social_feeds.selected() ||
NEWSBLUR.assets.starred_feeds.selected() ||
NEWSBLUR.assets.searches_feeds.selected();
var model = NEWSBLUR.assets.feeds.selected() ||
NEWSBLUR.assets.social_feeds.selected() ||
NEWSBLUR.assets.starred_feeds.selected() ||
NEWSBLUR.assets.searches_feeds.selected();
if (!model) return;
var feed_view = model.get("selected_title_view");
if (!feed_view) {
feed_view = _.detect(model.views, _.bind(function(view) {
feed_view = _.detect(model.views, _.bind(function (view) {
return !!view.$el.closest(this.$s.$feed_lists).length;
}, this));
}
if (!feed_view) return;
if (!$feed_lists.isScrollVisible(feed_view.$el)) {
var scroll = feed_view.$el.position().top;
var container = $feed_lists.scrollTop();
var height = $feed_lists.outerHeight();
$feed_lists.scrollTop(scroll+container-height/5);
$feed_lists.scrollTop(scroll + container - height / 5);
}
return true;
},
scroll_to_show_highlighted_feed: function() {
scroll_to_show_highlighted_feed: function () {
var $feed_lists = this.$s.$feed_lists;
var $feed = $('.NB-feed-selector-selected');
if (!$feed.length) return;
var is_feed_visible = $feed_lists.isScrollVisible($feed);
if (!is_feed_visible) {
var scroll = $feed.position().top;
var container = $feed_lists.scrollTop();
var height = $feed_lists.outerHeight();
$feed_lists.scrollTop(scroll+container-height/5);
}
$feed_lists.scrollTop(scroll + container - height / 5);
}
},
scroll_to_show_selected_folder: function() {
scroll_to_show_selected_folder: function () {
var $feed_lists = this.$s.$feed_lists;
var $selected_view;
var folder = NEWSBLUR.assets.folders.selected();
if (folder) {
$selected_view = folder.folder_view.$el;
@ -431,7 +431,7 @@ NEWSBLUR.Views.FeedList = Backbone.View.extend({
$selected_view = folder.list_view.$el;
}
}
if (!$selected_view && NEWSBLUR.reader.active_feed == 'river:') {
$selected_view = NEWSBLUR.reader.$s.$river_sites_header.closest(".NB-feeds-header-container");
} else if (!$selected_view && NEWSBLUR.reader.active_feed == 'river:infrequent') {
@ -442,41 +442,41 @@ NEWSBLUR.Views.FeedList = Backbone.View.extend({
$selected_view = NEWSBLUR.reader.$s.$read_header.closest(".NB-feeds-header-container");
}
if (!$selected_view) return;
var is_folder_visible = $feed_lists.isScrollVisible($selected_view);
if (!is_folder_visible) {
var scroll = $selected_view.position().top;
var container = $feed_lists.scrollTop();
var height = $feed_lists.outerHeight();
$feed_lists.scrollTop(scroll+container-height/5);
$feed_lists.scrollTop(scroll + container - height / 5);
}
return true;
},
scroll_to_selected: function() {
scroll_to_selected: function () {
var found = this.scroll_to_show_selected_feed();
if (!found) {
this.scroll_to_show_selected_folder();
}
},
start_sorting: function() {
start_sorting: function () {
this.options.sorting = true;
},
end_sorting: function() {
end_sorting: function () {
this.options.sorting = false;
},
is_sorting: function() {
is_sorting: function () {
return this.options.sorting;
},
show_read_stories_header: function() {
show_read_stories_header: function () {
NEWSBLUR.reader.$s.$read_header.closest('.NB-feeds-header-read-container')
.addClass('NB-block');
.addClass('NB-block');
}
});

View file

@ -1,19 +1,19 @@
NEWSBLUR.Views.StoryTitleView = Backbone.View.extend({
className: 'NB-story-title-container',
events: {
"dblclick .NB-story-title" : "open_story_in_story_view",
"click .NB-story-title" : "select_story",
"contextmenu .NB-story-title" : "show_manage_menu_rightclick",
"click .NB-story-manage-icon" : "show_manage_menu",
"dblclick .NB-story-title": "open_story_in_story_view",
"click .NB-story-title": "select_story",
"contextmenu .NB-story-title": "show_manage_menu_rightclick",
"click .NB-story-manage-icon": "show_manage_menu",
"click .NB-storytitles-sentiment": "show_manage_menu",
"click .NB-storytitles-shares" : "select_story_shared",
"mouseenter .NB-story-title" : "mouseenter_manage_icon",
"mouseleave .NB-story-title" : "mouseleave_manage_icon"
"click .NB-storytitles-shares": "select_story_shared",
"mouseenter .NB-story-title": "mouseenter_manage_icon",
"mouseleave .NB-story-title": "mouseleave_manage_icon"
},
initialize: function() {
initialize: function () {
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.switch_story_view, this);
@ -23,12 +23,12 @@ NEWSBLUR.Views.StoryTitleView = Backbone.View.extend({
this.collection.bind('render:intelligence', this.render_intelligence, this);
this.model.story_title_view = this;
},
render: function() {
render: function () {
var template_name = 'template';
var story_layout = this.options.override_layout || NEWSBLUR.assets.view_setting(NEWSBLUR.reader.active_feed, 'layout');
var pane_anchor = this.options.override_layout ? "west" : NEWSBLUR.assets.preference('story_pane_anchor');
if (this.options.is_list) template_name = "list_template";
if (story_layout == 'split' && _.contains(['north', 'south'], pane_anchor)) template_name = "list_template";;
if (this.options.is_grid) template_name = "grid_template";
@ -36,16 +36,16 @@ NEWSBLUR.Views.StoryTitleView = Backbone.View.extend({
if (this.options.is_list || this.options.is_grid || this.options.is_magazine) {
if (this.model.get('selected')) template_name = "list_template";
}
// console.log(['render story title', template_name, this.$el[0], this.options.is_grid, this.show_image_preview(), this.options.override_layout, NEWSBLUR.assets.get_feed(this.model.get('story_feed_id'))]);
this.$el.html(this[template_name]({
story : this.model,
feed : (this.options.override_layout == 'split' ||
NEWSBLUR.reader.flags.river_view ||
NEWSBLUR.reader.flags.social_view) &&
NEWSBLUR.assets.get_feed(this.model.get('story_feed_id')),
options : this.options,
show_content_preview : this.show_content_preview(template_name),
story: this.model,
feed: (this.options.override_layout == 'split' ||
NEWSBLUR.reader.flags.river_view ||
NEWSBLUR.reader.flags.social_view) &&
NEWSBLUR.assets.get_feed(this.model.get('story_feed_id')),
options: this.options,
show_content_preview: this.show_content_preview(template_name),
show_image_preview: this.show_image_preview(),
show_inline_author: story_layout == "list",
pane_anchor: this.options.override_layout ? "west" : NEWSBLUR.assets.preference('story_pane_anchor')
@ -58,10 +58,10 @@ NEWSBLUR.Views.StoryTitleView = Backbone.View.extend({
if (this.options.is_grid) this.watch_grid_image();
if (_.contains(['list', 'magazine'], story_layout) && this.show_image_preview()) this.watch_grid_image();
if (_.contains(['split'], story_layout) && this.show_image_preview() && NEWSBLUR.assets.preference('feed_view_single_story')) this.watch_grid_image();
return this;
},
template: _.template('\
<div class="NB-story-title NB-story-title-split <% if (!show_content_preview) { %>NB-story-title-hide-preview<% } %> <% if (show_image_preview) { %>NB-has-image<% } %> ">\
<div class="NB-storytitles-feed-border-inner"></div>\
@ -110,7 +110,7 @@ NEWSBLUR.Views.StoryTitleView = Backbone.View.extend({
</div>\
<div class="NB-story-detail"></div>\
'),
list_template: _.template('\
<div class="NB-story-title NB-story-title-list <% if (!show_content_preview) { %>NB-story-title-hide-preview<% } %> <% if (show_image_preview) { %>NB-has-image<% } %> ">\
<div class="NB-storytitles-feed-border-inner"></div>\
@ -153,7 +153,7 @@ NEWSBLUR.Views.StoryTitleView = Backbone.View.extend({
</div>\
<div class="NB-story-detail"></div>\
'),
grid_template: _.template('\
<div class="NB-story-title NB-story-title-grid <% if (!show_content_preview) { %>NB-story-title-hide-preview<% } %>">\
<div class="NB-storytitles-feed-border-inner"></div>\
@ -196,7 +196,7 @@ NEWSBLUR.Views.StoryTitleView = Backbone.View.extend({
</div>\
<div class="NB-story-detail"></div>\
'),
magazine_template: _.template('\
<div class="NB-story-title NB-story-title-magazine <% if (!show_content_preview) { %>NB-story-title-hide-preview<% } %>">\
<div class="NB-storytitles-feed-border-inner"></div>\
@ -239,8 +239,8 @@ NEWSBLUR.Views.StoryTitleView = Backbone.View.extend({
</div>\
<div class="NB-story-detail"></div>\
'),
render_inline_story_detail: function(temporary_text) {
render_inline_story_detail: function (temporary_text) {
// console.log(['render_inline_story_detail', this.model.get('story_title')]);
if (NEWSBLUR.reader.story_view == 'text' || temporary_text) {
this.text_view = new NEWSBLUR.Views.TextTabView({
@ -265,12 +265,12 @@ NEWSBLUR.Views.StoryTitleView = Backbone.View.extend({
this.story_detail.setElement(this.story_detail.$el);
}
},
render_magazine_story_detail: function () {
this.render_inline_story_detail();
},
destroy: function() {
destroy: function () {
// console.log(["destroy story title", this.model.get('story_title')]);
if (this.text_view) {
this.text_view.destroy();
@ -282,8 +282,8 @@ NEWSBLUR.Views.StoryTitleView = Backbone.View.extend({
this.collection.unbind(null, null, this);
this.remove();
},
destroy_inline_story_detail: function() {
destroy_inline_story_detail: function () {
if (this.story_detail) {
this.story_detail.destroy();
}
@ -292,18 +292,18 @@ NEWSBLUR.Views.StoryTitleView = Backbone.View.extend({
}
// this.$(".NB-story-detail").empty();
},
collapse_story: function() {
collapse_story: function () {
this.model.set('selected', false);
NEWSBLUR.app.story_titles.fill_out();
},
render_intelligence: function(options) {
render_intelligence: function (options) {
options = options || {};
var score = this.model.score();
var unread_view = NEWSBLUR.reader.get_unread_view_score();
// console.log(['render_intelligence', score, unread_view, this.model.get('visible'), this.model.get('story_title')]);
if (score >= unread_view) {
this.$el.removeClass('NB-hidden');
this.$st.removeClass('NB-hidden');
@ -314,8 +314,8 @@ NEWSBLUR.Views.StoryTitleView = Backbone.View.extend({
this.model.set('visible', false);
}
},
show_content_preview: function(template_name) {
show_content_preview: function (template_name) {
var preference = NEWSBLUR.assets.preference('show_content_preview');
if (!preference) return preference;
var max_length = preference == 'small' ? 300 : preference == 'medium' ? 600 : 1000;
@ -327,43 +327,43 @@ NEWSBLUR.Views.StoryTitleView = Backbone.View.extend({
}
var pruned_description = this.model.content_preview('story_content', max_length) || " ";
var pruned_title = this.model.content_preview('story_title');
if (pruned_title.substr(0, 30) == pruned_description.substr(0, 30)) return false;
if (pruned_description.length < 30) return false;
return pruned_description;
},
show_image_preview: function () {
var show_image_preview = NEWSBLUR.assets.preference('image_preview');
if (!show_image_preview || show_image_preview == "none") {
return false;
}
var story_layout = this.options.override_layout ||
NEWSBLUR.assets.view_setting(NEWSBLUR.reader.active_feed, 'layout');
var story_layout = this.options.override_layout ||
NEWSBLUR.assets.view_setting(NEWSBLUR.reader.active_feed, 'layout');
var pane_anchor = this.options.override_layout ? "west" : NEWSBLUR.assets.preference('story_pane_anchor');
if (_.contains(['list', 'grid', 'magazine'], story_layout)) return true;
if (story_layout == 'split' && _.contains(['north', 'south'], pane_anchor)) return true;
return !!this.model.image_url();
},
// ============
// = Bindings =
// ============
color_feedbar: function() {
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'));
if (!feed) return;
$inner.css('background-color', '#' + feed.get('favicon_fade'));
$outer.css('background-color', '#' + feed.get('favicon_color'));
},
found_largest_image: function(image_url) {
found_largest_image: function (image_url) {
if (this.load_youtube_embeds()) {
return;
}
@ -373,8 +373,8 @@ NEWSBLUR.Views.StoryTitleView = Backbone.View.extend({
'display': 'block'
});
},
watch_grid_image: function(index) {
watch_grid_image: function (index) {
if (!index) index = 0;
var self = this;
if (!index && this.load_youtube_embeds()) {
@ -387,7 +387,7 @@ NEWSBLUR.Views.StoryTitleView = Backbone.View.extend({
// console.log(["watch_grid_image", index, this.model.image_url(index), this.model.get('story_title').substr(0, 30)]);
// this.model == NEWSBLUR.assets.stories.at(5) && console.log(["Watching images", index, this.model.image_url(index), this.model.get('story_title').substr(0, 30)]);
var $img = $("<img>");
$img.imagesLoaded(function() {
$img.imagesLoaded(function () {
// console.log(["Loaded", index, $img[0].width, $img.attr('src'), self.model.get('story_title').substr(0, 30)]);
if ($img[0].width > 60 && $img[0].height > 60) {
self.$(".NB-storytitles-story-image").css({
@ -395,15 +395,15 @@ NEWSBLUR.Views.StoryTitleView = Backbone.View.extend({
'display': 'block'
});
} else {
self.watch_grid_image(index+1);
self.watch_grid_image(index + 1);
}
}).attr('src', this.model.image_url(index)).each(function() {
}).attr('src', this.model.image_url(index)).each(function () {
// fail-safe for cached images which sometimes don't trigger "load" events
if (this.complete) $(this).trigger('load');
});
},
select_regex: function(query, url) {
select_regex: function (query, url) {
if (url == null) {
return;
}
@ -414,17 +414,17 @@ NEWSBLUR.Views.StoryTitleView = Backbone.View.extend({
return;
}
},
load_youtube_embeds: function() {
load_youtube_embeds: function () {
var text = this.model.get('story_content');
var g = /youtube\.com\/embed\/([A-Za-z0-9\-_]+)/gi;
var f = /youtube\.com\/v\/([A-Za-z0-9\-_]+)/gi;
var e = /ytimg\.com\/vi\/([A-Za-z0-9\-_]+)/gi;
var d = /youtube\.com\/watch\?v=([A-Za-z0-9\-_]+)/gi;
var i = this.select_regex(g, text) ||
this.select_regex(f, text) ||
this.select_regex(e, text) ||
this.select_regex(d, text);
var i = this.select_regex(g, text) ||
this.select_regex(f, text) ||
this.select_regex(e, text) ||
this.select_regex(d, text);
if (i) {
// this.$(".NB-storytitles-story-image").css({
// 'display': 'block',
@ -433,14 +433,14 @@ NEWSBLUR.Views.StoryTitleView = Backbone.View.extend({
return true;
}
},
toggle_classes: function() {
toggle_classes: function () {
var changes = this.model.changedAttributes();
if (changes && _.all(_.keys(changes), function(change) {
if (changes && _.all(_.keys(changes), function (change) {
return _.contains(['intelligence', 'read_status', 'selected'], change);
})) return;
var story = this.model;
var unread_view = NEWSBLUR.reader.get_unread_view_score();
@ -448,7 +448,7 @@ NEWSBLUR.Views.StoryTitleView = Backbone.View.extend({
this.$st.toggleClass('NB-story-shared', !!story.get('shared'));
this.toggle_intelligence();
this.render_intelligence();
if (NEWSBLUR.assets.preference('show_tooltips')) {
this.$('.NB-story-sentiment').tipsy({
delayIn: 375,
@ -456,22 +456,22 @@ NEWSBLUR.Views.StoryTitleView = Backbone.View.extend({
});
}
},
toggle_intelligence: function() {
toggle_intelligence: function () {
var score = this.model.score();
this.$st.removeClass('NB-story-negative NB-story-neutral NB-story-postiive')
.addClass('NB-story-'+this.model.score_name(score));
.addClass('NB-story-' + this.model.score_name(score));
},
toggle_read_status: function(model, read_status, options) {
toggle_read_status: function (model, read_status, options) {
options = options || {};
this.$st.toggleClass('read', !!this.model.get('read_status'));
if (options.error_marking_unread) {
var pane_alignment = NEWSBLUR.assets.preference('story_pane_anchor');
var $star = this.$('.NB-storytitles-sentiment');
$star.stop().css('opacity', null);
$star.attr({'title': options.message || 'Failed to mark as unread'});
$star.attr({ 'title': options.message || 'Failed to mark as unread' });
$star.tipsy({
gravity: pane_alignment == 'north' ? 'nw' : 'sw',
fade: true,
@ -479,10 +479,10 @@ NEWSBLUR.Views.StoryTitleView = Backbone.View.extend({
offsetOpposite: -1
});
var tipsy = $star.data('tipsy');
_.defer(function() {
_.defer(function () {
tipsy.enable();
tipsy.show();
_.delay(function() {
_.delay(function () {
if (tipsy.enabled) {
tipsy.hide();
tipsy.disable();
@ -491,15 +491,15 @@ NEWSBLUR.Views.StoryTitleView = Backbone.View.extend({
});
}
},
toggle_selected: function (model, selected, options) {
var story_layout = this.options.override_layout ||
NEWSBLUR.assets.view_setting(NEWSBLUR.reader.active_feed, 'layout');
NEWSBLUR.assets.view_setting(NEWSBLUR.reader.active_feed, 'layout');
if (this.options.is_grid) this.render();
this.$st.toggleClass('NB-selected', !!this.model.get('selected'));
this.$el.toggleClass('NB-selected', !!this.model.get('selected'));
if (!!this.model.get('selected')) {
if (_.contains(['list', 'grid'], story_layout)) {
this.render_inline_story_detail();
@ -513,19 +513,19 @@ NEWSBLUR.Views.StoryTitleView = Backbone.View.extend({
this.destroy_inline_story_detail();
}
},
toggle_starred: function() {
var story_titles_visible = _.contains(['split', 'full'], this.options.override_layout ||
NEWSBLUR.assets.view_setting(NEWSBLUR.reader.active_feed, 'layout'));
toggle_starred: function () {
var story_titles_visible = _.contains(['split', 'full'], this.options.override_layout ||
NEWSBLUR.assets.view_setting(NEWSBLUR.reader.active_feed, 'layout'));
var pane_alignment = NEWSBLUR.assets.preference('story_pane_anchor');
var $star = this.$('.NB-storytitles-star');
if (story_titles_visible) {
NEWSBLUR.app.story_titles.scroll_to_selected_story(this.model);
}
if (this.model.get('starred')) {
$star.attr({'title': 'Saved!'});
$star.attr({ 'title': 'Saved!' });
$star.tipsy({
gravity: pane_alignment == 'north' ? 'nw' : 'sw',
fade: true,
@ -533,7 +533,7 @@ NEWSBLUR.Views.StoryTitleView = Backbone.View.extend({
offsetOpposite: -1
});
var tipsy = $star.data('tipsy');
_.defer(function() {
_.defer(function () {
tipsy.enable();
tipsy.show();
});
@ -543,7 +543,7 @@ NEWSBLUR.Views.StoryTitleView = Backbone.View.extend({
}, {
'duration': 850,
'queue': false,
'complete': function() {
'complete': function () {
if (tipsy.enabled) {
tipsy.hide();
tipsy.disable();
@ -551,11 +551,11 @@ NEWSBLUR.Views.StoryTitleView = Backbone.View.extend({
}
});
} else {
this.$st.one('mouseout', _.bind(function() {
this.$st.one('mouseout', _.bind(function () {
this.$st.removeClass('NB-unstarred');
}, this));
$star.attr({'title': 'Removed'});
$star.attr({ 'title': 'Removed' });
$star.tipsy({
gravity: pane_alignment == 'north' ? 'nw' : 'sw',
fade: true,
@ -566,53 +566,60 @@ NEWSBLUR.Views.StoryTitleView = Backbone.View.extend({
tipsy.enable();
tipsy.show();
_.delay(function() {
_.delay(function () {
if (tipsy.enabled) {
tipsy.hide();
tipsy.disable();
}
}, 850);
}
},
// ==========
// = Events =
// ==========
select_story: function(e) {
select_story: function (e) {
if (NEWSBLUR.hotkeys.shift) return;
e.preventDefault();
e.stopPropagation();
if (e.which == 1 && $('.NB-menu-manage-container:visible').length) return;
if (this.options.on_dashboard) {
// console.log(['clicked story', this.model]);
this.options.on_dashboard.open_story(this.model);
return;
} else if (this.options.on_discover) {
console.log(['clicked story', this.model]);
NEWSBLUR.reader.load_feed_in_tryfeed_view(this.model.get('story_feed_id'), {
'feed': this.options.on_discover.feed,
'select_story_in_feed': this.model.get('story_hash')
});
this.options.on_discover.close();
}
if (_.contains(['list', 'grid', 'magazine'], this.options.override_layout ||
NEWSBLUR.assets.view_setting(NEWSBLUR.reader.active_feed, 'layout')) &&
if (_.contains(['list', 'grid', 'magazine'], this.options.override_layout ||
NEWSBLUR.assets.view_setting(NEWSBLUR.reader.active_feed, 'layout')) &&
this.model.get('selected')) {
this.collapse_story();
} else {
this.model.set('selected', true, {'click_on_story_title': true});
this.model.set('selected', true, { 'click_on_story_title': true });
}
if (NEWSBLUR.hotkeys.command) {
this.model.open_story_in_new_tab(true);
}
},
select_story_shared: function(e) {
select_story_shared: function (e) {
e.preventDefault();
e.stopPropagation();
this.model.set('selected', true, {'click_on_story_title': true});
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'});
NEWSBLUR.reader.switch_taskbar_view('feed', { skip_save_type: 'page' });
}
NEWSBLUR.app.story_list.scroll_to_selected_story(this.model, {
@ -620,20 +627,20 @@ NEWSBLUR.Views.StoryTitleView = Backbone.View.extend({
scroll_offset: -50
});
},
show_manage_menu_rightclick: function(e) {
show_manage_menu_rightclick: function (e) {
if (!NEWSBLUR.assets.preference('show_contextmenus')) return;
return this.show_manage_menu(e);
},
show_manage_menu: function(e) {
show_manage_menu: function (e) {
e.preventDefault();
e.stopPropagation();
if (this.options.on_dashboard) {
if (this.options.on_dashboard || this.options.on_discover) {
return this.select_story(e);
}
// NEWSBLUR.log(["showing manage menu", this.model.is_social() ? 'socialfeed' : 'feed', $(this.el), this]);
NEWSBLUR.reader.show_manage_menu('story', this.$st, {
story_id: this.model.id,
@ -642,23 +649,23 @@ NEWSBLUR.Views.StoryTitleView = Backbone.View.extend({
});
return false;
},
mouseenter_manage_icon: function() {
mouseenter_manage_icon: function () {
var menu_height = 270;
// console.log(["mouseenter_manage_icon", this.$el.offset().top, $(window).height(), menu_height]);
if (this.$el.offset().top > $(window).height() - menu_height) {
this.$st.addClass('NB-hover-inverse');
}
},
mouseleave_manage_icon: function() {
mouseleave_manage_icon: function () {
this.$st.removeClass('NB-hover-inverse');
},
open_story_in_story_view: function(e) {
open_story_in_story_view: function (e) {
e.preventDefault();
e.stopPropagation();
if (this.options.on_dashboard) {
if (this.options.on_dashboard || this.options.on_discover) {
return this.select_story(e);
}
@ -666,8 +673,8 @@ NEWSBLUR.Views.StoryTitleView = Backbone.View.extend({
NEWSBLUR.app.story_tab_view.open_story(this.model);
return false;
},
switch_story_view: function(story, selected, options) {
switch_story_view: function (story, selected, options) {
// console.log(['switch_story_view title', story, selected, options]);
if (selected && !options.selected_by_scrolling) {
var story_view = NEWSBLUR.assets.view_setting(story.get('story_feed_id'), 'view');

View file

@ -34,6 +34,7 @@ NEWSBLUR.Views.StoryTitlesView = Backbone.View.extend({
var story_layout = this.options.override_layout ||
NEWSBLUR.assets.view_setting(NEWSBLUR.reader.active_feed, 'layout');
var on_dashboard = this.options.on_dashboard;
var on_discover = this.options.on_discover;
var override_layout = this.options.override_layout;
var stories = this.collection.map(function (story) {
return new NEWSBLUR.Views.StoryTitleView({
@ -43,7 +44,8 @@ NEWSBLUR.Views.StoryTitlesView = Backbone.View.extend({
is_grid: story_layout == 'grid',
is_magazine: story_layout == 'magazine',
override_layout: override_layout,
on_dashboard: on_dashboard
on_dashboard: on_dashboard,
on_discover: on_discover
}).render();
});
this.stories = stories;
@ -66,6 +68,7 @@ NEWSBLUR.Views.StoryTitlesView = Backbone.View.extend({
var collection = this.collection;
if (options.added) {
var on_dashboard = this.options.on_dashboard;
var on_discover = this.options.on_discover;
var override_layout = this.options.override_layout;
var story_layout = this.options.override_layout ||
NEWSBLUR.assets.view_setting(NEWSBLUR.reader.active_feed, 'layout');
@ -78,7 +81,8 @@ NEWSBLUR.Views.StoryTitlesView = Backbone.View.extend({
is_grid: story_layout == 'grid',
is_magazine: story_layout == 'magazine',
override_layout: override_layout,
on_dashboard: on_dashboard
on_dashboard: on_dashboard,
on_discover: on_discover
}).render();
}));
this.stories = this.stories.concat(stories);
@ -86,7 +90,7 @@ NEWSBLUR.Views.StoryTitlesView = Backbone.View.extend({
return story.el;
});
this.$el.append($stories);
if (this.options.on_dashboard) {
if (this.options.on_dashboard || this.options.on_discover) {
var $extras = this.$el.find('.NB-story-title-container .NB-story-title:not(.NB-hidden)').slice(5);
$extras.addClass('NB-hidden');
}
@ -230,7 +234,7 @@ NEWSBLUR.Views.StoryTitlesView = Backbone.View.extend({
check_premium_river: function () {
if (!NEWSBLUR.Globals.is_premium &&
NEWSBLUR.Globals.is_authenticated &&
(this.options.on_dashboard || NEWSBLUR.reader.flags['river_view'])) {
(this.options.on_dashboard || this.options.on_discover || NEWSBLUR.reader.flags['river_view'])) {
this.show_no_more_stories();
this.append_river_premium_only_notification();
} else if (this.collection.no_more_stories) {
@ -351,7 +355,7 @@ NEWSBLUR.Views.StoryTitlesView = Backbone.View.extend({
var $story_titles = this.$story_titles;
var scroll_y = $story_titles.scrollTop();
if (!this.options.on_dashboard) {
if (!this.options.on_dashboard && !this.options.on_discover) {
if (NEWSBLUR.reader.flags['opening_feed']) return;
// if (NEWSBLUR.reader.flags['opening_story']) return;
if (NEWSBLUR.assets.preference('mark_read_on_scroll_titles')) {

View file

@ -18,11 +18,11 @@
</div>
<div class="NB-feeds-header-user-name">{{ social_profile.username }}</div>
<div class="NB-feeds-header-collapse-sidebar" role="button">
<img src="{{ MEDIA_URL }}/img/reader/chevron_sq_left.png">
<img src="{{ MEDIA_URL }}/img/icons/nouns/nav-left.svg">
</div>
<div class="NB-feeds-header-user-interactions" role="button">
<div class="NB-feeds-header-user-interactions-badge NB-hidden"></div>
<img src="{{ MEDIA_URL }}/img/icons/nouns/history.svg">
<img src="{{ MEDIA_URL }}/img/icons/nouns/pulse.svg">
</div>
<div class="NB-feeds-header-dashboard"></div>
</div>
@ -236,70 +236,76 @@
</div>
<div id="story_taskbar" class="NB-taskbar-container content-south">
<ul class="segmented-control NB-taskbar NB-taskbar-view">
<li class="NB-taskbar-button task_view_page NB-tipsy" tipsy-title="Original">
<div class="NB-task-image"></div>
<span class="NB-task-title">Original</span>
<span class="NB-task-original-return NB-task-title">
Return
</span>
<div class="NB-task-view-switch-arrow NB-task-view-page-to-feed-arrow"></div>
</li>
<li class="NB-taskbar-button task_view_feed NB-active NB-tipsy" tipsy-title="Feed">
<div class="NB-task-image"></div>
<span class="NB-task-title">Feed</span>
<div class="NB-task-view-switch-arrow NB-task-view-to-feed-arrow"></div>
</li>
<li class="NB-taskbar-button task_view_text NB-tipsy" tipsy-title="Text">
<div class="NB-task-image"></div>
<span class="NB-task-title">Text</span>
<div class="NB-task-view-switch-arrow NB-task-view-to-text-arrow"></div>
</li>
<li class="NB-taskbar-button task_view_story NB-tipsy" tipsy-title="Story">
<div class="NB-task-image"></div>
<span class="NB-task-title">Story</span>
<div class="NB-task-view-switch-arrow NB-task-view-to-story-arrow"></div>
</li>
</ul>
<div class="NB-taskbar-flex">
<ul class="segmented-control NB-taskbar NB-taskbar-view">
<li class="NB-taskbar-button task_view_page NB-tipsy" tipsy-title="Original">
<div class="NB-task-image"></div>
<span class="NB-task-title">Original</span>
<span class="NB-task-original-return NB-task-title">
Return
</span>
<div class="NB-task-view-switch-arrow NB-task-view-page-to-feed-arrow"></div>
</li>
<li class="NB-taskbar-button task_view_feed NB-active NB-tipsy" tipsy-title="Feed">
<div class="NB-task-image"></div>
<span class="NB-task-title">Feed</span>
<div class="NB-task-view-switch-arrow NB-task-view-to-feed-arrow"></div>
</li>
<li class="NB-taskbar-button task_view_text NB-tipsy" tipsy-title="Text">
<div class="NB-task-image"></div>
<span class="NB-task-title">Text</span>
<div class="NB-task-view-switch-arrow NB-task-view-to-text-arrow"></div>
</li>
<li class="NB-taskbar-button task_view_story NB-tipsy" tipsy-title="Story">
<div class="NB-task-image"></div>
<span class="NB-task-title">Story</span>
<div class="NB-task-view-switch-arrow NB-task-view-to-story-arrow"></div>
</li>
</ul>
<ul class="segmented-control NB-taskbar NB-taskbar-layout">
<li class="NB-taskbar-button NB-task-layout-full NB-tipsy" tipsy-title="Full">
<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>
<span class="NB-task-title">List</span>
</li>
<li class="NB-taskbar-button NB-task-layout-magazine NB-tipsy" tipsy-title="Magazine">
<div class="NB-task-image"></div>
<span class="NB-task-title">Magazine</span>
</li>
<li class="NB-taskbar-button NB-task-layout-grid NB-tipsy" tipsy-title="Grid">
<div class="NB-task-image"></div>
<span class="NB-task-title">Grid</span>
</li>
</ul>
<div class="NB-taskbar-options-container">
<span class="NB-taskbar-options" role="button">
<div class="NB-icon"></div>
Style
</span>
</div>
{% if not user.is_authenticated %}
<div class="NB-callout-ftux-signup NB-callout">
<div class="NB-callout-container">
<div class="NB-callout-text"></div>
<div class="NB-callout-arrow"></div>
<div class="NB-modal-submit"><div class="NB-tryfeed-add NB-modal-submit-green NB-modal-submit-button">Subscribe</div></div>
<div class="NB-modal-submit"><div class="NB-tryfeed-follow NB-modal-submit-green NB-modal-submit-button">Follow</div></div>
<div class="NB-modal-submit"><div class="NB-tryfeed-signup NB-modal-submit-green NB-modal-submit-button">Sign up</div></div>
<div class="NB-taskbar-options-container">
<span class="NB-taskbar-options" role="button">
<div class="NB-icon"></div>
Style
</span>
</div>
{% if not user.is_authenticated %}
<div class="NB-callout-ftux-signup NB-callout">
<div class="NB-callout-container">
<div class="NB-callout-text"></div>
<div class="NB-callout-arrow"></div>
</div>
</div>
{% endif %}
<ul class="segmented-control NB-taskbar NB-taskbar-layout">
<li class="NB-taskbar-button NB-task-layout-full NB-tipsy" tipsy-title="Full">
<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>
<span class="NB-task-title">List</span>
</li>
<li class="NB-taskbar-button NB-task-layout-magazine NB-tipsy" tipsy-title="Magazine">
<div class="NB-task-image"></div>
<span class="NB-task-title">Magazine</span>
</li>
<li class="NB-taskbar-button NB-task-layout-grid NB-tipsy" tipsy-title="Grid">
<div class="NB-task-image"></div>
<span class="NB-task-title">Grid</span>
</li>
</ul>
</div>
{% endif %}
</div>
<div class="content-pane">