1$(document).ready(function () { 2 3 /** 4 * Set placeholder text to be label (Checkout, Checkout Thank You and Edit Payment Method Pages) 5 * */ 6 $('.secure-payment input[type=card],' + 7 '.secure-payment input[type=numeric],' + 8 '.secure-payment input[type=text],' + 9 '.secure-payment input[type=password],' + 10 '.secure-payment select,' + 11 '.billing-information input[type=card],' + 12 '.billing-information input[type=text],' + 13 '.billing-information input[type=email],' + 14 '.billing-information input[type=phone],' + 15 '.billing-information select,' + 16 '.tribute-options select,' + 17 '.tribute-options input[type=text],' + 18 '.tribute-options textarea,' + 19 '.tribute-recipient select,' + 20 '.tribute-recipient input[type=text],' + 21 '.tribute-recipient input[type=email],' + 22 '.tribute-recipient textarea,' + 23 '.organization-information input[type=text],' + 24 '.organization-information input[type=email],' + 25 '.organization-information input[type=phone],' + 26 '.contributions.thank-you input[type=email],' + 27 '.contributions.thank-you input[type=password]').each(function(index, element) { 28 if($(this).parent().siblings('label').length >0 ) { 29 var label = $(this).parent().siblings('label'); 30 var labelText = label.text(); 31 32 if(!$(this).is('select') && !$(this).parent().parent().hasClass('is-combo') && (!$(this).attr('placeholder') || $(this).attr('placeholder')=="") ) { 33 $(this).attr('placeholder',labelText); 34 label.addClass('hide-label'); 35 } 36 } 37 }); 38 39 //same as above but for transparent redirect forms 40 $('.form-panel-custom-method input[type=text]').each(function(index, element) { 41 if($(this).parent().siblings('label').length >0 ) { 42 var label = $(this).parent().siblings('label'); 43 var labelText = label.text(); 44 45 if(!$(this).is('select') && !$(this).parent().parent().hasClass('is-combo') && (!$(this).attr('placeholder') || $(this).attr('placeholder')=="") ) { 46 $(this).attr('placeholder',labelText); 47 label.addClass('hide-label'); 48 } 49 } 50 }); 51 52 53 /** 54 * Wait for customAlert 55 * - Close on outside click 56 * - Toggle "checked" class for radio field labels in "Custom Alert" popup 57 */ 58 if ($.fn.waitUntilExists && typeof $.fn.waitUntilExists !== "undefined") { 59 60 $('.customAlert').waitUntilExists(function () { 61 setTimeout(function() { 62 63 $(document).mousedown(function (e) { 64 var customAlert = $('.customAlert'); 65 if (customAlert && customAlert.length > 0 66 && !customAlert.is(e.target) && customAlert.has(e.target).length === 0){ 67 68 var cancelButton = $('.customAlert .customAlertButtonCancel'); 69 70 if(cancelButton.length > 0) { 71 cancelButton.trigger('click'); 72 } else { 73 $('.customAlert .closeAlert').trigger('click'); 74 } 75 } 76 }); 77 78 // Get radio wrapper 79 var radioWrapperInCustomAlertPopup = $(".customAlert .customAlertInner .customAlertMsg .radio-wrapper"); 80 81 if(radioWrapperInCustomAlertPopup && radioWrapperInCustomAlertPopup.length > 0){ 82 // On load 83 radioWrapperInCustomAlertPopup.find("input:radio:checked").parent().find("label").addClass("checked"); 84 85 // On label click 86 radioWrapperInCustomAlertPopup.find("label").on('click', function () { 87 radioWrapperInCustomAlertPopup.find('label').removeClass("checked"); 88 $(this).addClass("checked"); 89 }); 90 91 // On checkbox click 92 radioWrapperInCustomAlertPopup.find("input:radio").change(function () {
93 radioWrapperInCustomAlertPopup.find('label').removeClass("checked"); 94 $(this).parent().find("label[for='" + $(this).attr('id') + "']").addClass("checked"); 95 }); 96 } 97 98 },200); 99 }, true); 100 101 } else { 102 console.log("waitUntilExists not included from /lib/jQuery/wait-until-exists"); 103 } 104 105}); 106 107// Parallax 108$(window).load(function() { 109 if (typeof window.matchMedia !== 'undefined' && $.isFunction(window.matchMedia) && window.matchMedia("(min-width: 1025px)").matches) { 110 skrollr.init({ 111 forceHeight: false, 112 mobileCheck: function() { 113 return false; 114 } 115 }); 116 } 117}); 118 119/* 120* Check if the element is in view 121* returns true as soon as the top of the el reaches the bottom of the window, 122* and until the bottom of the element goes higher than top of the window 123*/ 124$.fn.isInViewport = function() { 125 var elementTop = $(this).offset().top; 126 var elementBottom = elementTop + $(this).outerHeight(); 127 128 var viewportTop = $(window).scrollTop(); 129 var viewportBottom = viewportTop + $(window).height(); 130 131 return elementBottom > viewportTop && elementTop < viewportBottom; 132};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.