26. sor: |
26. sor: |
| </form> | | </form> |
| <script type="text/javascript"> | | <script type="text/javascript"> |
− | var wmh_paypal = document.getElementById('wmh_paypal');
| + | $.queryParam = function(key) { |
− | var wmh_obutton = document.getElementById('wmh_obutton');
| + | /**/return $.map(window.location.search.substr(1).split('&'), function(part) { |
− | var wmh_otext = document.getElementById('wmh_otext');
| + | /**//**/var halves = part.split('=', 2); |
− | var custom = document.getElementById('custom'); | + | /**//**/if (halves[0] === key) return halves[1]; |
− | function copyAmount() {
| + | /**/})[0]; |
− | wmh_obutton.value = wmh_otext.value;
| + | }; |
− | } | + | // |
− | addOnloadHook(function() {
| + | $(function() { |
− | copyAmount();
| + | /**/var $sumField = $('#wmh_otext'), |
− | addHandler(wmh_otext, 'change', copyAmount);
| + | /**//**/$submitButton = $('#wmh_obutton'), |
− | addHandler(wmh_otext, 'blur', copyAmount);
| + | /**//**/$form = $('#wmh_paypal'), |
− | addHandler(wmh_otext, 'focus', function() {
| + | /**//**/$customField = $('#custom'); |
− | wmh_obutton.checked = true;
| + | /**/ |
− | }); | + | /**/$sumField.bind('change blur', function() { |
− | addHandler(wmh_paypal, 'submit', function(e) {
| + | /**//**/$submitButton.val($sumField.val()); |
− | custom.value = getQuerystring( 'utm_source' );
| + | /**/}).bind('focus', function() { |
− | piwikTracker.trackGoal(1, $j('[name=amount]:checked').val()); | + | /**//**/$sumField.attr('checked', true); |
− | if (!(!wmh_obutton.checked||!(wmh_obutton.value < 1500))) { | + | /**/}).change(); |
− | alert("A minimális összeg 1500Ft (ez alatt az adomány jelentős részét elvinné a PayPal járuléka)."); | + | /**/ |
− | if (e.preventDefault) e.preventDefault();
| + | /**/$form.bind('submit', function(e) { |
− | else e.returnValue = false;
| + | /**//**/$customField.val($.queryParam('utm_source')); |
− | } | + | /**//**/piwikTracker.trackGoal(1, $('[name=amount]:checked').val()); |
− | }); | + | /**//**/if ($submitButton.is(':checked') && $submitButton.val() < 1500) { |
| + | /**//**//**/alert("A minimális összeg 1500Ft (ez alatt az adomány jelentős részét elvinné a PayPal járuléka)."); |
| + | /**//**//**/return false; |
| + | /**//**/} |
| + | /**/}); |
| }); | | }); |
| </script> | | </script> |
| </html> | | </html> |