7a053b9fa0
* Update model to store multiple clients. * Delete tmp registration data after client creation. * Add minimal account selector view * Update clients so they can have an account attached. * List clients in the account selector. * List accounts in the account selector view. * It works™. * Minor CSS fix. * Reset server value when switching account. * Fix empty black screen on reauth with new client format. * Fix typo. [skip-ci]
70 lines
2.3 KiB
HTML
70 lines
2.3 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title>Tooty</title>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<link href="//bootswatch.com/slate/bootstrap.min.css" media="all" rel="stylesheet" />
|
|
<link href="style.css" media="all" rel="stylesheet" />
|
|
<link rel="icon" type="image/png" sizes="192x192" href="images/favicon-192x192.png">
|
|
<link rel="icon" type="image/png" sizes="96x96" href="images/favicon-96x96.png">
|
|
<link rel="icon" type="image/png" sizes="32x32" href="images/favicon-32x32.png">
|
|
<link rel="icon" type="image/png" sizes="16x16" href="images/favicon-16x16.png">
|
|
<meta name="msapplication-TileColor" content="#272b30">
|
|
<meta name="theme-color" content="#272b30">
|
|
</head>
|
|
|
|
<body>
|
|
<script src="app.js"></script>
|
|
<script>
|
|
// Note: this is a transitional upgrade to new client storage format, which
|
|
// is now now a list of clients, which all require an "account" property set.
|
|
const oldClient = JSON.parse(localStorage.getItem("tooty.client"));
|
|
const defaultClients = oldClient ? [oldClient] : [];
|
|
const clients = (JSON.parse(localStorage.getItem("tooty.clients")) || defaultClients)
|
|
.map(client => {
|
|
if (!client.hasOwnProperty("account")) {
|
|
client.account = null;
|
|
}
|
|
return client;
|
|
});
|
|
|
|
const app = Elm.Main.fullscreen({
|
|
clients: clients,
|
|
registration: JSON.parse(localStorage.getItem("tooty.registration"))
|
|
});
|
|
|
|
app.ports.saveClients.subscribe(json => {
|
|
localStorage.setItem("tooty.clients", json);
|
|
});
|
|
|
|
app.ports.saveRegistration.subscribe(json => {
|
|
localStorage.setItem("tooty.registration", json);
|
|
});
|
|
|
|
app.ports.deleteRegistration.subscribe(json => {
|
|
localStorage.removeItem("tooty.registration");
|
|
});
|
|
|
|
app.ports.setStatus.subscribe(function(data) {
|
|
var element = document.getElementById(data.id);
|
|
if (element) {
|
|
element.value = data.status;
|
|
// Reset cursor at the end
|
|
element.focus();
|
|
}
|
|
});
|
|
|
|
app.ports.scrollIntoView.subscribe(function(id) {
|
|
requestAnimationFrame(function() {
|
|
var element = document.getElementById(id);
|
|
if (element) {
|
|
element.scrollIntoView(false);
|
|
}
|
|
});
|
|
});
|
|
|
|
</script>
|
|
</body>
|
|
</html>
|