Template:2010/Donate-nowFR

 /* Conversion des virgules en points, interdiction des lettres */ function verificationsaisie { var amountGiven = document.getElementById('amountGiven'); var firstChar = amountGiven.value.charAt(0); if (('1' > firstChar) || ('9' < firstChar)) amountGiven.value = amountGiven.value.substr(1); amountGiven.value = amountGiven.value.replace(/[^0-9.,]/g, '').replace(/^([0-9]*[.,][0-9]*)[.,]*/g, '$1'); amountGiven.value = amountGiven.value.replace(/,/, '.'); return; }

function validateForm( form ) {

var error = true;

// Get amount selection var amount = null; for ( var i = 0; i < form.input_amount.length; i++ ) { if ( form.input_amount[i].checked ) { amount = form.input_amount[i].value; if ( amount == "Other" ) {     amount = form.amountGiven.value; }   }  }

// Check amount is a real number error = ( amount == null || isNaN( amount ) || amount.value <= 0 ); if ( amount < 5 || error ) { alert( ' ' ); error = true; } document.paypalcontribution.amount.value = Math.floor(eval(amount)*100) ; return !error; }

function redirectPayment(i) { //if i == 1 var paymentType ="cc"; var action_url = " " ; if (i==2) {action_url="http://wikimediafoundation.org/wiki/Special:ContributionTracking/ "; paymentType = "pp"; }   document.paypalcontribution.action = action_url; document.paypalcontribution.utm_source.value = getQuerystring( 'utm_source' ) + '.' + getLandingPage + '.' + paymentType; if(validateForm(document.paypalcontribution)){ if(typeof(OWA) !== 'undefined'){OWATracker.shareStateByPost( document.paypalcontribution );} document.paypalcontribution.submit; } }        

  €   €   € <label for="input_amount_other">  <input type="text" name="amountGiven" id="amountGiven" size="4" onKeyUp="verificationsaisie" onfocus="this.form.input_amount_other.checked=true;"> € <input type="hidden" name="amount" /> <input type="button" value=" " class="input-button  " onclick="redirectPayment('1');"/> <input name="COMPLUS" value="WikimediaFoundation" type="hidden">

<script type="text/javascript"> function getQuerystring( key ) { key = key.replace( /[\[]/, '\\\[' ).replace( /[\]]/, '\\\]' ); var regex = new RegExp( '[\\?&]' + key + '=([a-zA-Z0-9\_\-]*)' ); var qs = regex.exec( window.location.search ); return qs == null ? '' : qs[1]; }

function getLandingPage {  var path = "  ";

if( path == "default"){ pathArray = window.location.pathname.split( '/' ); return pathArray[2]; }  else return path; }

document.paypalcontribution.utm_medium.value = getQuerystring( 'utm_medium' ); document.paypalcontribution.utm_campaign.value = getQuerystring( 'utm_campaign' ); document.paypalcontribution.referrer.value = document.referrer;