Difference between revisions of "User:Aude/common.js"
Jump to navigation
Jump to search
(tweak) |
(tweak) |
||
Line 1: | Line 1: | ||
− | function validateAmount(amount){ |
||
− | if(amount.value.match( /^[0-9]+(\.([0-9]+))?$/)){ |
||
− | return true; |
||
− | }else{ |
||
− | alert('You must enter a valid donation.'); |
||
− | amount.focus(); |
||
− | return false; |
||
− | } |
||
− | } |
||
− | |||
if ( ( mw.config.get('wgPageName') == 'Home' ) && ( wgNamespaceNumber == 0 ) ) { |
if ( ( mw.config.get('wgPageName') == 'Home' ) && ( wgNamespaceNumber == 0 ) ) { |
||
$('#donatebutton').css({'border' : 'solid 1px red'}); |
$('#donatebutton').css({'border' : 'solid 1px red'}); |
||
+ | alert('red'); |
||
− | $('#donatebutton').html('<form action="https://checkout.google.com/cws/v2/Donations/334897480085960/checkoutForm" id="BB_BuyButtonForm" method="post" name="BB_BuyButtonForm" onSubmit="return validateAmount(this.item_price_1)" target="_top"> |
+ | $('#donatebutton').html('<form action="https://checkout.google.com/cws/v2/Donations/334897480085960/checkoutForm" id="BB_BuyButtonForm" method="post" name="BB_BuyButtonForm" onSubmit="return validateAmount(this.item_price_1)" target="_top"></form>'); |
− | <input name="item_name_1" type="hidden" value="Wiki Society of Washington, DC"/> |
||
+ | alert('donate'); |
||
− | <input name="item_description_1" type="hidden" value="Support DC region Wikimedia volunteers"/> |
||
− | <input name="item_quantity_1" type="hidden" value="1"/> |
||
− | <input name="item_currency_1" type="hidden" value="USD"/> |
||
− | <input name="item_is_modifiable_1" type="hidden" value="true"/> |
||
− | <input name="item_min_price_1" type="hidden" value="0.01"/> |
||
− | <input name="item_max_price_1" type="hidden" value="25000.0"/> |
||
− | <input name="_charset_" type="hidden" value="utf-8"/> |
||
− | </form> |
||
− | '); |
||
} |
} |
Revision as of 15:33, 16 September 2011
if ( ( mw.config.get('wgPageName') == 'Home' ) && ( wgNamespaceNumber == 0 ) ) {
$('#donatebutton').css({'border' : 'solid 1px red'});
alert('red');
$('#donatebutton').html('<form action="https://checkout.google.com/cws/v2/Donations/334897480085960/checkoutForm" id="BB_BuyButtonForm" method="post" name="BB_BuyButtonForm" onSubmit="return validateAmount(this.item_price_1)" target="_top"></form>');
alert('donate');
}