mirror of
https://github.com/samuelclay/NewsBlur.git
synced 2025-09-18 21:50:56 +00:00
Styling
This commit is contained in:
parent
3abffebab4
commit
cb4e73b665
6 changed files with 183 additions and 163 deletions
|
@ -1697,6 +1697,17 @@ img.feed_favicon {
|
|||
filter: none;
|
||||
}
|
||||
|
||||
.NB-discover-popover .NB-discover-loading {
|
||||
margin: 24px 0;
|
||||
}
|
||||
|
||||
.NB-discover-popover .NB-loading.NB-active {
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
background-size: 32px;
|
||||
margin: 24px auto;
|
||||
}
|
||||
|
||||
.NB-discover-feed-badges .NB-story-titles {
|
||||
margin-left: 36px;
|
||||
}
|
||||
|
@ -5572,7 +5583,7 @@ background: transparent;
|
|||
}
|
||||
#story_taskbar .NB-taskbar-options-container {
|
||||
flex-shrink: 1;
|
||||
margin: 3px 0px;
|
||||
margin: 3px 12px;
|
||||
}
|
||||
#story_taskbar .NB-taskbar-options {
|
||||
cursor: pointer;
|
||||
|
@ -13819,10 +13830,8 @@ form.opml_import_form input {
|
|||
}
|
||||
.NB-popover-section-title {
|
||||
color: #585A55;
|
||||
text-transform: uppercase;
|
||||
margin: 12px 0 10px;
|
||||
font-size: 12px;
|
||||
font-weight: bold;
|
||||
font-size: 15px;
|
||||
}
|
||||
.NB-popover-section-title:first-child {
|
||||
margin-top: 0;
|
||||
|
@ -13840,7 +13849,7 @@ form.opml_import_form input {
|
|||
float: right;
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
margin-top: 8px;
|
||||
margin-top: 14px;
|
||||
cursor: pointer;
|
||||
background-size: 18px;
|
||||
}
|
||||
|
@ -14096,7 +14105,6 @@ form.opml_import_form input {
|
|||
clear: both;
|
||||
overflow: hidden;
|
||||
border-bottom: 1px solid #F0F0F0;
|
||||
box-shadow: 0 1px 2px rgba(0,0,0,0.1);
|
||||
}
|
||||
.NB-feed-badge:last-child {
|
||||
border-bottom: none;
|
||||
|
|
Binary file not shown.
|
@ -1,17 +1,18 @@
|
|||
NEWSBLUR.ReaderFeedException = function(feed_id, options) {
|
||||
NEWSBLUR.ReaderFeedException = function (feed_id, options) {
|
||||
var defaults = {
|
||||
'onOpen': function() {
|
||||
'onOpen': function () {
|
||||
$(window).trigger('resize.simplemodal');
|
||||
}
|
||||
},
|
||||
'width': 700
|
||||
};
|
||||
|
||||
|
||||
this.options = $.extend({}, defaults, options);
|
||||
this.model = NEWSBLUR.assets;
|
||||
this.model = NEWSBLUR.assets;
|
||||
this.feed_id = _.isString(feed_id) && _.string.startsWith(feed_id, 'feed:') ? parseInt(feed_id.replace('feed:', ''), 10) : feed_id;
|
||||
this.feed = this.model.get_feed(feed_id);
|
||||
this.folder_title = this.options.folder_title;
|
||||
this.folder = this.folder_title && NEWSBLUR.assets.get_folder(this.folder_title);
|
||||
|
||||
this.feed = this.model.get_feed(feed_id);
|
||||
this.folder_title = this.options.folder_title;
|
||||
this.folder = this.folder_title && NEWSBLUR.assets.get_folder(this.folder_title);
|
||||
|
||||
this.runner();
|
||||
};
|
||||
|
||||
|
@ -19,8 +20,8 @@ NEWSBLUR.ReaderFeedException.prototype = new NEWSBLUR.Modal;
|
|||
NEWSBLUR.ReaderFeedException.prototype.constructor = NEWSBLUR.ReaderFeedException;
|
||||
|
||||
_.extend(NEWSBLUR.ReaderFeedException.prototype, {
|
||||
|
||||
runner: function() {
|
||||
|
||||
runner: function () {
|
||||
if (this.folder) {
|
||||
NEWSBLUR.Modal.prototype.initialize_folder.call(this, this.folder_title);
|
||||
} else {
|
||||
|
@ -29,19 +30,19 @@ _.extend(NEWSBLUR.ReaderFeedException.prototype, {
|
|||
this.make_modal();
|
||||
if (this.feed) {
|
||||
this.show_recommended_options_meta();
|
||||
_.delay(_.bind(function() {
|
||||
_.delay(_.bind(function () {
|
||||
this.get_feed_settings();
|
||||
}, this), 50);
|
||||
}
|
||||
this.handle_cancel();
|
||||
this.open_modal();
|
||||
this.initialize_feed(this.feed_id);
|
||||
|
||||
|
||||
this.$modal.bind('click', $.rescope(this.handle_click, this));
|
||||
this.$modal.bind('change', $.rescope(this.handle_change, this));
|
||||
},
|
||||
|
||||
initialize_feed: function(feed_id) {
|
||||
initialize_feed: function (feed_id) {
|
||||
var view_setting = this.model.view_setting(feed_id, 'view');
|
||||
var story_layout = this.model.view_setting(feed_id, 'layout');
|
||||
|
||||
|
@ -54,20 +55,20 @@ _.extend(NEWSBLUR.ReaderFeedException.prototype, {
|
|||
} else if (this.folder) {
|
||||
NEWSBLUR.Modal.prototype.initialize_folder.call(this, feed_id);
|
||||
}
|
||||
|
||||
$('input[name=view_settings]', this.$modal).each(function() {
|
||||
|
||||
$('input[name=view_settings]', this.$modal).each(function () {
|
||||
if ($(this).val() == view_setting) {
|
||||
$(this).prop('checked', true);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
$('input[name=story_layout]', this.$modal).each(function() {
|
||||
$('input[name=story_layout]', this.$modal).each(function () {
|
||||
if ($(this).val() == story_layout) {
|
||||
$(this).prop('checked', true);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
if (this.folder) {
|
||||
this.$modal.addClass('NB-modal-folder-settings');
|
||||
this.$modal.removeClass('NB-modal-feed-settings');
|
||||
|
@ -84,36 +85,36 @@ _.extend(NEWSBLUR.ReaderFeedException.prototype, {
|
|||
|
||||
this.resize();
|
||||
},
|
||||
|
||||
get_feed_settings: function() {
|
||||
|
||||
get_feed_settings: function () {
|
||||
if (this.feed.is_starred()) return;
|
||||
|
||||
|
||||
var $loading = $('.NB-modal-loading', this.$modal);
|
||||
$loading.addClass('NB-active');
|
||||
|
||||
|
||||
var settings_fn = this.options.social_feed ? this.model.get_social_settings :
|
||||
this.model.get_feed_settings;
|
||||
this.model.get_feed_settings;
|
||||
settings_fn.call(this.model, this.feed_id, _.bind(this.populate_settings, this));
|
||||
},
|
||||
|
||||
populate_settings: function(data) {
|
||||
|
||||
populate_settings: function (data) {
|
||||
var $submit = $('.NB-modal-submit-save', this.$modal);
|
||||
var $loading = $('.NB-modal-loading', this.$modal);
|
||||
var $page_history = $(".NB-exception-page-history", this.$modal);
|
||||
var $feed_history = $(".NB-exception-feed-history", this.$modal);
|
||||
|
||||
|
||||
$feed_history.html(this.make_history(data, 'feed_fetch'));
|
||||
$page_history.html(this.make_history(data, 'page_fetch'));
|
||||
|
||||
|
||||
$loading.removeClass('NB-active');
|
||||
this.resize();
|
||||
},
|
||||
|
||||
make_modal: function() {
|
||||
|
||||
make_modal: function () {
|
||||
var self = this;
|
||||
|
||||
|
||||
this.$modal = $.make('div', { className: 'NB-modal-exception NB-modal' }, [
|
||||
(this.feed && $.make('div', { className: 'NB-modal-feed-chooser-container'}, [
|
||||
(this.feed && $.make('div', { className: 'NB-modal-feed-chooser-container' }, [
|
||||
this.make_feed_chooser()
|
||||
])),
|
||||
$.make('div', { className: 'NB-modal-loading' }),
|
||||
|
@ -134,79 +135,79 @@ _.extend(NEWSBLUR.ReaderFeedException.prototype, {
|
|||
]),
|
||||
$.make('div', { className: 'NB-fieldset-fields' }, [
|
||||
$.make('div', { className: 'NB-exception-input-wrapper' }, [
|
||||
$.make('div', { className: 'NB-preference-label'}, [
|
||||
$.make('div', { className: 'NB-preference-label' }, [
|
||||
'Reading view'
|
||||
]),
|
||||
$.make('div', { className: 'NB-preference-options NB-view-settings' }, [
|
||||
$.make('div', { className: "NB-view-setting-original" }, [
|
||||
$.make('label', { 'for': 'NB-preference-view-1' }, [
|
||||
$.make('input', { id: 'NB-preference-view-1', type: 'radio', name: 'view_settings', value: 'page' }),
|
||||
$.make("img", { src: NEWSBLUR.Globals.MEDIA_URL+'/img/icons/circular/nav_story_original_active.png' }),
|
||||
$.make("img", { src: NEWSBLUR.Globals.MEDIA_URL + '/img/icons/circular/nav_story_original_active.png' }),
|
||||
$.make("div", { className: "NB-view-title" }, "Original")
|
||||
])
|
||||
]),
|
||||
$.make('div', [
|
||||
$.make('label', { 'for': 'NB-preference-view-2' }, [
|
||||
$.make('input', { id: 'NB-preference-view-2', type: 'radio', name: 'view_settings', value: 'feed' }),
|
||||
$.make("img", { src: NEWSBLUR.Globals.MEDIA_URL+'/img/icons/circular/nav_story_feed_active.png' }),
|
||||
$.make("img", { src: NEWSBLUR.Globals.MEDIA_URL + '/img/icons/circular/nav_story_feed_active.png' }),
|
||||
$.make("div", { className: "NB-view-title" }, "Feed")
|
||||
])
|
||||
]),
|
||||
$.make('div', [
|
||||
$.make('label', { 'for': 'NB-preference-view-3' }, [
|
||||
$.make('input', { id: 'NB-preference-view-3', type: 'radio', name: 'view_settings', value: 'text' }),
|
||||
$.make("img", { src: NEWSBLUR.Globals.MEDIA_URL+'/img/icons/circular/nav_story_text_active.png' }),
|
||||
$.make("img", { src: NEWSBLUR.Globals.MEDIA_URL + '/img/icons/circular/nav_story_text_active.png' }),
|
||||
$.make("div", { className: "NB-view-title" }, "Text")
|
||||
])
|
||||
]),
|
||||
$.make('div', [
|
||||
$.make('label', { 'for': 'NB-preference-view-4' }, [
|
||||
$.make('input', { id: 'NB-preference-view-4', type: 'radio', name: 'view_settings', value: 'story' }),
|
||||
$.make("img", { src: NEWSBLUR.Globals.MEDIA_URL+'/img/icons/circular/nav_story_story_active.png' }),
|
||||
$.make("img", { src: NEWSBLUR.Globals.MEDIA_URL + '/img/icons/circular/nav_story_story_active.png' }),
|
||||
$.make("div", { className: "NB-view-title" }, "Story")
|
||||
])
|
||||
])
|
||||
]),
|
||||
$.make('div', { className: 'NB-preference-label'}, [
|
||||
$.make('div', { className: 'NB-preference-label' }, [
|
||||
'Story layout'
|
||||
]),
|
||||
$.make('div', { className: 'NB-preference-options NB-view-settings' }, [
|
||||
$.make('div', { className: "" }, [
|
||||
$.make('label', { 'for': 'NB-preference-layout-1' }, [
|
||||
$.make('input', { id: 'NB-preference-layout-1', type: 'radio', name: 'story_layout', value: 'full' }),
|
||||
$.make("img", { src: NEWSBLUR.Globals.MEDIA_URL+'/img/icons/circular/nav_story_full_active.png' }),
|
||||
$.make("img", { src: NEWSBLUR.Globals.MEDIA_URL + '/img/icons/circular/nav_story_full_active.png' }),
|
||||
$.make("div", { className: "NB-layout-title" }, "Full")
|
||||
])
|
||||
]),
|
||||
$.make('div', [
|
||||
$.make('label', { 'for': 'NB-preference-layout-2' }, [
|
||||
$.make('input', { id: 'NB-preference-layout-2', type: 'radio', name: 'story_layout', value: 'split' }),
|
||||
$.make("img", { src: NEWSBLUR.Globals.MEDIA_URL+'/img/icons/circular/nav_story_split_active.png' }),
|
||||
$.make("img", { src: NEWSBLUR.Globals.MEDIA_URL + '/img/icons/circular/nav_story_split_active.png' }),
|
||||
$.make("div", { className: "NB-layout-title" }, "Split")
|
||||
])
|
||||
]),
|
||||
$.make('div', [
|
||||
$.make('label', { 'for': 'NB-preference-layout-3' }, [
|
||||
$.make('input', { id: 'NB-preference-layout-3', type: 'radio', name: 'story_layout', value: 'list' }),
|
||||
$.make("img", { src: NEWSBLUR.Globals.MEDIA_URL+'/img/icons/circular/nav_story_list_active.png' }),
|
||||
$.make("img", { src: NEWSBLUR.Globals.MEDIA_URL + '/img/icons/circular/nav_story_list_active.png' }),
|
||||
$.make("div", { className: "NB-layout-title" }, "List")
|
||||
])
|
||||
]),
|
||||
$.make('div', [
|
||||
$.make('label', { 'for': 'NB-preference-layout-4' }, [
|
||||
$.make('input', { id: 'NB-preference-layout-4', type: 'radio', name: 'story_layout', value: 'grid' }),
|
||||
$.make("img", { src: NEWSBLUR.Globals.MEDIA_URL+'/img/icons/circular/nav_story_grid_active.png' }),
|
||||
$.make("img", { src: NEWSBLUR.Globals.MEDIA_URL + '/img/icons/circular/nav_story_grid_active.png' }),
|
||||
$.make("div", { className: "NB-layout-title" }, "Grid")
|
||||
])
|
||||
]),
|
||||
$.make('div', [
|
||||
$.make('label', { 'for': 'NB-preference-layout-5' }, [
|
||||
$.make('input', { id: 'NB-preference-layout-5', type: 'radio', name: 'story_layout', value: 'magazine' }),
|
||||
$.make("img", { src: NEWSBLUR.Globals.MEDIA_URL+'/img/icons/circular/nav_story_magazine_active.png' }),
|
||||
$.make("img", { src: NEWSBLUR.Globals.MEDIA_URL + '/img/icons/circular/nav_story_magazine_active.png' }),
|
||||
$.make("div", { className: "NB-layout-title" }, "Magazine")
|
||||
])
|
||||
])
|
||||
])
|
||||
])
|
||||
])
|
||||
])
|
||||
]),
|
||||
|
@ -291,8 +292,8 @@ _.extend(NEWSBLUR.ReaderFeedException.prototype, {
|
|||
$.make('input', { type: 'text', id: 'NB-exception-input-focus', className: 'NB-exception-input-focus NB-input', name: 'folder_rss_focus_url', value: this.folder.rss_url('focus') })
|
||||
]),
|
||||
(!NEWSBLUR.Globals.is_premium && $.make('div', { className: 'NB-premium-only' }, [
|
||||
$.make('div', { className: 'NB-premium-only-divider'}),
|
||||
$.make('div', { className: 'NB-premium-only-text'}, [
|
||||
$.make('div', { className: 'NB-premium-only-divider' }),
|
||||
$.make('div', { className: 'NB-premium-only-text' }, [
|
||||
'RSS feeds for folders is a ',
|
||||
$.make('a', { href: '#', className: 'NB-premium-only-link NB-splash-link' }, 'premium feature'),
|
||||
'.'
|
||||
|
@ -315,20 +316,20 @@ _.extend(NEWSBLUR.ReaderFeedException.prototype, {
|
|||
])
|
||||
]);
|
||||
},
|
||||
|
||||
make_history: function(data, fetch_type) {
|
||||
var fetches = data[fetch_type+'_history'];
|
||||
|
||||
make_history: function (data, fetch_type) {
|
||||
var fetches = data[fetch_type + '_history'];
|
||||
var $history;
|
||||
|
||||
|
||||
if (fetches && fetches.length) {
|
||||
$history = _.map(fetches, function(fetch) {
|
||||
$history = _.map(fetches, function (fetch) {
|
||||
var feed_ok = _.contains([200, 304], fetch.status_code) || !fetch.status_code;
|
||||
var status_class = feed_ok ? ' NB-ok ' : ' NB-errorcode ';
|
||||
return $.make('div', { className: 'NB-history-fetch' + status_class, title: feed_ok ? '' : fetch.exception }, [
|
||||
$.make('div', { className: 'NB-history-fetch-date' }, fetch.fetch_date || fetch.push_date),
|
||||
$.make('div', { className: 'NB-history-fetch-message' }, [
|
||||
fetch.message,
|
||||
(fetch.status_code && $.make('div', { className: 'NB-history-fetch-code' }, ' ('+fetch.status_code+')'))
|
||||
(fetch.status_code && $.make('div', { className: 'NB-history-fetch-code' }, ' (' + fetch.status_code + ')'))
|
||||
])
|
||||
]);
|
||||
});
|
||||
|
@ -336,83 +337,83 @@ _.extend(NEWSBLUR.ReaderFeedException.prototype, {
|
|||
|
||||
return $.make('div', $history);
|
||||
},
|
||||
|
||||
show_recommended_options_meta: function() {
|
||||
var $meta_retry = $('.NB-exception-option-retry .NB-exception-option-meta', this.$modal);
|
||||
var $meta_page = $('.NB-exception-option-page .NB-exception-option-meta', this.$modal);
|
||||
var $meta_feed = $('.NB-exception-option-feed .NB-exception-option-meta', this.$modal);
|
||||
var is_400 = (400 <= this.feed.get('exception_code') && this.feed.get('exception_code') < 500);
|
||||
|
||||
if (!is_400) {
|
||||
$meta_retry.addClass('NB-exception-option-meta-recommended');
|
||||
$meta_retry.text('Recommended');
|
||||
return;
|
||||
}
|
||||
if (this.feed.get('exception_type') == 'feed') {
|
||||
$meta_page.addClass('NB-exception-option-meta-recommended');
|
||||
$meta_page.text('Recommended');
|
||||
}
|
||||
if (this.feed.get('exception_type') == 'page') {
|
||||
if (is_400) {
|
||||
$meta_feed.addClass('NB-exception-option-meta-recommended');
|
||||
$meta_feed.text('Recommended');
|
||||
} else {
|
||||
$meta_page.addClass('NB-exception-option-meta-recommended');
|
||||
$meta_page.text('Recommended');
|
||||
}
|
||||
}
|
||||
|
||||
show_recommended_options_meta: function () {
|
||||
var $meta_retry = $('.NB-exception-option-retry .NB-exception-option-meta', this.$modal);
|
||||
var $meta_page = $('.NB-exception-option-page .NB-exception-option-meta', this.$modal);
|
||||
var $meta_feed = $('.NB-exception-option-feed .NB-exception-option-meta', this.$modal);
|
||||
var is_400 = (400 <= this.feed.get('exception_code') && this.feed.get('exception_code') < 500);
|
||||
|
||||
if (!is_400) {
|
||||
$meta_retry.addClass('NB-exception-option-meta-recommended');
|
||||
$meta_retry.text('Recommended');
|
||||
return;
|
||||
}
|
||||
if (this.feed.get('exception_type') == 'feed') {
|
||||
$meta_page.addClass('NB-exception-option-meta-recommended');
|
||||
$meta_page.text('Recommended');
|
||||
}
|
||||
if (this.feed.get('exception_type') == 'page') {
|
||||
if (is_400) {
|
||||
$meta_feed.addClass('NB-exception-option-meta-recommended');
|
||||
$meta_feed.text('Recommended');
|
||||
} else {
|
||||
$meta_page.addClass('NB-exception-option-meta-recommended');
|
||||
$meta_page.text('Recommended');
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
handle_cancel: function() {
|
||||
|
||||
handle_cancel: function () {
|
||||
var $cancel = $('.NB-modal-cancel', this.$modal);
|
||||
|
||||
$cancel.click(function(e) {
|
||||
|
||||
$cancel.click(function (e) {
|
||||
e.preventDefault();
|
||||
$.modal.close();
|
||||
});
|
||||
},
|
||||
|
||||
save_retry_feed: function() {
|
||||
|
||||
save_retry_feed: function () {
|
||||
var $loading = $('.NB-modal-loading', this.$modal);
|
||||
$loading.addClass('NB-active');
|
||||
var feed_id = this.feed_id;
|
||||
|
||||
|
||||
$('.NB-modal-submit-retry', this.$modal).addClass('NB-disabled').attr('value', 'Fetching...');
|
||||
|
||||
this.model.save_exception_retry(feed_id, function() {
|
||||
|
||||
this.model.save_exception_retry(feed_id, function () {
|
||||
NEWSBLUR.reader.force_feed_refresh(feed_id);
|
||||
$.modal.close();
|
||||
});
|
||||
},
|
||||
|
||||
delete_feed: function() {
|
||||
|
||||
delete_feed: function () {
|
||||
var $loading = $('.NB-modal-loading', this.$modal);
|
||||
$loading.addClass('NB-active');
|
||||
|
||||
|
||||
$('.NB-modal-submit-delete', this.$modal).addClass('NB-disabled').attr('value', 'Deleting...');
|
||||
|
||||
|
||||
var feed_id = this.feed_id;
|
||||
|
||||
|
||||
// this.model.delete_feed(feed_id, function() {
|
||||
NEWSBLUR.reader.manage_menu_delete_feed(feed_id);
|
||||
_.delay(function() { $.modal.close(); }, 500);
|
||||
_.delay(function () { $.modal.close(); }, 500);
|
||||
// });
|
||||
},
|
||||
|
||||
change_feed_address: function() {
|
||||
|
||||
change_feed_address: function () {
|
||||
var feed_id = this.feed_id;
|
||||
var $loading = $('.NB-modal-loading', this.$modal);
|
||||
var $feed_address = $('input[name=feed_address]', this.$modal);
|
||||
var $submit = $('.NB-modal-submit-address', this.$modal);
|
||||
var $error = $feed_address.closest('.NB-exception-option').find('.NB-error');
|
||||
var feed_address = $feed_address.val();
|
||||
|
||||
|
||||
$loading.addClass('NB-active');
|
||||
$submit.addClass('NB-disabled').attr('value', 'Parsing...');
|
||||
$error.hide().html('');
|
||||
|
||||
|
||||
if (feed_address.length) {
|
||||
this.model.save_exception_change_feed_address(feed_id, feed_address, _.bind(function(data) {
|
||||
this.model.save_exception_change_feed_address(feed_id, feed_address, _.bind(function (data) {
|
||||
console.log(["return to change address", data]);
|
||||
NEWSBLUR.assets.feeds.add(_.values(data.feeds));
|
||||
var feed = NEWSBLUR.assets.get_feed(data.new_feed_id || feed_id);
|
||||
|
@ -420,15 +421,15 @@ _.extend(NEWSBLUR.ReaderFeedException.prototype, {
|
|||
if (data.new_feed_id != feed_id && old_feed.get('selected')) {
|
||||
old_feed.set('selected', false);
|
||||
}
|
||||
|
||||
|
||||
if (data && data.new_feed_id) {
|
||||
NEWSBLUR.assets.load_feeds(function() {
|
||||
NEWSBLUR.assets.load_feeds(function () {
|
||||
var feed = NEWSBLUR.assets.get_feed(data.new_feed_id || feed_id);
|
||||
console.log(["Loading feed", data.new_feed_id || feed_id, feed]);
|
||||
NEWSBLUR.reader.open_feed(feed.id);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
console.log(["feed address", feed, NEWSBLUR.assets.get_feed(feed_id)]);
|
||||
if (!data || data.code < 0 || !data.new_feed_id) {
|
||||
var error = data.message || "There was a problem fetching the feed from this URL.";
|
||||
|
@ -443,8 +444,8 @@ _.extend(NEWSBLUR.ReaderFeedException.prototype, {
|
|||
}, this));
|
||||
}
|
||||
},
|
||||
|
||||
change_feed_link: function() {
|
||||
|
||||
change_feed_link: function () {
|
||||
var feed_id = this.feed_id;
|
||||
var $feed_link = $('input[name=feed_link]', this.$modal);
|
||||
var $loading = $('.NB-modal-loading', this.$modal);
|
||||
|
@ -457,22 +458,22 @@ _.extend(NEWSBLUR.ReaderFeedException.prototype, {
|
|||
$error.hide().html('');
|
||||
|
||||
if (feed_link.length) {
|
||||
this.model.save_exception_change_feed_link(feed_id, feed_link, _.bind(function(data) {
|
||||
this.model.save_exception_change_feed_link(feed_id, feed_link, _.bind(function (data) {
|
||||
var old_feed = NEWSBLUR.assets.get_feed(feed_id);
|
||||
if (data.new_feed_id != feed_id && old_feed.get('selected')) {
|
||||
old_feed.set('selected', false);
|
||||
}
|
||||
|
||||
|
||||
if (data && data.new_feed_id) {
|
||||
NEWSBLUR.assets.load_feeds(function() {
|
||||
NEWSBLUR.assets.load_feeds(function () {
|
||||
var feed = NEWSBLUR.assets.get_feed(data.new_feed_id || feed_id);
|
||||
console.log(["Loading feed", data.new_feed_id || feed_id, feed]);
|
||||
NEWSBLUR.reader.open_feed(feed.id);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
var feed = NEWSBLUR.assets.get_feed(data.new_feed_id) || NEWSBLUR.assets.get_feed(feed_id);
|
||||
|
||||
|
||||
if (!data || data.code < 0 || !data.new_feed_id) {
|
||||
var error = data.message || "There was a problem fetching the feed from this URL.";
|
||||
if (feed.get('exception_code') == '404') {
|
||||
|
@ -486,84 +487,84 @@ _.extend(NEWSBLUR.ReaderFeedException.prototype, {
|
|||
}, this));
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
// ===========
|
||||
// = Actions =
|
||||
// ===========
|
||||
|
||||
handle_click: function(elem, e) {
|
||||
handle_click: function (elem, e) {
|
||||
var self = this;
|
||||
|
||||
$.targetIs(e, { tagSelector: '.NB-modal-submit-retry' }, function($t, $p) {
|
||||
|
||||
$.targetIs(e, { tagSelector: '.NB-modal-submit-retry' }, function ($t, $p) {
|
||||
e.preventDefault();
|
||||
|
||||
|
||||
self.save_retry_feed();
|
||||
});
|
||||
$.targetIs(e, { tagSelector: '.NB-modal-submit-delete' }, function($t, $p) {
|
||||
$.targetIs(e, { tagSelector: '.NB-modal-submit-delete' }, function ($t, $p) {
|
||||
e.preventDefault();
|
||||
|
||||
|
||||
self.delete_feed();
|
||||
});
|
||||
$.targetIs(e, { tagSelector: '.NB-modal-submit-address' }, function($t, $p) {
|
||||
$.targetIs(e, { tagSelector: '.NB-modal-submit-address' }, function ($t, $p) {
|
||||
e.preventDefault();
|
||||
|
||||
|
||||
self.change_feed_address();
|
||||
});
|
||||
$.targetIs(e, { tagSelector: '.NB-modal-submit-link' }, function($t, $p) {
|
||||
$.targetIs(e, { tagSelector: '.NB-modal-submit-link' }, function ($t, $p) {
|
||||
e.preventDefault();
|
||||
|
||||
|
||||
self.change_feed_link();
|
||||
});
|
||||
$.targetIs(e, { tagSelector: '.NB-premium-only-link' }, function($t, $p){
|
||||
$.targetIs(e, { tagSelector: '.NB-premium-only-link' }, function ($t, $p) {
|
||||
e.preventDefault();
|
||||
|
||||
self.close(function() {
|
||||
NEWSBLUR.reader.open_feedchooser_modal({premium_only: true});
|
||||
|
||||
self.close(function () {
|
||||
NEWSBLUR.reader.open_feedchooser_modal({ premium_only: true });
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
animate_saved: function() {
|
||||
|
||||
animate_saved: function () {
|
||||
var $status = $('.NB-exception-option-view .NB-exception-option-status', this.$modal);
|
||||
$status.text('Saved').animate({
|
||||
'opacity': 1
|
||||
}, {
|
||||
'queue': false,
|
||||
'duration': 600,
|
||||
'complete': function() {
|
||||
_.delay(function() {
|
||||
$status.animate({'opacity': 0}, {'queue': false, 'duration': 1000});
|
||||
'complete': function () {
|
||||
_.delay(function () {
|
||||
$status.animate({ 'opacity': 0 }, { 'queue': false, 'duration': 1000 });
|
||||
}, 300);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
handle_change: function(elem, e) {
|
||||
|
||||
handle_change: function (elem, e) {
|
||||
var self = this;
|
||||
|
||||
$.targetIs(e, { tagSelector: '.NB-modal-feed-chooser' }, function($t, $p){
|
||||
|
||||
$.targetIs(e, { tagSelector: '.NB-modal-feed-chooser' }, function ($t, $p) {
|
||||
var feed_id = $t.val();
|
||||
self.first_load = false;
|
||||
self.initialize_feed(feed_id);
|
||||
self.get_feed_settings();
|
||||
});
|
||||
|
||||
$.targetIs(e, { tagSelector: 'input[name=view_settings]' }, function($t, $p){
|
||||
|
||||
$.targetIs(e, { tagSelector: 'input[name=view_settings]' }, function ($t, $p) {
|
||||
if (self.folder) {
|
||||
self.folder.view_setting({'view': $t.val()});
|
||||
self.folder.view_setting({ 'view': $t.val() });
|
||||
} else {
|
||||
NEWSBLUR.assets.view_setting(self.feed_id, {'view': $t.val()});
|
||||
NEWSBLUR.assets.view_setting(self.feed_id, { 'view': $t.val() });
|
||||
}
|
||||
self.animate_saved();
|
||||
});
|
||||
$.targetIs(e, { tagSelector: 'input[name=story_layout]' }, function($t, $p){
|
||||
$.targetIs(e, { tagSelector: 'input[name=story_layout]' }, function ($t, $p) {
|
||||
if (self.folder) {
|
||||
self.folder.view_setting({'layout': $t.val()});
|
||||
self.folder.view_setting({ 'layout': $t.val() });
|
||||
} else {
|
||||
NEWSBLUR.assets.view_setting(self.feed_id, {'layout': $t.val()});
|
||||
NEWSBLUR.assets.view_setting(self.feed_id, { 'layout': $t.val() });
|
||||
}
|
||||
self.animate_saved();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
NEWSBLUR.DiscoverFeedsPopover = NEWSBLUR.ReaderPopover.extend({
|
||||
|
||||
className: "NB-filter-popover",
|
||||
className: "NB-discover-popover",
|
||||
|
||||
options: {
|
||||
'width': 604,
|
||||
|
@ -42,15 +42,19 @@ NEWSBLUR.DiscoverFeedsPopover = NEWSBLUR.ReaderPopover.extend({
|
|||
NEWSBLUR.ReaderPopover.prototype.render.call(this);
|
||||
|
||||
this.showLoading();
|
||||
this.discover_feeds_model.fetch({
|
||||
success: function () {
|
||||
self.hideLoading();
|
||||
self.render();
|
||||
},
|
||||
error: function () {
|
||||
self.hideLoading();
|
||||
}
|
||||
});
|
||||
try {
|
||||
this.discover_feeds_model.fetch({
|
||||
success: function () {
|
||||
self.hideLoading();
|
||||
self.render();
|
||||
},
|
||||
error: function () {
|
||||
self.hideLoading();
|
||||
}
|
||||
});
|
||||
} catch (e) {
|
||||
this.onDataLoadError();
|
||||
}
|
||||
},
|
||||
|
||||
showLoading: function () {
|
||||
|
@ -58,13 +62,15 @@ NEWSBLUR.DiscoverFeedsPopover = NEWSBLUR.ReaderPopover.extend({
|
|||
this.$el.html($.make('div', [
|
||||
$.make('div', { className: 'NB-popover-section' }, [
|
||||
$.make('div', { className: 'NB-popover-section-title' }, 'Discover sites'),
|
||||
$.make('div', { className: 'NB-discover-loading' }, "Loading...")
|
||||
$.make('div', { className: 'NB-discover-loading' }, [
|
||||
$.make('div', { className: 'NB-loading NB-active' })
|
||||
])
|
||||
])
|
||||
]));
|
||||
},
|
||||
|
||||
hideLoading: function () {
|
||||
this.$el.html('');
|
||||
this.$el.find(".NB-loading").html('');
|
||||
},
|
||||
|
||||
onDataLoaded: function () {
|
||||
|
@ -73,8 +79,8 @@ NEWSBLUR.DiscoverFeedsPopover = NEWSBLUR.ReaderPopover.extend({
|
|||
},
|
||||
|
||||
onDataLoadError: function () {
|
||||
// Handle the error, for example:
|
||||
this.$el.html('<div class="error-message">Failed to load data</div>');
|
||||
this.hideLoading();
|
||||
this.$el.find(".NB-discover-loading").html('<div class="error-message">Failed to load related sites</div>');
|
||||
},
|
||||
|
||||
render: function () {
|
||||
|
@ -90,7 +96,8 @@ NEWSBLUR.DiscoverFeedsPopover = NEWSBLUR.ReaderPopover.extend({
|
|||
collection: discover_feed.get("stories"),
|
||||
$story_titles: $story_titles,
|
||||
override_layout: 'split',
|
||||
on_discover: self
|
||||
on_discover: discover_feed,
|
||||
in_popover: self
|
||||
});
|
||||
return [
|
||||
new NEWSBLUR.Views.FeedBadge({
|
||||
|
|
|
@ -592,12 +592,12 @@ NEWSBLUR.Views.StoryTitleView = Backbone.View.extend({
|
|||
this.options.on_dashboard.open_story(this.model);
|
||||
return;
|
||||
} else if (this.options.on_discover) {
|
||||
console.log(['clicked story', this.model]);
|
||||
console.log(['clicked story', this.model, this.options.on_discover, this.options.in_popover]);
|
||||
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();
|
||||
this.options.in_popover.close();
|
||||
}
|
||||
|
||||
if (_.contains(['list', 'grid', 'magazine'], this.options.override_layout ||
|
||||
|
|
|
@ -35,6 +35,7 @@ NEWSBLUR.Views.StoryTitlesView = Backbone.View.extend({
|
|||
NEWSBLUR.assets.view_setting(NEWSBLUR.reader.active_feed, 'layout');
|
||||
var on_dashboard = this.options.on_dashboard;
|
||||
var on_discover = this.options.on_discover;
|
||||
var in_popover = this.options.in_popover;
|
||||
var override_layout = this.options.override_layout;
|
||||
var stories = this.collection.map(function (story) {
|
||||
return new NEWSBLUR.Views.StoryTitleView({
|
||||
|
@ -45,7 +46,8 @@ NEWSBLUR.Views.StoryTitlesView = Backbone.View.extend({
|
|||
is_magazine: story_layout == 'magazine',
|
||||
override_layout: override_layout,
|
||||
on_dashboard: on_dashboard,
|
||||
on_discover: on_discover
|
||||
on_discover: on_discover,
|
||||
in_popover: in_popover
|
||||
}).render();
|
||||
});
|
||||
this.stories = stories;
|
||||
|
@ -69,6 +71,7 @@ NEWSBLUR.Views.StoryTitlesView = Backbone.View.extend({
|
|||
if (options.added) {
|
||||
var on_dashboard = this.options.on_dashboard;
|
||||
var on_discover = this.options.on_discover;
|
||||
var in_popover = this.options.in_popover;
|
||||
var override_layout = this.options.override_layout;
|
||||
var story_layout = this.options.override_layout ||
|
||||
NEWSBLUR.assets.view_setting(NEWSBLUR.reader.active_feed, 'layout');
|
||||
|
@ -82,7 +85,8 @@ NEWSBLUR.Views.StoryTitlesView = Backbone.View.extend({
|
|||
is_magazine: story_layout == 'magazine',
|
||||
override_layout: override_layout,
|
||||
on_dashboard: on_dashboard,
|
||||
on_discover: on_discover
|
||||
on_discover: on_discover,
|
||||
in_popover: in_popover
|
||||
}).render();
|
||||
}));
|
||||
this.stories = this.stories.concat(stories);
|
||||
|
|
Loading…
Add table
Reference in a new issue