//live mode or dev mode if (window.location.href.indexOf("dynamic_donation_dev_2") > -1) { var live = false; }else{ var live = true; } //mail-in option var mailInOption = 0; //phone number required option var phoneNumberRequiredOption = 0; var overall_custom_header = 0; var forms_heading_title_en = ''; var forms_heading_title_es = ''; var forms_heading_title_fr = ''; var forms_heading_subtitle_en = ''; var forms_heading_subtitle_es = ''; var forms_heading_subtitle_fr = ''; var show_script = false; var form_brand_name = ''; // Showing Script Texts - Variable Declarations // --------------------------------------------- // Header prompts var header_frequency_prompt = `Will this be a single or monthly gift?`; var header_amount_prompt = `How much would you like to give today?`; var header_payment_prompt = `How would you like to make your donation today?`; var header_cc_prompt = `I am ready for your credit card information whenever you are ready.
(Do not read back CC# - have them repeat it if necessary)`; var header_info_prompt = `Please allow me to gather some of your information, and I'll be happy to get your donation processed for you.`; // Non-header prompts var processing_prompt = `Would you be willing to increase your donation to help cover the 2.9% credit card processing fees?`; var receipts_prompt = `“Thank you! Your initial donation will be processed today. Future donations will process monthly on this day, (or the day specified below).
If you ever need to make a change, simply contact us via phone or web.”`; var submit_prompt = `Thanks again for calling in today to show your support for our ministry. Have a blessed day!`; var tshirt_prompt = `You qualify for a free t-shirt!
(You will receive a separate email within a week where you may request your t-shirt size.)`; // Form prompts var email_addr_prompt = `May I please have an email address where we may send your receipt?
(leave blank if no email addresses)`; var phone_prompt = `May I please have your phone number?
(if no phone number, enter 999-999-9999)`; var address_prompt = `May I please have your address?
(Start typing and select the address from the drop-down menu)`; // -------------------- // redirect time // if an url that is not connected to a active live donation page is selected // it will redirct the end user to our main donation page after how many seconds var time_left_redirect = 7; // Processing Fees needs set in two places //here for the frontend var processing_fee_percent_decimal = 0.029; //and within the RaiseDonors Setup, in the menu below at the bottom of page, for the backend //setting the local processing fee variable //live mode vs dev mode prefix for urls //these do not need changed unless your domains prefixes have changed. if(live==false){ var domainPre = 'felix'; }else{ var domainPre = 'dash'; } //defaults variables var language = "en"; var published = true; var capital_campaign = false; var cpp = false; var t_shirt = false; var t_shirt_single_min = 200; var t_shirt_monthly_min = 20; var singleAmount1 = '200'; //anAmount1 var singleAmount2 = '400'; //anAmount2 var singleAmount3 = '500'; //anAmount3 var singleAmount4 = '1,000'; //anAmount4 var monthlyAmount1 = '20/mo'; //anAmount5 var monthlyAmount2 = '40/mo'; //anAmount6 var monthlyAmount3 = '50/mo'; //anAmount7 var monthlyAmount4 = '100/mo'; //anAmount8 var monthlyAmount1_amount = '20'; var monthlyAmount2_amount = '40'; var monthlyAmount3_amount = '50'; var monthlyAmount4_amount = '100'; var defaultSingle = 'anAmount1'; var defaultMonthly = 'anAmount5'; var unique_id = Date.now().toString(36) + Math.random().toString(36).substr(2) + '_j_' + self.crypto.randomUUID() + '_t'; var pattern_id = navigator.userAgent; var number_of_submit_clicks = 0; var currentAmount = 0; var form_id = 'missing'; var form_pass_thr = 'missing'; var form_brand = 'missing'; var form_cycle = 'missing'; var hope_language = []; var bg_size = "200px"; var img_url = "https://"+domainPre+".hopemediagroup.com/img/hope.png"; var short_img_url = "https://"+domainPre+".hopemediagroup.com/img/hope32.png"; var language_change_ready = 0; // when creating a new language make sure to // copy hope_language['en'] and rename it and update all values to new language. // update end of changed_language(); a new image src needs to be created. // create new list-group-item for the language modal. // update language modal height and margin-top with new height added. // finally update returnFreqTypeMemo(); var myTimeout = ''; var random = 76; function return_shirt_int(){ if($('#tshirtDiv').css('display')=='block' && $('#cb1').is(':checked') && t_shirt == true ){ return 1; }else{ return 0; } } function return_selected_cycle(){ if($('#memicBTNs2').hasClass('activeBTN')){ if($('#memicBTNs_sub4').hasClass('activeBTN')){ return 'monthly'; }else{ return 'yearly'; } }else{ return 'single'; } } function hope_validation(){ //simple add email if missing START var email = document.getElementById('cphDonationForm_txtEmail'); if(email.value==''||email.value==' '){ var suffix = '-noemail@email.com'; var firstName = document.getElementById('cphDonationForm_txtFName'); var lastName = document.getElementById('cphDonationForm_txtLName'); var fakeEmail = firstName.value + lastName.value + suffix; email.value = fakeEmail; } //simple add email if missing END if($('#hope_submit_btn_in_action').css('display')=='none'){ $('#hope_submit_btn_in_action').show(); $('#hope_submit_btn').prop("disabled",true); number_of_submit_clicks++; formStats(3,returnAmount()); if(document.getElementById('hope_media_group_name_on_air').checked){ $('#cphDonationForm_cbIsAnonymous').prop('checked',true); }else{ $('#cphDonationForm_cbIsAnonymous').prop('checked',false); } if($('#cphDonationForm_hdnChosenAmount').val()>4.99){ //we have more than 5 dollars var parsley = $('#form1').parsley(); if(parsley.validate() && parsley.isValid()){ //we have all the contact info we need if($('#cphDonationForm_hdnPaymentMethod').val()==9||$('#cphDonationForm_hdnPaymentMethod').val()==14){ //mail in / cash // or update donation var data = new Object(); if($('#cphDonationForm_hdnPaymentMethod').val()==9){ data.method = 340; }else{ data.method = 360; } data.l = btoa(language); data.cy = btoa(return_selected_cycle()); data.t = btoa(return_shirt_int()); data.a = btoa($('#cphDonationForm_hdnChosenAmount').val()); data.b = btoa(form_brand); data.f = btoa($('#cphDonationForm_txtFName').val()); data.la = btoa($('#cphDonationForm_txtLName').val()); data.e = btoa(returnEmail()); data.ph = btoa($('#cphDonationForm_txtPhone').val()); data.b_a = btoa($('#cphDonationForm_txtAddress').val()); data.fc = btoa(returnURLParamValue(window.location.href, 'fund-code')); if($('#cphDonationForm_cbMilitaryCheckbox').is(':checked')){ data.b_c = btoa($('#cphDonationForm_ddlMilitaryCity').val()); data.b_s = btoa($('#cphDonationForm_ddlMilitaryState').val()); data.b_z = btoa($('#cphDonationForm_txtMilitaryZip').val()); }else{ data.b_c = btoa($('#cphDonationForm_txtCity').val()); data.b_s = btoa($('#cphDonationForm_ddlState').val()); data.b_z = btoa($('#cphDonationForm_txtZipCode').val()); } data.b_co = btoa($('#cphDonationForm_ddlCountry').val()); data.com = btoa($('#cphDonationForm_txtComments').val()); data.o = btoa($('#cbOrgName').is(':checked')); data.o_n = btoa($('#cphDonationForm_txtOrganizationName').val()); data.an = btoa($('#cphDonationForm_cbIsAnonymous').is(':checked')); var options = new Object(); options.data = data; options.dataType = 'text'; options.type = 'post'; options.success = function (response) { var objectReturned = JSON.parse(response); if(objectReturned['status']=='success' && objectReturned['results']['status']){ if($('#cphDonationForm_hdnPaymentMethod').val()==9){ location.href = 'https://'+domainPre+'.hopemediagroup.com/thankyou.php?e='+returnEmail()+'&c=pledge'; }else{ location.href = 'https://'+domainPre+'.hopemediagroup.com/thankyou.php?e='+returnEmail()+'&c=increase'; } }else{ $('#hope_submit_btn_in_action').hide(); $('#hope_submit_btn').prop("disabled",false); alert("An Error Occurred. Reload webpage."); } }; options.error = function (response) { $('#hope_submit_btn_in_action').hide(); $('#hope_submit_btn').prop("disabled",false); alert('failure ' + response); }; options.url = 'https://'+domainPre+'.hopemediagroup.com/api_endpoints/api_sub_processor2.php'; $.ajax(options); }else{ //everything else now use normal validator $('#hope_submit_btn_in_action').hide(); $('#hope_submit_btn').prop("disabled",false); $('#hope_submit_btn').hide(); $('#cphDonationForm_btnStripeSubmit').show(); $('#cphDonationForm_btnStripeSubmit').click(); } }else{ $('#hope_submit_btn_in_action').hide(); $('#hope_submit_btn').prop("disabled",false); showErrorMessage($('#address').offset().top - 90,'
' + hope_language[language]['Complete all required fields']); } }else{ $('#hope_submit_btn_in_action').hide(); $('#hope_submit_btn').prop("disabled",false); showErrorMessage($('.legend-your-donation-amount-information').parent().parent().offset().top - 90,'
' + hope_language[language]['Amount must be at least...']); } } } function showErrorMessage(locationTop,messageIn){ $('#hope_error_message').html(messageIn); $('#hope_error_message').show(); $("body, html").animate({ scrollTop: locationTop }); clearTimeout(myTimeout); myTimeout = setTimeout(function() { $('#hope_error_message').hide(); }, 7000); } function numberWithCommas(x) { return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","); } function updateMisInfo2(){ var currentData = $('#cphDonationForm_hdnMiscInformation').val(); if($('#cb1').is(':checked')){ $('#cphDonationForm_hdnMiscInformation').val(currentData.replace("custom_virtuousapi_shirt=false", "custom_virtuousapi_shirt=true")); }else{ $('#cphDonationForm_hdnMiscInformation').val(currentData.replace("custom_virtuousapi_shirt=true", "custom_virtuousapi_shirt=false")); } } function updateAnon(){ var currentData = document.getElementById('cphDonationForm_hdnMiscInformation').value; if(document.getElementById('hope_media_group_name_on_air').checked){ //document.getElementById('cphDonationForm_hdnMiscInformation').value = currentData.replace("custom_virtuousapi_anonymous=false", "custom_virtuousapi_anonymous=true"); $('#cphDonationForm_cbIsAnonymous').prop('checked',true); }else{ //document.getElementById('cphDonationForm_hdnMiscInformation').value = currentData.replace("custom_virtuousapi_anonymous=true", "custom_virtuousapi_anonymous=false"); $('#cphDonationForm_cbIsAnonymous').prop('checked',false); } } function updateMisInfo(){ var currentData = document.getElementById('cphDonationForm_hdnMiscInformation').value; if(t_shirt == true){ if($('#memicBTNs2').hasClass('activeBTN')){ //monthly if(currentAmount >= t_shirt_monthly_min){ $('#tshirtDiv').show(); $('#tshirt_prompt_container').show(); updateMisInfo2(); }else{ document.getElementById('cphDonationForm_hdnMiscInformation').value = currentData.replace("custom_virtuousapi_shirt=true", "custom_virtuousapi_shirt=false"); $('#tshirtDiv').hide(); $('#tshirt_prompt_container').hide(); } }else{ //single if(currentAmount >= t_shirt_single_min){ $('#tshirtDiv').show(); $('#tshirt_prompt_container').show(); updateMisInfo2(); }else{ $('#tshirtDiv').hide(); $('#tshirt_prompt_container').hide(); document.getElementById('cphDonationForm_hdnMiscInformation').value = currentData.replace("custom_virtuousapi_shirt=true", "custom_virtuousapi_shirt=false"); } } }else{ document.getElementById('cphDonationForm_hdnMiscInformation').value = currentData.replace("custom_virtuousapi_shirt=true", "custom_virtuousapi_shirt=false"); } } function changeView(whoIn){ $('#other-amt-monthly').removeClass('activeBTN'); $('#other-amt-monthly').removeClass('choosenOne'); $('#other-amt-single').removeClass('activeBTN'); $('#other-amt-single').removeClass('choosenOne'); $('.submit-amount').addClass('d-none'); $('#other-amt-monthly').val(''); $('#other-amt-single').val(''); $('.with-fee-total').html(''); $('.with-fee-total').addClass('d-none'); $('.anAmount label').removeClass('active'); $('.anAmount label').removeClass('choosenOne'); $('.with-fee-total').addClass('d-none'); if(whoIn){ $('#memicBTNs1').removeClass('activeBTN'); $('#memicBTNs2').addClass('activeBTN'); if($('.updateExistingDonation').hasClass('active')){ $('#amount .recurring').hide(); }else{ $('#amount .recurring').show(); } $('#cphDonationForm_cbRecurring').prop( "checked", true ); $('#single').hide(); $('#monthly').show(); if($('.updateExistingDonation').length>0){ $('.updateExistingDonation').show(); } if(capital_campaign){ //$('#other-amt-monthly').focus(); }else{ $('#'+defaultMonthly).click(); //monthly default } if(capital_campaign){ //$('#frequency_section').show(); } }else{ $('#frequency_section').hide(); $('#amount .recurring').hide(); $('#memicBTNs1').addClass('activeBTN'); $('#memicBTNs2').removeClass('activeBTN'); if($('.updateExistingDonation').hasClass('active')){ $('#updateExistingDonationContent').hide(); $('#amount').show(); $('.with-fee-total strong').text(hope_language[language]['total_gift_title']); $('.updateExistingDonation').removeClass('active'); $('.credit').click(); $('.credit').addClass('active'); $('.credit-card').removeClass('d-none'); $('#cphDonationForm_hdnPaymentMethod').val(1); if($('#memicBTNs2').hasClass('activeBTN')){ $('#amount .recurring').show(); } // $('#cphDonationForm_txtPhone').attr('data-parsley-required', false); // $('#cphDonationForm_txtPhone').attr('data-parsley-error-message', hope_language[language]['Phone is required']); // $('#cphDonationForm_txtPhone').attr('data-parsley-trigger', 'input change'); // $('label[for="cphDonationForm_txtPhone"]').text(hope_language[language]['Phone']); } $('.updateExistingDonation').hide(); $('#cphDonationForm_cbRecurring').prop( "checked", false ); $('#amount .recurring').hide(); $('#monthly').hide(); $('#single').show(); if(capital_campaign){ //$('#other-amt-single').focus(); }else{ $('#'+defaultSingle).click(); //single default } } } function addUpMealsFeed(amountIn){ var currentAmount = amountIn; updateMisInfo(); //addUpMealsFeedTiers(amountIn); var multi = 100; if($('#memicBTNs2').hasClass('activeBTN')){ multi = 10; } $('#numMeals').text( (Math.floor(amountIn / multi) * 4) ); } function addUpMealsFeedTiers(amountIn){ var meals = 0; if($('#memicBTNs2').hasClass('activeBTN')){ //monthly if(amountIn>=20 && amountIn<40){ meals = 10; }else if(amountIn>=40 && amountIn<50){ meals = 18; }else if(amountIn>=50 && amountIn<100){ meals = 22; }else if(amountIn>=100 && amountIn<200){ meals = 42; }else if(amountIn>=200){ meals = 42 * Math.floor(amountIn/100); } }else{ //single if(amountIn>=200 && amountIn<400){ meals = 10; }else if(amountIn>=400 && amountIn<500){ meals = 18; }else if(amountIn>=500 && amountIn<1000){ meals = 22; }else if(amountIn>=1000 && amountIn<2000){ meals = 42; }else if(amountIn>=2000){ meals = 42 * Math.floor(amountIn/1000); } } $('#numMeals').text( meals ); } function updateAmountsKey(whoIn){ if($('#cphDonationForm_hdnPaymentMethod').val()==14){ //increasing gift var totGiftOrIncreaseTitle = hope_language[language]['increase_gift_title']; }else{ var totGiftOrIncreaseTitle = hope_language[language]['total_gift_title']; } if($('#memicBTNs2').hasClass('activeBTN')){ //monthly if($('#other-amt-monthly').val()==''||$('#other-amt-monthly').val()==' '){ $('#other-amt-monthly').val(''); $('.with-fee-total').html(''); $('.with-fee-total').addClass('d-none'); $('.submit-amount').addClass("d-none"); }else{ if($('#cphDonationForm_cbDonorCoversProcessingFee').is(':checked')){ $('.with-fee-total').removeClass('d-none'); var thisTotal = Number($('#other-amt-monthly').val()) + (processing_fee_percent_decimal * Number($('#other-amt-monthly').val())); $('#cphDonationForm_hdnChosenAmount').val((Number(thisTotal)).toFixed(2)); if($('#memicBTNs_sub4').hasClass('activeBTN')){ $('.with-fee-total').html('

'+ totGiftOrIncreaseTitle +' '+ numberWithCommas(thisTotal.toFixed(2)) +' ' + hope_language[language]['monthly'] + '

'); }else{ $('.with-fee-total').html('

'+ totGiftOrIncreaseTitle +' '+ numberWithCommas(thisTotal.toFixed(2)) +' ' + hope_language[language]['Annually'] + '

'); } $('#submitAmount').html(' ' + numberWithCommas(thisTotal.toFixed(2)) + ' '); $('#hope_submit_btn_preview_below_title').html(' '+numberWithCommas(thisTotal.toFixed(2)) + ' '); returnFreqType(); currentAmount = thisTotal; addUpMealsFeed(thisTotal); }else{ $('.with-fee-total').addClass('d-none'); if($('#memicBTNs_sub4').hasClass('activeBTN')){ $('.with-fee-total').html('

'+ totGiftOrIncreaseTitle +' '+ numberWithCommas((Number($('#other-amt-monthly').val())).toFixed(2)) +' ' + hope_language[language]['monthly'] + '

'); }else{ $('.with-fee-total').html('

'+ totGiftOrIncreaseTitle +' '+ numberWithCommas((Number($('#other-amt-monthly').val())).toFixed(2)) +' ' + hope_language[language]['Annually'] + '

'); } $('#cphDonationForm_hdnChosenAmount').val((Number($('#other-amt-monthly').val())).toFixed(2)); $('#submitAmount').html(' ' +numberWithCommas((Number($('#other-amt-monthly').val())).toFixed(2)) + ' '); $('#hope_submit_btn_preview_below_title').html(' '+ numberWithCommas((Number($('#other-amt-monthly').val())).toFixed(2)) + ' '); returnFreqType(); //$('#other-amt-monthly').val(numberWithCommas(return_number($('#other-amt-monthly').val()))); currentAmount = $('#other-amt-monthly').val(); addUpMealsFeed($('#other-amt-monthly').val()); } $('.submit-amount').removeClass("d-none"); } }else{ //single if($('#other-amt-single').val()==''||$('#other-amt-single').val()==' '){ $('#other-amt-single').val(''); $('.with-fee-total').html(''); $('.with-fee-total').addClass('d-none'); $('#cphDonationForm_hdnChosenAmount').val(0); $('.submit-amount').addClass("d-none"); }else{ $('.submit-amount').removeClass("d-none"); if($('#cphDonationForm_cbDonorCoversProcessingFee').is(':checked')){ //with processing fees $('.with-fee-total').removeClass('d-none'); var currentSelected = parseFloat($('#other-amt-single').val()); var total = Math.round((currentSelected + (currentSelected*processing_fee_percent_decimal)) * 10) / 10; $('.with-fee-total').html('

'+ totGiftOrIncreaseTitle +' '+ numberWithCommas(total.toFixed(2)) +'

'); $('#cphDonationForm_hdnChosenAmount').val((Number($('#other-amt-single').val())+(Number($('#other-amt-single').val())*processing_fee_percent_decimal)).toFixed(2)); document.getElementById('submitAmount').innerText = ' ' + numberWithCommas(total.toFixed(2)); $('#hope_submit_btn_preview_below_title').html(' ' + numberWithCommas(total.toFixed(2))); //$('#other-amt-single').val( numberWithCommas($('#other-amt-single').val())); currentAmount = total; addUpMealsFeed(total); }else{ //no fees $('.with-fee-total').html('

'+ totGiftOrIncreaseTitle +' '+ numberWithCommas((Number($('#other-amt-single').val())).toFixed(2)) +'

'); $('#cphDonationForm_hdnChosenAmount').val((Number($('#other-amt-single').val())).toFixed(2)); document.getElementById('submitAmount').innerText = ' ' + numberWithCommas((Number($('#other-amt-single').val())).toFixed(2)); $('#hope_submit_btn_preview_below_title').html(' ' + numberWithCommas((Number($('#other-amt-single').val())).toFixed(2)) ); //$('#other-amt-single').val(numberWithCommas($('#other-amt-single').val())); currentAmount = $('#other-amt-single').val(); addUpMealsFeed($('#other-amt-single').val()); } } } } function inputChanged(whoIn){ $('#other-amt-monthly').removeClass('activeBTN'); $('#other-amt-monthly').removeClass('choosenOne'); $('#other-amt-single').removeClass('activeBTN'); $('#other-amt-single').removeClass('choosenOne'); $('.anAmount label').removeClass('active'); $('.anAmount label').removeClass('choosenOne'); if(whoIn==0){ $('#other-amt-single').addClass('activeBTN'); $('#other-amt-single').addClass('choosenOne'); }else{ $('#other-amt-monthly').addClass('activeBTN'); $('#other-amt-monthly').addClass('choosenOne'); } } function returnFreqType(){ $("#frequency_section .memicBTNs").each(function(){ if($(this).hasClass("activeBTN")){ var pieces = ($(this)[0].id).split('memicBTNs_sub'); updateRecDate(pieces[1]); var word = $('#'+$(this)[0].id).text(); var firstLetter = word.charAt(0) var firstLetterCap = firstLetter.toUpperCase() var remainingLetters = word.slice(1) $("#submitAmount").find('span').first().text(' ' + firstLetterCap + remainingLetters); $('#hope_submit_btn_preview_below_title .moMeFull').html(' ' + firstLetterCap + remainingLetters); } }); } function returnFreqTypeMemo(){ $("#frequency_section .memicBTNs").each(function(){ if($(this).hasClass("activeBTN")){ var pieces = ($(this)[0].id).split('memicBTNs_sub'); updateRecDate(pieces[1]); var word = $('#'+$(this)[0].id).text(); var firstLetter = word.charAt(0) var firstLetterCap = firstLetter.toUpperCase() var remainingLetters = word.slice(1) if(firstLetterCap + remainingLetters=='Weekly'||firstLetterCap + remainingLetters=='Semanalmente'||firstLetterCap + remainingLetters=='Hebdomadaire'){ $('.moMe').text(hope_language[language]['wkly']); }else if(firstLetterCap + remainingLetters=='Bi-Weekly'||firstLetterCap + remainingLetters=='Quincenal'||firstLetterCap + remainingLetters=='Bihebdomadaire'){ $('.moMe').text(hope_language[language]['bwkly']); }else if(firstLetterCap + remainingLetters=='Quarterly'||firstLetterCap + remainingLetters=='Trimestral'||firstLetterCap + remainingLetters=='Trimestriel'){ $('.moMe').text(hope_language[language]['qtly']); }else if(firstLetterCap + remainingLetters=='Bi-Annually'||firstLetterCap + remainingLetters=='Dos Veces Al Año'||firstLetterCap + remainingLetters=='Semestriel'){ $('.moMe').text(hope_language[language]['bannu']); }else if(firstLetterCap + remainingLetters=='Annually'||firstLetterCap + remainingLetters=='Anualmente'||firstLetterCap + remainingLetters=='Annuellement'){ $('.moMe').text(hope_language[language]['annu']); }else{ //monthly default $('.moMe').text(hope_language[language]['month_abbreviation']); } return false; } }); } function updateButtons(buttonIn){ if($('#cphDonationForm_hdnPaymentMethod').val()==14){ //increasing gift var totGiftOrIncreaseTitle = hope_language[language]['increase_gift_title']; }else{ var totGiftOrIncreaseTitle = hope_language[language]['total_gift_title']; } $('#other-amt-single').val(''); $('#other-amt-monthly').val(''); $('#other-amt-monthly').removeClass('activeBTN'); $('#other-amt-monthly').removeClass('choosenOne'); $('#other-amt-single').removeClass('activeBTN'); $('#other-amt-single').removeClass('choosenOne'); $('.anAmount label').removeClass('active'); $('.anAmount label').removeClass('choosenOne'); $('.anAmount label').removeClass('active'); $('.anAmount label').removeClass('choosenOne'); $('#'+buttonIn.id+' label').addClass('active'); $('#'+buttonIn.id+' label').addClass('choosenOne'); var floatAmount = parseFloat( (((buttonIn.innerText).replace(/\s/g, '')).replace(/,|\/mo/gi, '')).trim() ); if($('#cphDonationForm_cbDonorCoversProcessingFee').is(':checked')){ var total = floatAmount + (floatAmount*processing_fee_percent_decimal); $('#cphDonationForm_hdnChosenAmount').val((total).toFixed(2)); if($('#memicBTNs2').hasClass('activeBTN')){ //monthly if($('#memicBTNs_sub4').hasClass('activeBTN')){ var ending = ' ' + hope_language[language]['monthly'] + ''; $('.with-fee-total').html('

'+ totGiftOrIncreaseTitle +' '+ numberWithCommas(total.toFixed(2)) +' '+ending+'

'); }else{ var ending = ' ' + hope_language[language]['Annually'] + ''; $('.with-fee-total').html('

'+ totGiftOrIncreaseTitle +' '+ numberWithCommas(total.toFixed(2)) +' '+ending+'

'); } }else{ var ending = ''; $('.with-fee-total').html('

'+ totGiftOrIncreaseTitle +' '+ numberWithCommas(total.toFixed(2)) +'

'); } $('.with-fee-total').removeClass('d-none'); }else{ var total = floatAmount $('#cphDonationForm_hdnChosenAmount').val( (floatAmount).toFixed(2) ); $('.with-fee-total').addClass('d-none'); if($('#memicBTNs2').hasClass('activeBTN')){ if($('#memicBTNs_sub4').hasClass('activeBTN')){ var ending = ' ' + hope_language[language]['monthly'] + ''; }else{ var ending = ' ' + hope_language[language]['Annually'] + ''; } }else{ var ending = ''; } } if (floatAmount && floatAmount > 0) { document.getElementsByClassName('submit-amount')[0].classList.remove('d-none'); $('#hope_submit_btn_preview_below_title').html(' ' + total.toFixed(2) + ending); $('#submitAmount').html(' '+ numberWithCommas(total.toFixed(2)) + ending); returnFreqType(); currentAmount = total; addUpMealsFeed(total); document.getElementsByClassName('btn-submit')[0].disabled = false; //$('#cphDonationForm_cbDonorCoversProcessingFee').val(floatAmount.toFixed(2)); }else{ document.getElementsByClassName('submit-amount')[0].className += " d-none"; document.getElementById('submitAmount').innerText = ''; $('#hope_submit_btn_preview_below_title').html(''); currentAmount = 0; addUpMealsFeed(0); document.getElementsByClassName('btn-submit')[0].disabled = true; //$('#cphDonationForm_cbDonorCoversProcessingFee').val(''); } if (floatAmount && parseFloat(floatAmount) > 0) { $('#cphDonationForm_txtAskTextBox').val(floatAmount.toFixed(2)) ; }else{ $('#cphDonationForm_txtAskTextBox').val('') ; } } function returnURLParamValue(urlString, urlKey){ var param = null; if(urlString.includes('?')){ var paramString = urlString.split('?')[1]; var params_arr = paramString.split('&'); if(params_arr.length>0){ for (var i = 0; i < params_arr.length; i++) { let pair = params_arr[i].split('='); if(pair[0]==urlKey){ return pair[1]; } if((i+1)==params_arr.length){ return param; } } }else{ return param; } }else{ return param; } } function returnURLParams(urlString){ var params = {}; if(urlString.includes('?')){ var paramString = urlString.split('?')[1]; var params_arr = paramString.split('&'); if(params_arr.length>0){ for (var i = 0; i < params_arr.length; i++) { let pair = params_arr[i].split('='); params[pair[0]] = pair[1]; if((i+1)==params_arr.length){ return JSON.stringify(params); } } }else{ return JSON.stringify(params); } }else{ return JSON.stringify(params); } } function returnURLParamsNum(urlString){ if(urlString.includes('?')){ var paramString = urlString.split('?')[1]; var params_arr = paramString.split('&'); return params_arr.length; }else{ return 0; } } function returnEmail(){ if( $('#cphDonationForm_txtEmail').val()!='' && $('#cphDonationForm_txtEmail').val()!=' ' ){ return $('#cphDonationForm_txtEmail').val(); }else{ return 'missing'; } } function formStats(statusIn, amountIn){ var tshirtInt = 0; if($('#tshirtDiv').css('display')=='block' && $('#cb1').is(':checked') && t_shirt == true ){ tshirtInt = 1; } const date = new Date(); var year = date.getFullYear(); var month = (1 + date.getMonth()).toString(); month = month.length > 1 ? month : '0' + month; var day = date.getDate().toString(); day = day.length > 1 ? day : '0' + day; var finalDate = month + '/' + day + '/' + year; var data = new Object(); data.method = 7; data.s = btoa(statusIn); data.a = btoa(amountIn); data.ag = btoa(navigator.appVersion); data.w = btoa(form_id); data.u = btoa(window.location.href); data.p = btoa(returnURLParams(window.location.href)); data.n = btoa(returnURLParamsNum(window.location.href)); data.e = btoa(returnEmail()); data.c = btoa(number_of_submit_clicks); data.i = btoa(unique_id); data.t = btoa(tshirtInt); data.l = btoa(language); data.b = btoa(form_brand); data.f = btoa($('#cphDonationForm_txtFName').val()); data.la = btoa($('#cphDonationForm_txtLName').val()); data.gd = btoa(finalDate); data.b_co = btoa($('#cphDonationForm_ddlCountry').val()); data.b_a = btoa($('#cphDonationForm_txtAddress').val()); data.ph = btoa($('#cphDonationForm_txtPhone').val()); if($('#memicBTNs2').hasClass('activeBTN')){ if($('#memicBTNs_sub4').hasClass('activeBTN')){ data.cy = btoa('monthly'); }else{ data.cy = btoa('yearly'); } }else{ data.cy = btoa('single'); } if($('#cphDonationForm_cbDonorCoversProcessingFee').is(':checked')){ data.pr = btoa( Math.round( (amountIn*processing_fee_percent_decimal) * 100) / 100 ); }else{ data.pr = btoa(0); } if($('#cphDonationForm_cbMilitaryCheckbox').is(':checked')){ data.b_c = btoa($('#cphDonationForm_ddlMilitaryCity').val()); data.b_s = btoa($('#cphDonationForm_ddlMilitaryState').val()); data.b_z = btoa($('#cphDonationForm_txtMilitaryZip').val()); }else{ data.b_c = btoa($('#cphDonationForm_txtCity').val()); data.b_s = btoa($('#cphDonationForm_ddlState').val()); data.b_z = btoa($('#cphDonationForm_txtZipCode').val()); } var options = new Object(); options.data = data; options.dataType = 'text'; options.type = 'post'; options.success = function (response) { //nothing }; options.error = function (response) { //nothing }; options.url = 'https://'+domainPre+'.hopemediagroup.com/api_endpoints/api_sub_processor2.php'; $.ajax(options); } function addressCompleted(){ if($( "#cphDonationForm_ddlCountry" ).val()=='US'){ //fix +4 zips if($( "#cphDonationForm_txtZipCode" ).val().includes("-")){ var arrayI = $( "#cphDonationForm_txtZipCode" ).val().split("-"); $( "#cphDonationForm_txtZipCode" ).val(arrayI[0]); } if($( "#cphDonationForm_txtAddress" ).val()!=''&&$( "#cphDonationForm_txtCity" ).val()!=''&&$( "#cphDonationForm_ddlState" ).val()!=''&&$( "#cphDonationForm_txtZipCode" ).val()!=''){ var options = new Object(); options.dataType = 'text'; options.type = 'post'; options.success = function (response) { var parser = new DOMParser(); var xmlDoc = parser.parseFromString(response,"text/xml"); if( xmlDoc.getElementsByTagName("Address2")[0].childNodes[0].nodeValue == ($( "#cphDonationForm_txtAddress" ).val()).toUpperCase() && xmlDoc.getElementsByTagName("City")[0].childNodes[0].nodeValue == ($( "#cphDonationForm_txtCity" ).val()).toUpperCase() && xmlDoc.getElementsByTagName("State")[0].childNodes[0].nodeValue == ($( "#cphDonationForm_ddlState" ).val()).toUpperCase() && xmlDoc.getElementsByTagName("Zip5")[0].childNodes[0].nodeValue == ($( "#cphDonationForm_txtZipCode" ).val()).toUpperCase() ){ //all good //$('#cphDonationForm_btnStripeSubmit').prop("disabled",false); }else{ //needs validated formStats(4,returnAmount()); //show message of inaccuracy $('#orgAddress').html(($( "#cphDonationForm_txtAddress" ).val()).toUpperCase() + '
' + ($( "#cphDonationForm_txtCity" ).val()).toUpperCase() + ', ' + ($( "#cphDonationForm_ddlState" ).val()).toUpperCase() + '  ' + ($( "#cphDonationForm_txtZipCode" ).val()).toUpperCase()); //+ ' US' $('#usps_address').text(xmlDoc.getElementsByTagName("Address2")[0].childNodes[0].nodeValue); $('#usps_city').text(xmlDoc.getElementsByTagName("City")[0].childNodes[0].nodeValue); $('#usps_state').text(xmlDoc.getElementsByTagName("State")[0].childNodes[0].nodeValue); $('#usps_zip').text(xmlDoc.getElementsByTagName("Zip5")[0].childNodes[0].nodeValue); if(xmlDoc.getElementsByTagName("Address2")[0].childNodes[0].nodeValue != ($( "#cphDonationForm_txtAddress" ).val()).toUpperCase()){ $('#usps_address').addClass('text-primary'); $('#usps_address').addClass('font-weight-bold'); }else{ $('#usps_address').removeClass('text-primary'); $('#usps_address').removeClass('font-weight-bold'); } if(xmlDoc.getElementsByTagName("City")[0].childNodes[0].nodeValue != ($( "#cphDonationForm_txtCity" ).val()).toUpperCase()){ $('#usps_city').addClass('text-primary'); $('#usps_city').addClass('font-weight-bold'); }else{ $('#usps_city').removeClass('text-primary'); $('#usps_city').removeClass('font-weight-bold'); } if(xmlDoc.getElementsByTagName("State")[0].childNodes[0].nodeValue != ($( "#cphDonationForm_ddlState" ).val()).toUpperCase()){ $('#usps_state').addClass('text-primary'); $('#usps_state').addClass('font-weight-bold'); }else{ $('#usps_state').removeClass('text-primary'); $('#usps_state').removeClass('font-weight-bold'); } if(xmlDoc.getElementsByTagName("Zip5")[0].childNodes[0].nodeValue != ($( "#cphDonationForm_txtZipCode" ).val()).toUpperCase()){ $('#usps_zip').addClass('text-primary'); $('#usps_zip').addClass('font-weight-bold'); }else{ $('#usps_zip').removeClass('text-primary'); $('#usps_zip').removeClass('font-weight-bold'); } $('#staticBackdrop').modal('show'); } }; options.error = function (response) { //$('#cphDonationForm_btnStripeSubmit').prop("disabled",false); // alert('error' + response); }; options.url = 'https://production.shippingapis.com/ShippingAPI.dll?API=Verify&XML=
' + $( "#cphDonationForm_txtAddress" ).val() + '' + $( "#cphDonationForm_txtCity" ).val() + '' + $( "#cphDonationForm_ddlState" ).val() + '' + $( "#cphDonationForm_txtZipCode" ).val() + '
'; $.ajax(options); } }else{ //$('#cphDonationForm_btnStripeSubmit').prop("disabled",false); } } function returnAmount(){ try{ if($('#other-amt-single').hasClass('choosenOne')){ return Number($('#other-amt-single').val().replace(/[^\d.]/g, '').trim()); }else if($('#other-amt-monthly').hasClass('choosenOne')){ return Number($('#other-amt-monthly').val().replace(/[^\d.]/g, '').trim()); }else{ return Number($('.choosenOne').html().replace(/[^\d.]/g, '').trim()); } }catch(e){ return 0; } } function rejectUSPSAddress(){ $('#staticBackdrop').modal('hide'); //$('#cphDonationForm_btnStripeSubmit').prop("disabled",false); //rejects validation formStats(5,returnAmount()); } function acceptUSPSAddress(){ //accepts validation formStats(6,returnAmount()); $( "#cphDonationForm_txtAddress" ).val($('#usps_address').text()); $( "#cphDonationForm_txtCity" ).val($('#usps_city').text()); $( "#cphDonationForm_ddlState" ).val($('#usps_state').text()); $( "#cphDonationForm_txtZipCode" ).val($('#usps_zip').text()); $('#staticBackdrop').modal('hide'); $('#cphDonationForm_btnStripeSubmit').prop("disabled",false); } function close_language_modal(){ //hide the language modal $('#language_modal').hide(); $('#language_modal_screen').fadeOut(); } function chooseLang(){ //show the language modal $('.language_modal').show(); } function updateRecDate(span_in){ if($('#cphDonationForm_ddlRecurringDate').length){ $('.recurring .content .instructions p').text(hope_language[language]['The same amount...'] + hope_language[language]['the date selected'] + hope_language[language][', until the subscription ...']); }else{ var today = new Date(); if(span_in==1){ //weekly var thisDay = today.getDate() + 7; today.setDate(thisDay); }else if(span_in==2){ //bi weekly var thisDay = today.getDate() + 14; today.setDate(thisDay); }else if(span_in==4){ //monthly today.setMonth(today.getMonth() + 1); }else if(span_in==6){ //quarterly today.setMonth(today.getMonth() + 3); }else if(span_in==7){ //biyearly today.setMonth(today.getMonth() + 6); }else if(span_in==8){ //yearly today.setMonth(today.getMonth() + 12); } var dd = String(today.getDate()).padStart(2, '0'); var mm = String(today.getMonth() + 1).padStart(2, '0'); //January is 0! var yyyy = today.getFullYear(); today = mm + '/' + dd + '/' + yyyy; var today_computer = yyyy + '-' + mm + '-' + dd; $('#cphDonationForm_txtNextChargeDate').val(today_computer); $('.recurring .content .instructions p').text(hope_language[language]['The same amount...'] + today + hope_language[language][', until the subscription ...']); } } function removeMonthlySelector(){ $('.instructions').removeClass('monthly-only'); $('#cphDonationForm_ddlRecurringDate').remove(); } function addMonthlySelector(){ if($('#cphDonationForm_ddlRecurringDate').length){ //nothing }else{ $('.instructions').addClass('monthly-only'); $('').insertAfter( ".instructions" ); var date = new Date().getDate(); if(date>28){ $('#cphDonationForm_ddlRecurringDate').val(28); }else{ $('#cphDonationForm_ddlRecurringDate').val(date); } } } function changeViewSub(id_in){ updateRecDate(id_in); $('#frequency_section .memicBTNs').removeClass('activeBTN'); $('#memicBTNs_sub'+id_in).addClass('activeBTN'); var word = $('#memicBTNs_sub'+id_in).text(); var firstLetter = word.charAt(0) var firstLetterCap = firstLetter.toUpperCase() var remainingLetters = word.slice(1) $("#submitAmount").find('span').first().text(' ' + firstLetterCap + remainingLetters); $('#hope_submit_btn_preview_below_title .moMeFull').html(' ' + firstLetterCap + remainingLetters); if(id_in==1){ $('#cphDonationForm_ddlRecurringFrequency').val(52); $('.moMe').text(hope_language[language]['wkly']); $('#other-amt-monthly').prop('placeholder', hope_language[language]['My Best Weekly Gift']); }else if(id_in==2){ $('#cphDonationForm_ddlRecurringFrequency').val(26); $('.moMe').text(hope_language[language]['bwkly']); $('#other-amt-monthly').prop('placeholder', hope_language[language]['My Best Bi-Weekly Gift']); }else if(id_in==4){ //addMonthlySelector(); updateRecDate(id_in); $('#cphDonationForm_ddlRecurringFrequency').val(12); $('.moMe').text(hope_language[language]['month_abbreviation']); $('#other-amt-monthly').prop('placeholder', hope_language[language]['My Best Monthly Gift']); }else if(id_in==6){ $('#cphDonationForm_ddlRecurringFrequency').val(4); $('.moMe').text(hope_language[language]['qtly']); $('#other-amt-monthly').prop('placeholder', hope_language[language]['My Best Quarterly Gift']); }else if(id_in==7){ $('#cphDonationForm_ddlRecurringFrequency').val(2); $('.moMe').text(hope_language[language]['bannu']); $('#other-amt-monthly').prop('placeholder', hope_language[language]['My Best Bi-Yearly Gift']); }else if(id_in==8){ removeMonthlySelector(); updateRecDate(id_in); $('#cphDonationForm_ddlRecurringFrequency').val(1); $('.moMe').text(hope_language[language]['annu']); $('#other-amt-monthly').prop('placeholder', hope_language[language]['My Best Yearly Gift']); } if(capital_campaign){ //$('#other-amt-monthly').focus(); } updateAmountsKey(1); } function scrollFunction() { if (document.documentElement.scrollTop > 0){ $('#cpContentHeader_ImgLogoNoLink').css('max-height',"50px"); }else{ $('#cpContentHeader_ImgLogoNoLink').css('max-height',"120px"); } if (document.documentElement.scrollTop < 100){ //$('#existing_account').show(); }else{ $('#existing_account').hide(); } } function change_lang(lang_in){ var orginal_language = language; if(language_change_ready==1){ $('.language_options').removeClass('active'); $('#language_options_'+lang_in).addClass('active_loading'); language = lang_in; var change_to_statment = orginal_language + ' to ' + lang_in; var data = new Object(); data.method = 240; data.l = btoa(lang_in); var options = new Object(); options.data = data; options.dataType = 'text'; options.type = 'post'; options.success = function (response) { var objectReturned = JSON.parse(response); if(objectReturned['status']=='success'){ var keys = Object.keys(objectReturned['results']['texts']); if((keys).length>0){ hope_language[language] = objectReturned['results']['texts']; if(parseInt(returnAmount())>=0 && $('.active_loading').length==0){ if(change_to_statment=='en to es'){ formStats(16,returnAmount()); }else if(change_to_statment=='en to fr'){ formStats(17,returnAmount()); }else if(change_to_statment=='es to en'){ formStats(18,returnAmount()); }else if(change_to_statment=='es to fr'){ formStats(19,returnAmount()); }else if(change_to_statment=='fr to en'){ formStats(20,returnAmount()); }else if(change_to_statment=='fr to es'){ formStats(21,returnAmount()); }else{ formStats(7,returnAmount()); } } $('#language_options_'+lang_in).addClass('active'); $('#language_options_'+lang_in).removeClass('active_loading'); var languageV = 'English'; if(lang_in=='es'){ languageV = 'Español'; } else if(lang_in=='fr') { languageV = 'Français'; } $('#lang_option').text(languageV); changed_language(); setTimeout(function () { close_language_modal(); }, 100); } } }; options.error = function (response) { alert('error response ' + response); }; options.url = 'https://'+domainPre+'.hopemediagroup.com/api_endpoints/api_sub_processor2.php'; $.ajax(options); }else{ language_change_ready=1; } } function return_number(string_in){ return Number(string_in.toString().replace(/,/g, "")); } function changed_language(){ if(language=='en'){ // Showing Script Texts for English // --------------------------------- // Header prompts header_frequency_prompt = `Will this be a single or monthly gift?`; header_amount_prompt = `How much would you like to give today?`; header_payment_prompt = `How would you like to make your donation today?`; header_cc_prompt = `I am ready for your credit card information whenever you are ready.
(Do not read back CC# - have them repeat it if necessary)`; header_info_prompt = `Please allow me to gather some of your information, and I'll be happy to get your donation processed for you.`; // Non-header prompts processing_prompt = `Would you be willing to increase your donation to help cover the 2.9% credit card processing fees?`; receipts_prompt = `Your initial donation will be processed today. Future donations will process monthly on this day, (or the day specified below).
If you ever need to make a change, simply contact us via phone or web.”`; submit_prompt = `Thanks again for calling in today to show your support for our ministry. Have a blessed day!`; tshirt_prompt = `You qualify for a free t-shirt!
(You will receive a separate email within a week where you may request your t-shirt size.)`; // Form prompts email_addr_prompt = `May I please have an email address where we may send your receipt?
(leave blank if no email addresses)`; phone_prompt = `May I please have your phone number?
(if no phone number, enter 999-999-9999)`; address_prompt = `May I please have your address?
(Start typing and select the address from the drop-down menu.)`; // -------------------- // Now let's append these language changes to the screen... if(show_script == "true"){ $("#frequency_prompt_container").html(header_frequency_prompt); $("#amount_prompt_container").html(header_amount_prompt); $("#payment_prompt_container").html(header_payment_prompt); $("#cc_prompt_container").html(header_cc_prompt); $("#info_prompt_container").html(header_info_prompt); $("#tshirt_prompt_container").html(tshirt_prompt); $("#processing_prompt_container").html(processing_prompt); $("#recurring_prompt_container").html(receipts_prompt); $("#submit_prompt_container").html(submit_prompt); $("#email_prompt_container").html(email_addr_prompt); $("#phone_prompt_container").html(phone_prompt); $("#addr_prompt_container").html(address_prompt); } $('#hope_custom_header').html('

'+forms_heading_title_en+'

'+forms_heading_subtitle_en); }else if(language=='es'){ // Showing Script Texts for Spanish // --------------------------------- // Header prompts header_frequency_prompt = `¿Esto va a ser un donativo de una sola vez o mensual?`; header_amount_prompt = `¿Cuánto le gustaría donar hoy?`; header_payment_prompt = `¿Como le gustaría hacer su donativo hoy?`; header_cc_prompt = `Estoy listo/a para la información de su tarjeta de crédito, cuando usted lo esté.
(No lea el número de tarjeta de crédito en voz alta. De ser necesario, pídale al/la donante que lo repita, por favor.)`; header_info_prompt = `Por favor permítame tomar su información y con mucho gusto procesaré su donativo.`; // Non-header prompts processing_prompt = `De ser posible, ¿desearía aumentar su donativo para cubrir la tarifa de procesamiento de tarjeta de crédito de 2.9%?`; receipts_prompt = `Su donativo inicial será procesado hoy. Donaciones futuras serán procesadas mensualmente en este día (o el día especificado a continuación).
Si tuviera que hacer un cambio, simplemente contáctenos por teléfono o por internet.`; submit_prompt = `Gracias nuevamente por su llamada y por su apoyo a nuestro ministerio. ¡Dios le bendiga!`; tshirt_prompt = `¡Usted cualifica para recibir una camiseta gratis!
(Va a recibir un correo electrónico por separado dentro de una semana para que pueda pedir el tamaño de camiseta que desee.)`; // Form prompts email_addr_prompt = `¿Me permite su dirección de correo electrónico donde le podamos enviar un recibo?
(Deje en blanco si no tiene correo electrónico.)`; phone_prompt = `¿Me permite su número de teléfono?
(Si no tiene número de teléfono, ingrese 999-999-9999)`; address_prompt = `¿Me permite su dirección postal?
(Comience a escribir y seleccione la dirección del listado de opciones).`; // -------------------- // Now let's append these language changes to the screen... if(show_script == "true"){ $("#frequency_prompt_container").html(header_frequency_prompt); $("#amount_prompt_container").html(header_amount_prompt); $("#payment_prompt_container").html(header_payment_prompt); $("#cc_prompt_container").html(header_cc_prompt); $("#info_prompt_container").html(header_info_prompt); $("#tshirt_prompt_container").html(tshirt_prompt); $("#processing_prompt_container").html(processing_prompt); $("#recurring_prompt_container").html(receipts_prompt); $("#submit_prompt_container").html(submit_prompt); $("#email_prompt_container").html(email_addr_prompt); $("#phone_prompt_container").html(phone_prompt); $("#addr_prompt_container").html(address_prompt); } $('#hope_custom_header').html('

'+forms_heading_title_es+'

'+forms_heading_subtitle_es); }else{ // Showing Script Texts for French // -------------------------------- // Header prompts header_frequency_prompt = `S'agit-il d'un don unique ou mensuel ?`; header_amount_prompt = `Combien souhaitez-vous donner aujourd'hui ?`; header_payment_prompt = `Comment souhaitez-vous faire votre don aujourd'hui ?`; header_cc_prompt = `Je suis prêt à recevoir vos informations de carte de crédit dès que vous êtes prêt.
(Ne répétez pas le numéro de carte de crédit - faites-le leur répéter si nécessaire.)`; header_info_prompt = `Permettez-moi de recueillir certaines de vos informations, et je serai heureux de traiter votre don pour vous.`; // Non-header prompts processing_prompt = `Seriez-vous disposé à augmenter votre don pour aider à couvrir les frais de traitement des cartes de crédit de 2,9 % ?`; receipts_prompt = `Votre premier don sera traité aujourd'hui. Les dons futurs seront traités chaque mois à cette date (ou à la date spécifiée ci-dessous).
Si vous avez besoin de faire un changement, contactez-nous simplement par téléphone ou sur internet.`; submit_prompt = `Merci encore d'avoir appelé aujourd'hui pour montrer votre soutien à notre ministère. Passez une journée bénie !`; tshirt_prompt = `Vous avez droit à un t-shirt gratuit !
(Vous recevrez un e-mail séparé dans une semaine où vous pourrez indiquer la taille de votre t-shirt.)`; // Form prompts email_addr_prompt = `Puis-je avoir une adresse e-mail où nous pourrons vous envoyer votre reçu, s'il vous plaît ?
(laisser vide s'il n'y a pas d'adresse e-mail)`; phone_prompt = `Puis-je avoir votre numéro de téléphone, s'il vous plaît ?
(si aucun numéro de téléphone, entrez 999-999-9999)`; address_prompt = `Puis-je avoir votre adresse ?
(Commencez à taper et sélectionnez l'adresse dans le menu déroulant.)`; // -------------------- // Now let's append these language changes to the screen... if(show_script == "true"){ $("#frequency_prompt_container").html(header_frequency_prompt); $("#amount_prompt_container").html(header_amount_prompt); $("#payment_prompt_container").html(header_payment_prompt); $("#cc_prompt_container").html(header_cc_prompt); $("#info_prompt_container").html(header_info_prompt); $("#tshirt_prompt_container").html(tshirt_prompt); $("#processing_prompt_container").html(processing_prompt); $("#recurring_prompt_container").html(receipts_prompt); $("#submit_prompt_container").html(submit_prompt); $("#email_prompt_container").html(email_addr_prompt); $("#phone_prompt_container").html(phone_prompt); $("#addr_prompt_container").html(address_prompt); } $('#hope_custom_header').html('

'+forms_heading_title_fr+'

'+forms_heading_subtitle_fr); } $('#existing_account').html(hope_language[language]['Need to make a change on an existing donation?']+' '+hope_language[language]['Login']+''); $('#updateExistingDonationContent .alert-warning').html(hope_language[language]['Update Existing Donation...']); $('.updateExistingDonation').html(hope_language[language]['Update Existing Donation']); $('.mailInCash').html( hope_language[language]['Mail-In / Cash']); $('#capital_cam_title').html(hope_language[language]['Transform Every Heart...']); //these are only needed if localizing the numbers // $('#anAmount1').html(''); // $('#anAmount2').html(''); // $('#anAmount3').html(''); // $('#anAmount4').html(''); // $('#anAmount5').html(''); // $('#anAmount6').html(''); // $('#anAmount7').html(''); // $('#anAmount8').html(''); $("#cphDonationForm_ddlState option:first").text(hope_language[language]['State / Territory']); $('footer .d-block a').text(hope_language[language]['Privacy Policy']); $('#lnkLogoLinkOut span').text(hope_language[language]['Powered by'] + ' RaiseDonors & Hope Media Group '+new Date().getFullYear()); $('#cphDonationForm_txtZipCode').attr('data-parsley-error-message',hope_language[language]['Zip Code is required']); $('#cphDonationForm_txtZipCode').attr('data-parsley-pattern-message',hope_language[language]['Zip Code must be in the correct format']); //if the element is already showing then we need to interact with it to show update string or manually change it here. //$('#cphDonationForm_txtZipCode').click(); //or keypress or event dispatch $('label[for="cphDonationForm_txtZipCode"]').html(hope_language[language]['Zip Code'] + ' *'); $('#cphDonationForm_ddlState').attr('data-parsley-error-message', hope_language[language]['State is required']); $('label[for="cphDonationForm_ddlState"]').html(hope_language[language]['State'] + ' *'); $('#cphDonationForm_txtCity').attr('data-parsley-error-message', hope_language[language]['City is required']); $('label[for="cphDonationForm_txtCity"]').html(hope_language[language]['City'] + ' *'); $('#cphDonationForm_txtAddress').attr('data-parsley-error-message', hope_language[language]['Address is required']); //military $('#cphDonationForm_ddlMilitaryCity').attr('data-parsley-error-message', hope_language[language]['City is required']); $('#cphDonationForm_ddlMilitaryState').attr('data-parsley-error-message', hope_language[language]['State is required']); $('#cphDonationForm_txtMilitaryZip').attr('data-parsley-error-message', hope_language[language]['Zip Code is required']); $('#cphDonationForm_txtEmail').attr('data-parsley-error-message', hope_language[language]['Email is required']); $('label[for="cphDonationForm_txtAddress"]').html(hope_language[language]['Address'] + ' *'); $('#help-toggle').text(hope_language[language]['Help & Information']); $('label[for="cphDonationForm_ddlMilitaryCity"]').html(hope_language[language]['City'] + ' *'); $('label[for="cphDonationForm_ddlMilitaryState"]').html(hope_language[language]['State'] + ' *'); $('label[for="cphDonationForm_txtMilitaryZip"]').html(hope_language[language]['Zip Code'] + ' *'); $('label[for="cphDonationForm_cbMilitaryCheckbox"]').text(hope_language[language]['I have a military address']); $('label[for="cphDonationForm_ddlCountry"]').html(hope_language[language]['Country']+ ' *'); $('#cphDonationForm_ddlCountry').attr('data-parsley-error-message', hope_language[language]['Country is required']); if( phoneNumberRequiredOption == 1 ){ $('label[for="cphDonationForm_txtPhone"]').html(hope_language[language]['Phone']+' *'); $('#cphDonationForm_txtPhone').attr('data-parsley-error-message', hope_language[language]['Phone is required']); }else{ $('label[for="cphDonationForm_txtPhone"]').text(hope_language[language]['Phone']); } $('label[for="cphDonationForm_txtEmail"]').html(hope_language[language]['Email']+' *'); $('label[for="cphDonationForm_cbIsAnonymous"]').text(hope_language[language]['I would like my donation to be anonymous']); $('label[for="hope_media_group_name_on_air"]').text(hope_language[language]['I would like my donation to be anonymous']); $('label[for="cphDonationForm_txtOrganizationName"]').text(hope_language[language]['Organization Name']); $('label[for="cbOrgName"]').text(hope_language[language]['I am giving on behalf of an organization']); $('label[for="cphDonationForm_txtComments"]').text(hope_language[language]['Comments']); $('#cphDonationForm_txtComments').attr('placeholder',hope_language[language]['comments_placeholder']); $('#cphDonationForm_txtLName').attr('placeholder',hope_language[language]['Last Name']); $('#cphDonationForm_txtLName').attr('data-parsley-error-message',hope_language[language]['Last Name is required']); $('#cphDonationForm_txtFName').attr('placeholder',hope_language[language]['First Name']); $('#cphDonationForm_txtFName').attr('data-parsley-error-message',hope_language[language]['First Name is required']); $('#address .label-info-name').html(hope_language[language]['Name'] + ' *'); // $('label[for="card-element"]').text(hope_language[language]['Credit or debit card']); $('.credit-card label').html(hope_language[language]['Credit or debit card'] + ' *'); $('#cphDonationForm_sectionPlaid .align-items-sm-center p strong').text(hope_language[language]['We abide by strictest security standards.']); $('#cphDonationForm_sectionPlaid .align-items-sm-center p span').text(hope_language[language]['We never store any of your banking information.']); $('#help-info .close-modal').text(hope_language[language]['Close']); $('#amount .recurring .header').text(hope_language[language]['This months donation will be processed immediately.']); $('#payment .payment-types .credit').text(hope_language[language]['Credit Card']); $('#payment .payment-types .ach').text(hope_language[language]['Bank Account']); $('#btnLinkPlaid').text(hope_language[language]['Link Bank']); $('#help-info .mb-0').html(''+hope_language[language]['Is my donation secure?']+'
'+hope_language[language]['The security and confidentiality of your information is our highest priority...']+'

'+hope_language[language]['Do I get a receipt?']+'
'+hope_language[language]['A donation receipt will be sent to you at the email address you provide on this form...']); $('#help-info-title').text(hope_language[language]['Help & Information']); if(cpp){ $('#memicBTNs2').text(hope_language[language]['Monthly Gift']); }else{ $('#memicBTNs2').text(hope_language[language]['Monthly Gift']); //Recurring Gift } $('#memicBTNs1').text(hope_language[language]['Single Gift']); $('label[for="cb1"]').html( hope_language[language]['Yes, I want my free t-shirt!'] + ' '); $('#payment .legend-payment-options').text(hope_language[language]['Payment Details']); if($('#memicBTNs_sub4').hasClass('activeBTN')){ $('.moMeFull').text(hope_language[language]['monthly']); }else{ $('.moMeFull').text(hope_language[language]['Annually']); } returnFreqTypeMemo(); $('#staticBackdropLabel').text(hope_language[language]['USPS Address Validation']); $('#reject_usps_address_btn').text(hope_language[language]['Use provided address']); $('#accept_usps_address_btn').text(hope_language[language]['Use validated address']); $('#other-amt-monthly').attr('placeholder',hope_language[language]['My Best Monthly Gift']); $('#other-amt-monthly').attr('data-content',hope_language[language]['Click here and then type your best gift.']); $('#other-amt-single').attr('placeholder',hope_language[language]['My Best Single Gift']); $('#other-amt-single').attr('data-content',hope_language[language]['Click here and then type your best gift.']); if($('#cphDonationForm_hdnPaymentMethod').val()==14){ //increasing gift $('.with-fee-total strong').text(hope_language[language]['increase_gift_title']); }else{ $('.with-fee-total strong').text(hope_language[language]['total_gift_title']); } $('label[for="cphDonationForm_cbDonorCoversProcessingFee"]').html((hope_language[language]['Yes, add 2.5% to my donation to cover credit card fees...']).replace('RPAD_PROCESSING_FEE_PERCENTAGE', Math.round((processing_fee_percent_decimal*100) * 10) / 10)); $('.legend-your-frequency-information').html(hope_language[language]['CHOOSE RECURRING FREQUENCY']); $('.legend-your-frequency-type-information').html(hope_language[language]['PLEASE CHOOSE YOUR DONATION FREQUENCY']); $('.legend-your-donation-amount-information').html(hope_language[language]['YOUR DONATION']); $('.legend-your-information').html(hope_language[language]['YOUR INFORMATION']); $('#memicBTNs_sub1').text(hope_language[language]['Weekly']); $('#memicBTNs_sub2').text(hope_language[language]['Bi-Weekly']); $('#memicBTNs_sub4').text(hope_language[language]['monthly']); $('#memicBTNs_sub6').text(hope_language[language]['Quarterly']); $('#memicBTNs_sub7').text(hope_language[language]['Bi-Annually']); $('#memicBTNs_sub8').text(hope_language[language]['Annually']); $('#memicBTNs_sub1').attr('data-content', hope_language[language]['Every 7 Days']); $('#memicBTNs_sub2').attr('data-content', hope_language[language]['Every 14 Days']); $('#memicBTNs_sub7').attr('data-content', hope_language[language]['Twice A Year']); // Scripting Prompts // Show Frequency Prompt if(show_script == "true"){ var freq_script = `
${header_frequency_prompt}
`; if(!$("#frequency_prompt_container").length){ $('.legend-your-frequency-information').append(freq_script); } // Show Amount Prompt var amt_script = `
${header_amount_prompt}
` if(!$("#amount_prompt_container").length){ $('.legend-your-donation-amount-information').append(amt_script); } // Show Payment Details Prompt var pay_script = `
${header_payment_prompt}
`; if(!$("#payment_prompt_container").length){ $('.legend-payment-options').append(pay_script); } var cc_script = `
${header_cc_prompt}
`; if(!$("#cc_prompt_container").length){ $(".credit-card").prepend(cc_script) } var info_script = `
${header_info_prompt}
`; if(!$("#info_prompt_container").length){ $('.legend-your-information').append(info_script); } }; //overrides the images for languages $('.legend-payment-options').removeClass('fr_secure_donation'); $('.legend-payment-options').removeClass('es_secure_donation'); if(language=='es'){ $('.legend-payment-options').addClass('es_secure_donation'); }else if(language=='fr'){ $('.legend-payment-options').addClass('fr_secure_donation'); }else{ //nothing } $('#hope_submit_btn_title').text(hope_language[language]['Submit Donation']); $("#cphDonationForm_btnStripeSubmit").find('span').first().text(hope_language[language]['Submit Donation']); //at end of everything initalize popovers $('[data-toggle=popover]').popover(); try{ // var theActiveRecurringElement = document.querySelector('#frequency_section .memicBTNs').id; $("#frequency_section .memicBTNs").each(function(){ if($(this).hasClass("activeBTN")){ var pieces = ($(this)[0].id).split('memicBTNs_sub'); updateRecDate(pieces[1]); var word = $('#'+$(this)[0].id).text(); var firstLetter = word.charAt(0) var firstLetterCap = firstLetter.toUpperCase() var remainingLetters = word.slice(1) $("#submitAmount").find('span').first().text(' ' + firstLetterCap + remainingLetters); $('#hope_submit_btn_preview_below_title .moMeFull').html(' ' + firstLetterCap + remainingLetters); return false; } }); }catch(e){ //nothing } } function closeErrorMessage(){ $('#hope_error_message').hide(); } function doesNotExist(){ //does not exists $('body').html('

Redirecting to Donation Page
The donation url you entered is no longer available.
Redirecting to the current donation page in '+time_left_redirect+' seconds.
'); setInterval(function () { time_left_redirect = time_left_redirect - 1; $('#seconds_left').text(time_left_redirect); if(time_left_redirect<1){ location.href = 'https://raisedonors.com/wayfm/donation-page-main'; } }, 1000); } function addUpdateExistingButtonAndlistener(){ $('.payment-types').append(''+hope_language[language]['Update Existing Donation']+''); $( ".updateExistingDonation" ).click(function(event) { $( ".ach" ).removeClass('active'); $( ".credit" ).removeClass('active'); $( ".mailInCash" ).removeClass('active'); $( ".updateExistingDonation" ).addClass('active'); $('.credit-card').addClass('d-none'); $('#cphDonationForm_sectionPlaid').addClass('d-none'); $('#cphDonationForm_hdnPaymentMethod').val(14); $('#cphDonationForm_divGoogleApplePayCampaignName').addClass('d-none'); $('#updateExistingDonationContent').show(); $('#amount .recurring').hide(); $('.with-fee-total strong').text(hope_language[language]['increase_gift_title']); // $('#cphDonationForm_txtPhone').attr('data-parsley-required', true); // $('#cphDonationForm_txtPhone').attr('data-parsley-error-message', hope_language[language]['Phone is required']); // $('#cphDonationForm_txtPhone').attr('data-parsley-trigger', 'input change'); // $('label[for="cphDonationForm_txtPhone"]').html( hope_language[language]['Phone'] + '*' ); //uncheck processing fees - there is none on mail-in / cash //$( "#cphDonationForm_cbDonorCoversProcessingFee" ).prop( "checked", false ); //$( "#cphDonationForm_cbDonorCoversProcessingFee" ).change(); //hide amount / processing fees //$('#amount').hide(); }); } function addMailInButtonAndlistener(){ if(mailInOption == 1){ $('.payment-types').append('' + hope_language[language]['Mail-In / Cash'] + ''); $( ".mailInCash" ).click(function(event) { $( ".ach" ).removeClass('active'); $( ".credit" ).removeClass('active'); $( ".mailInCash" ).addClass('active'); $('.credit-card').addClass('d-none'); $('#cphDonationForm_sectionPlaid').addClass('d-none'); $('#cphDonationForm_hdnPaymentMethod').val(9); $('#cphDonationForm_divGoogleApplePayCampaignName').addClass('d-none'); $('#updateExistingDonationContent').hide(); if($('#memicBTNs2').hasClass('activeBTN')){ $('#amount .recurring').show(); } $('.with-fee-total strong').text(hope_language[language]['total_gift_title']); // $('#cphDonationForm_txtPhone').attr('data-parsley-required', false); // $('#cphDonationForm_txtPhone').attr('data-parsley-error-message', hope_language[language]['Phone is required']); // $('#cphDonationForm_txtPhone').attr('data-parsley-trigger', 'input change'); // $('label[for="cphDonationForm_txtPhone"]').text(hope_language[language]['Phone']); $('.updateExistingDonation').removeClass('active'); //uncheck processing fees - there is none on mail-in / cash $( "#cphDonationForm_cbDonorCoversProcessingFee" ).prop( "checked", false ); $( "#cphDonationForm_cbDonorCoversProcessingFee" ).change(); //hide amount / processing fees $('#amount').hide(); }); } } window.onscroll = function () { scrollFunction(); }; function init_display(){ //insert new anonymous option next to old one //onchange="updateAnon()" $( '' ).insertBefore( "#cphDonationForm_cbIsAnonymous" ); //hide the old anonymous option. -- we will toggle this programmically $('#cphDonationForm_cbIsAnonymous').hide(); $("label[for='cphDonationForm_cbIsAnonymous']").hide(); var top_header_details = ''; if(overall_custom_header==1){ if(language=='en'){ top_header_details = '

'+forms_heading_title_en+'

'+forms_heading_subtitle_en+'
'; }else if(language=='es'){ top_header_details = '

'+forms_heading_title_es+'

'+forms_heading_subtitle_es+'
'; }else{ top_header_details = '

'+forms_heading_title_fr+'

'+forms_heading_subtitle_fr+'
'; } } $('link[rel="shortcut icon"]').attr('href', short_img_url); document.getElementById("wayFMScreen").style.backgroundSize = bg_size; document.getElementById("wayFMScreen").style.backgroundImage = "url('"+img_url+"')"; document.getElementById("cpContentHeader_ImgLogoNoLink").src = img_url; $('#wayFMScreenSpinner').fadeOut(); var thisHtml = $('#cphDonationForm_btnStripeSubmit .submit-amount').html(); thisHtml = thisHtml.replace('Amount: ', ''); $('#cphDonationForm_btnStripeSubmit .submit-amount').html(thisHtml); $('#hope_submit_btn_preview_below_title').html(thisHtml); $('#cphDonationForm_ddlRecurringFrequency').val(12); $('.recurring .content .row').hide(); updateRecDate(4); if(form_cycle=='Single'){ changeView(0); } if( language=="es"){ $('#cpContentHeader_divDonorLoginAndHelp_Top .list-unstyled').append('
  • Español
  • '); } else if (language=="fr"){ $('#cpContentHeader_divDonorLoginAndHelp_Top .list-unstyled').append('
  • Français
  • '); } else { $('#cpContentHeader_divDonorLoginAndHelp_Top .list-unstyled').append('
  • English
  • '); } change_lang(language); //when a user clicks the submit button. Can be decline, form invalid (not completed), or success // $( "#cphDonationForm_btnStripeSubmit" ).click(function(event) { //number_of_submit_clicks++; //formStats(3,returnAmount()); //}); //$('body').css("overflow","visible"); $( ".ach" ).click(function(event) { $('.credit-card').addClass('d-none'); $('#updateExistingDonationContent').hide(); $('#cphDonationForm_sectionPlaid').removeClass('d-none'); $('#amount').show(); if($('#memicBTNs2').hasClass('activeBTN')){ $('#amount .recurring').show(); } $('.updateExistingDonation').removeClass('active'); $('.with-fee-total strong').text(hope_language[language]['total_gift_title']); // $('#cphDonationForm_txtPhone').attr('data-parsley-required', false); // $('#cphDonationForm_txtPhone').attr('data-parsley-error-message', hope_language[language]['Phone is required']); // $('#cphDonationForm_txtPhone').attr('data-parsley-trigger', 'input change'); // $('label[for="cphDonationForm_txtPhone"]').text(hope_language[language]['Phone']); }); $( ".credit" ).click(function(event) { $('#updateExistingDonationContent').hide(); $('#amount').show(); $('.with-fee-total strong').text(hope_language[language]['total_gift_title']); $('.updateExistingDonation').removeClass('active'); if($('#memicBTNs2').hasClass('activeBTN')){ $('#amount .recurring').show(); } // $('#cphDonationForm_txtPhone').attr('data-parsley-required', false); // $('#cphDonationForm_txtPhone').attr('data-parsley-error-message', hope_language[language]['Phone is required']); // $('#cphDonationForm_txtPhone').attr('data-parsley-trigger', 'input change'); // $('label[for="cphDonationForm_txtPhone"]').text(hope_language[language]['Phone']); }); $( ".ap" ).click(function(event) { $('#updateExistingDonationContent').hide(); $('#amount').show(); $('.with-fee-total strong').text(hope_language[language]['total_gift_title']); $('.updateExistingDonation').removeClass('active'); if($('#memicBTNs2').hasClass('activeBTN')){ $('#amount .recurring').show(); } //$('#cphDonationForm_txtPhone').attr('data-parsley-required', false); //$('#cphDonationForm_txtPhone').attr('data-parsley-error-message', hope_language[language]['Phone is required']); //$('#cphDonationForm_txtPhone').attr('data-parsley-trigger', 'input change'); //$('label[for="cphDonationForm_txtPhone"]').text(hope_language[language]['Phone']); }); //addMonthlySelector(); //after the user fills in their email address (aka starts the form) $('#cphDonationForm_txtEmail').change(function() { formStats(2,returnAmount()); }); $('#tab-content').remove(); $('#processing-fees .form-check').addClass('mod_check_box'); $('#processing-fees .mod_check_box').removeClass('form-check'); if(t_shirt){ var fairMarketVal = ' '; if(form_brand=='2'||form_brand=='4'||form_brand=='11'){ fairMarketVal = ''; } $('#processing-fees').append('
    '); } //
    Semimonthly
    //
    Bimonthly
    //
    Biennially
    $('body').append('
    Donation amount must be at least $5
    '); var customNumberInput = '
    '; var customNumberInput2 = '
    '; $('.language_options').removeClass('active'); $('#language_options_' + language).addClass('active'); var single_col_type = '3'; var firstSection = 'style="display:none;"'; var recurringVsMonthly = hope_language[language]['Monthly Gift']; //Recurring Gift if(capital_campaign){ var capitalCamTitle = '
    ' + hope_language[language]['Transform Every Heart...'] + '
    '; $('#cphDonationForm_hdnChosenAmount').val(0); if(form_cycle=='Monthly'){ // firstSection = ''; } var first_element = ''; var second_element = ''; var single_amount_btns = ''; var recurring_amount_btns = ''; var inputs_active_class = "activeBTN "; addMailInButtonAndlistener(); }else if(cpp){ $('#donation').addClass('cppStructure'); $('.form-wrapper').addClass('cppFormStyle'); $('#cbOrgName').click(); //$('#cbOrgName').prop('checked',true); $('#cbOrgName').prop('disabled',true); $('#cphDonationForm_cbIsAnonymous').parent().parent().hide(); var capitalCamTitle = ''; var first_element = '
    '; //
    or
    var second_element = '
    '; //
    or
    var recurring_amount_btns = ''; var single_amount_btns = ''; recurringVsMonthly = hope_language[language]['Monthly Gift']; customNumberInput = ''; customNumberInput2 = ''; }else{ var capitalCamTitle = ''; var inputs_active_class = ""; addMailInButtonAndlistener(); if(Number(singleAmount1)==0){ var first_element = ''; single_col_type = '4'; }else{ var first_element = '
    '; } var monthly_col_type = '3'; if(Number(monthlyAmount1_amount)==0){ var second_element = ''; monthly_col_type = '4'; }else{ var second_element = '
    '; } addUpdateExistingButtonAndlistener(); var single_amount_btns = '
    '; var recurring_amount_btns = '
    '; } if($('#cphDonationForm_hdnPaymentMethod').val()==14){ //increasing gift var totGiftOrIncreaseTitle = hope_language[language]['increase_gift_title']; }else{ var totGiftOrIncreaseTitle = hope_language[language]['total_gift_title']; } //
    '+hope_language[language]['Weekly']+'
    '+hope_language[language]['Bi-Weekly']+'
    //
    '+hope_language[language]['Quarterly']+'
    '+hope_language[language]['Bi-Annually']+'
    var modifiyExisting = '
    '+hope_language[language]['Need to make a change on an existing donation?']+' '+hope_language[language]['Login']+'
    '; $('
    ').insertAfter( ".payment-types" ); $('header').append(modifiyExisting); $('#form').prepend(top_header_details+capitalCamTitle+'
    '+hope_language[language]['PLEASE CHOOSE YOUR DONATION FREQUENCY']+'
    '+recurringVsMonthly+'
    '+hope_language[language]['Single Gift']+'
    '+hope_language[language]['CHOOSE RECURRING FREQUENCY']+'
    '+hope_language[language]['monthly']+'
    '+hope_language[language]['Annually']+'
    '+hope_language[language]['YOUR DONATION']+'
    '+first_element+single_amount_btns+customNumberInput+'
    '+second_element + recurring_amount_btns + customNumberInput2 + '
    '); // This page is for internal use - append scripting to the page. if(show_script == "true"){ // T-shirt Prompt var tshirt_script = `
    ${tshirt_prompt}
    ` $("#tshirtDiv").before(tshirt_script); // Processing Fees Prompt var pfee_script = `
    ${processing_prompt}
    ` $("#processing-fees").prepend(pfee_script); // Recurring Option Prompt var rec_script = `
    ${receipts_prompt}
    `; $("#amount .recurring").prepend(rec_script); // Submit Button var sub_script = `
    ${submit_prompt}
    `; $("#submit-stripe").prepend(sub_script); // Email var email_script = `
    ${email_addr_prompt}
    `; $(".label-info-email").parent().prepend(email_script); // Phone var phone_script = `
    ${phone_prompt}
    `; $(".label-info-phone").parent().prepend(phone_script); // Address var addr_script = `
    ${address_prompt}
    `; $(".label-info-address").parent().prepend(addr_script); }; if(capital_campaign){ if(form_cycle!='Single'){ // $('#other-amt-monthly').focus(); }else{ // $('#other-amt-single').focus(); } } change_lang(language); // //$('#plaid-link-iframe-1').prependTo("body"); $('[data-toggle="popover"]').popover(); // $('[data-toggle="tooltip"]').tooltip() if($("#cphDonationForm_cbRecurring").is(':checked')){ $('#memicBTNs1').removeClass("activeBTN"); $('#memicBTNs2').addClass("activeBTN"); $('#single').hide(); $('#monthly').show(); setTimeout(function(){ $('#'+defaultMonthly).click(); //monthly default }, 40); }else{ $('#memicBTNs1').addClass("activeBTN"); $('#memicBTNs2').removeClass("activeBTN"); $('#single').show(); $('#monthly').hide(); setTimeout(function(){ $('#'+defaultSingle).click(); //single default }, 40); } document.getElementsByClassName('submit-amount')[0].className += " d-none"; $('#other-amt-monthly').removeClass('activeBTN'); $('#other-amt-monthly').removeClass('choosenOne'); $('#other-amt-single').removeClass('activeBTN'); $('#other-amt-single').removeClass('choosenOne'); $('.anAmount label').removeClass('active'); $('.anAmount label').removeClass('choosenOne'); $('.anAmount label').removeClass('active'); $('.anAmount label').removeClass('choosenOne'); $( "#cphDonationForm_cbDonorCoversProcessingFee" ).change(function(e) { setTimeout(function(){ if($('#other-amt-single').hasClass('choosenOne')){ var thisBlock = $('#other-amt-single').val(); }else if($('#other-amt-monthly').hasClass('choosenOne')){ var thisBlock = $('#other-amt-monthly').val(); }else{ var thisBlock = $('.choosenOne').html(); } if(thisBlock==''||thisBlock==' '||thisBlock==undefined){ var floatAmount = 0; $('.with-fee-total').addClass('d-none'); }else{ $('.with-fee-total').removeClass('d-none'); var floatAmount = parseFloat((thisBlock).replace(/[^0-9.]/g, '').trim()); } if($('#cphDonationForm_cbDonorCoversProcessingFee').is(':checked')){ var total = floatAmount + (floatAmount*processing_fee_percent_decimal); $('#cphDonationForm_hdnChosenAmount').val( (total).toFixed(2) ); var thisTotal = total; if($('#memicBTNs2').hasClass('activeBTN')){ //monthly currentAmount = total; addUpMealsFeed(total); if($('#memicBTNs_sub4').hasClass('activeBTN')){ $('.with-fee-total').html('

    '+ totGiftOrIncreaseTitle +' '+ numberWithCommas((Number(thisTotal)).toFixed(2)) +' ' + hope_language[language]['monthly'] + '

    '); $('#submitAmount').html(' ' + numberWithCommas(thisTotal.toFixed(2)) + ' ' + hope_language[language]['monthly'] + ''); $('#hope_submit_btn_preview_below_title').html(' '+ numberWithCommas(thisTotal.toFixed(2)) + ' ' + hope_language[language]['monthly'] + ''); }else{ $('.with-fee-total').html('

    '+ totGiftOrIncreaseTitle +' '+ numberWithCommas((Number(thisTotal)).toFixed(2)) +' ' + hope_language[language]['Annually'] + '

    '); $('#submitAmount').html(' ' + numberWithCommas(thisTotal.toFixed(2)) + ' ' + hope_language[language]['Annually'] + ''); $('#hope_submit_btn_preview_below_title').html(' '+ numberWithCommas(thisTotal.toFixed(2)) + ' ' + hope_language[language]['Annually'] + ''); } }else{ $('#submitAmount').html(' ' + numberWithCommas(thisTotal.toFixed(2)) ); $('#hope_submit_btn_preview_below_title').html(' '+ thisTotal.toFixed(2) ); currentAmount = total; addUpMealsFeed(total); $('.with-fee-total').html('

    '+ totGiftOrIncreaseTitle +' '+ numberWithCommas((Number(thisTotal)).toFixed(2)) +'

    '); } // $('.with-fee-total').removeClass('d-none'); }else{ $('#cphDonationForm_hdnChosenAmount').val( (floatAmount).toFixed(2) ); if($('#memicBTNs2').hasClass('activeBTN')){ if($('#memicBTNs_sub4').hasClass('activeBTN')){ $('#submitAmount').html(' ' +numberWithCommas(floatAmount.toFixed(2)) + ' ' + hope_language[language]['monthly'] + ''); $('#hope_submit_btn_preview_below_title').html(' '+ numberWithCommas(floatAmount.toFixed(2)) + ' ' + hope_language[language]['monthly'] + ''); }else{ $('#submitAmount').html(' ' +numberWithCommas(floatAmount.toFixed(2)) + ' ' + hope_language[language]['Annually'] + ''); $('#hope_submit_btn_preview_below_title').html(' '+numberWithCommas(floatAmount.toFixed(2)) + ' ' + hope_language[language]['Annually'] + ''); } }else{ $('#hope_submit_btn_preview_below_title').html(' '+ numberWithCommas(floatAmount.toFixed(2))); $('#submitAmount').html(' ' +numberWithCommas(floatAmount.toFixed(2))); } currentAmount = floatAmount; addUpMealsFeed(floatAmount); $('.with-fee-total').addClass('d-none'); } }, 10); }); setTimeout(function(){ $( "#cphDonationForm_txtAddress" ).change(addressCompleted); $('#cphDonationForm_txtCity').change(addressCompleted); $('#cphDonationForm_ddlState').change(addressCompleted); $('#cphDonationForm_txtZipCode').change(addressCompleted); $('#cphDonationForm_ddlCountry').change(addressCompleted); formStats(1,returnAmount()); //$('#cphDonationForm_btnStripeSubmit').prop("disabled",true); }, 100); $( "#cphDonationForm_cbMilitaryCheckbox" ).change(function() { if($( "#cphDonationForm_cbMilitaryCheckbox" ).is(":checked")){ //$('#cphDonationForm_btnStripeSubmit').prop("disabled",false); } }); setTimeout(function(){ $('#donation').removeClass('modal-open'); $(window).scrollTop(0); $('#wayFMScreen').fadeOut(); $('#cpContentHeader_ImgLogoNoLink').show(); }, 1000); } function trueFalseToInt(flagIn){ if(flagIn=="true"||flagIn==true){ return 1; }else{ return 0; } } document.addEventListener("DOMContentLoaded", function(){ $('body').addClass('modal-open'); $('#cphDonationForm_btnStripeSubmit').hide(); $('#cpContentHeader_ImgLogoNoLink').hide(); $('#cphDonationForm_hdnMiscInformation').val($('#cphDonationForm_hdnMiscInformation').val() + 'custom_virtuousapi_shirt=true|'); $('#cphDonationForm_hdnDonorCoversProcessingFeePercent').val( (processing_fee_percent_decimal * 100).toFixed(2) ); $("#submit-stripe").append('
    Submit Donation
    10.00 Monthly
    '); var donation_page_id = returnURLParamValue(window.location.href, 'i'); var donation_fund_code = returnURLParamValue(window.location.href, 'fund-code'); if(donation_page_id==null||donation_fund_code==null){ $('body').html('
    Configuration Error
    This page is missing required URL parameters.
    example
    https://'+ window.location.hostname + window.location.pathname +'?i=YOUR_PAGE_ID&fund-code=YOUR_FUND_CODE
    '); }else{ var data = new Object(); data.method = 430; data.ag = btoa(navigator.appVersion); data.i = btoa(donation_page_id.replace(/[^a-z0-9]/gi, '')); data.u = btoa(window.location.href); data.p = btoa(returnURLParams(window.location.href)); data.n = btoa(returnURLParamsNum(window.location.href)); data.e = btoa(returnEmail()); data.c = btoa(number_of_submit_clicks); data.u = btoa(unique_id); var options = new Object(); options.data = data; options.dataType = 'text'; options.type = 'post'; options.success = function (response) { var objectReturned = JSON.parse(response); if(objectReturned['status']=='success'){ if((objectReturned['results']['page']).length>0){ form_id = objectReturned['results']['donation_page_id']; form_brand = objectReturned['results']['brand']; switch(form_brand){ case "1": form_brand_name = 'WayFM'; break; case "2": form_brand_name = 'Hope Media Group'; break; case "3": form_brand_name = 'KSBJ'; break; case "5": form_brand_name = 'NGEN Radio'; break; case "7": form_brand_name = 'WAY LOUD'; break; case "10": form_brand_name = 'Hope On Demand'; break; case "12": form_brand_name = 'Vida Unida'; break; case "14": form_brand_name = 'Hope Nation'; break; case "15": form_brand_name = 'Hope Events'; break; case "16": form_brand_name = 'God Listens, the Prayer App'; break; } img_url = "https://"+domainPre+".hopemediagroup.com/img/"+ objectReturned['results']['logo']; short_img_url = "https://"+domainPre+".hopemediagroup.com/img/"+ objectReturned['results']['favicon']; for (var x = 0; x < (objectReturned['results']['page']).length; x++) { if(objectReturned['results']['page'][x]['name']=='T-Shirt'){ t_shirt = parseInt(trueFalseToInt(objectReturned['results']['page'][x]['value'])); }else if(objectReturned['results']['page'][x]['name']=='Default Cycle'){ form_cycle = objectReturned['results']['page'][x]['value']; }else if(objectReturned['results']['page'][x]['name']=='Default Single Amount'){ defaultSingle = "anAmount" + (objectReturned['results']['page'][x]['value']).slice(-1); }else if(objectReturned['results']['page'][x]['name']=='Default Monthly Amount'){ defaultMonthly = "anAmount" + (Number((objectReturned['results']['page'][x]['value']).slice(-1)) + 4); }else if(objectReturned['results']['page'][x]['name']=='Language'){ language = objectReturned['results']['page'][x]['value']; }else if(objectReturned['results']['page'][x]['name']=='T-Shirt Recurring Threshold'){ t_shirt_monthly_min = Number(objectReturned['results']['page'][x]['value']); }else if(objectReturned['results']['page'][x]['name']=='T-Shirt Single Threshold'){ t_shirt_single_min = Number(objectReturned['results']['page'][x]['value']); }else if(objectReturned['results']['page'][x]['name']=='capital_campaign'){ capital_campaign = objectReturned['results']['page'][x]['value']; }else if(objectReturned['results']['page'][x]['name']=='Custom Header'){ overall_custom_header = parseInt(trueFalseToInt(objectReturned['results']['page'][x]['value'])); }else if(objectReturned['results']['page'][x]['name']=='Custom Header English Title'){ forms_heading_title_en = objectReturned['results']['page'][x]['value']; }else if(objectReturned['results']['page'][x]['name']=='Custom Header Spanish Title'){ forms_heading_title_es = objectReturned['results']['page'][x]['value']; }else if(objectReturned['results']['page'][x]['name']=='Custom Header French Title'){ forms_heading_title_fr = objectReturned['results']['page'][x]['value']; }else if(objectReturned['results']['page'][x]['name']=='Custom Header English Subtext'){ forms_heading_subtitle_en = objectReturned['results']['page'][x]['value']; }else if(objectReturned['results']['page'][x]['name']=='Custom Header Spanish Subtext'){ forms_heading_subtitle_es = objectReturned['results']['page'][x]['value']; }else if(objectReturned['results']['page'][x]['name']=='Custom Header French Subtext'){ forms_heading_subtitle_fr = objectReturned['results']['page'][x]['value']; }else if(objectReturned['results']['page'][x]['name']=='Mail In Payment Method'){ mailInOption = parseInt(trueFalseToInt(objectReturned['results']['page'][x]['value'])); }else if(objectReturned['results']['page'][x]['name']=='Require Phone Number'){ phoneNumberRequiredOption = parseInt(trueFalseToInt(objectReturned['results']['page'][x]['value'])); if(phoneNumberRequiredOption==1){ $('label[for=cphDonationForm_txtPhone]').html('Phone *'); $('#cphDonationForm_txtPhone').attr('data-parsley-required',true); $('#cphDonationForm_txtPhone').attr('data-parsley-trigger','input change'); $('#cphDonationForm_txtPhone').attr('data-parsley-error-message','Phone is required'); } }else if(objectReturned['results']['page'][x]['name']=='Donation Form Type'){ if(objectReturned['results']['page'][x]['value']=="CPP"){ cpp = true; }else if(objectReturned['results']['page'][x]['value']=="Capital Campaign"){ capital_campaign = true; } }else if(objectReturned['results']['page'][x]['name']=='Single Amount 1'){ singleAmount1 = return_number(objectReturned['results']['page'][x]['value']); }else if(objectReturned['results']['page'][x]['name']=='Single Amount 2'){ singleAmount2 = return_number(objectReturned['results']['page'][x]['value']); }else if(objectReturned['results']['page'][x]['name']=='Single Amount 3'){ singleAmount3 = return_number(objectReturned['results']['page'][x]['value']); }else if(objectReturned['results']['page'][x]['name']=='Single Amount 4'){ singleAmount4 = return_number(objectReturned['results']['page'][x]['value']); }else if(objectReturned['results']['page'][x]['name']=='Monthly Amount 1'){ monthlyAmount1_amount = return_number(objectReturned['results']['page'][x]['value']); }else if(objectReturned['results']['page'][x]['name']=='Monthly Amount 2'){ monthlyAmount2_amount = return_number(objectReturned['results']['page'][x]['value']); }else if(objectReturned['results']['page'][x]['name']=='Monthly Amount 3'){ monthlyAmount3_amount = return_number(objectReturned['results']['page'][x]['value']); }else if(objectReturned['results']['page'][x]['name']=='Monthly Amount 4'){ monthlyAmount4_amount = return_number(objectReturned['results']['page'][x]['value']); }else if(objectReturned['results']['page'][x]['name']=='Published'){ published = objectReturned['results']['page'][x]['value']; }else if(objectReturned['results']['page'][x]['name']=='Show Script'){ show_script = objectReturned['results']['page'][x]['value']; } if((x+1)==(objectReturned['results']['page']).length){ if(overall_custom_header==0){ //we dont want to use these forms_heading_title_en = ''; forms_heading_title_es = ''; forms_heading_title_fr = ''; forms_heading_subtitle_en = ''; forms_heading_subtitle_es = ''; forms_heading_subtitle_fr = ''; } hope_language[language] = objectReturned['results']['texts']; document.title = hope_language[language]['donate_to'] + " " + objectReturned['results']['name']; monthlyAmount1 = return_number(monthlyAmount1_amount) +'/'+hope_language[language]['month_abbreviation']+''; //anAmount5 monthlyAmount2 = return_number(monthlyAmount2_amount) +'/'+hope_language[language]['month_abbreviation']+''; //anAmount6 monthlyAmount3 = return_number(monthlyAmount3_amount) +'/'+hope_language[language]['month_abbreviation']+''; //anAmount7 monthlyAmount4 = return_number(monthlyAmount4_amount) +'/'+hope_language[language]['month_abbreviation']+''; //anAmount8 if(published=="true"||published==true){ init_display(); }else{ doesNotExist(); } } } }else{ doesNotExist(); } }else{ alert('could not connect'); } }; options.error = function (response) { doesNotExist() }; options.url = 'https://'+domainPre+'.hopemediagroup.com/api_endpoints/api_sub_processor2.php'; $.ajax(options); } });