diff --git a/resources/js/bitpay.js b/resources/js/bitpay.js deleted file mode 100644 index 40a550e833807b58cc0cc86903d6c234b63b72a1..0000000000000000000000000000000000000000 --- a/resources/js/bitpay.js +++ /dev/null @@ -1,24 +0,0 @@ -function bitpayCheckRequiredFields(form) { - var elements = form.elements; - var invalid = false; - for (var i = 0; i < elements.length; i++) { - elements[i].className = elements[i].className.replace('bitpay-donate-error', ''); - if (elements[i].className.indexOf("required") !== -1 && elements[i].value.length < 1) { - elements[i].className = elements[i].className + ' bitpay-donate-error'; - invalid = true; - }; - } - if (invalid) { - return false; - } - var donationElement = document.getElementById('donation-value'); - if (donationElement) { - var enteredDonation = Number(donationElement.value); - var maximumDonation = Number(document.getElementById('reference-maximum').value); - if (enteredDonation > maximumDonation) { - alert("Your donation was larger than the allowed maximum of " + Number(maximumDonation).toFixed(2)) - return false; - }; - }; - return true; -}; \ No newline at end of file diff --git a/resources/js/donation.js b/resources/js/donation.js new file mode 100644 index 0000000000000000000000000000000000000000..f6ad022a560959d2701fc652228fed19b748d187 --- /dev/null +++ b/resources/js/donation.js @@ -0,0 +1,7 @@ +$(document).ready(function () { + $(".amount-custom").click(function () { + setTimeout(function () { + $("#custom-amount").focus(); + }, 100) + }); +}); \ No newline at end of file diff --git a/resources/views/layouts/staticPages.blade.php b/resources/views/layouts/staticPages.blade.php index 04059176c7254111593b3bb3e93ad6c7a5933794..b4c9520beb809e8c364510afdc75da9da3c5c3d5 100644 --- a/resources/views/layouts/staticPages.blade.php +++ b/resources/views/layouts/staticPages.blade.php @@ -62,6 +62,11 @@ <link type="text/css" rel="stylesheet" href="{{ mix('css/fontawesome-solid.css') }}" /> <script src="{{ mix('js/lib.js') }}"></script> <script src="{{ mix('js/utility.js') }}"></script> + @if(!empty($js) && is_array($js)) + @foreach($js as $jsFile) + <script src="{{$jsFile}}" async></script> + @endforeach + @endif </head> <body> @if(Request::getHttpHost() === "metager3.de") diff --git a/routes/web.php b/routes/web.php index da5dae281108282da61ea83896f0d34393a1172e..aa421dad3e8bccb4f126294af82f4dfe7658f0de 100644 --- a/routes/web.php +++ b/routes/web.php @@ -73,6 +73,7 @@ Route::group( Route::get('spende', function () { return view('spende.spende') ->with('title', trans('titles.spende')) + ->with('js', [mix('/js/donation.js')]) ->with('navbarFocus', 'foerdern'); }); Route::get('spende/danke/{data}', ['as' => 'danke', function ($data) { diff --git a/webpack.mix.js b/webpack.mix.js index 9d6a8b62e129167cd0ad82bdc58b92ec6b26ff4c..5103ed5838b76375f21d56bbefd436562cbdc6a5 100644 --- a/webpack.mix.js +++ b/webpack.mix.js @@ -78,7 +78,7 @@ mix "public/js/scriptResultPage.js" ) .babel("resources/js/editLanguage.js", "public/js/editLanguage.js") - .babel("resources/js/bitpay.js", "public/js/bitpay.js") + .babel("resources/js/donation.js", "public/js/donation.js") // utility .babel( ["resources/js/utility.js", "resources/js/translations.js"],