2014-07-03 14:47:43 -04:00
|
|
|
|
var SupporterPage = {
|
|
|
|
|
onPageShow: function() {
|
|
|
|
|
var page = this;
|
2013-02-20 20:33:05 -05:00
|
|
|
|
|
2014-07-03 14:47:43 -04:00
|
|
|
|
$('#paypalReturnUrl', page).val(ApiClient.getUrl("supporterkey.html"));
|
|
|
|
|
$('#cbxRecurring', '#supporterPage').change(function() {
|
|
|
|
|
if (this.checked) {
|
|
|
|
|
SupporterPage.addRecurringFields();
|
|
|
|
|
} else {
|
|
|
|
|
SupporterPage.removeRecurringFields();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
addRecurringFields: function() {
|
|
|
|
|
// Add recurring fields to form
|
|
|
|
|
$("<input type='hidden' name='a3' class='pprecurring' />")
|
|
|
|
|
.attr('value', $('#donateAmt', '#supporterPage').val())
|
|
|
|
|
.appendTo("#payPalForm", '#supporterPage');
|
2014-07-15 12:12:47 -04:00
|
|
|
|
$("<input type='hidden' name='p3' value='6' class='pprecurring' />")
|
2014-07-03 14:47:43 -04:00
|
|
|
|
.appendTo("#payPalForm", '#supporterPage');
|
|
|
|
|
$("<input type='hidden' name='t3' value='M' class='pprecurring' />")
|
|
|
|
|
.appendTo("#payPalForm", '#supporterPage');
|
|
|
|
|
$("<input type='hidden' name='src' value='1' class='pprecurring' />")
|
|
|
|
|
.appendTo("#payPalForm", '#supporterPage');
|
|
|
|
|
$("<input type='hidden' name='sra' value='1' class='pprecurring' />")
|
|
|
|
|
.appendTo("#payPalForm", '#supporterPage');
|
2013-02-20 20:33:05 -05:00
|
|
|
|
|
2014-07-03 14:47:43 -04:00
|
|
|
|
//change command for subscriptions
|
|
|
|
|
$('#ppCmd', '#supporterPage').val('_xclick-subscriptions');
|
2014-04-13 13:27:13 -04:00
|
|
|
|
|
2014-07-03 14:47:43 -04:00
|
|
|
|
$('#payPalForm', '#supporterPage').trigger('create');
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
removeRecurringFields: function() {
|
|
|
|
|
$('.pprecurring', '#supporterPage').remove();
|
|
|
|
|
|
|
|
|
|
//change command back
|
|
|
|
|
$('#ppCmd', '#supporterPage').val('_xclick');
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
2013-02-20 20:33:05 -05:00
|
|
|
|
|
2014-07-03 14:47:43 -04:00
|
|
|
|
$(document).on('pageshow', "#supporterPage", SupporterPage.onPageShow);
|
2013-02-20 20:33:05 -05:00
|
|
|
|
|