1
0
mirror of https://github.com/bigchaindb/site.git synced 2024-12-01 13:37:14 +01:00
site/_src/_assets/javascripts/bigchain/newsletter.js

54 lines
1.2 KiB
JavaScript
Raw Normal View History

//=include vendor/jquery.ajaxchimp.js
var Newsletter = (function(w, d, $) {
'use strict';
var app, _private, _config;
_config = {
newsletter: $('#newsletter')
},
_private = {
ajaxChimp: function() {
_config.newsletter.ajaxChimp({
callback: formCallback
});
function formCallback (resp) {
if (resp.result === 'success') {
_config.newsletter.find('.input-group').addClass('hide');
// send GA event
2016-02-23 00:15:54 +01:00
if (!_dntEnabled()) {
GoogleAnalytics.gaEventNewsletterSuccess();
}
}
if (resp.result === 'error') {
_config.newsletter.find('.btn')
.removeClass('disabled')
.text('Subscribe');
// send GA event
2016-02-23 00:15:54 +01:00
if (!_dntEnabled()) {
GoogleAnalytics.gaEventNewsletterError();
}
}
}
}
};
app = {
init: function() {
_private.ajaxChimp();
}
};
return app;
})(window, document, jQuery);