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

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..."
 
clean up methods
 
(5 intermediate revisions by the same user not shown)
Line 1:
<html>
<style>
#problems-donating-text {
display: none;
}
</style>
</html>
{{2012FR/Form-section/Processing/Default
| language = {{{language}}}
| country = {{{country}}}
| appeal = {{{appeal}}}
| currency = USD
| handler = GC
| GC-CC-ffname = cc-vmad
}}
{{2012FR/Form-section/Radiobuttons/3-buttons
| country = {{{country}}}
Line 22 ⟶ 7:
| donate-amount-2 = 20
}}
{{2012FR/Form-section/PaymentmethodsPaymentmethod/Creditcard}}
{{2012FR/Form-section/Paymentmethods/EWalletPaymentmethod/PayPal}}
{{2012FR/Form-section/Paymentmethods/EWalletPaymentmethod/Amazon}}
<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 ){
// change amounts on radio buttons
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] );
}
}
}
 
// change amounts in appeal
var considerAmountString = "";
for( var j = 0; j < ask.length; j++ ) {
considerAmountString += symbol + ask[j] + ', ';
}
considerAmountString = considerAmountString.trim();
$('.consider-amounts').html(considerAmountString);
}
}
});
</script>
</html>