| |
| |
| // donate.js |
| (function($, document) { |
| |
| $(document).ready(function() { |
| |
| // If the page loads and the recognition checkbox is already checked |
| if ($('input.recognition-checkbox').is(':checked')) { |
| $('.recognition-fields').slideDown(300); |
| } |
| |
| // If the recognition checkbox is clicked |
| $('input.recognition-checkbox').click(function(){ |
| if($(this).prop("checked") == true){ |
| $('.recognition-fields').slideDown(300); |
| } |
| else if($(this).prop("checked") == false){ |
| $('.recognition-fields').slideUp(300); |
| } |
| }); |
| |
| // When the user click on a pre-defined donation amount |
| $('.btn-square').click(function() { |
| $('.btn-square, .amount-body, .highlight-amount-body').removeClass('active'); |
| $(this).addClass('active'); |
| $('input[name=amount]').val($(this).val()); |
| }); |
| |
| // When the user click in the custom donation amount field |
| $('input[name=amount]').click(function() { |
| $('input[name=amount]').bind("keyup change", function(e) { |
| $('.btn-square').removeClass('active'); |
| }); |
| }); |
| |
| /** |
| * Disable the Payment radio depending |
| * if Paypal or Bitcoin is selected |
| */ |
| function disablePaymentRadio() { |
| var payment_type = $('input[name=type]:radio:checked').val(); |
| if (payment_type === "paypal") { |
| $('input[name=subscription]').attr("disabled",false); |
| } |
| else{ |
| $('#subscription_default').prop('checked',true); |
| $('input[name=subscription]').attr("disabled",true); |
| } |
| } |
| |
| // Disable the Bitcoin radio if the page loads and it is selected. |
| disablePaymentRadio(); |
| |
| // Make changes when the user chooses either Paypal or Bitcoin |
| $('input[name=type]:radio').change(function(e){ |
| disablePaymentRadio(); |
| }); |
| |
| $('.btn-donate-close').click(function () { |
| |
| // The cookie name based on what has been set in the settings |
| var cookie_name = eclipse_org_common.settings.cookies_class.name; |
| |
| // The JSON decoded value of the cookie |
| // fetched based on the cookie_name variable |
| var cookie = jQuery.parseJSON(unescape(solsticeFetchCookie(cookie_name))); |
| |
| // Set the path |
| var path = "/"; |
| |
| // Set the banner as NOT visible |
| cookie.donation_banner.value.visible = 0; |
| |
| // Make a string out of the object |
| cookie = JSON.stringify(cookie); |
| |
| // Create the cookie |
| solsticeCreateCookie(cookie_name, cookie, path); |
| |
| // Make the banner slide up |
| $('.donate-ad').slideUp(300); |
| }); |
| |
| }); |
| |
| })(jQuery, document); |
| |