Skip to content
This repository was archived by the owner on Oct 17, 2018. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 42 additions & 11 deletions pay/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -82,27 +82,27 @@ <h1>Install Payment</h1>
<p>Please also subscribe me to a monthly donation (starting next month)</p>
<div>
<div>
<input class="w1" type="radio" id="contactChoice1"
<input class="w1" type="radio" id="twenty-monthly"
name="contact" value="email" checked="checked" onclick="setSubscription('twenty-monthly')">
<label class="fw4" for="contactChoice1">$20</label>
<label class="fw4" for="twenty-monthly">$20</label>
</div>

<div>
<input class="w1" type="radio" id="contactChoice2"
<input class="w1" type="radio" id="fifty-monthly"
name="contact" value="phone" onclick="setSubscription('fifty-monthly')">
<label class="fw4" for="contactChoice2">$50</label>
<label class="fw4" for="fifty-monthly">$50</label>
</div>

<div>
<input class="w1" type="radio" id="contactChoice3"
<input class="w1" type="radio" id="hundred-monthly"
name="contact" value="mail" onclick="setSubscription('hundred-monthly')">
<label class="fw4" for="contactChoice3">$100 (business)</label>
<label class="fw4" for="hundred-monthly">$100 (business)</label>
</div>

<div>
<input class="w1" type="radio" id="contactChoice3"
<input class="w1" type="radio" id="no-monthly"
name="contact" value="mail" onclick="setSubscription(undefined)">
<label class="fw4" for="contactChoice3">I do not wish to donate</label>
<label class="fw4" for="no-monthly">I do not wish to donate</label>
</div>
</div>
</form>
Expand Down Expand Up @@ -147,10 +147,42 @@ <h1>Install Payment</h1>

<!-- handle form input -->
<script>
var donationAmount = 11000
var subscriptionPlan = 'twenty-monthly'
var defaultDonation = 110
var defaultSubscription = 'twenty-monthly'

// Get donation and sub from url
var url_string = window.location.href
var url = new URL(url_string);
var URLamount = url.searchParams.get("a");
var donationAmount = URLamount * 100 || defaultDonation * 100

var subscriptionPlan = defaultSubscription
var plan = url.searchParams.get("s");
if (plan == 20) {
let planId = 'twenty-monthly'
document.getElementById(planId).checked = "checked"
setSubscription(planId)
}
if (plan == 50) {
let planId = 'fifty-monthly'
document.getElementById(planId).checked = "checked"
setSubscription(planId)
}
if (plan == 100) {
let planId = 'hundred-monthly'
document.getElementById(planId).checked = "checked"
setSubscription(planId)
}
if (plan == 'none' || plan == 0) {
let planId = 'no-monthly'
document.getElementById(planId).checked = "checked"
setSubscription(undefined)
}

var donationType, customAmount;
var customDonation = document.getElementById('custom');
customDonation.value = donationAmount / 100

customDonation.onkeypress = function(e) {
// not a number
if (e.which < 48 || e.which > 57)
Expand All @@ -165,7 +197,6 @@ <h1>Install Payment</h1>

customDonation.addEventListener('focus', function(e) {
var tmpStr = e.target.value;
console.log(tmpStr)
e.target.value = '';
e.target.value = tmpStr;
donationAmount = customAmount;
Expand Down