// Listen for signup button click
$("#signup-button").click( function() {
$("#signup-button").text("...");
$("form").css("opacity","0.7");
});
// Listen for messages from the Brightspot frontend JS
window.addEventListener("message", function (e) {
// Verify that the message is coming from Piano.
if (typeof e.data.piano != 'undefined') {
// Get the object with the result.
var result = e.data.piano;
// Check for success from the message
if (!result.success) {
console.log("error")
// Show the error block.
$('#signup-error').show();
// Append the text message into the block.
$('#signup-error').text(result.message);
$("#signup-button").text("Sign up now");
$("form").css("opacity","1");
} else {
$(".pn-widget__container").hide();
$("#signup-success").show();
}
}
return;
}, false);