66 lines
2.1 KiB
HTML
66 lines
2.1 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<title>Top up your balance | Stand</title>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<link href="/halfmoon-variables.min.css" crossorigin="anonymous" rel="stylesheet" />
|
|
<link href="/halfmoon-config.css" rel="stylesheet" />
|
|
</head>
|
|
<body class="dark-mode">
|
|
<div class="page-wrapper with-navbar">
|
|
<nav class="navbar">
|
|
<div class="container-xl">
|
|
<a class="navbar-brand" href="/">Stand</a>
|
|
<ul class="navbar-nav">
|
|
<li class="nav-item active"><a class="nav-link" href="/account/">Account</a></li>
|
|
<li class="nav-item"><a class="nav-link" href="/help/">Help</a></li>
|
|
</ul>
|
|
</div>
|
|
</nav>
|
|
<div class="content-wrapper">
|
|
<div class="container-xl">
|
|
<div class="content">
|
|
<h1>Top up your balance</h1>
|
|
<p>You can redeem your <b>5€ Top Up Keys</b> here. These are no longer being sold.</p>
|
|
<form onsubmit="topup_submit();return false;" method="GET" action="/bad_browser.txt">
|
|
<p><input type="text" class="form-control" placeholder="Top up key" required pattern="Stand-Topup-[a-z0-9]{31}" title="Stand Topup Key" /></p>
|
|
<p><input type="submit" class="btn btn-primary" value="Top up" /></p>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<script src="/common.js"></script>
|
|
<script>
|
|
if(typeof localStorage.getItem("account_id")!="string")
|
|
{
|
|
location.href=".";
|
|
}
|
|
let topup_pending = false;
|
|
function topup_submit()
|
|
{
|
|
if(topup_pending)
|
|
{
|
|
return;
|
|
}
|
|
topup_pending = true;
|
|
$.post("/api/topup", {
|
|
account_id: localStorage.getItem("account_id"),
|
|
key: document.querySelector("[type='text']").value
|
|
}).done(function(data)
|
|
{
|
|
store_account_data(data);
|
|
alert("Success! You now have a balance of " + format_coins(data.coins) + "€.");
|
|
document.querySelector("[type='text']").value = "";
|
|
}).fail(function()
|
|
{
|
|
alert("Top up failed. Invalid key or already used?");
|
|
}).always(function()
|
|
{
|
|
topup_pending = false;
|
|
});
|
|
}
|
|
</script>
|
|
<script src="https://code.jquery.com/jquery-3.6.0.min.js" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script>
|
|
</body>
|