Template:2011FR/lp-form-US7amounts-gc: Difference between revisions
Jump to navigation
Jump to search
Content deleted Content added
No edit summary |
m Reverted edits by Pcoombe (talk) to last revision by Pgehres (WMF) |
||
Line 1: | Line 1: | ||
{{MediaWiki:Resources/validation.js}} |
|||
<html> |
<html> |
||
<script> |
|||
<script type="text/javascript" language="javascript"> |
|||
function getQuerystring( key ) { |
|||
function validateForm( form ) { |
|||
key = key.replace( /[\[]/, '\\\[' ).replace( /[\]]/, '\\\]' ); |
|||
var regex = new RegExp( '[\\?&]' + key + '=([a-zA-Z0-9\_\-]*)' ); |
|||
var minimums = { |
|||
var qs = regex.exec( window.location.search ); |
|||
'USD' : 1, |
|||
'GBP' : 1, // $1.26 |
|||
'EUR' : 1, // $1.26 |
|||
'AUD' : 2, // $1.35 |
|||
'CAD' : 1, // $0.84 |
|||
'CHF' : 1, // $0.85 |
|||
'CZK' : 20, // $1.03 |
|||
'DKK' : 5, // $0.85 |
|||
'HKD' : 10, // $1.29 |
|||
'HUF' : 200, // $0.97 |
|||
'JPY' : 100, // $1 |
|||
'NZD' : 2, // $1.18 |
|||
'NOK' : 10, // $1.44 |
|||
'PLN' : 5, // $1.78 |
|||
'SGD' : 2, // $1.35 |
|||
'SEK' : 10, // $1.28 |
|||
'ILS' : 5 // $1.39 |
|||
}; |
|||
var error = true; |
|||
// Get amount selection |
|||
var amount = null; |
|||
for ( var i = 0; i < form.amount.length; i++ ) { |
|||
if ( form.amount[i].checked ) { |
|||
amount = form.amount[i].value; |
|||
} |
|||
} |
|||
if ( form.amountGiven.value != "" ) { |
|||
var otherAmount = form.amountGiven.value; |
|||
otherAmount = otherAmount.replace(/[,.](\d)$/, '\:$10'); |
|||
otherAmount = otherAmount.replace(/[,.](\d)(\d)$/, '\:$1$2'); |
|||
otherAmount = otherAmount.replace(/[\$,.]/g, ''); |
|||
otherAmount = otherAmount.replace(/:/, '.'); |
|||
form.amountGiven.value = otherAmount; |
|||
amount = otherAmount; |
|||
} |
|||
// Check amount is a real number |
|||
error = ( amount == null || isNaN( amount ) || amount.value <= 0 ); |
|||
// Check amount is at least the minimum |
|||
var currency = form.currency_code.value; |
|||
if ( typeof( minimums[currency] ) == 'undefined' ) { |
|||
minimums[currency] = 1; |
|||
} |
|||
if ( amount < minimums[currency] || error ) { |
|||
alert( '</html>{{{validation-error-minimum|You must contribute at least $1}}}<html>'.replace('$1', minimums[currency] + ' ' + currency ) ); |
|||
$( "input[name='amountGiven']" ).val( '' ); |
|||
$( "input[name='amountGiven']" ).focus(); |
|||
error = true; |
|||
} |
|||
return !error; |
|||
} |
|||
function DefaultSubmit(formfield,Action) { |
|||
var keycode; |
|||
if (window.event) keycode = window.event.keyCode; |
|||
else if (Action) keycode = Action.which; |
|||
else return true; |
|||
if (keycode == 13) { |
|||
redirectPayment(</html>{{#ifeq:{{CC-status}}|block|'1'|'2'}}<html>); |
|||
return false; |
|||
} |
|||
else |
|||
return true; |
|||
} |
|||
function redirectPayment(i) { |
|||
//if i == 1 |
|||
var paymentType ="cc"; |
|||
var action_url = "https://payments.wikimedia.org/index.php/Special:GlobalCollectGateway?uselang=</html>{{{language}}}\x26form_name={{{form-name}}}\x26appeal=JimmyQuote\x26ffname={{{ffname}}}<html>" ; |
|||
if (i==2) { |
|||
action_url="https://wikimediafoundation.org/wiki/Special:ContributionTracking/</html>{{{language|{{BASEPAGENAME}}}}}<html>"; |
|||
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(); |
|||
} |
|||
} |
} |
||
</script> |
</script> |
||
<form method="post" name="paypalcontribution"> |
|||
<input type="hidden" name="gateway" value="paypal" /> |
|||
<input type="hidden" name="utm_source" value="" /> |
|||
<input type="hidden" name="utm_medium" value="" /> |
|||
<input type="hidden" name="utm_campaign" value="" /> |
|||
<input type="hidden" name="language" value="</html>{{{language|{{SUBPAGENAME}}}}}<html>" /> |
|||
<input type="hidden" name="referrer" value="" /> |
|||
<input type="hidden" name="country" value="US" /> |
|||
<input type="hidden" name="returnto" value="Thank_You/</html>{{{language|{{SUBPAGENAME}}}}}<html>" /> |
|||
<div style="padding: 0.2em 0em; font-weight: normal;"> |
|||
<script type="text/javascript"> |
|||
<p style="font-weight: bold;"></html>{{{gift-amount-text}}}<html></p> |
|||
document.paypalcontribution.utm_medium.value = getQuerystring( 'utm_medium' ); |
|||
<div id="amount-box" style="font-size: 100%; padding: 0; margin-left: -5px; "> |
|||
document.paypalcontribution.utm_campaign.value = getQuerystring( 'utm_campaign' ); |
|||
<table id="amount-table" style="background-color: #CCE7CD;"> |
|||
document.paypalcontribution.utm_key.value = getQuerystring( 'utm_key' ); |
|||
<tr> |
|||
document.paypalcontribution.referrer.value = document.referrer; |
|||
<td style="white-space:nowrap;"><input type="radio" name="amount" id="input_amount_0" onclick="document.paypalcontribution. amountGiven.value = ''" value="</html>{{{donate-amount-0}}}<html>" /><label for="input_amount_0"></html>${{{donate-amount-0}}}<html></label></td> |
|||
</script> |
|||
<td style="white-space:nowrap;"><input type="radio" name="amount" id="input_amount_1" onclick="document.paypalcontribution. amountGiven.value = ''" value="</html>{{{donate-amount-1}}}<html>" /><label for="input_amount_1"></html>${{{donate-amount-1}}}<html></label></td> |
|||
<td style="white-space:nowrap;"><input type="radio" name="amount" id="input_amount_2" onclick="document.paypalcontribution. amountGiven.value = ''" value="</html>{{{donate-amount-2}}}<html>" /><label for="input_amount_2"></html>${{{donate-amount-2}}}<html></label></td> |
|||
<td style="white-space:nowrap;"><input type="radio" name="amount" id="input_amount_3" onclick="document.paypalcontribution. amountGiven.value = ''" value="</html>{{{donate-amount-3}}}<html>" /><label for="input_amount_3"></html>${{{donate-amount-3}}}<html></label></td> <!--<div style="height:8px;font-size:8px;"> </div>--> |
|||
</tr> |
|||
<tr> |
|||
<td style="white-space:nowrap;"><input type="radio" name="amount" id="input_amount_4" onclick="document.paypalcontribution. amountGiven.value = ''" value="</html>{{{donate-amount-4}}}<html>" /><label for="input_amount_4"></html>${{{donate-amount-4}}}<html></label></td> |
|||
<td style="white-space:nowrap;"><input type="radio" name="amount" id="input_amount_5" onclick="document.paypalcontribution. amountGiven.value = ''" value="</html>{{{donate-amount-5}}}<html>" /><label for="input_amount_5"></html>${{{donate-amount-5}}}<html></label></td> |
|||
<td style="white-space:nowrap;"><input type="radio" name="amount" id="input_amount_6" onclick="document.paypalcontribution. amountGiven.value = ''" value="</html>{{{donate-amount-6}}}<html>" /><label for="input_amount_6"></html>${{{donate-amount-6}}}<html></label></td> |
|||
<td style="white-space:nowrap;"><input type="radio" name="amount" id="input_amount_other" value="Other" /><label for="input_amount_other"></html>{{{donate-amount-other|<html>Other:</html>}}}<html></label> |
|||
<input type="text" name="amountGiven" size="2" autocomplete="off" onfocus="this.form.input_amount_other.checked=true;" onKeyPress="return DefaultSubmit(this,event)" /></td> |
|||
</tr> |
|||
</table> |
|||
<!-- currency menu --><input name="currency_code" id="input_currency_code" type="hidden" value="USD" /> |
|||
</div> |
|||
<div id="cc-donate-button"> |
|||
<input type="hidden" name="language" value="en" /> |
|||
<input type="button" value="</html>{{{creditcard-label}}}<html>" class="button" onclick="redirectPayment('1');"/> |
|||
</div> |
|||
<input type="hidden" name="returnto" value="Thank_You/en" /> |
|||
<div id="paypal-donate-button"> |
|||
<input type="button" value="</html>{{{paypal-label}}}<html>" class="button" onclick="redirectPayment('2');"/> |
|||
</div> |
|||
<input type="hidden" name="amountGiven" value="" /> |
|||
</html> |
</html> |
||
{{2012FR/Form-section/Processing/Old |
|||
| language = en |
|||
| country = US |
|||
| currency = USD |
|||
| appeal = {{{appeal}}} |
|||
| handler = GC |
|||
| GC-CC-ffname = cc-vmaj |
|||
}} |
|||
<div class="select-amount-header-new">Select your gift amount:</div> |
|||
{{2012FR/Form-section/Radiobuttons/Default |
|||
| country = US |
|||
| language = en |
|||
| currency = USD |
|||
| donate-amount-0 = 5 |
|||
| donate-amount-1 = 10 |
|||
| donate-amount-2 = 20 |
|||
| donate-amount-3 = 35 |
|||
| donate-amount-4 = 50 |
|||
| donate-amount-5 = 100 |
|||
| donate-amount-6 = 250 |
|||
}} |
|||
{{2012FR/Form-section/Paymentmethods/Creditcard}} |
|||
{{2012FR/Form-section/Paymentmethods/EWallet/PayPal}} |
|||
<div class="donate-body-small">{{{monthlydonation-text|}}}</div> |
<div class="donate-body-small">{{{monthlydonation-text|}}}</div> |
||
<div style="text-align:center">* * *</div> |
<div style="text-align:center">* * *</div> |
||
<div class="donate-body-small">{{{privacy-policy-text}}}</div> |
<div class="donate-body-small">{{{privacy-policy-text}}}</div> |
||
<p style="margin-top: 1em;"><div class="donate-body-small">{{{other-ways-link}}}</div></p> |
<p style="margin-top: 1em;"><div class="donate-body-small">{{{other-ways-link}}}</div></p> |
||
<html> |
<html> |
||
< |
</div> |
||
</form> |
|||
.select-amount-header-new { |
|||
font-weight: bold; |
|||
<script type="text/javascript"> |
|||
margin-bottom: 0.8em; |
|||
function getQuerystring( key ) { |
|||
margin-top: 1.4em; |
|||
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]; |
|||
} |
} |
||
#radiobuttons-table-header { |
|||
function getLandingPage() { |
|||
display: none; |
|||
var path = "</html>{{{landing-page|default}}}<html>"; |
|||
} |
|||
#radiobuttons-table { |
|||
if( path == "default") { |
|||
font-size: 1em; |
|||
pathArray = window.location.pathname.split( '/' ); |
|||
} |
|||
return pathArray[2]; |
|||
.payment-method-button { |
|||
} |
|||
font-size: 14px; |
|||
else return path; |
|||
} |
} |
||
</style> |
|||
function updateCC( currency ) { |
|||
</html> |
|||
if ( ( currency == 'AUD' ) || ( currency == 'CAD' ) || ( currency == 'EUR' ) || |
|||
(currency == 'GBP' ) || ( currency == 'JPY' ) || ( currency == 'USD' ) ) { |
|||
document.getElementById('cc-donate-button').style.display = "</html>{{CC-status}}<html>"; |
|||
} else { |
|||
document.getElementById('cc-donate-button').style.display = "none"; |
|||
} |
|||
} |
|||
document.paypalcontribution.utm_medium.value = getQuerystring( 'utm_medium' ); |
|||
document.paypalcontribution.utm_campaign.value = getQuerystring( 'utm_campaign' ); |
|||
document.paypalcontribution.referrer.value = document.referrer; |
|||
( function( $ ) { |
|||
$(document).ready(function(){ |
|||
var currency = $("#input_currency_code").val(); |
|||
updateCC(currency); |
|||
}) |
|||
} )( jQuery ); |
|||
</script> |
|||
</html><noinclude> |
|||
[[Category:Fundraising templates|{{PAGENAME}}]] |
|||
</noinclude> |