Template:2011FR/Form-section-radiobuttons-2: Difference between revisions

From Donate
Jump to navigation Jump to search
Content deleted Content added
Cbarr (talk | contribs)
No edit summary
Cbarr (talk | contribs)
Undo revision 2784 by Cbarr (talk)
Line 1: Line 1:
<html>
{{2011FR/Form-section-radiobuttons-2/{{{country}}}

| country = {{{country}}}
<style type="text/css">
| uselang = {{{uselang}}}

| currency-position = before
#radiobuttons-table-header{
| currency-symbol = $
font-weight: bold;
| donate-amount-0 = {{{donate-amount-0|5}}}
font-size: 1.3em;
| donate-amount-1 = {{{donate-amount-1|10}}}
float: </html>{{#ifeq:{{Template:Ltr-direction|{{{uselang}}}}}|rtl|right|left}}<html>;
| donate-amount-2 = {{{donate-amount-2|20}}}
}
| donate-amount-3 = {{{donate-amount-3|35}}}

| donate-amount-4 = {{{donate-amount-4|50}}}
#radiobuttons-table-body{
| donate-amount-5 = {{{donate-amount-5|100}}}
margin-left: -5px;
| donate-amount-6 = {{{donate-amount-6|250}}}
padding-top: 2.3em;
}}
}

#input_amount_other_box{
color: #aaaaaa;
font-size: 0.8em;
border:1px solid #c0c0c0;
direction: </html>{{Template:Ltr-direction|{{{uselang}}}}}<html>;
}

#amount-table{
font-size: 1.2em;
}

.amount-table-cell{
white-space: nowrap;
}

.currency-collapsible-container-contained{
display: none;
background-color: #FFFFFF;
color: black;
}

#country-container{
/*display: none;*/
float: </html>{{#ifeq:{{Template:Ltr-direction|{{{uselang}}}}}|rtl|left|right}}<html>;
}

#country-container-trigger{
font-size: 0.9em
}

#country-container-contained{
}

#input_currency_code{
width: 9em;
font-size: 0.95em;
}
</style>

<script type="text/javascript">

function clearOther(box){
document.getElementById("input_amount_other").checked = true;
box.value = "";
box.style.color = "#000000";
}

function resetOther(box){
box.value = "</html>{{int:donate_interface-other}}<html>";
box.style.color = "#aaaaaa";
}

function selectAmount(){
document.getElementById("input_amount_other_box").value = "</html>{{int:donate_interface-other}}<html>";
document.getElementById("input_amount_other_box").style.color = "#aaaaaa";
}

function validateForm(form){

var minimums = {
'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
for ( var i = 0; i < form.amount.length; i++ ) {
if ( form.amount[i].checked ) {
amount = form.amount[i].value;
}
}
if ( form.amountGiven.value != "</html>{{int:donate_interface-other}}<html>" ) {
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 ) );
error = true;
}
return !error;
}

</script>

<div>
<div id="radiobuttons-table-header">
</html>{{int:donate_interface-amount-legend}}<html>
</div>
<div class="collapsible-container" id="country-container" onclick="triggerClick('country');">
<span class="collapsible-container-trigger" id="country-container-trigger"></html>{{int:donate_interface-country-dropdown-{{{country}}}}}<html> not your country?</span><br/>
<span class="currency-collapsible-container-contained" id="country-container-contained">

<select name="currency_code" id="input_currency_code" onchange="loadCountry();">
<option value="US" selected>USD – $</option>
<option value="GB">GBP – £</option>
<option value="FR">EUR – €</option>
<option value="AU">AUD – $</option>
<option value="CA">CAD – $</option>
<option value="CH">CHF – Fr.</option>
<option value="CZ">CZK – Kč</option>
<option value="DK">DKK – kr</option>
<option value="HK">HKD – HK$</option>
<option value="HU">HUF – Ft</option>
<option value="IL">ILS – ₪</option>
<option value="JP">JPY – ¥</option>
<option value="NO">NOK – kr</option>
<option value="NZ">NZD – $</option>
<option value="PL">PLN – zł</option>
<option value="SE">SEK – kr</option>
<option value="SG">SGD – S$</option>
</select>

