Clean up tabs & comments

This commit is contained in:
John Weston
2017-02-18 21:10:13 -08:00
parent 9f93b2154d
commit 5e42c0b636
+134 -124
View File
@@ -1,145 +1,155 @@
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="apple-mobile-web-app-capable" content="yes">
<title>Nightscout</title>
<title>Nightscout</title>
<link href="/images/round1.png" rel="icon" id="favicon" type="image/png" />
<link rel="apple-touch-icon" sizes="57x57" href="/images/apple-touch-icon-57x57.png">
<link rel="apple-touch-icon" sizes="60x60" href="/images/apple-touch-icon-60x60.png">
<link rel="apple-touch-icon" sizes="72x72" href="/images/apple-touch-icon-72x72.png">
<link rel="apple-touch-icon" sizes="76x76" href="/images/apple-touch-icon-76x76.png">
<link rel="apple-touch-icon" sizes="114x114" href="/images/apple-touch-icon-114x114.png">
<link rel="apple-touch-icon" sizes="120x120" href="/images/apple-touch-icon-120x120.png">
<link rel="apple-touch-icon" sizes="144x144" href="/images/apple-touch-icon-144x144.png">
<link rel="apple-touch-icon" sizes="152x152" href="/images/apple-touch-icon-152x152.png">
<link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-180x180.png">
<link href="/images/round1.png" rel="icon" id="favicon" type="image/png" />
<link rel="apple-touch-icon" sizes="57x57" href="/images/apple-touch-icon-57x57.png">
<link rel="apple-touch-icon" sizes="60x60" href="/images/apple-touch-icon-60x60.png">
<link rel="apple-touch-icon" sizes="72x72" href="/images/apple-touch-icon-72x72.png">
<link rel="apple-touch-icon" sizes="76x76" href="/images/apple-touch-icon-76x76.png">
<link rel="apple-touch-icon" sizes="114x114" href="/images/apple-touch-icon-114x114.png">
<link rel="apple-touch-icon" sizes="120x120" href="/images/apple-touch-icon-120x120.png">
<link rel="apple-touch-icon" sizes="144x144" href="/images/apple-touch-icon-144x144.png">
<link rel="apple-touch-icon" sizes="152x152" href="/images/apple-touch-icon-152x152.png">
<link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-180x180.png">
<style type="text/css">
@import url("//fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,300,400,600,700,800");
<style type="text/css">
@import url("//fonts.googleapis.com/css?family=Open+Sans:700");
body {
text-align: center;
margin: 0 0;
padding: 0;
overflow: hidden;
color: white;
}
main {
display: -webkit-box; // Lots of vertical centering redundancy here
display: -ms-flexbox; // to accommodate different/old browsers.
display: -webkit-flex;
display: flex;
-webkit-box-align: center;
-webkit-flex-align: center;
-ms-flex-align: center;
-webkit-align-items: center;
align-items: center;
height: 100vh;
width: 100%;
margin: 0 0;
padding: 0;
}
.inner {
width: 100%;
-webkit-transform: translateY(-5%);
}
.bgnow {
font-family: 'Open Sans';
font-weight: 700;
font-size: 40vmin;
}
.arrow {
width: 100%;
}
img#arrow {
width: 40vmin;
}
.stale {
color: black;
}
</style>
body {
text-align: center;
margin: 0 0;
padding: 0;
overflow: hidden;
color: white;
}
main {
display: -webkit-box;
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
-webkit-box-align: center;
-webkit-flex-align: center;
-ms-flex-align: center;
-webkit-align-items: center;
align-items: center;
height: 100vh;
width: 100%;
margin: 0 0;
padding: 0;
}
.inner {
width: 100%;
-webkit-transform: translateY(-5%);
}
.bgnow {
font-family: 'Open Sans';
font-weight: 700;
font-size: 40vmin;
}
.arrow {
width: 100%;
}
img#arrow {
width: 40vmin;
}
.stale {
color: black;
}
</style>
</head>
<body>
<main>
<div class="inner">
<div class="bgnow"></div>
<div class="arrow"><img id="arrow" src=""/></div>
</div>
</main>
<main>
<div class="inner">
<div class="bgnow"></div>
<div class="arrow"><img id="arrow" src=""/></div>
</div>
</main>
<script src="/bower_components/jquery/dist/jquery.min.js"></script>
<script src="/api/v1/status.js"></script>
<script src="/public/js/bundle.js"></script>
<script src="/bower_components/jquery/dist/jquery.min.js"></script>
<script src="/api/v1/status.js"></script>
<script src="/public/js/bundle.js"></script>
<script type="text/javascript">
function query ( ) {
console.log('query');
$.ajax('/api/v1/entries/current.json', { success: render });
}
function render (xhr) {
console.log('xhr', xhr);
var rec = xhr[0];
var last = new Date(rec.date);
var now = new Date( );
var LowThresh = parseFloat("4"); // Set low/med/high thresholds here.
var MedThresh = parseFloat("10"); // Below Low will be red; between Low & Med
var HighThresh = parseFloat("15"); // is green; between Med & High is yellow;
// above High is red. Use mg/dl numbers if
// that's your site setting.
if (window.serverSettings.settings.units == 'mmol') {
rec.sgv = Nightscout.units.mgdlToMMOL(rec.sgv);
}
var bgNum = parseFloat(rec.sgv);
var red = 'rgba(213,9,21,1)'; // These are the particular shades of
var yellow = 'rgba(233,205,53,1)'; // red, yellow, and green.
var green = 'rgba(134,207,70,1)';
var direction = rec.direction;
$('#arrow').attr('src', 'images/'+direction+'.svg'); // Insert the trend arrow.
$('.bgnow').text(rec.sgv); // Insert the BG value text.
if (bgNum < LowThresh) {
$('body').css('background-color', red); // Threshold background coloring.
}
if ((LowThresh <= bgNum) && (bgNum < MedThresh)) {
$('body').css('background-color', green);
}
if ((MedThresh <= bgNum) && (bgNum < HighThresh)) {
$('body').css('background-color', yellow);
}
if (bgNum >= HighThresh) {
$('body').css('background-color', red);
<script type="text/javascript">
function query ( ) {
console.log('query');
$.ajax('/api/v1/entries/current.json', { success: render });
}
var threshold = 1000 * 60 * 13; // Time before data considered stale.
function render (xhr) {
console.log('xhr', xhr);
var rec = xhr[0];
var last = new Date(rec.date);
var now = new Date( );
/*
Set low/med/high thresholds here.
Below Low will be red; between Low & Med
is green; between Med & High is yellow;
above High is red. Use mg/dl numbers if
that's your site setting.
*/
var LowThresh = parseFloat("4");
var MedThresh = parseFloat("10");
var HighThresh = parseFloat("15");
if (window.serverSettings.settings.units == 'mmol') {
rec.sgv = Nightscout.units.mgdlToMMOL(rec.sgv);
}
var bgNum = parseFloat(rec.sgv);
/*
These are the particular shades of red, yellow, and green.
*/
var red = 'rgba(213,9,21,1)';
var yellow = 'rgba(233,205,53,1)';
var green = 'rgba(134,207,70,1)';
var direction = rec.direction;
$('#arrow').attr('src', 'images/'+direction+'.svg'); // Insert the trend arrow.
$('.bgnow').text(rec.sgv); // Insert the BG value text.
if (bgNum < LowThresh) {
$('body').css('background-color', red); // Threshold background coloring.
}
if ((LowThresh <= bgNum) && (bgNum < MedThresh)) {
$('body').css('background-color', green);
}
if ((MedThresh <= bgNum) && (bgNum < HighThresh)) {
$('body').css('background-color', yellow);
}
if (bgNum >= HighThresh) {
$('body').css('background-color', red);
}
var staleMinutes = 13; // Time before data considered stale.
var threshold = 1000 * 60 * staleMinutes;
$('body').toggleClass('stale', (now - last > threshold)); // Restyle if stale.
$('body').toggleClass('stale', (now - last > threshold)); // Restyle if stale.
if (now - last > threshold) { // Restyle body bg too.
$('body').css('background-color', 'grey');
if (now - last > threshold) { // Restyle body bg too.
$('body').css('background-color', 'grey');
}
}
}
function init ( ) {
console.log('init');
query( );
setInterval(query, 1 * 60 * 1000);
}
function init ( ) {
console.log('init');
query( );
setInterval(query, 1 * 60 * 1000);
}
init( );
</script>
init( );
</script>
</body>
</html>
</html>