Commit d255679b authored by Deimos's avatar Deimos

Move Stripe donation form to main site

parent 0460d1ae
......@@ -83,7 +83,7 @@ It won't be a priority to make *interaction* work without javascript. Some featu
### Zero third-party scripts/assets during normal use
Currently, the only page that includes any third-party assets at all is [the page for donating via Stripe](https://docs.tildes.net/donate-stripe.html). This may be required again for some other donation methods or other very specialized uses, but in general there shouldn't be any third-party scripts or assets used on the site.
Currently, the only page that includes any third-party assets at all is the one that redirects to a Stripe Checkout page when making a donation. This may be required again for some other donation methods or other very specialized uses, but in general there shouldn't be any third-party scripts or assets used on the site.
This means that when people are using Tildes, their device is communicating *only* with Tildes servers, not other companies that are tracking and collecting their data.
......
......@@ -16,9 +16,9 @@ Thanks for donating to Tildes! If you have any questions, please check the answe
### Credit card (via Stripe)
You can donate directly using a credit card through Stripe. Note that the Stripe donation page will load third-party assets from Stripe and communicate with Stripe servers to process the transaction.
You can donate directly using a credit card through Stripe.
[Donate with Stripe](https://docs.tildes.net/donate-stripe)
[Donate with Stripe](https://tildes.net/donate_stripe)
### Patreon
......
......@@ -52,7 +52,6 @@ FEED_ALL_ATOM = 'blog/all.atom.xml'
TEMPLATE_PAGES = {
'index.html': 'blog/index.html',
'page_index.html': 'docs/index.html',
'donate-stripe.html': 'docs/donate-stripe.html',
}
DIRECT_TEMPLATES = ['index']
......
{% extends "page.html" %}
{% block meta_og_tags %}{% endblock %}
{% block title %}Donate to Tildes via Stripe{% endblock %}
{% block content %}
<h1>Donate to Tildes via Stripe</h1>
<p>Please enter the amount that you'd like to donate (at least $1).</p>
<p>Note that the donation is in Canadian Dollars (CAD) by default, but you can switch to USD if you prefer. At the moment, $10 CAD is about $8 USD.</p>
<form id="donate-form" method="post" action="https://tildes.net/donate_stripe">
<label for="amount">Donation amount ($):</label>
<input id="amount" name="amount" type="text" placeholder="Amount ($)">
<select id="currency" name="currency">
<option value="CAD" selected>CAD</option>
<option value="USD">USD</option>
</select>
<button type="submit">Donate</button>
</form>
<div id="error-explanation" class="text-error"></div>
<script>
var donateForm = document.getElementById("donate-form");
var errorDiv = document.getElementById("error-explanation");
donateForm.addEventListener("submit", function(event) {
amountInput = document.getElementById("amount");
var amount = amountInput.value;
// remove dollar sign and/or comma, then parse into float
amount = amount.replace(/\$/g, "").replace(/\,/g, "");
amount = parseFloat(amount);
if (isNaN(amount)) {
errorDiv.innerHTML = "<p>Please enter a valid dollar amount.</p>";
event.preventDefault();
} else if (amount < 1.00) {
errorDiv.innerHTML = "<p>Donation amount must be at least $1.</p>";
event.preventDefault();
}
// set the value in case any of the replacements happened
amountInput.value = amount;
});
</script>
{% endblock %}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment