2012-03-02 17:51:28 -08:00
|
|
|
NEWSBLUR.ReaderIntro = function(options) {
|
2013-02-01 17:17:16 -08:00
|
|
|
var defaults = {
|
2013-04-03 22:33:01 -07:00
|
|
|
modal_container_class: "NB-full-container"
|
2013-02-01 17:17:16 -08:00
|
|
|
};
|
2012-06-14 17:21:51 -07:00
|
|
|
var intro_page = NEWSBLUR.assets.preference('intro_page');
|
2012-03-02 17:51:28 -08:00
|
|
|
|
2020-06-10 19:24:02 -04:00
|
|
|
_.bindAll(this, 'close', 'post_connect');
|
2012-03-02 17:51:28 -08:00
|
|
|
this.options = $.extend({
|
2012-03-12 12:33:54 -07:00
|
|
|
'page_number': intro_page && _.isNumber(intro_page) && intro_page <= 4 ? intro_page : 1
|
2012-03-02 17:51:28 -08:00
|
|
|
}, defaults, options);
|
2012-03-06 11:41:57 -08:00
|
|
|
this.services = {
|
|
|
|
'twitter': {},
|
|
|
|
'facebook': {}
|
|
|
|
};
|
2012-07-20 19:43:28 -07:00
|
|
|
this.flags = {};
|
2012-03-06 11:41:57 -08:00
|
|
|
this.autofollow = true;
|
2013-07-03 17:52:13 -07:00
|
|
|
this.chosen_categories = [];
|
2012-03-06 11:41:57 -08:00
|
|
|
|
2012-03-02 17:51:28 -08:00
|
|
|
this.page_number = this.options.page_number;
|
|
|
|
this.slider_value = 0;
|
|
|
|
this.intervals = {};
|
2012-12-20 14:44:53 -08:00
|
|
|
this.sync_checks = 0;
|
2012-03-02 17:51:28 -08:00
|
|
|
this.runner();
|
|
|
|
};
|
|
|
|
|
|
|
|
NEWSBLUR.ReaderIntro.prototype = new NEWSBLUR.Modal;
|
|
|
|
NEWSBLUR.ReaderIntro.prototype.constructor = NEWSBLUR.ReaderIntro;
|
|
|
|
|
|
|
|
_.extend(NEWSBLUR.ReaderIntro.prototype, {
|
|
|
|
|
|
|
|
runner: function() {
|
|
|
|
this.make_modal();
|
2012-03-06 11:41:57 -08:00
|
|
|
this.make_find_friends_and_services();
|
2012-03-02 17:51:28 -08:00
|
|
|
this.open_modal();
|
|
|
|
this.page(this.page_number);
|
2013-07-03 17:52:13 -07:00
|
|
|
this.fetch_categories();
|
2013-07-03 19:35:18 -07:00
|
|
|
this.fetch_friends();
|
2012-03-02 17:51:28 -08:00
|
|
|
|
|
|
|
this.$modal.bind('click', $.rescope(this.handle_click, this));
|
2012-03-05 19:18:40 -08:00
|
|
|
this.$modal.bind('change', $.rescope(this.handle_change, this));
|
2012-03-02 17:51:28 -08:00
|
|
|
},
|
|
|
|
|
|
|
|
make_modal: function() {
|
|
|
|
var self = this;
|
|
|
|
|
|
|
|
this.$modal = $.make('div', { className: 'NB-modal-intro NB-modal' }, [
|
2013-02-01 17:17:16 -08:00
|
|
|
$.make('div', { className: 'NB-modal-page' }, [
|
|
|
|
$.make('span', { className: 'NB-modal-page-text' }),
|
|
|
|
$.make('span', { className: 'NB-modal-loading NB-spinner'})
|
|
|
|
]),
|
|
|
|
$.make('h2', { className: 'NB-modal-title' }, [
|
|
|
|
'Welcome to NewsBlur',
|
|
|
|
$.make('div', { className: 'NB-divider' })
|
|
|
|
]),
|
2012-03-02 17:51:28 -08:00
|
|
|
$.make('img', { className: 'NB-intro-spinning-logo', src: NEWSBLUR.Globals.MEDIA_URL + 'img/logo_512.png' }),
|
|
|
|
$.make('div', { className: 'NB-page NB-page-1' }, [
|
|
|
|
$.make('h4', { className: 'NB-page-1-started' }, "So much time and so little to do. Strike that! Reverse it.")
|
|
|
|
]),
|
2012-07-30 21:39:21 -07:00
|
|
|
$.make('div', { className: 'NB-page NB-page-2' }, [
|
2013-07-03 19:13:54 -07:00
|
|
|
$.make('div', { className: 'NB-intro-imports NB-intro-imports-start'}, [
|
|
|
|
$.make('div', { className: 'NB-page-2-started' }, [
|
|
|
|
$.make('h4', "Let's get some sites to read."),
|
2013-07-03 19:31:45 -07:00
|
|
|
$.make('div', { className: 'NB-intro-import-starred-message' })
|
2013-07-03 19:13:54 -07:00
|
|
|
]),
|
|
|
|
$.make('div', { className: 'NB-intro-module-containers' }, [
|
|
|
|
$.make('div', { className: 'NB-intro-module-container NB-left' }, [
|
|
|
|
$.make('h3', { className: 'NB-module-content-header' }, 'Choose categories'),
|
|
|
|
$.make('div', { className: 'NB-intro-module NB-intro-categories-container' }, [
|
|
|
|
$.make('div', { className: "NB-intro-categories-loader" }),
|
|
|
|
$.make('div', { className: "NB-intro-categories" })
|
|
|
|
])
|
|
|
|
]),
|
|
|
|
$.make('div', { className: 'NB-intro-module-container NB-right' }, [
|
|
|
|
$.make('h3', { className: 'NB-module-content-header' }, 'Upload'),
|
|
|
|
$.make('div', { className: 'NB-intro-module NB-intro-import-opml' }, [
|
|
|
|
$.make('div', { className: 'NB-carousel'}, [
|
|
|
|
$.make('div', { className: 'NB-carousel-inner NB-intro-imports' }, [
|
|
|
|
$.make('div', { className: 'NB-carousel-item NB-intro-imports-start' }, [
|
|
|
|
$.make('h3', 'OPML'),
|
|
|
|
$.make('form', { method: 'post', enctype: 'multipart/form-data', encoding: 'multipart/form-data', className: 'NB-opml-upload-form' }, [
|
|
|
|
$.make('div', { href: '#', className: 'NB-intro-upload-opml NB-modal-submit-green NB-modal-submit-button' }, [
|
|
|
|
'Upload OPML File',
|
|
|
|
$.make('input', { type: 'file', name: 'file', id: 'NB-intro-upload-opml-button', className: 'NB-intro-upload-opml-button' })
|
|
|
|
])
|
2013-04-02 15:41:50 -07:00
|
|
|
])
|
|
|
|
]),
|
2013-07-03 19:13:54 -07:00
|
|
|
$.make('div', { className: 'NB-carousel-item NB-intro-imports-progress' }, [
|
|
|
|
$.make('div', { className: 'NB-page-2-importing' }, "Importing your sites..."),
|
|
|
|
$.make('div', { className: 'NB-loading' })
|
|
|
|
]),
|
|
|
|
$.make('div', { className: 'NB-carousel-item NB-intro-imports-sites' }, [
|
|
|
|
$.make('h6', { className: 'NB-intro-import-message' }),
|
|
|
|
$.make('div', { className: 'NB-intro-import-delayed' }, [
|
|
|
|
'There are too many sites and stories to process. ',
|
|
|
|
'You will be emailed within a minute or three.'
|
|
|
|
]),
|
|
|
|
$.make('div', { className: 'NB-intro-import-restart NB-modal-submit-grey NB-modal-submit-button' }, [
|
|
|
|
'« Re-upload your sites'
|
|
|
|
]),
|
|
|
|
$.make('div', { className: 'NB-intro-bookmarklet NB-intro-section NB-intro-import-container' }, [
|
|
|
|
$.make('h3', { className: 'NB-module-content-header' }, 'Install'),
|
|
|
|
$.make('div', { className: 'NB-intro-import NB-intro-module' }, [
|
|
|
|
NEWSBLUR.generate_bookmarklet(),
|
|
|
|
$.make('div', { className: 'NB-intro-bookmarklet-info' }, 'Drag this bookmarklet into your bookmarks bar')
|
|
|
|
])
|
|
|
|
])
|
|
|
|
])
|
2013-07-03 17:52:13 -07:00
|
|
|
])
|
2013-02-01 17:17:16 -08:00
|
|
|
])
|
2013-07-03 19:13:54 -07:00
|
|
|
])
|
2012-03-05 19:18:40 -08:00
|
|
|
])
|
2012-03-02 17:51:28 -08:00
|
|
|
])
|
|
|
|
])
|
|
|
|
]),
|
|
|
|
$.make('div', { className: 'NB-page NB-page-3' }, [
|
2012-03-06 11:41:57 -08:00
|
|
|
$.make('h4', { className: 'NB-page-3-started' }, "Connect with friends"),
|
|
|
|
$.make('div', { className: 'NB-intro-services' })
|
2012-03-02 17:51:28 -08:00
|
|
|
]),
|
|
|
|
$.make('div', { className: 'NB-page NB-page-4' }, [
|
2012-03-16 20:40:48 -07:00
|
|
|
$.make('h4', { className: 'NB-page-4-started' }, "Keep up-to-date with NewsBlur"),
|
2013-02-25 17:30:53 -08:00
|
|
|
$.make('table', { className: 'NB-intro-follows', cellpadding: 0, cellspacing: 0 }, [
|
|
|
|
$.make('tr', [
|
|
|
|
$.make('td', { className: 'NB-intro-uptodate-follow NB-intro-uptodate-follow-twitter' }, [
|
|
|
|
$.make('input', { type: 'checkbox', id: 'NB-intro-uptodate-follow-samuelclay' }),
|
|
|
|
$.make('label', { 'for': 'NB-intro-uptodate-follow-samuelclay' }, [
|
2021-03-25 12:47:39 -04:00
|
|
|
$.make('img', { src: "https://s3.amazonaws.com/static.newsblur.com/blog/Campeche%20Steps%20resized.jpeg", style: 'border-color: #505050;' }),
|
2013-02-25 17:30:53 -08:00
|
|
|
$.make('span', '@samuelclay')
|
|
|
|
]),
|
2013-02-25 17:57:43 -08:00
|
|
|
$.make('iframe', { allowtransparency: "true", frameborder: "0", scrolling: "no", src: "//platform.twitter.com/widgets/follow_button.html?screen_name=samuelclay", width: 260, height: 20 })
|
2013-02-25 17:30:53 -08:00
|
|
|
]),
|
|
|
|
$.make('td', { className: 'NB-intro-uptodate-follow NB-intro-uptodate-follow-twitter' }, [
|
|
|
|
$.make('input', { type: 'checkbox', id: 'NB-intro-uptodate-follow-newsblur' }),
|
|
|
|
$.make('label', { 'for': 'NB-intro-uptodate-follow-newsblur' }, [
|
2014-02-20 09:39:46 -08:00
|
|
|
$.make('img', { src: NEWSBLUR.Globals.MEDIA_URL + '/img/logo_128.png', style: 'border-color: #505050;' }),
|
2013-02-25 17:30:53 -08:00
|
|
|
$.make('span', '@newsblur')
|
|
|
|
]),
|
2013-02-25 17:57:43 -08:00
|
|
|
$.make('iframe', { allowtransparency: "true", frameborder: "0", scrolling: "no", src: "//platform.twitter.com/widgets/follow_button.html?screen_name=newsblur", width: 260, height: 20 })
|
2012-03-16 20:40:48 -07:00
|
|
|
])
|
|
|
|
]),
|
2013-02-25 17:30:53 -08:00
|
|
|
$.make('tr', { className: 'NB-intro-uptodate-subscribe' }, [
|
|
|
|
$.make('td', { className: 'NB-intro-uptodate-follow' }, [
|
2013-02-25 17:51:56 -08:00
|
|
|
$.make('div', [
|
|
|
|
$.make('img', { src: '/media/img/favicon.png' }),
|
|
|
|
'Popular Shared Stories'
|
|
|
|
]),
|
2013-02-25 17:30:53 -08:00
|
|
|
$.make('div', { className: 'NB-intro-uptodate-follow-popular NB-modal-submit-green NB-modal-submit-button' }, [
|
|
|
|
'Subscribe'
|
|
|
|
]),
|
|
|
|
$.make('div', { className: 'NB-subscribed' }, "Subscribed")
|
|
|
|
]),
|
|
|
|
$.make('td', { className: 'NB-intro-uptodate-follow' }, [
|
2013-02-25 17:51:56 -08:00
|
|
|
$.make('div', [
|
|
|
|
$.make('img', { src: '/media/img/favicon.png' }),
|
|
|
|
'The NewsBlur Blog'
|
|
|
|
]),
|
2013-02-25 17:30:53 -08:00
|
|
|
$.make('div', { className: 'NB-intro-uptodate-follow-blog NB-modal-submit-green NB-modal-submit-button' }, [
|
|
|
|
'Subscribe'
|
|
|
|
]),
|
|
|
|
$.make('div', { className: 'NB-subscribed' }, "Subscribed")
|
2012-03-16 20:40:48 -07:00
|
|
|
])
|
|
|
|
])
|
|
|
|
]),
|
|
|
|
$.make('div', { className: 'NB-intro-section' }, [
|
2012-03-19 11:15:26 -07:00
|
|
|
"You're ready to go! Hope you enjoy NewsBlur."
|
2012-03-16 20:40:48 -07:00
|
|
|
])
|
2012-03-02 17:51:28 -08:00
|
|
|
]),
|
2013-04-04 16:22:49 -07:00
|
|
|
$.make('div', { className: 'NB-modal-submit-bottom' }, [
|
2012-03-02 17:51:28 -08:00
|
|
|
$.make('div', { className: 'NB-page-next NB-modal-submit-button NB-modal-submit-green NB-modal-submit-save' }, [
|
|
|
|
$.make('span', { className: 'NB-tutorial-next-page-text' }, "Let's Get Started "),
|
|
|
|
$.make('span', { className: 'NB-raquo' }, '»')
|
|
|
|
])
|
|
|
|
])
|
|
|
|
]);
|
2013-04-02 15:41:50 -07:00
|
|
|
|
|
|
|
if (this.options.force_import) {
|
2013-07-03 17:52:13 -07:00
|
|
|
// this.$modal.addClass('NB-intro-import-only');
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
// ==============
|
|
|
|
// = Categories =
|
|
|
|
// ==============
|
|
|
|
|
|
|
|
fetch_categories: function(callback) {
|
|
|
|
$('.NB-intro-categories-loader', this.$modal).addClass('NB-active');
|
|
|
|
NEWSBLUR.assets.fetch_categories(_.bind(function(data) {
|
|
|
|
this.categories = data.categories;
|
|
|
|
this.category_feeds = data.feeds;
|
|
|
|
this.make_categories();
|
|
|
|
callback && callback();
|
|
|
|
}, this), _.bind(function(data) {
|
|
|
|
console.log(['Categories fetch error', data]);
|
|
|
|
}, this));
|
|
|
|
},
|
|
|
|
|
|
|
|
make_categories: function() {
|
|
|
|
$('.NB-intro-categories-loader', this.$modal).removeClass('NB-active');
|
|
|
|
|
|
|
|
var $categories = $(".NB-intro-categories", this.$modal);
|
|
|
|
var categories = _.map(this.categories, _.bind(function(category) {
|
|
|
|
var $feeds = _.compact(_.map(category.feed_ids, _.bind(function(feed_id) {
|
|
|
|
var feed = this.category_feeds[feed_id];
|
|
|
|
if (!feed) return;
|
|
|
|
feed = new NEWSBLUR.Models.Feed(feed);
|
2013-07-03 19:35:18 -07:00
|
|
|
var border = feed.get('favicon_color') || "707070";
|
2013-07-03 17:52:13 -07:00
|
|
|
return $.make("div", { className: "NB-category-feed", style: "border-left: 4px solid #" + border + "; border-right: 4px solid #" + border }, [
|
|
|
|
$.make('img', { className: 'NB-category-feed-favicon', src: $.favicon(feed) }),
|
|
|
|
$.make('div', { className: 'NB-category-feed-title' }, feed.get('feed_title'))
|
|
|
|
]);
|
|
|
|
}, this)));
|
|
|
|
var $category = $.make('div', { className: 'NB-category' }, [
|
|
|
|
$.make('div', { className: 'NB-category-title NB-modal-submit-grey NB-modal-submit-button' }, [
|
|
|
|
$.make('div', { className: 'NB-checkmark' }),
|
|
|
|
category.title
|
|
|
|
]),
|
|
|
|
$.make('div', { className: 'NB-category-feeds' }, $feeds)
|
|
|
|
]).data('category', category.title);
|
|
|
|
return $category;
|
|
|
|
}, this));
|
|
|
|
|
|
|
|
$categories.html($.make('div', categories));
|
|
|
|
},
|
|
|
|
|
|
|
|
toggle_category: function(category, $category) {
|
|
|
|
var on = _.contains(this.chosen_categories, category);
|
|
|
|
if (on) {
|
|
|
|
this.chosen_categories = _.without(this.chosen_categories, category);
|
|
|
|
} else {
|
|
|
|
this.chosen_categories.push(category);
|
|
|
|
}
|
|
|
|
$category.toggleClass('NB-active', !on);
|
|
|
|
$(".NB-category-title", $category).toggleClass('NB-modal-submit-grey', on)
|
|
|
|
.toggleClass('NB-modal-submit-green', !on);
|
|
|
|
|
|
|
|
if (this.chosen_categories.length) {
|
|
|
|
NEWSBLUR.assets.preference('has_setup_feeds', true);
|
|
|
|
NEWSBLUR.reader.check_hide_getting_started();
|
|
|
|
$('.NB-tutorial-next-page-text', this.$modal).text('Next step ');
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
submit_categories: function() {
|
|
|
|
if (this.chosen_categories.length) {
|
|
|
|
NEWSBLUR.assets.subscribe_to_categories(this.chosen_categories, function() {
|
|
|
|
NEWSBLUR.assets.load_feeds();
|
|
|
|
});
|
2013-04-02 15:41:50 -07:00
|
|
|
}
|
2012-03-02 17:51:28 -08:00
|
|
|
},
|
|
|
|
|
2012-03-06 11:41:57 -08:00
|
|
|
// ==========
|
|
|
|
// = Social =
|
|
|
|
// ==========
|
|
|
|
|
|
|
|
fetch_friends: function(callback) {
|
|
|
|
$('.NB-modal-loading', this.$modal).addClass('NB-active');
|
2012-06-14 17:21:51 -07:00
|
|
|
NEWSBLUR.assets.fetch_friends(_.bind(function(data) {
|
|
|
|
this.profile = NEWSBLUR.assets.user_profile;
|
2012-03-06 11:41:57 -08:00
|
|
|
this.services = data.services;
|
|
|
|
this.autofollow = data.autofollow;
|
|
|
|
this.make_find_friends_and_services();
|
|
|
|
callback && callback();
|
2013-06-12 14:26:09 -07:00
|
|
|
}, this), _.bind(function(data) {
|
|
|
|
console.log(['Friends fetch error', data]);
|
2012-03-06 11:41:57 -08:00
|
|
|
}, this));
|
|
|
|
},
|
|
|
|
|
|
|
|
make_find_friends_and_services: function() {
|
|
|
|
$('.NB-modal-loading', this.$modal).removeClass('NB-active');
|
|
|
|
var $services = $('.NB-intro-services', this.$modal).empty();
|
2012-07-13 15:32:27 -07:00
|
|
|
var service_syncing = false;
|
2012-03-06 11:41:57 -08:00
|
|
|
|
|
|
|
_.each(['twitter', 'facebook'], _.bind(function(service) {
|
|
|
|
var $service;
|
2012-07-11 00:43:53 -07:00
|
|
|
if (this.services && this.services[service][service+'_uid'] && !this.services[service].syncing) {
|
2013-02-25 17:30:53 -08:00
|
|
|
$service = $.make('div', { className: 'NB-intro-module-container NB-friends-service NB-connected NB-friends-service-'+service }, [
|
|
|
|
$.make('h3', { className: 'NB-module-content-header' }, _.string.capitalize(service)),
|
|
|
|
$.make('div', { className: 'NB-intro-module NB-intro-module-'+service }, [
|
|
|
|
$.make('h3', [
|
|
|
|
$.make('img', { src: NEWSBLUR.Globals.MEDIA_URL + '/img/reader/' + service + '_big.png', width: 44, height: 44 })
|
|
|
|
]),
|
|
|
|
$.make('div', { className: 'NB-friends-service-connected' }, [
|
|
|
|
'Connected'
|
|
|
|
])
|
2012-03-06 11:41:57 -08:00
|
|
|
])
|
|
|
|
]);
|
|
|
|
} else {
|
2012-07-11 00:43:53 -07:00
|
|
|
var syncing = this.services && this.services[service] && this.services[service].syncing;
|
2012-07-13 15:32:27 -07:00
|
|
|
if (syncing) service_syncing = true;
|
|
|
|
|
2013-02-25 17:30:53 -08:00
|
|
|
$service = $.make('div', { className: 'NB-intro-module-container NB-friends-service NB-friends-service-'+service + (syncing ? ' NB-friends-service-syncing' : '') }, [
|
|
|
|
$.make('h3', { className: 'NB-module-content-header' }, _.string.capitalize(service)),
|
|
|
|
$.make('div', { className: 'NB-intro-module NB-intro-module-'+service }, [
|
|
|
|
$.make('h3', [
|
|
|
|
$.make('img', { src: NEWSBLUR.Globals.MEDIA_URL + '/img/reader/' + service + '_big.png', width: 44, height: 44 })
|
|
|
|
]),
|
|
|
|
$.make('div', { className: 'NB-friends-service-connect NB-modal-submit-button ' + (syncing ? 'NB-modal-submit-grey' : 'NB-modal-submit-green') }, [
|
|
|
|
(syncing ? 'Fetching...' : 'Find ' + _.string.capitalize(service) + ' Friends')
|
|
|
|
])
|
2012-03-06 11:41:57 -08:00
|
|
|
])
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
$services.append($service);
|
|
|
|
}, this));
|
|
|
|
|
2012-03-06 18:34:59 -08:00
|
|
|
var $autofollow = $.make('div', { className: 'NB-friends-autofollow'}, [
|
2012-03-06 11:41:57 -08:00
|
|
|
$.make('input', { type: 'checkbox', className: 'NB-friends-autofollow-checkbox', id: 'NB-friends-autofollow-checkbox', checked: this.autofollow ? 'checked' : null }),
|
|
|
|
$.make('label', { className: 'NB-friends-autofollow-label', 'for': 'NB-friends-autofollow-checkbox' }, 'and auto-follow them')
|
|
|
|
]);
|
|
|
|
$services.prepend($autofollow);
|
|
|
|
|
2012-03-07 15:01:44 -08:00
|
|
|
if (!this.services.twitter.twitter_uid || !this.services.facebook.facebook_uid) {
|
2012-03-06 19:03:04 -08:00
|
|
|
var $note = $.make('div', { className: 'NB-note'}, [
|
|
|
|
'Feel comfortable connecting to these services.',
|
|
|
|
$.make('br'),
|
2012-03-20 11:15:40 -07:00
|
|
|
'Nothing happens without your permission.'
|
2012-03-06 19:03:04 -08:00
|
|
|
]);
|
|
|
|
$services.append($note);
|
|
|
|
}
|
2012-03-06 11:41:57 -08:00
|
|
|
if (this.services.twitter.twitter_uid || this.services.facebook.facebook_uid) {
|
2012-03-06 19:03:04 -08:00
|
|
|
var $stats = $.make('div', { className: 'NB-services-stats' });
|
|
|
|
_.each(['following', 'follower'], _.bind(function(follow) {
|
|
|
|
var $stat = $.make('div', { className: 'NB-intro-services-stats-count' }, [
|
|
|
|
$.make('div', { className: 'NB-intro-services-stats-count-number' }, this.profile.get(follow+'_count')),
|
|
|
|
$.make('div', { className: 'NB-intro-services-stats-count-description' }, Inflector.pluralize(follow, this.profile.get(follow+'_count')))
|
2012-03-06 18:34:59 -08:00
|
|
|
]);
|
2012-03-06 19:03:04 -08:00
|
|
|
$stats.append($stat);
|
2012-03-06 18:34:59 -08:00
|
|
|
}, this));
|
2012-03-06 19:03:04 -08:00
|
|
|
$services.append($stats);
|
2012-03-06 11:41:57 -08:00
|
|
|
$('.NB-tutorial-next-page-text', this.$modal).text('Next step ');
|
|
|
|
}
|
2012-07-13 15:32:27 -07:00
|
|
|
|
|
|
|
if (service_syncing) {
|
2012-12-20 14:44:53 -08:00
|
|
|
clearTimeout(this.sync_interval);
|
|
|
|
this.sync_checks += 1;
|
|
|
|
this.sync_interval = _.delay(_.bind(function() {
|
2012-08-10 19:20:08 -07:00
|
|
|
this.fetch_friends();
|
2012-12-20 14:44:53 -08:00
|
|
|
}, this), this.sync_checks * 1000);
|
2012-07-13 15:32:27 -07:00
|
|
|
}
|
2012-03-06 11:41:57 -08:00
|
|
|
},
|
|
|
|
|
|
|
|
connect: function(service) {
|
|
|
|
var options = "location=0,status=0,width=800,height=500";
|
2012-03-19 11:15:26 -07:00
|
|
|
var url = "/oauth/" + service + "_connect";
|
2012-12-20 14:44:53 -08:00
|
|
|
this.sync_checks = 0;
|
2012-03-06 11:41:57 -08:00
|
|
|
this.connect_window = window.open(url, '_blank', options);
|
2012-08-10 19:20:08 -07:00
|
|
|
this.connect_window_timer = setInterval(_.bind(function() {
|
|
|
|
console.log(["post connect window?", this.connect_window, this.connect_window.closed, this.connect_window.location]);
|
|
|
|
try {
|
|
|
|
if (!this.connect_window ||
|
|
|
|
!this.connect_window.location ||
|
|
|
|
this.connect_window.closed) {
|
|
|
|
this.post_connect({});
|
|
|
|
}
|
|
|
|
} catch (err) {
|
|
|
|
this.post_connect({});
|
|
|
|
}
|
|
|
|
}, this), 1000);
|
2020-06-22 08:44:40 -04:00
|
|
|
// _gaq.push(['_trackEvent', 'reader_intro', 'Connect to ' + service.name + ' attempt']);
|
2013-02-04 15:14:20 -08:00
|
|
|
|
|
|
|
NEWSBLUR.assets.preference('has_found_friends', true);
|
|
|
|
NEWSBLUR.reader.check_hide_getting_started();
|
2012-03-06 11:41:57 -08:00
|
|
|
},
|
|
|
|
|
|
|
|
disconnect: function(service) {
|
|
|
|
var $service = $('.NB-friends-service-'+service, this.$modal);
|
|
|
|
$('.NB-friends-service-connect', $service).text('Disconnecting...');
|
2020-06-22 08:44:40 -04:00
|
|
|
// _gaq.push(['_trackEvent', 'reader_intro', 'Disconnect from ' + service.name]);
|
2012-06-14 17:21:51 -07:00
|
|
|
NEWSBLUR.assets.disconnect_social_service(service, _.bind(function(data) {
|
2012-03-06 11:41:57 -08:00
|
|
|
this.services = data.services;
|
|
|
|
this.make_find_friends_and_services();
|
|
|
|
this.make_profile_section();
|
|
|
|
this.make_profile_tab();
|
|
|
|
}, this));
|
|
|
|
},
|
|
|
|
|
|
|
|
post_connect: function(data) {
|
2012-07-12 22:26:49 -07:00
|
|
|
console.log(["Intro post_connect", data]);
|
2012-08-10 19:20:08 -07:00
|
|
|
clearInterval(this.connect_window_timer);
|
2012-03-06 11:41:57 -08:00
|
|
|
$('.NB-error', this.$modal).remove();
|
2013-02-25 17:30:53 -08:00
|
|
|
$(".NB-note", this.$modal).hide();
|
2012-03-06 11:41:57 -08:00
|
|
|
if (data.error) {
|
|
|
|
var $error = $.make('div', { className: 'NB-error' }, [
|
|
|
|
$.make('span', { className: 'NB-raquo' }, '» '),
|
|
|
|
data.error
|
2012-03-06 17:33:02 -08:00
|
|
|
]).css({'opacity': 0});
|
|
|
|
$('.NB-intro-services', this.$modal).append($error);
|
2012-03-06 11:41:57 -08:00
|
|
|
$error.animate({'opacity': 1}, {'duration': 1000});
|
|
|
|
this.resize();
|
2020-06-22 08:44:40 -04:00
|
|
|
// _gaq.push(['_trackEvent', 'reader_intro', 'Connect to service error']);
|
2012-03-06 11:41:57 -08:00
|
|
|
} else {
|
|
|
|
this.fetch_friends();
|
2020-06-22 08:44:40 -04:00
|
|
|
// _gaq.push(['_trackEvent', 'reader_intro', 'Connect to service success']);
|
2012-03-06 11:41:57 -08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2012-03-02 17:51:28 -08:00
|
|
|
// ==========
|
|
|
|
// = Paging =
|
|
|
|
// ==========
|
|
|
|
|
|
|
|
next_page: function() {
|
2012-07-12 12:57:35 -07:00
|
|
|
return this.page(this.page_number+1, this.page_number);
|
2012-03-02 17:51:28 -08:00
|
|
|
},
|
|
|
|
|
|
|
|
previous_page: function() {
|
2012-07-12 12:57:35 -07:00
|
|
|
return this.page(this.page_number-1, this.page_number);
|
2012-03-02 17:51:28 -08:00
|
|
|
},
|
|
|
|
|
|
|
|
page: function(page_number, from_page) {
|
|
|
|
if (page_number == null) {
|
|
|
|
return this.page_number;
|
|
|
|
}
|
|
|
|
var page_count = $('.NB-page', this.$modal).length;
|
|
|
|
this.page_number = page_number;
|
|
|
|
|
|
|
|
if (page_number == page_count) {
|
|
|
|
$('.NB-tutorial-next-page-text', this.$modal).text('All Done ');
|
|
|
|
} else if (page_number > page_count) {
|
2012-03-19 14:15:38 -07:00
|
|
|
NEWSBLUR.reader.check_hide_getting_started();
|
2013-07-24 13:46:39 -07:00
|
|
|
NEWSBLUR.assets.preference('has_setup_feeds', true);
|
2012-07-20 19:43:28 -07:00
|
|
|
this.close(_.bind(function() {
|
2013-02-26 10:00:35 -08:00
|
|
|
NEWSBLUR.reader.open_dialog_after_feeds_loaded({
|
|
|
|
delayed_import: this.flags.delayed_import,
|
|
|
|
finished_intro: true
|
|
|
|
});
|
2012-07-20 19:43:28 -07:00
|
|
|
}, this));
|
2012-03-12 12:33:54 -07:00
|
|
|
return;
|
2012-03-02 17:51:28 -08:00
|
|
|
} else if (page_number == 1) {
|
|
|
|
$('.NB-tutorial-next-page-text', this.$modal).text("Let's Get Started ");
|
|
|
|
} else {
|
2012-03-06 11:41:57 -08:00
|
|
|
$('.NB-tutorial-next-page-text', this.$modal).text('Skip this step ');
|
2012-03-02 17:51:28 -08:00
|
|
|
}
|
|
|
|
$('.NB-page', this.$modal).css({'display': 'none'});
|
|
|
|
$('.NB-page-'+this.page_number, this.$modal).css({'display': 'block'});
|
2013-02-01 17:17:16 -08:00
|
|
|
$('.NB-modal-page-text', this.$modal).html($.make('div', [
|
2012-03-02 17:51:28 -08:00
|
|
|
'Step ',
|
|
|
|
$.make('b', this.page_number),
|
|
|
|
' of ',
|
|
|
|
$.make('b', page_count)
|
|
|
|
]));
|
|
|
|
if (page_number > 1) {
|
2013-02-01 17:17:16 -08:00
|
|
|
$('.NB-intro-spinning-logo', this.$modal).css({'top': 12, 'left': 12, 'width': 48, 'height': 48});
|
|
|
|
// $('.NB-modal-title', this.$modal).css({'paddingLeft': 42});
|
2012-03-02 17:51:28 -08:00
|
|
|
}
|
|
|
|
|
2012-03-05 19:18:40 -08:00
|
|
|
if (page_number == 2) {
|
|
|
|
this.advance_import_carousel();
|
|
|
|
}
|
2012-03-06 19:03:04 -08:00
|
|
|
if (page_number == 3) {
|
2013-07-03 17:52:13 -07:00
|
|
|
this.submit_categories();
|
2012-03-06 19:03:04 -08:00
|
|
|
this.make_find_friends_and_services();
|
|
|
|
}
|
2012-03-19 17:51:54 -07:00
|
|
|
if (page_number == 4) {
|
|
|
|
this.show_twitter_follow_buttons();
|
|
|
|
}
|
2012-07-12 12:57:35 -07:00
|
|
|
|
2012-12-20 14:44:53 -08:00
|
|
|
clearTimeout(this.sync_interval);
|
2012-07-28 23:02:35 -07:00
|
|
|
NEWSBLUR.assets.preference('intro_page', page_number);
|
2020-06-22 08:44:40 -04:00
|
|
|
// _gaq.push(['_trackEvent', 'reader_intro', 'Page ' + this.page_number]);
|
2012-03-05 19:18:40 -08:00
|
|
|
},
|
|
|
|
|
2013-04-02 15:41:50 -07:00
|
|
|
advance_import_carousel: function(page, options) {
|
|
|
|
options = options || {};
|
2013-02-01 17:17:16 -08:00
|
|
|
var $carousel = $('.NB-carousel-inner', this.$modal);
|
|
|
|
|
2012-03-06 11:41:57 -08:00
|
|
|
if (page >= 2) {
|
2013-02-04 15:14:20 -08:00
|
|
|
NEWSBLUR.assets.preference('has_setup_feeds', true);
|
|
|
|
NEWSBLUR.reader.check_hide_getting_started();
|
2012-03-06 11:41:57 -08:00
|
|
|
$('.NB-tutorial-next-page-text', this.$modal).text('Next step ');
|
|
|
|
}
|
|
|
|
|
2013-02-01 17:17:16 -08:00
|
|
|
$carousel.animate({'left': (-1 * page * 100) + '%'}, {
|
|
|
|
'queue': false,
|
|
|
|
'easing': 'easeInOutQuint',
|
|
|
|
'duration': 1000
|
2012-08-12 19:16:21 -07:00
|
|
|
});
|
2013-04-02 15:41:50 -07:00
|
|
|
this.count_feeds(options);
|
2012-03-05 19:18:40 -08:00
|
|
|
},
|
|
|
|
|
2013-04-02 15:41:50 -07:00
|
|
|
count_feeds: function(options) {
|
|
|
|
options = options || {};
|
|
|
|
var feed_count = options.fake_count || NEWSBLUR.assets.feeds.size();
|
|
|
|
var starred_count = options.starred_count || NEWSBLUR.assets.starred_count;
|
2012-03-19 16:35:56 -07:00
|
|
|
|
2013-07-03 19:13:54 -07:00
|
|
|
if (feed_count) {
|
|
|
|
$(".NB-page-2-started h4", this.$modal).text([
|
|
|
|
'You are subscribed to ',
|
|
|
|
(options.fake_count && 'at least '),
|
|
|
|
Inflector.pluralize(' site', feed_count, true),
|
|
|
|
'.'
|
|
|
|
].join(""));
|
|
|
|
}
|
2012-03-19 16:35:56 -07:00
|
|
|
|
2013-04-02 15:41:50 -07:00
|
|
|
if (starred_count) {
|
2013-07-03 19:31:45 -07:00
|
|
|
var $info = $(".NB-page-2-started .NB-intro-import-starred-message", this.$modal);
|
2013-04-02 15:41:50 -07:00
|
|
|
$info.text([
|
|
|
|
"And you have ",
|
|
|
|
Inflector.pluralize(' saved story', starred_count, true),
|
|
|
|
". "
|
2013-07-03 19:31:45 -07:00
|
|
|
].join("")).show();
|
2012-03-19 16:35:56 -07:00
|
|
|
}
|
2012-03-02 17:51:28 -08:00
|
|
|
},
|
|
|
|
|
|
|
|
fade_out_logo: function() {
|
|
|
|
var self = this;
|
|
|
|
var $logo = $('.NB-intro-spinning-logo', this.$modal);
|
|
|
|
var $page1 = $('.NB-page-1', this.$modal);
|
|
|
|
var $page2 = $('.NB-page-2', this.$modal);
|
|
|
|
var $submit = $('.NB-modal-submit', this.$modal);
|
|
|
|
var $title = $('.NB-modal-title', this.$modal);
|
|
|
|
|
|
|
|
$submit.animate({'opacity': 0}, {'duration': 800, 'easing': 'easeInOutQuad'});
|
|
|
|
$page1.animate({'opacity': 0}, {
|
|
|
|
'duration': 800,
|
|
|
|
'easing': 'easeInOutQuint',
|
|
|
|
'complete': function() {
|
2013-02-01 17:17:16 -08:00
|
|
|
$logo.animate({'top': 12, 'left': 12, 'width': 48, 'height': 48}, {
|
2012-03-05 19:18:40 -08:00
|
|
|
'duration': 1160,
|
2012-03-02 17:51:28 -08:00
|
|
|
'easing': 'easeInOutCubic',
|
|
|
|
'complete': function() {
|
|
|
|
$page2.css({'opacity': 0});
|
|
|
|
self.page(2);
|
|
|
|
$page2.animate({'opacity': 1}, {'duration': 1000, 'easing': 'easeInOutQuad'});
|
|
|
|
$submit.animate({'opacity': 1}, {'duration': 1000, 'easing': 'easeInOutQuad'});
|
|
|
|
}
|
|
|
|
});
|
2013-02-01 17:17:16 -08:00
|
|
|
// $title.animate({'paddingLeft': 42}, {'duration': 1100, 'easing': 'easeInOutQuart'});
|
2012-03-02 17:51:28 -08:00
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
close_and_load_newsblur_blog: function() {
|
|
|
|
this.close();
|
2012-04-19 22:38:00 -07:00
|
|
|
NEWSBLUR.reader.load_feed_in_tryfeed_view(this.newsblur_feed.id, {'feed': this.newsblur_feed});
|
2012-03-02 17:51:28 -08:00
|
|
|
},
|
|
|
|
|
2012-03-03 09:51:38 -08:00
|
|
|
// ==========
|
|
|
|
// = Import =
|
|
|
|
// ==========
|
|
|
|
|
|
|
|
handle_opml_upload: function() {
|
|
|
|
var self = this;
|
2012-03-05 19:18:40 -08:00
|
|
|
var $loading = $('.NB-intro-imports-progress .NB-loading', this.$modal);
|
|
|
|
var $file = $('.NB-intro-upload-opml-button', this.$modal);
|
2012-03-03 09:51:38 -08:00
|
|
|
$loading.addClass('NB-active');
|
|
|
|
|
2012-03-05 19:18:40 -08:00
|
|
|
this.advance_import_carousel(1);
|
|
|
|
|
2012-03-03 09:51:38 -08:00
|
|
|
// NEWSBLUR.log(['Uploading']);
|
2012-07-12 23:44:30 -07:00
|
|
|
var params = {
|
2012-03-05 19:18:40 -08:00
|
|
|
url: NEWSBLUR.URLs['opml-upload'],
|
|
|
|
type: 'POST',
|
2012-07-20 19:43:28 -07:00
|
|
|
dataType: 'json',
|
2012-03-03 09:51:38 -08:00
|
|
|
success: function (data, status) {
|
2012-06-15 14:49:59 -07:00
|
|
|
NEWSBLUR.assets.load_feeds(function() {
|
2013-08-07 19:46:47 -07:00
|
|
|
console.log(["opml upload", data, status]);
|
2012-03-12 18:11:13 -07:00
|
|
|
$loading.removeClass('NB-active');
|
2012-03-05 19:18:40 -08:00
|
|
|
self.advance_import_carousel(2);
|
2012-07-20 19:43:28 -07:00
|
|
|
if (data.payload.delayed) {
|
|
|
|
NEWSBLUR.reader.flags.delayed_import = true;
|
2013-04-02 15:41:50 -07:00
|
|
|
self.count_feeds({fake_count: data.payload.feed_count});
|
2012-07-20 19:43:28 -07:00
|
|
|
$('.NB-intro-import-delayed', self.$modal).show();
|
2013-07-03 19:13:54 -07:00
|
|
|
$('.NB-intro-import-restart', self.$modal).hide();
|
|
|
|
$('.NB-intro-import-message', self.$modal).hide();
|
2013-08-07 19:46:47 -07:00
|
|
|
} else if (data.code < 0) {
|
|
|
|
$('.NB-intro-import-delayed', self.$modal).hide();
|
|
|
|
$('.NB-intro-import-restart', self.$modal).show();
|
|
|
|
$('.NB-intro-import-message', self.$modal).addClass('NB-error').show().text(data.message);
|
2013-07-03 19:13:54 -07:00
|
|
|
} else {
|
|
|
|
$('.NB-intro-import-message', self.$modal).text("All done!").removeClass('NB-error').show();
|
|
|
|
$('.NB-intro-import-delayed', self.$modal).hide();
|
|
|
|
$('.NB-intro-import-restart', self.$modal).show();
|
2012-07-20 19:43:28 -07:00
|
|
|
}
|
2012-03-05 19:18:40 -08:00
|
|
|
});
|
2012-03-03 09:51:38 -08:00
|
|
|
NEWSBLUR.reader.load_recommended_feed();
|
|
|
|
},
|
2012-03-05 19:18:40 -08:00
|
|
|
error: function (data, status, e) {
|
2013-07-03 19:13:54 -07:00
|
|
|
self.advance_import_carousel(2);
|
2012-03-03 09:51:38 -08:00
|
|
|
$loading.removeClass('NB-active');
|
|
|
|
NEWSBLUR.log(['Error', data, status, e]);
|
2013-07-03 19:13:54 -07:00
|
|
|
$('.NB-intro-import-message', self.$modal).text("There was a problem uploading your OPML file.").addClass('NB-error').css('display', 'block');
|
2012-03-05 19:18:40 -08:00
|
|
|
},
|
|
|
|
cache: false,
|
|
|
|
contentType: false,
|
|
|
|
processData: false
|
2012-07-12 23:44:30 -07:00
|
|
|
};
|
|
|
|
if (window.FormData) {
|
|
|
|
var formData = new FormData($file.closest('form')[0]);
|
|
|
|
params['data'] = formData;
|
|
|
|
|
|
|
|
$.ajax(params);
|
|
|
|
} else {
|
|
|
|
// IE9 has no FormData
|
|
|
|
params['secureuri'] = false;
|
|
|
|
params['fileElementId'] = 'NB-intro-upload-opml-button';
|
|
|
|
params['dataType'] = 'json';
|
|
|
|
|
|
|
|
$.ajaxFileUpload(params);
|
|
|
|
}
|
2012-03-03 09:51:38 -08:00
|
|
|
|
2012-03-05 19:18:40 -08:00
|
|
|
$file.replaceWith($file.clone());
|
|
|
|
|
2012-03-03 09:51:38 -08:00
|
|
|
return false;
|
|
|
|
},
|
|
|
|
|
2012-03-16 20:40:48 -07:00
|
|
|
// ===================
|
|
|
|
// = Stay Up To Date =
|
|
|
|
// ===================
|
|
|
|
|
2012-03-19 17:51:54 -07:00
|
|
|
show_twitter_follow_buttons: function() {
|
2012-03-20 11:15:40 -07:00
|
|
|
$('.NB-intro-uptodate-follow', this.$modal).toggleClass('NB-intro-uptodate-twitter-inactive', !this.services.twitter.twitter_uid);
|
2012-03-19 17:51:54 -07:00
|
|
|
},
|
|
|
|
|
2012-03-16 20:40:48 -07:00
|
|
|
follow_twitter_account: function(username) {
|
|
|
|
var $input = $('#NB-intro-uptodate-follow-'+username, this.$modal);
|
|
|
|
var $button = $input.closest('.NB-intro-uptodate-follow');
|
|
|
|
|
|
|
|
if ($input.is(':checked')) {
|
|
|
|
$button.addClass('NB-active');
|
2012-03-19 17:51:54 -07:00
|
|
|
if (this.services.twitter.twitter_uid) {
|
2012-06-14 17:21:51 -07:00
|
|
|
NEWSBLUR.assets.follow_twitter_account(username);
|
2012-03-19 17:51:54 -07:00
|
|
|
} else {
|
|
|
|
window.open('http://twitter.com/'+username, '_blank');
|
|
|
|
}
|
2012-03-16 20:40:48 -07:00
|
|
|
} else {
|
|
|
|
$button.removeClass('NB-active');
|
2012-03-19 17:51:54 -07:00
|
|
|
if (this.services.twitter.twitter_uid) {
|
2012-06-14 17:21:51 -07:00
|
|
|
NEWSBLUR.assets.unfollow_twitter_account(username);
|
2012-03-19 17:51:54 -07:00
|
|
|
}
|
2012-03-16 20:40:48 -07:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
subscribe_to_feed: function(feed) {
|
2013-02-25 17:30:53 -08:00
|
|
|
var $button = $('.NB-intro-uptodate-follow-'+feed);
|
|
|
|
var $parent = $button.closest(".NB-intro-uptodate-follow");
|
2012-08-12 20:34:30 -07:00
|
|
|
var blog_url = 'http://blog.newsblur.com/rss';
|
2012-03-19 17:16:59 -07:00
|
|
|
var popular_username = 'social:popular';
|
2013-02-25 17:30:53 -08:00
|
|
|
console.log(["subscribe_to_feed", feed, $button, $parent]);
|
|
|
|
$parent.addClass('NB-active');
|
|
|
|
if (feed == 'blog') {
|
|
|
|
NEWSBLUR.assets.save_add_url(blog_url, "", function() {
|
|
|
|
NEWSBLUR.assets.load_feeds();
|
|
|
|
}, {auto_active: false, skip_fetch: true});
|
|
|
|
|
|
|
|
} else if (feed == 'popular') {
|
|
|
|
NEWSBLUR.assets.follow_user(popular_username, function() {
|
|
|
|
NEWSBLUR.app.feed_list.make_social_feeds();
|
|
|
|
});
|
2012-03-16 20:40:48 -07:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2012-03-02 17:51:28 -08:00
|
|
|
// ===========
|
|
|
|
// = Actions =
|
|
|
|
// ===========
|
|
|
|
|
|
|
|
handle_click: function(elem, e) {
|
|
|
|
var self = this;
|
|
|
|
|
|
|
|
$.targetIs(e, { tagSelector: '.NB-page-next' }, function($t, $p) {
|
|
|
|
e.preventDefault();
|
|
|
|
|
|
|
|
if (self.page_number == 1) {
|
|
|
|
self.fade_out_logo();
|
|
|
|
} else {
|
|
|
|
self.next_page();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
$.targetIs(e, { tagSelector: '.NB-tutorial-finish-newsblur-blog' }, function($t, $p) {
|
|
|
|
e.preventDefault();
|
|
|
|
|
|
|
|
self.close_and_load_newsblur_blog();
|
|
|
|
});
|
|
|
|
|
2013-04-02 15:41:50 -07:00
|
|
|
$.targetIs(e, { tagSelector: '.NB-starredimport-button' }, function($t, $p) {
|
|
|
|
e.preventDefault();
|
2013-07-03 19:27:51 -07:00
|
|
|
// self.google_reader_connect({'starred_only': true});
|
2013-04-02 15:41:50 -07:00
|
|
|
});
|
2012-03-05 19:18:40 -08:00
|
|
|
$.targetIs(e, { tagSelector: '.NB-intro-import-restart' }, function($t, $p) {
|
|
|
|
e.preventDefault();
|
|
|
|
self.advance_import_carousel(0);
|
|
|
|
});
|
2012-03-03 09:51:38 -08:00
|
|
|
$.targetIs(e, { tagSelector: '.NB-intro-upload-opml' }, function($t, $p) {
|
|
|
|
// e.preventDefault();
|
|
|
|
// return false;
|
|
|
|
});
|
2012-03-02 17:51:28 -08:00
|
|
|
$.targetIs(e, { tagSelector: '.NB-goodies-bookmarklet-button' }, function($t, $p) {
|
|
|
|
e.preventDefault();
|
|
|
|
|
|
|
|
alert('Drag this button to your bookmark toolbar.');
|
|
|
|
});
|
2012-03-06 11:41:57 -08:00
|
|
|
$.targetIs(e, { tagSelector: '.NB-friends-service-connect' }, function($t, $p) {
|
|
|
|
e.preventDefault();
|
|
|
|
var service;
|
|
|
|
var $service = $t.closest('.NB-friends-service');
|
|
|
|
if ($service.hasClass('NB-friends-service-twitter')) {
|
|
|
|
service = 'twitter';
|
|
|
|
} else if ($service.hasClass('NB-friends-service-facebook')) {
|
|
|
|
service = 'facebook';
|
|
|
|
}
|
|
|
|
if ($service.hasClass('NB-connected')) {
|
|
|
|
self.disconnect(service);
|
|
|
|
} else {
|
|
|
|
self.connect(service);
|
|
|
|
}
|
|
|
|
});
|
2013-02-25 17:30:53 -08:00
|
|
|
|
|
|
|
$.targetIs(e, { tagSelector: '.NB-intro-uptodate-follow-blog' }, function($t, $p) {
|
|
|
|
self.subscribe_to_feed('blog');
|
|
|
|
});
|
|
|
|
$.targetIs(e, { tagSelector: '.NB-intro-uptodate-follow-popular' }, function($t, $p) {
|
|
|
|
self.subscribe_to_feed('popular');
|
|
|
|
});
|
2013-07-03 17:52:13 -07:00
|
|
|
$.targetIs(e, { tagSelector: '.NB-category' }, function($t, $p) {
|
|
|
|
var category = $t.data('category');
|
|
|
|
self.toggle_category(category, $t);
|
|
|
|
});
|
2012-03-05 19:18:40 -08:00
|
|
|
},
|
|
|
|
|
|
|
|
handle_change: function(elem, e) {
|
|
|
|
var self = this;
|
|
|
|
|
|
|
|
$.targetIs(e, { tagSelector: '.NB-intro-upload-opml-button' }, function($t, $p) {
|
|
|
|
e.preventDefault();
|
|
|
|
|
|
|
|
self.handle_opml_upload();
|
|
|
|
});
|
2012-03-07 16:32:02 -08:00
|
|
|
$.targetIs(e, { tagSelector: '.NB-friends-autofollow-checkbox' }, function($t, $p) {
|
2012-08-12 16:49:14 -07:00
|
|
|
NEWSBLUR.assets.preference('autofollow_friends', $t.is(':checked'));
|
2012-03-07 16:32:02 -08:00
|
|
|
});
|
2012-03-16 20:40:48 -07:00
|
|
|
$.targetIs(e, { tagSelector: '#NB-intro-uptodate-follow-newsblur' }, function($t, $p) {
|
|
|
|
self.follow_twitter_account('newsblur');
|
|
|
|
});
|
|
|
|
$.targetIs(e, { tagSelector: '#NB-intro-uptodate-follow-samuelclay' }, function($t, $p) {
|
|
|
|
self.follow_twitter_account('samuelclay');
|
|
|
|
});
|
2012-03-02 17:51:28 -08:00
|
|
|
}
|
|
|
|
|
2021-03-25 12:47:39 -04:00
|
|
|
});
|