</span>
</div>
</div>
<div id="radiobuttons-table-body">
<table id="amount-table">
<tr>
<td class="amount-table-cell">
<input type="radio" name="amount" id="input_amount_0" onclick="selectAmount();" value="</html>{{{donate-amount-0}}}<html>" />
<label for="input_amount_0"></html>{{#ifeq:{{{currency-position}}}|before|{{{currency-symbol}}}|}}{{{donate-amount-0}}}{{#ifeq:{{{currency-position}}}|after|{{{currency-symbol}}}|}}<html></label>
</td>
<td class="amount-table-cell">
<input type="radio" name="amount" id="input_amount_1" onclick="selectAmount();" value="</html>{{{donate-amount-1}}}<html>" />
<label for="input_amount_1"></html>{{#ifeq:{{{currency-position}}}|before|{{{currency-symbol}}}|}}{{{donate-amount-1}}}{{#ifeq:{{{currency-position}}}|after|{{{currency-symbol}}}|}}<html></label>
</td>
<td class="amount-table-cell">
<input type="radio" name="amount" id="input_amount_2" onclick="selectAmount();" value="</html>{{{donate-amount-2}}}<html>" />
<label for="input_amount_2"></html>{{#ifeq:{{{currency-position}}}|before|{{{currency-symbol}}}|}}{{{donate-amount-2}}}{{#ifeq:{{{currency-position}}}|after|{{{currency-symbol}}}|}}<html></label>
</td>
<td class="amount-table-cell">
<input type="radio" name="amount" id="input_amount_3" onclick="selectAmount();" value="</html>{{{donate-amount-3}}}<html>" />
<label for="input_amount_3"></html>{{#ifeq:{{{currency-position}}}|before|{{{currency-symbol}}}|}}{{{donate-amount-3}}}{{#ifeq:{{{currency-position}}}|after|{{{currency-symbol}}}|}}<html></label>
</td>
</tr>
<tr>
<td class="amount-table-cell">
<input type="radio" name="amount" id="input_amount_4" onclick="selectAmount();" value="</html>{{{donate-amount-4}}}<html>" />
<label for="input_amount_4"></html>{{#ifeq:{{{currency-position}}}|before|{{{currency-symbol}}}|}}{{{donate-amount-4}}}{{#ifeq:{{{currency-position}}}|after|{{{currency-symbol}}}|}}<html></label>
</td>
<td class="amount-table-cell">
<input type="radio" name="amount" id="input_amount_5" onclick="selectAmount();" value="</html>{{{donate-amount-5}}}<html>" />
<label for="input_amount_5"></html>{{#ifeq:{{{currency-position}}}|before|{{{currency-symbol}}}|}}{{{donate-amount-5}}}{{#ifeq:{{{currency-position}}}|after|{{{currency-symbol}}}|}}<html></label>
</td>
<td class="amount-table-cell">
<input type="radio" name="amount" id="input_amount_6" onclick="selectAmount();" value="</html>{{{donate-amount-6}}}<html>" />
<label for="input_amount_6"></html>{{#ifeq:{{{currency-position}}}|before|{{{currency-symbol}}}|}}{{{donate-amount-6}}}{{#ifeq:{{{currency-position}}}|after|{{{currency-symbol}}}|}}<html></label>
</td>
<td class="amount-table-cell">
<input type="radio" name="amount" id="input_amount_other" value="" />
</html>{{#ifeq:{{{currency-position}}}|before|{{{currency-symbol}}}|}}<html>
<input type="text" name="amountGiven" id="input_amount_other_box" size="3" autocomplete="off" value="</html>{{int:donate_interface-other}}<html>" onfocus="clearOther(this)"/>
</html>{{#ifeq:{{{currency-position}}}|after|{{{currency-symbol}}}|}}<html>
</td>
</tr>
</table>
</div>
</html>

Revision as of 00:01, 3 November 2011

Donation amount
⧼donate_interface-country-dropdown-{{{country}}}⧽ not your country?