const loadScript = (src, callback) => { var done = false; var head = document.getElementsByTagName('head')[0], script = document.createElement('script'); script.setAttribute('src', src); script.setAttribute('type', 'text/javascript'); script.setAttribute('charset', 'utf-8'); script.onload = script.onreadstatechange = function() { if (!done && (!this.readyState || this.readyState == 'loaded' || this.readyState == 'complete')) { done = true; script.onload = script.onreadystatechange = null; if (callback) { callback(); } } } head.insertBefore(script, head.firstChild); }; const getUrlVars = () => { var vars = [], hash; var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&'); for(var i = 0; i < hashes.length; i++) { hash = hashes[i].split('='); if (hash[0]) { //vars.push(hash[0]); vars[hash[0]] = hash[1]; } } return vars; }; const init = () => { var pageParams = getUrlVars(location.search); var widgetId = "sbx-widget-donate-form_frame"; var widgetHeight = "100%"; var widgetUrl = "https://trinityservices.secure.nonprofitsoapbox.com/?option=com_donations&view=donate&tmpl=component&id=3"; for (key in pageParams) { if (typeof pageParams[key] !== "function") { widgetUrl += "&" + key + "=" + pageParams[key]; } }; var iframe = jQuery(''); iframe.attr("src", widgetUrl); jQuery(document).ready(() => { jQuery("#sbx-widget-donate-form").height(widgetHeight).html(iframe); }); }; loadScript('https://js.pusher.com/7.0/pusher.min.js'); if (window.jQuery) { init(); } else { loadScript('https://code.jquery.com/jquery-3.5.1.min.js', init); }