mirror of
https://github.com/neocities/neocities.git
synced 2025-04-25 01:32:36 +02:00
replace skeuocard with code that hopefully has less issues
This commit is contained in:
parent
c994f9f4c1
commit
790d31f578
5 changed files with 730 additions and 52 deletions
2
public/js/imask.min.js
vendored
Normal file
2
public/js/imask.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
public/js/imask.min.js.map
Normal file
1
public/js/imask.min.js.map
Normal file
File diff suppressed because one or more lines are too long
705
views/_card.erb
Normal file
705
views/_card.erb
Normal file
File diff suppressed because one or more lines are too long
|
@ -8,14 +8,15 @@
|
|||
|
||||
$(document).ready(function() {
|
||||
$('#upgradeForm').submit(function(event) {
|
||||
/* event.preventDefault(); */
|
||||
event.preventDefault();
|
||||
|
||||
if ($('#stripe_token').val() === '') {
|
||||
Stripe.card.createToken({
|
||||
number: $('[name="cc_number"]').val(),
|
||||
cvc: $('[name="cc_cvc"]').val(),
|
||||
exp_month: $('[name="cc_exp_month"]').val(),
|
||||
exp_year: $('[name="cc_exp_year"]').val()
|
||||
//name: $('input[id="name"]').val(),
|
||||
number: $('input[id="cardnumber"]').val(),
|
||||
cvc: $('input[id="securitycode"]').val(),
|
||||
exp_month: $('input[id="expirationdate"]').val().split('/')[0],
|
||||
exp_year: $('input[id="expirationdate"]').val().split('/')[1]
|
||||
}, stripeResponseHandler);
|
||||
return false;
|
||||
} else {
|
||||
|
@ -25,12 +26,10 @@
|
|||
});
|
||||
|
||||
function clearCardInfo() {
|
||||
$('[name="cc_number"]').val('');
|
||||
$('[name="cc_cvc"]').val('');
|
||||
$('[name="cc_exp_month"]').val('');
|
||||
$('[name="cc_exp_year"]').val('');
|
||||
$('[name="cc_name"]').val('');
|
||||
$('[name="cc_type"]').val('');
|
||||
//$('input[id="name"]').val('');
|
||||
$('input[id="cardnumber"]').val('');
|
||||
$('input[id="securitycode"]').val('');
|
||||
$('input[id="expirationdate"]').val('');
|
||||
}
|
||||
|
||||
function stripeResponseHandler(status, response) {
|
||||
|
@ -40,7 +39,9 @@
|
|||
var token = response.id;
|
||||
$('#stripe_token').val(token);
|
||||
clearCardInfo();
|
||||
$('.form-container').html('Thank you!<br>Upgrading your account, please wait...')
|
||||
$('#upgradeForm').off('submit').submit();
|
||||
$('#upgradeDiv').css('display', 'none');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -68,49 +68,21 @@
|
|||
</div>
|
||||
|
||||
<div class="col col-66">
|
||||
<p class="instructions">Just enter your card info, and you're done:</p>
|
||||
<div>
|
||||
<div id="plan_error" class="alert alert-block alert-error" style="display:none"></div>
|
||||
<form id="upgradeForm" method="POST" action="/supporter/update">
|
||||
<%== csrf_token_input_html %>
|
||||
<input type="hidden" value="supporter" name="plan_type">
|
||||
<input id="stripe_token" name="stripe_token" type="hidden" value="<%= params[:stripe_token] %>">
|
||||
|
||||
<div class="credit-card-input no-js" id="skeuocard" style="margin-left: auto; margin-right: auto; margin-bottom: 20px">
|
||||
<p class="no-support-warning"></p>
|
||||
<label for="cc_type">Card Type</label>
|
||||
<select name="cc_type">
|
||||
<option value="">...</option>
|
||||
<option value="visa">Visa</option>
|
||||
<option value="discover">Discover</option>
|
||||
<option value="mastercard">MasterCard</option>
|
||||
<option value="maestro">Maestro</option>
|
||||
<option value="jcb">JCB</option>
|
||||
<option value="unionpay">China UnionPay</option>
|
||||
<option value="amex">American Express</option>
|
||||
<option value="dinersclubintl">Diners Club</option>
|
||||
</select>
|
||||
<label for="cc_number">Card Number</label>
|
||||
<input type="text" name="cc_number" id="cc_number" placeholder="XXXX XXXX XXXX XXXX" maxlength="19" size="19">
|
||||
<label for="cc_exp_month">Expiration Month</label>
|
||||
<input type="text" name="cc_exp_month" id="cc_exp_month" placeholder="00">
|
||||
<label for="cc_exp_year">Expiration Year</label>
|
||||
<input type="text" name="cc_exp_year" id="cc_exp_year" placeholder="00">
|
||||
<label for="cc_name">Cardholder's Name</label>
|
||||
<input type="text" name="cc_name" id="cc_name" placeholder="John Doe">
|
||||
<label for="cc_cvc">Card Validation Code</label>
|
||||
<input type="text" name="cc_cvc" id="cc_cvc" placeholder="123" maxlength="3" size="3">
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div id="plan_error" class="alert alert-block alert-error" style="display:none"></div>
|
||||
<form id="upgradeForm" method="POST" action="/supporter/update">
|
||||
<%== csrf_token_input_html %>
|
||||
<input type="hidden" value="supporter" name="plan_type">
|
||||
<input id="stripe_token" name="stripe_token" type="hidden" value="<%= params[:stripe_token] %>">
|
||||
<%== erb :'_card'%>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row content txt-Center">
|
||||
<div id="upgradeDiv" class="row content txt-Center">
|
||||
<a id="upgradeLink" href="/" class="btn-Action" onclick="$('#upgradeForm').submit(); return false">
|
||||
Upgrade for $<%= Site::PLAN_FEATURES[:supporter][:price] %>/mo
|
||||
</a>
|
||||
or pay with <a href="/supporter/paypal">PayPal</a> or <a href="/supporter/bitcoin">Bitcoin</a>
|
||||
or pay with <strong><a href="/supporter/paypal" style="color: #00308a; text-decoration: underline;"><span style="color: #00308a">Pay</span><span style="color: #029be1">Pal</span></a></strong> or <strong><a href="/supporter/bitcoin" style="color: #f79319; text-decoration: underline;">Bitcoin</a></strong>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -159,6 +131,3 @@
|
|||
})
|
||||
})
|
||||
</script>
|
||||
<script>
|
||||
card = new Skeuocard($('#skeuocard'))
|
||||
</script>
|
||||
|
|
Loading…
Add table
Reference in a new issue