2011-01-20 09:57:23 -05:00
|
|
|
NEWSBLUR.ReaderGoodies = function(options) {
|
|
|
|
var defaults = {};
|
|
|
|
|
|
|
|
this.options = $.extend({}, defaults, options);
|
|
|
|
this.model = NEWSBLUR.AssetModel.reader();
|
|
|
|
this.runner();
|
|
|
|
};
|
|
|
|
|
|
|
|
NEWSBLUR.ReaderGoodies.prototype = {
|
|
|
|
|
|
|
|
runner: function() {
|
|
|
|
this.make_modal();
|
|
|
|
this.open_modal();
|
|
|
|
|
|
|
|
this.$modal.bind('click', $.rescope(this.handle_click, this));
|
|
|
|
},
|
|
|
|
|
|
|
|
make_modal: function() {
|
|
|
|
var self = this;
|
|
|
|
|
|
|
|
this.$modal = $.make('div', { className: 'NB-modal-goodies NB-modal' }, [
|
|
|
|
$.make('h2', { className: 'NB-modal-title' }, 'Goodies & Extras'),
|
|
|
|
$.make('div', { className: 'NB-goodies-group' }, [
|
2011-01-22 21:42:58 -05:00
|
|
|
NEWSBLUR.generate_bookmarklet(),
|
|
|
|
$.make('div', { className: 'NB-goodies-title' }, 'Add Site Bookmarklet')
|
2011-02-01 03:35:11 +01:00
|
|
|
]),
|
2011-02-25 13:07:08 -05:00
|
|
|
$.make('div', { className: 'NB-goodies-group NB-modal-submit' }, [
|
2011-02-01 03:35:11 +01:00
|
|
|
$.make('a', {
|
2011-02-25 13:07:08 -05:00
|
|
|
className: 'NB-goodies-firefox-link NB-modal-submit-button NB-modal-submit-green',
|
2011-02-01 03:35:11 +01:00
|
|
|
href: '#'
|
2011-02-25 13:07:08 -05:00
|
|
|
}, 'Add NewsBlur'),
|
|
|
|
$.make('div', { className: 'NB-goodies-firefox' }),
|
|
|
|
$.make('div', { className: 'NB-goodies-title' }, 'Firefox: Register Newsblur as an RSS reader')
|
2011-01-20 09:57:23 -05:00
|
|
|
])
|
|
|
|
]);
|
|
|
|
},
|
|
|
|
|
|
|
|
open_modal: function() {
|
|
|
|
var self = this;
|
|
|
|
|
|
|
|
this.$modal.modal({
|
|
|
|
'minWidth': 600,
|
|
|
|
'maxWidth': 600,
|
|
|
|
'overlayClose': true,
|
|
|
|
'onOpen': function (dialog) {
|
|
|
|
dialog.overlay.fadeIn(200, function () {
|
|
|
|
dialog.container.fadeIn(200);
|
|
|
|
dialog.data.fadeIn(200);
|
|
|
|
});
|
|
|
|
},
|
|
|
|
'onShow': function(dialog) {
|
|
|
|
$('#simplemodal-container').corner('6px');
|
|
|
|
},
|
|
|
|
'onClose': function(dialog) {
|
|
|
|
dialog.data.hide().empty().remove();
|
|
|
|
dialog.container.hide().empty().remove();
|
|
|
|
dialog.overlay.fadeOut(200, function() {
|
|
|
|
dialog.overlay.empty().remove();
|
|
|
|
$.modal.close();
|
|
|
|
});
|
|
|
|
$('.NB-modal-holder').empty().remove();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
// ===========
|
|
|
|
// = Actions =
|
|
|
|
// ===========
|
|
|
|
|
|
|
|
handle_click: function(elem, e) {
|
|
|
|
var self = this;
|
|
|
|
|
2011-01-24 09:58:16 -05:00
|
|
|
$.targetIs(e, { tagSelector: '.NB-goodies-bookmarklet-button' }, function($t, $p) {
|
2011-01-20 09:57:23 -05:00
|
|
|
e.preventDefault();
|
|
|
|
|
2011-01-24 09:58:16 -05:00
|
|
|
alert('Drag this button to your bookmark toolbar.');
|
2011-01-20 09:57:23 -05:00
|
|
|
});
|
2011-02-01 03:35:11 +01:00
|
|
|
|
2011-02-25 13:07:08 -05:00
|
|
|
$.targetIs(e, { tagSelector: '.NB-goodies-firefox-link' }, function($t, $p) {
|
2011-02-01 03:35:11 +01:00
|
|
|
e.preventDefault();
|
|
|
|
|
|
|
|
navigator.registerContentHandler("application/vnd.mozilla.maybe.feed",
|
2011-02-25 13:07:08 -05:00
|
|
|
document.location +"?url=%s",
|
2011-02-01 03:35:11 +01:00
|
|
|
"NewsBlur");
|
|
|
|
});
|
2011-01-20 09:57:23 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
};
|