mirror of
https://github.com/viq/NewsBlur.git
synced 2025-08-31 22:20:12 +00:00
77 lines
2.4 KiB
JavaScript
77 lines
2.4 KiB
JavaScript
![]() |
NEWSBLUR.ReaderRecommendFeed = function(options) {
|
||
|
var defaults = {};
|
||
|
|
||
|
this.options = $.extend({}, defaults, options);
|
||
|
this.model = NEWSBLUR.AssetModel.reader();
|
||
|
this.runner();
|
||
|
};
|
||
|
|
||
|
NEWSBLUR.ReaderRecommendFeed.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-recommend NB-modal' }, [
|
||
|
$.make('h2', { className: 'NB-modal-title' }, 'Recommend this Site'),
|
||
|
$.make('form', { className: 'NB-recommend-form' }, [
|
||
|
$.make('div', { className: 'NB-modal-submit' }, [
|
||
|
$.make('input', { type: 'submit', className: 'NB-modal-submit-save NB-modal-submit-green', value: 'Recommend Site' }),
|
||
|
' or ',
|
||
|
$.make('a', { href: '#', className: 'NB-modal-cancel' }, 'cancel')
|
||
|
])
|
||
|
])
|
||
|
]);
|
||
|
},
|
||
|
|
||
|
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);
|
||
|
setTimeout(function() {
|
||
|
$(window).resize();
|
||
|
});
|
||
|
});
|
||
|
},
|
||
|
'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;
|
||
|
|
||
|
$.targetIs(e, { tagSelector: '.NB-modal-cancel' }, function($t, $p) {
|
||
|
e.preventDefault();
|
||
|
$.modal.close();
|
||
|
});
|
||
|
}
|
||
|
|
||
|
};
|