1
0
mirror of https://github.com/bigchaindb/site.git synced 2024-11-23 02:00:18 +01:00
site/_src/_assets/javascripts/bigchain/newsletter.js
Matthias Kretschmann 6ede38abfc
dev tweaks
- start linting scss based on Airbnb style guide
- add includePaths to css & js tasks
2017-05-06 18:03:40 +02:00

54 lines
1.2 KiB
JavaScript

//=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
if (!_dntEnabled()) {
GoogleAnalytics.gaEventNewsletterSuccess();
}
}
if (resp.result === 'error') {
_config.newsletter.find('.btn')
.removeClass('disabled')
.text('Subscribe');
// send GA event
if (!_dntEnabled()) {
GoogleAnalytics.gaEventNewsletterError();
}
}
}
}
};
app = {
init: function() {
_private.ajaxChimp();
}
};
return app;
})(window, document, jQuery);