Template:2012France/lp-form: Difference between revisions

From Donate
Jump to navigation Jump to search
Content deleted Content added
tweaks
Line 4: Line 4:
/* Conversion des virgules en points, interdiction des lettres */
/* Conversion des virgules en points, interdiction des lettres */
function verificationsaisie() {
function verificationsaisie() {
var amountGiven = document.getElementById('amountGiven');
var amountGiven = document.getElementById('amountGiven');
var firstChar = amountGiven.value.charAt(0);
var firstChar = amountGiven.value.charAt(0);
if (('1' > firstChar) || ('9' < firstChar))
if (('1' > firstChar) || ('9' < firstChar))
amountGiven.value = amountGiven.value.substr(1);
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(/[^0-9.,]/g, '').replace(/^([0-9]*[.,][0-9]*)[.,]*/g, '$1');
amountGiven.value = amountGiven.value.replace(/,/, '.');
amountGiven.value = amountGiven.value.replace(/,/, '.');
return;
return;
}
}


Line 43: Line 43:
function redirectPayment(i) {
function redirectPayment(i) {
//if i == 1
//if i == 1
var paymentType ="cc";
var paymentType = "cc";
var action_url = "</html>{{{donate-url}}}<html>" ;
var action_url = "</html>{{{donate-url}}}<html>" ;
if (i==2) {action_url="http://wikimediafoundation.org/wiki/Special:ContributionTracking/</html>{{{language|{{BASEPAGENAME}}}}}<html>";
//if (i==2) {
// action_url = "http://wikimediafoundation.org/wiki/Special:ContributionTracking/</html>{{{language|{{BASEPAGENAME}}}}}<html>";
paymentType = "pp";
// paymentType = "pp";
}
//}
document.paypalcontribution.action = action_url;
document.paypalcontribution.action = action_url;
document.paypalcontribution.utm_source.value = getQuerystring( 'utm_source' ) + '.' + getLandingPage() + '.' + paymentType;
document.paypalcontribution.utm_source.value = getQuerystring( 'utm_source' ) + '.' + getLandingPage() + '.' + paymentType;
if(validateForm(document.paypalcontribution)){
if (validateForm(document.paypalcontribution)) {
if(typeof(OWA) !== 'undefined'){OWATracker.shareStateByPost( document.paypalcontribution );}
if (typeof(OWA) !== 'undefined') { OWATracker.shareStateByPost( document.paypalcontribution ); }
document.paypalcontribution.submit();
document.paypalcontribution.submit();
}
}
Line 68: Line 69:
<div style="padding: 0.1em 0em; font-weight: normal; text-align:center;">
<div style="padding: 0.1em 0em; font-weight: normal; text-align:center;">
</html>{{{gift-amount-text}}}<html><br /><br />
</html>{{{gift-amount-text}}}<html><br /><br />
<div id="amount-box" style="font-size: 100%; padding: 0; font-weight:bold;margin-left: -5px; ">
<div id="amount-box" style="font-size: 100%; padding: 0; font-weight: bold; margin-left: -5px; ">
<table id="amount-table">
<table id="amount-table">
<tr>
<tr>
<td style="white-space:nowrap;text-align:justify;"><input type="radio" name="input_amount" id="input_amount_0" onclick="document.paypalcontribution. amountGiven.value = ''" style="text-align:justify;" value="</html>{{{donate-amount-0}}}<html>"><label for="input_amount_0">&nbsp;</html>{{{donate-amount-0}}}<html>&nbsp;€</label></td>
<td style="white-space: nowrap; text-align:justify;"><input type="radio" name="input_amount" id="input_amount_0" onclick="document.paypalcontribution. amountGiven.value = ''" style="text-align:justify;" value="</html>{{{donate-amount-0}}}<html>"><label for="input_amount_0">&nbsp;</html>{{{donate-amount-0}}}<html>&nbsp;€</label></td>
<td style="white-space:nowrap;text-align:justify;"><input type="radio" name="input_amount" id="input_amount_1" onclick="document.paypalcontribution. amountGiven.value = ''" value="</html>{{{donate-amount-1}}}<html>"><label for="input_amount_1">&nbsp;</html>{{{donate-amount-1}}}<html>&nbsp;€</label></td>
<td style="white-space: nowrap; text-align:justify;"><input type="radio" name="input_amount" id="input_amount_1" onclick="document.paypalcontribution. amountGiven.value = ''" value="</html>{{{donate-amount-1}}}<html>"><label for="input_amount_1">&nbsp;</html>{{{donate-amount-1}}}<html>&nbsp;€</label></td>
<td style="white-space:nowrap;text-align:justify;"><input type="radio" name="input_amount" id="input_amount_2" onclick="document.paypalcontribution. amountGiven.value = ''" value="</html>{{{donate-amount-2}}}<html>"><label for="input_amount_2">&nbsp;</html>{{{donate-amount-2}}}<html>&nbsp;€</label></td>
<td style="white-space: nowrap; text-align:justify;"><input type="radio" name="input_amount" id="input_amount_2" onclick="document.paypalcontribution. amountGiven.value = ''" value="</html>{{{donate-amount-2}}}<html>"><label for="input_amount_2">&nbsp;</html>{{{donate-amount-2}}}<html>&nbsp;€</label></td>
</tr>
</tr>
<tr>
<tr>
<td style="white-space:nowrap;text-align:justify;"><input type="radio" name="input_amount" id="input_amount_3" onclick="document.paypalcontribution. amountGiven.value = ''" value="</html>{{{donate-amount-3}}}<html>"><label for="input_amount_3">&nbsp;</html>{{{donate-amount-3}}}<html>&nbsp;€</label></td>
<td style="white-space: nowrap; text-align:justify;"><input type="radio" name="input_amount" id="input_amount_3" onclick="document.paypalcontribution. amountGiven.value = ''" value="</html>{{{donate-amount-3}}}<html>"><label for="input_amount_3">&nbsp;</html>{{{donate-amount-3}}}<html>&nbsp;€</label></td>
<td style="white-space:nowrap;text-align:justify;"><input type="radio" name="input_amount" id="input_amount_other" value="Other"><label for="input_amount_other"></html>{{{donate-amount-other|<html>Other:</html>}}}<html></label>&nbsp;<input type="text" name="amountGiven" id="amountGiven" size="4" onKeyUp="verificationsaisie()" onfocus="this.form.input_amount_other.checked=true;">&nbsp;€<br/></td>
<td style="white-space: nowrap; text-align:justify;"><input type="radio" name="input_amount" id="input_amount_other" value="Other"><label for="input_amount_other"></html>{{{donate-amount-other|<html>Other:</html>}}}<html></label>&nbsp;<input type="text" name="amountGiven" id="amountGiven" size="4" onKeyUp="verificationsaisie()" onfocus="this.form.input_amount_other.checked=true;">&nbsp;€<br/></td>
</tr>
</tr>
</table>
</table>
</div></html>{{{gift-amount-text-suite}}}<html></div>
</div></html>{{{gift-amount-text-suite}}}<html></div>
Line 85: Line 86:
<input type="hidden" name="amount" />
<input type="hidden" name="amount" />
<div id="cc-donate-button" align="center">
<div id="cc-donate-button" align="center">
<input type="button" value="</html>{{{donate-label}}}<html>" style="background-color:</html>{{{button-color}}}<html>;font-weight:bold; font-size:125%;padding: 0.5em 0.5em;" onclick="redirectPayment('1');" title="Faire un don !" alt="Faire un don !"/>
<input type="button" value="</html>{{{donate-label}}}<html>" style="background-color: </html>{{{button-color}}}<html>; font-weight: bold; font-size: 125%; padding: 0.5em 0.5em;" onclick="redirectPayment('1');" title="Faire un don !" alt="Faire un don !"/>
<input name="COMPLUS" value="WikimediaFoundation" type="hidden">
<input name="COMPLUS" value="WikimediaFoundation" type="hidden">
</form>
</form>
Line 96: Line 97:


<script type="text/javascript">
<script type="text/javascript">
function getQuerystring( key )
function getQuerystring( key ) {
{
key = key.replace( /[\[]/, '\\\[' ).replace( /[\]]/, '\\\]' );
key = key.replace( /[\[]/, '\\\[' ).replace( /[\]]/, '\\\]' );
var regex = new RegExp( '[\\?&]' + key + '=([a-zA-Z0-9\_\-]*)' );
var regex = new RegExp( '[\\?&]' + key + '=([a-zA-Z0-9\_\-]*)' );
Line 104: Line 104:
}
}


function getLandingPage()
function getLandingPage() {
{
var path = "</html>{{{landing-page|default}}}<html>";
var path = "</html>{{{landing-page|default}}}<html>";


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


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


</script>
</script>

Revision as of 15:16, 16 October 2012

{{{gift-amount-text}}}

  €
{{{gift-amount-text-suite}}}