Template:2012FR/Form-email-20131004/US: Difference between revisions

From Donate
Jump to navigation Jump to search
Content deleted Content added
Created page with "<html> <style> #problems-donating-text { display: none; } </style> </html> {{2012FR/Form-section/Processing/Default | language = {{{language}}} | country = {{{country}}} | a..."
 
add tweaked hpc code
Line 1: Line 1:
<html>
<style>
#problems-donating-text {
display: none;
}
</style>
</html>
{{2012FR/Form-section/Processing/Default
{{2012FR/Form-section/Processing/Default
| language = {{{language}}}
| language = {{{language}}}
Line 26: Line 19:
{{2012FR/Form-section/Paymentmethods/EWallet/Amazon}}
{{2012FR/Form-section/Paymentmethods/EWallet/Amazon}}
<html>
<html>
<script>
$(document).ready(function(){
var hpc = getQuerystring( 'hpc' );
if( hpc == '' || isNaN( parseFloat( hpc ) ) ){
// go ahead and try mrc as well
hpc = getQuerystring( 'mrc' );
if( hpc == '' || isNaN( parseFloat( hpc ) ) ){
return;
}
}
hpc = parseFloat( hpc );
var asks = {
'USD' : {
0 : [5, 10, 20],
10 : [10, 20, 50],
20 : [20, 30, 50],
35 : [20, 30, 50],
50 : [20, 50, 100],
75 : [50, 75, 100],
100 : [50, 75, 150],
150 : [75, 100, 200],
200 : [100, 200, 300]
}
};
asks['AUD'] = asks['USD'];
asks['CAD'] = asks['USD'];
asks['EUR'] = asks['USD'];
asks['GBP'] = asks['USD'];
asks['NZD'] = asks['USD'];
var symbols = {
'USD' : '$',
'AUD' : '$',
'CAD' : '$',
'EUR' : '€',
'GBP' : '£',
'NZD' : '$'
};
var ask = null;
var symbol = '';
var currency = $("input[name='currency_code']").val();
if( currency in symbols ){
symbol = symbols[currency];
}
if( currency in asks ){
if( asks[currency].length < 1 ){
return;
}
for( var prev in asks[currency] ){
// this assumes that JS returns keys in sorted order, most do
if( prev > hpc ){
break;
}
ask = asks[currency][prev];
}
if( ask != null ){
for( var j = 0; j < ask.length; j++ ){
var radio = $("#input_amount_" + j);
var label = $("label[for='input_amount_" + j + "']");
if( radio != null ){
if( label != null ){
// I know an && could be used here, but they are getting escaped
radio.val( ask[j] );
label.text( symbol + ask[j] );
}
}
}
}
}
});
</script>
</html>
</html>

Revision as of 20:47, 3 October 2013

Donation amount (USD)

Template:2012FR/Form-section/Paymentmethods/Creditcard Template:2012FR/Form-section/Paymentmethods/EWallet/PayPal Template:2012FR/Form-section/Paymentmethods/EWallet/Amazon