Format status box
This commit is contained in:
@@ -4,25 +4,50 @@
|
|||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
||||||
<title>Fáfnir Doorbell</title>
|
<title>Fáfnir Doorbell</title>
|
||||||
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha256-4+XzXVhsDmqanXGHaHvgh1gMQKX40OUvDEBTu8JcmNs=" crossorigin="anonymous"></script>
|
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha256-4+XzXVhsDmqanXGHaHvgh1gMQKX40OUvDEBTu8JcmNs=" crossorigin="anonymous"></script>
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
background-color: black;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
#status_box {
|
||||||
|
margin: auto;
|
||||||
|
width: 30%;
|
||||||
|
border-style: ridge;
|
||||||
|
border-color: yellow;
|
||||||
|
border-width: 5px;
|
||||||
|
padding: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.status {
|
||||||
|
font-family: monospace;
|
||||||
|
font-size: 250%;
|
||||||
|
font-variant: small-caps;
|
||||||
|
}
|
||||||
|
|
||||||
|
.connected {
|
||||||
|
color: green;
|
||||||
|
}
|
||||||
|
|
||||||
|
.disconnected {
|
||||||
|
color: red;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<section id="status">
|
<section id="status_box">
|
||||||
Status:
|
Status:
|
||||||
<span id="status_line"></span>
|
<span id="status_line"></span>
|
||||||
</section>
|
<br><br>
|
||||||
<section id="log">
|
Last Ring: <span id="last_ring" class="status"></span>
|
||||||
<h1>Incoming Events</h1>
|
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<audio id="chime" src="indoor.mp3"></audio>
|
<audio id="chime" src="indoor.mp3"></audio>
|
||||||
<template id="connected">
|
<template id="connected">
|
||||||
<span class="connected">Connected</span>
|
<span class="status connected">Connected</span>
|
||||||
</template>
|
</template>
|
||||||
<template id="disconnected">
|
<template id="disconnected">
|
||||||
<span class="disconnected">Disconnected</span>
|
<span class="status disconnected">Disconnected</span>
|
||||||
</template>
|
|
||||||
<template id="ring">
|
|
||||||
<p>Ring!
|
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
"use strict";
|
"use strict";
|
||||||
@@ -66,8 +91,16 @@
|
|||||||
if (chime.paused) {
|
if (chime.paused) {
|
||||||
chime.play();
|
chime.play();
|
||||||
}
|
}
|
||||||
const template = get_template('ring');
|
|
||||||
$('#log').append(template);
|
let now = new Date();
|
||||||
|
let hours = now.getHours();
|
||||||
|
let hours12 = (hours + 11) % 12 + 1;
|
||||||
|
let mins = now.getMinutes();
|
||||||
|
mins = (mins < 10) ? '0' + mins : mins;
|
||||||
|
let secs = now.getSeconds();
|
||||||
|
secs = (secs < 10) ? '0' + secs : secs;
|
||||||
|
let demidiemity = (hours / 12)|0 ? 'PM' : 'AM';
|
||||||
|
$('#last_ring').text(`${hours12}:${mins}:${secs} ${demidiemity}`);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user