var myPostRender = function(args) {
(function ($) {
// remove stuff we don't need
$("#content section.embedded-form header.at-title").remove(); // the header on the custom form
$("#custom-buttons-form fieldset.ContributionInformation .at-radios label").removeClass("tooLong incrediblyLong"); // the css classes on the buttons
// Add the necessary classes we'll need later, for the form with that ID
$("#custom-buttons-form fieldset.ContributionInformation .at-radios label:nth-of-type(1)").addClass("first-button");
$("#custom-buttons-form fieldset.ContributionInformation .at-radios label:nth-of-type(2)").addClass("second-button recurring-option");
$("#custom-buttons-form fieldset.ContributionInformation .at-radios label:nth-of-type(3)").addClass("third-button");
$("#custom-buttons-form fieldset.ContributionInformation .at-radios label:nth-of-type(4)").addClass("fourth-button");
// set the HTML values inside each label to get the text value we need, for the form with that ID
$("#custom-buttons-form fieldset.ContributionInformation .at-radios label.first-button").html("$54 Annual Membership");
$("#custom-buttons-form fieldset.ContributionInformation .at-radios label.second-button").html("$9 Champion Monthly Membership");
$("#custom-buttons-form fieldset.ContributionInformation .at-radios label.third-button").html("$144 Three Year Membership");
$("#custom-buttons-form fieldset.ContributionInformation .at-radios label.fourth-button").html("$36 Under 36 Annual Membership");
// This function checks the selected button - if it's a recurring button (based on the applied class) it checks the recurring box
// This runs on all contribution forms, but only checks or unchecks the box for a form with that ID
function updateRecurring() {
if ($("#custom-buttons-form label.recurring-option").hasClass("current")) { //
$("#custom-buttons-form .at-recurring input").prop('checked', true);
} else {
$("#custom-buttons-form .at-recurring input").prop('checked', false);
}
}
// on form load
$(document).ready(function() {
$("#content section.embedded-form fieldset.ContributionInformation .at-radios label.label-amount input:checked").parent().addClass('current'); // add the class of "current" to the preselected donation amount
updateRecurring(); // run the updateRcurring function
});
// whenever the buttons are clicked
$('#content section.embedded-form fieldset.ContributionInformation .at-radios label.label-amount').click(function() {
$(this).addClass('current').siblings().removeClass('current'); // add the class of "current" to the parent of the selected button
updateRecurring(); // run the updateRecurring function
});
}(jQuery));
return args;
};
var nvtag_callbacks = nvtag_callbacks || {};
nvtag_callbacks.postRender = nvtag_callbacks.postRender || [];
nvtag_callbacks.postRender.push(myPostRender);