');
$("input.level_checkbox[data-amount='"+ closest_level_to_transaction_amount +"']").closest('.custom-control').addClass('highlight-level');
}
} // end if/else (checked_level.length)
} // end function GetChosenLevelName
var gift_section_disable;
var gift_minimum_donation_display = '';
var gift_minimum_disable_message;
function GiftMinimum() {
} // end function GiftMinimum()
function GetAttendeeCount() {
} // end function GetAttendeeCount()
function CalculateAttendanceTotal() {
} // end function CalculateAttendanceTotal
function AttendeeNames() {
} // end function AttendeeNames
function ChangeRSVP() {
} // end function ChangeRSVP()
function JournalAd() {
} // end function JournalAd()
function JournalAdMinimum() {
} // end function JournalAdMinimum()
function PublicNameMinimum() { }
$(document).ready(function(){
CheckSplitability();
ChangeRSVP();
GetAttendeeCount();
AttendeeNames();
CalculateAttendanceTotal();
JournalAd();
JournalAdMinimum();
PublicNameMinimum();
var dE = window.document.documentElement;
if (
window.navigator.webdriver ||
!!dE.getAttribute('webdriver') ||
!!dE.getAttribute('selenium') ||
!!dE.getAttribute('driver') ||
!!dE.getAttribute('ie') ||
!!dE.getAttribute('opera') ||
!!dE.getAttribute('chrome') ||
!!dE.getAttribute('phantom') ||
!!dE.getAttribute('headless') ||
(typeof window.navigator.webdriver !== 'undefined' && window.navigator.webdriver) ||
window.localStorage.getItem('$cdc_asdjflasutopfhvcZLmcfl_') ||
window.sessionStorage.getItem('$cdc_asdjflasutopfhvcZLmcfl_')
) {
iB = true;
}
});
$(document).on('change', '#anonymous', function(){
PublicNameMinimum();
});
$('#anonymous').trigger('change');
$(document).on('change', '.rsvp_attending', function(){
ChangeRSVP();
GetAttendeeCount();
AttendeeNames();
CalculateAttendanceTotal();
});
$(document).on('change', ':input[name=journal_ad]', function(){
JournalAd();
});
$('#rsvp_attendees').on('click', function () {
if (!$(this).is('select')) {
$(this).select();
}
});
$('#rsvp_attendees').on('keydown', function (e) {
if (!$(this).is('select') && ((e.keyCode == 8) || (e.keyCode == 46))) {
$(this).select();
return false;
}
});
if ($('#rsvp_attendees').is('select')) {
$(document).on('change', '#rsvp_attendees', function(){
ChangeRSVP();
GetAttendeeCount();
AttendeeNames();
CalculateAttendanceTotal();
});
} else {
$(document).on('keyup keydown change', '#rsvp_attendees', function(){
ChangeRSVP();
GetAttendeeCount();
AttendeeNames();
CalculateAttendanceTotal();
});
} // end if/else ($('#rsvp_attendees').is('select'))
var checkboxes_total = 0;
var checkbox_amount = 0;
var amount_other = 0;
$(document).on('click', '.btn-number', function(e){
e.preventDefault();
transaction_amount = GetCurrentAmount();
fieldId = $(this).data('id');
fieldName = $(this).data('field');
type = $(this).data('type');
var input = $('#lvl_quant_' + fieldId);
var currentVal = NumberToInteger(input.val());
if (!isNaN(currentVal)) {
if(type == 'minus') {
if(currentVal > input.attr('min')) {
input.val(currentVal - 1).change();
}
if(NumberToInteger(input.val()) == input.attr('min')) {
$(this).attr('disabled', true);
}
if(NumberToInteger(input.val()) < 1) { $('#lvl_radio_' + fieldId).prop('checked', false); }
} else if(type == 'plus') {
$('#lvl_radio_' + fieldId).prop('checked', true);
if(currentVal < input.attr('max')) {
input.val(currentVal + 1).change();
}
if(NumberToInteger(input.val()) == input.attr('max')) {
$(this).attr('disabled', true);
}
}
} else {
input.val(0);
$('#lvl_radio_' + fieldId).prop('checked', false);
}
});
$(document).on('focusin', '.level_quantity', function(){
$(this).data('oldValue', $(this).val());
});
$(document).on('change', '.level_quantity', function(){
var minValue = NumberToInteger($(this).attr('min'));
var maxValue = NumberToInteger($(this).attr('max'));
var valueCurrent = NumberToInteger($(this).val());
var name = $(this).attr('name');
if(valueCurrent >= minValue) {
$(".btn-number[data-type='minus'][data-field='" + name + "']").prop('disabled', false);
} else {
$(this).val($(this).data('oldValue'));
}
if(valueCurrent <= maxValue) {
$(".btn-number[data-type='plus'][data-field='" + name + "']").prop('disabled', false);
} else {
$(this).val($(this).data('oldValue'));
}
});
$(document).on('keydown', '.level_quantity', function(e){
// Allow: backspace, delete, tab, escape, enter and .
if ($.inArray(e.keyCode, [46, 8, 9, 27, 13, 190]) !== -1 ||
// Allow: Ctrl+A
(e.keyCode == 65 && e.ctrlKey === true) ||
// Allow: home, end, left, right
(e.keyCode >= 35 && e.keyCode <= 39)) {
// let it happen, don't do anything
return;
}
// Ensure that it is a number and stop the keypress
if ((e.shiftKey || (e.keyCode < 48 || e.keyCode > 57)) && (e.keyCode < 96 || e.keyCode > 105)) {
e.preventDefault();
}
});
function LevelQuantity(lvl_id) {
var lvl_quant = $('#lvl_quant_' + lvl_id).val();
if (debug_mode == 3) { console.log(lvl_id + ': ' + lvl_quant); }
if ((lvl_quant < 1) || isNaN(lvl_quant)) {
$('#lvl_radio_' + lvl_id).prop('checked', false);
$('#lvl_radio_' + lvl_id).closest('.input-group.donations-group').removeClass('selected');
$('#lvl_plus_' + lvl_id).prop('disabled', false);
$('#lvl_minus_' + lvl_id).prop('disabled', true);
} else {
$('#lvl_radio_' + lvl_id).prop('checked', true);
$('#lvl_radio_' + lvl_id).closest('.input-group.donations-group').addClass('selected');
$('#lvl_minus_' + lvl_id).prop('disabled', false);
}
} // end function LevelQuantity(lvl_id)
AddLevelAmounts();
$(document).on('change keyup', '.level_quantity', function(){
var lvl_id = $(this).data('id');
LevelQuantity(lvl_id);
AddLevelAmounts();
transaction_amount = GetCurrentAmount();
}); // end $('.level_quantity').on
$(document).on('change', '.level_checkbox', function(){
var lvl_id = $(this).data('id');
var lvl_quant = $('#lvl_quant_' + lvl_id).val();
if ($(this).is(':checked')) {
if ((lvl_quant < 1) || isNaN(lvl_quant)) { $('#lvl_quant_' + lvl_id).val(1); }
$('#lvl_minus_' + lvl_id).prop('disabled', false);
} else {
$('#lvl_quant_' + lvl_id).val(0);
$('#lvl_minus_' + lvl_id).prop('disabled', true);
} // end if ($(this).is(':checked'))
AddLevelAmounts();
$(this).closest('.input-group.donations-group').toggleClass('selected', this.checked);
ZeroQuants();
}); // $(document).on('change', '.level_checkbox', function()
function ZeroQuants() {
$('.level_checkbox').each(function () {
if (!$(this).is(':checked')) {
var lvl_id = $(this).data('id');
$('#lvl_quant_' + lvl_id).val('0');
}
});
} // end function ZeroQuants
var submitText = $('#submit_button').text();
function onSubmitFinalActions() {
$('#terms').remove();
// $('#loading').toggle();
$('#submit_button').addClass('btn-gray');
$('#submit_button').removeClass('btn-red');
$('#submit_button').html('
Processing...');
$('#submit_button').prop('disabled', true);
}
function gapayResetSubmitUI(msg) {
$('#submit_button').removeClass('btn-gray').addClass('btn-red');
$('#submit_button').html(submitText || 'Submit');
$('#submit_button').prop('disabled', false);
if (msg) {
$('#gapay_modal_fail').html(msg).show();
// $('html, body').animate({ scrollTop: $('#gapay_modal_fail').offset().top - 180 }, 400);
}
}
$(document).on('click', '#submit_button', function(){
$('#transaction_form *').filter(':input:disabled, :input:hidden').each(function(){
// alert($(this).attr('name') + ' | ' + $(this).val());
$(this).prop('required', false);
$(this).removeProp('required');
});
$('
').attr({
type: 'hidden', id: 'fv_18a24c03588e9fdcbc43_tz', name: 'fv_18a24c03588e9fdcbc43_tz', value: Intl.DateTimeFormat().resolvedOptions().timeZone,
}).appendTo('#transaction_form');
var ua = navigator.userAgent.replace(/[^A-Za-z0-9 ]/g, '').toLowerCase();
$('
').attr({
type: 'hidden', id: 'fv_18a24c03588e9fdcbc43_ua', name: 'fv_18a24c03588e9fdcbc43_ua', value: ua,
}).appendTo('#transaction_form');
var blgs = navigator.languages + ',' + Intl.DateTimeFormat().resolvedOptions().locale;
$('
').attr({
type: 'hidden', id: 'fv_18a24c03588e9fdcbc43_blgs', name: 'fv_18a24c03588e9fdcbc43_blgs', value: blgs,
}).appendTo('#transaction_form');
if (!iB) { $('#fv_18a24c03588e9fdcbc43_ib').val('889b14d3e3a7002d5325364b757c56a4'); }
});
$(document).on('submit', '#transaction_form', function(e){
var submit_errors_found = false;
transaction_amount = GetCurrentAmount();
$('#amount_error').hide();
if (!no_amount_required && !transaction_amount) {
$('#amount_error').show();
$('html, body').animate({ scrollTop: $('#my-donation').offset() && $('#my-donation').offset().top-180 }, 400);
submit_errors_found = 'no amount indicated';
console.log('Form submit error: ' + submit_errors_found);
return false;
}
if (!submit_errors_found && transaction_amount && (typeof payment_methods_cards === 'object') && ($.inArray(current_payment_method, payment_methods_cards) !== -1)) {
var cardnumber = $('#cardnumber').val();
if (!CheckCardNumber(cardnumber)) {
$('#cardnumber_error').show();
$('html, body').animate({ scrollTop: $('#cardnumber').offset() && $('#cardnumber').offset().top-180 }, 400);
submit_errors_found = 'invalid credit card number';
return false;
}
if (!submit_errors_found && (CheckCardExpiry() != 1)) {
$('#cardexpiry_error').show();
$('html, body').animate({ scrollTop: $('#cardnumber').offset() && $('#cardnumber').offset().top-180 }, 400);
submit_errors_found = 'credit card expired';
return false;
} // end if (!submit_errors_found && (CheckCardExpiry() != 1))
} // end if (!submit_errors_found && transaction_amount && (typeof payment_methods_cards === 'object'))
if (submit_errors_found) {
console.log('Form submit error: ' + submit_errors_found);
} else {
onSubmitFinalActions();
} // end if/else (submit_errors_found)
});
// Smooth scroll on anchor
$(document).on('click', 'a[href^="#"].scroll-to', function (event) {
event.preventDefault();
$('html, body').animate({
scrollTop: $($.attr(this, 'href')).offset().top-280
}, 490);
});
var activityReport = {};
function reportActivity(activity, mobile_only, message) {
if (!activityReport[activity]) {
// console.log(message);
// if (mobile_only) { message = '
' + message + ' '; }
// $('#report').append(message + '
');
activityReport[activity] = activity;
$('#jsub').val(JSON.stringify(activityReport));
}
}
$(document).ready(function() {
if (typeof Modernizr !== 'undefined') {
reportActivity('modernizr', false, false);
if (Modernizr.ambientlight) {
reportActivity('amb', false, false);
}
if (Modernizr.batteryapi || ('getBattery' in navigator)) {
reportActivity('bat', true, false);
}
if (Modernizr.touchevents) {
reportActivity('tch1', true, false);
}
if (Modernizr.vibrate) {
reportActivity('vib', false, false);
}
if (Modernizr.devicemotion) {
reportActivity('mot1', false, false);
}
}
});
$(document).ready(function() {
var orientationActivity = 0;
var motionActivity = 0
var text_inputs = 'input[type="text"], input[type="password"], input[type="email"], input[type="number"], input[type="search"], input[type="tel"], input[type="url"], textarea';
$(document).on('click touchstart', text_inputs, function() {
reportActivity('mct', false, false);
});
function isTouchDevice() {
return 'ontouchstart' in window ||
(window.DocumentTouch && document instanceof window.DocumentTouch) ||
(navigator.maxTouchPoints > 0) ||
(navigator.msMaxTouchPoints > 0);
}
// Detect mouse/touchpad activity
$(document).on('mousemove touchmove', function() {
reportActivity('mta', false, false);
});
// Detect screen-tapping activity on mobile devices
if ('ontouchstart' in window && /Mobi/.test(navigator.userAgent) && isTouchDevice()) {
$(document).on('touchstart', function() {
reportActivity('st', true, false);
});
// Detect mobile screen scrolling/swiping activity (Y-axis and X-axis)
var startY = 0;
var startX = 0;
$(document).on('touchstart', function(event) {
startY = event.originalEvent.touches[0].clientY;
startX = event.originalEvent.touches[0].clientX;
});
$(document).on('touchmove', function(event) {
var currentY = event.originalEvent.touches[0].clientY;
var currentX = event.originalEvent.touches[0].clientX;
if (currentY !== startY) {
reportActivity('msy', true, false);
}
if (currentX !== startX) {
reportActivity('msx', true, false);
}
});
}
if (/(iPhone|iPod|iPad)/i.test(navigator.userAgent) && !window.MSStream && window.matchMedia('only screen and (max-device-width: 1024px) and (-webkit-min-device-pixel-ratio: 2)').matches && (window.getComputedStyle(document.documentElement).getPropertyValue('-webkit-touch-callout') !== null)) {
reportActivity('ios', true, false);
}
if (window.DeviceMotionEvent || window.DeviceOrientationEvent || 'Accelerometer' in window) {
reportActivity('dms', false, false);
window.addEventListener('devicemotion', handleDeviceMotion, false);
window.addEventListener('deviceorientation', handleDeviceOrientation, false);
if (window.DeviceMotionEvent) {
window.addEventListener('devicemotion', handleDeviceMotion, false);
function handleDeviceMotion(event) {
var acceleration = event.acceleration;
var accelerationIncludingGravity = event.accelerationIncludingGravity;
var rotationRate = event.rotationRate;
var interval = event.interval;
// Process the motion data Example: Check if the device is in motion based on acceleration
if ((acceleration.x < -0.1) || (acceleration.x > 0.1) || (acceleration.y < -0.1) || (acceleration.y > 0.1) || (acceleration.z < -0.3) || (acceleration.z > 0.3)) {
if (motionActivity == 6) {
reportActivity('mdm', true, false);
}
motionActivity++;
}
}
} else if ('Accelerometer' in window) {
const accelerometer = new Accelerometer({ frequency: 60 });
accelerometer.addEventListener('reading', handleGenericSensorMotion);
accelerometer.start();
// Event handler for Generic Sensor API motion events
function handleGenericSensorMotion(event) {
if (motionActivity == 6) {
reportActivity('mdm', true, false);
}
motionActivity++;
}
}
// Event handler for device orientation events
function handleDeviceOrientation(event) {
var alpha = event.alpha; // Z-axis rotation (in degrees)
var beta = event.beta; // X-axis rotation (in degrees)
var gamma = event.gamma; // Y-axis rotation (in degrees)
// Process the orientation data Example: Check the device's orientation or rotation
if (alpha || beta || gamma) {
if ((orientationActivity > 1) && (orientationActivity < 3)) {
reportActivity('mdo', true, false);
}
orientationActivity++;
}
}
}
});