(function( window, document, req_version, callback, $, script, done, readystate ){ if ( !($ = window.jQuery) || req_version > $.fn.jquery || callback( $ ) ) { script = document.createElement( 'script' ); script.type = 'text/javascript'; script.src = 'https://ajax.googleapis.com/ajax/libs/jquery/' + req_version + '/jquery.min.js'; script.onload = script.onreadystatechange = function() { if ( !done && ( !( readystate = this.readyState ) || readystate == 'loaded' || readystate == 'complete' ) ) { console.log(window.jQuery); callback( window.jQuery, done = 1 ); window.jQuery( script ).remove(); } }; document.head.appendChild( script ); } })( window, document, '3.5.1', function( $, L ) { '$:nomunge, L:nomunge'; // Used by YUI compressor. (function( window, document, req_version, callback, $, script, done, readystate ){ if ( !(typeof $.ui != 'undefined') || req_version > $.fn.jquery || callback( $ ) ) { script = document.createElement( 'script' ); script.type = 'text/javascript'; script.src = 'https://code.jquery.com/ui/' + req_version + '/jquery-ui.min.js'; script.onload = script.onreadystatechange = function() { if ( !done && ( !( readystate = this.readyState ) || readystate == 'loaded' || readystate == 'complete' ) ) { callback($.noConflict(1), done = 1 ); var link = $("",{ rel: "stylesheet", type: "text/css", href: "https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css" }); $('head').append(link); $( script ).remove(); } }; document.head.appendChild( script ); } })( window, document, '1.12.1', function( $, L ) { '$:nomunge, L:nomunge'; var amplyMatchingCompany; var amplyFormString; var amplyMatchData = {}; var amplyCompanyToken = false; var waitBindings; function amplyGetMatch(type = 'id', id) { console.log("Get Match"); $.ajax({ type: "GET", url: 'http://giveamply.com/api/donation/' + type + '/' + id + '/results', success: (data) => { amplyMatchData = data.donation; if (typeof data.companyToken != 'undefined') amplyCompanyToken = data.companyToken; amplyProcessResults(data) }, error: function (data) { console.log(data); } }); } function amplyInjectSearch(platform) { switch(platform) { case 'online-express': injectOnlineExpress(); break; } } function amplyWaitFor() { for (let i = 0; i < waitBindings[0].length; i++) { if (!document.getElementById(waitBindings[0][i]) || !document.getElementById(waitBindings[0][i]).value) { setTimeout(amplyWaitFor, 500); return; } } amplySubmitMatch(waitBindings[0], waitBindings[1]); } function htmlToElement(html) { var template = document.createElement('template'); html = html.trim(); // Never return a text node of whitespace as the result template.innerHTML = html; return template.content.firstChild; } /* global $ */ function injectOnlineExpress(){ setTimeout(injectOnlineExpress,1000); if (document.getElementById('amplyMatchInput') == null && (document.getElementById('bboxdonation_btnSecurePayment') !== null || document.getElementById('bboxmembership_btnSecurePayment') !== null)) { $('#amply-root').show(); let emailField = $('#bboxdonation_billing_divEmail'); amplyFormString = 'bboxdonation'; if (document.getElementById('bboxdonation_btnSecurePayment') == null) { emailField = $('#bboxmembership_billing_divEmail'); amplyFormString = 'bboxmembership'; } let cSearch = emailField.clone(); cSearch.attr("id", "cSearch"); cSearch.children('label').attr('for', "amplyMatchInput"); cSearch.children('label').html('Employer'); cSearch.children('label').attr('id', "amplyCompanylbl"); cSearch.children('input').attr('id', "amplyMatchInput"); cSearch.children('input').attr('name', "amplyMatchInput"); cSearch.children('input').attr("autocomplete", "off"); cSearch.children('input').attr("data-lpignore", "true"); cSearch.children('input').attr("data-form-type", "other"); cSearch.children('input').attr("type", "text"); cSearch.children('input').attr('value', ''); if (amplyMatchingCompany) { cSearch.value = amplyMatchingCompany; } else cSearch.value = ""; cSearch.children('input').attr('required', ""); emailField.after(cSearch); document.getElementById('amplyMatchInput').removeAttribute('required'); amplyCreateAutocomplete(); document.getElementById(amplyFormString + '_btnSecurePayment').addEventListener('click', gatherOnlineExpressData); document.getElementById(amplyFormString + '_btnSubmit').addEventListener('click', gatherOnlineExpressData); // addding tooltip to search-box. document.getElementById("amplyMatchInput").parentElement.append(htmlToElement(`