//var domain = "https://utilityapi-mmoolgastaging.24livehost.com/"; //var domain = "https://utilityapi-mmoolga.24livehost.com/"; //var domain = "http://localhost/DCUtilityWebAPI/"; //var domain = "https://utility.mygiving.online/"; var domain = "https://utilitymygiving.24livehost.com/"; requirejs.config({ shim: { "bootstrap": { "deps": ['jquery'] }, "validate": { "deps": ['jquery'] } }, baseUrl: 'scripts', waitSeconds: 200, paths: { jquery: domain + 'scripts/jquery-1.10.2.min', bootstrap: domain + 'scripts/bootstrap.min', validate: domain + 'scripts/jquery.validate.min' } }); requirejs(['jquery', 'bootstrap', 'validate'], function ($) { $(document).ready(function () { loadCss(domain + 'content/bootstrap.min.css'); $("#divdonate #model-donate-now").remove(); $("#divdonate .img-loading-div").remove(); $.get(domain + "html/_DonateNow.html", function (html_string) { $("#divdonate").append(html_string) }, 'html'); //var html = "
"; //html = html + " "; //html = html + " "; //$("#divdonate").append(html); if ($("#donateFrom").length && $("#donateFrom").val() == "mygiving") { // add splash image in link verson of donate now form $('body').addClass('screenImageClass') var linkVersion = true; debugger; var buttonId = $("#donateFrom").attr("rel"); $.get(domain + 'api/getcherityform/' + buttonId + '/' + linkVersion).done(function (data) { $("#model-donate-now .modal-content").html(data.content); $("#model-donate-now").modal("show"); SetDecimal($('#Donation_Amount')); }) .fail(function (data) { alert(data.responseJSON.content); }); } else { $("#btnnow").on("click", function () { debugger; if ($("#divdonate").hasClass("donate-now-ver-1")) { var buttonId = $(this).attr("rel"); $('.img-loading-div').show(); var linkVersion = false; $.get(domain + 'api/getcherityform/' + buttonId + '/' + linkVersion).done(function (data) { $("#model-donate-now .modal-content").html(data.content); $("#model-donate-now").modal("show"); SetDecimal($('#Donation_Amount')); }) .fail(function (data) { alert(data.responseJSON.content); }) .always(function () { $('.img-loading-div').hide(); }); } else { alert("This service is currently unavailable. Please try again later or contact us to make your donation via an alternate method."); } //window.open('http://localhost/DCUtilityWebAPI/DonateNow/DonorForm/DonorForm', "_blank", "location=no,width=350,height=250"); }); } }); //$("#BranchId").select2(); function loadCss(url) { var link = document.createElement("link"); link.type = "text/css"; link.rel = "stylesheet"; link.href = url; document.getElementsByTagName("head")[0].appendChild(link); } SetDecimal = function (element) { $(element).on('keydown', function (e) { var $txtBox = $(this); // Allow: backspace, delete, tab, escape, enter and . if ($.inArray(e.keyCode, [46, 8, 9, 27, 13, 110, 190]) !== -1 || // Allow: Ctrl+A, Command+A (e.keyCode == 65 && (e.ctrlKey === true || e.metaKey === true)) || // Allow: home, end, left, right, down, up (e.keyCode >= 35 && e.keyCode <= 40)) { // 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(); } // Ensure that there is only 2 digits after decimal points var index = $txtBox.val().indexOf('.'); if (index >= 0) { var charAfterdot = $txtBox.val().split('.').length > 1 ? $txtBox.val().split('.')[1] : $txtBox.val().split('.')[0]; if (parseFloat(charAfterdot) > 0 && charAfterdot.length > 1) { e.preventDefault(); } } }); $(element).on('blur', function (e) { if ($(this).val().split(".").length > 0) { if ($(this).val().split(".")[0] == "") { $(this).val("0" + $(this).val()); } if ($(this).val().split(".").length == 1) { $(this).val($(this).val() + ".00"); } else if ($(this).val().split(".").length == 2) { if ($(this).val().split(".")[1].length == 1) { $(this).val($(this).val() + "0"); } else if ($(this).val().split(".")[1].length == 0) { $(this).val($(this).val() + "00"); } } } }); } });