mirror of
https://github.com/bigchaindb/site.git
synced 2024-11-01 15:55:36 +01:00
49 lines
1.1 KiB
JavaScript
49 lines
1.1 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
|
|
ga('send', 'event', 'newsletter', 'subscribe', 'success', true);
|
|
}
|
|
if (resp.result === 'error') {
|
|
_config.newsletter.find('.btn')
|
|
.removeClass('disabled')
|
|
.text('Subscribe');
|
|
|
|
// send GA event
|
|
ga('send', 'event', 'newsletter', 'subscribe', 'error', true);
|
|
}
|
|
}
|
|
}
|
|
};
|
|
|
|
app = {
|
|
init: function() {
|
|
_private.ajaxChimp();
|
|
}
|
|
};
|
|
|
|
return app;
|
|
|
|
})(window, document, jQuery);
|