diff options
Diffstat (limited to 'snag/static')
-rw-r--r-- | snag/static/interactive.js | 64 | ||||
-rw-r--r-- | snag/static/pagedown.css | 155 | ||||
-rw-r--r-- | snag/static/style.css | 18 |
3 files changed, 237 insertions, 0 deletions
diff --git a/snag/static/interactive.js b/snag/static/interactive.js new file mode 100644 index 0000000..de44670 --- /dev/null +++ b/snag/static/interactive.js @@ -0,0 +1,64 @@ +/** + * Script to change the shown graph + * + * Matt Kohls + * 2021 + */ + +const form = document.getElementById('query'); +const submitButton = document.getElementById('submit'); +const figure = document.getElementById('figure'); + +function sendRequest(data) { + let url = "/", + urlEncoded = "", + urlEncodedPairs = [], + name, + startDate, + startTime, + endDate, + endTime; + + for (name of data) { + switch (name[0]) { + case 'graph': + url = url.concat(name[1]); + break; + case 'sd': + startDate = name[1].replace(/-/g, ''); + break; + case 'st': + startTime = name[1].replace(/:/g, '').concat('00'); + case 'ed': + endDate = name[1].replace(/-/g, ''); + break; + case 'et': + endTime = name[1].replace(/:/g, '').concat('00'); + break; + case 'deviceId': + default: + urlEncodedPairs.push(name[0] + '=' + name[1]); + } + } + if (startDate !== "") { + if (startTime === "00") { + startTime = "000000"; + } + urlEncodedPairs.push('start=' + startDate + startTime); + } + if (endDate !== "") { + if (endTime === "00") { + endTime = "000000"; + } + urlEncodedPairs.push('end=' + endDate + endTime); + } + + urlEncoded = urlEncodedPairs.join('&'); + figure.setAttribute('src', url + '?' + urlEncoded); +} + +submitButton.addEventListener('click', function() { + const formData = new FormData(form); + sendRequest(formData); +}) + diff --git a/snag/static/pagedown.css b/snag/static/pagedown.css new file mode 100644 index 0000000..7f9c3e0 --- /dev/null +++ b/snag/static/pagedown.css @@ -0,0 +1,155 @@ +@font-face { + font-family: "Courier 10 Pitch"; + src: url(/fonts/courier10bt-regular.woff); + font-weight: normal; + font-style: normal; +} + +@font-face { + font-family: "Courier 10 Pitch"; + src: url(/fonts/courier10bt-bold.woff); + font-weight: bold; + font-style: normal; +} + +@font-face { + font-family: "Courier 10 Pitch"; + src: url(/fonts/courier10bt-italic.woff); + font-weight: normal; + font-style: italic; +} + +@font-face { + font-family: "Courier 10 Pitch"; + src: url(/fonts/courier10bt-bolditalic.woff); + font-weight: bold; + font-style: italic; +} + +@font-face { + font-family: Literata; + src: url(/fonts/Literata-Regular.woff) + font-weight: normal; + font-style: normal; +} + +@font-face { + font-family: Literata; + src: url(/fonts/Literata-Bold.woff) + font-weight: bold; + font-style: normal; +} + +@font-face { + font-family: Literata; + src: url(/fonts/Literata-Italic.woff) + font-weight: normal; + font-style: italic; +} + +@font-face { + font-family: Literata; + src: url(/fonts/Literata-BoldItalic.woff) + font-weight: bold; + font-style: italic; +} + +html, body { + min-height: 100%; + height: 100%; + margin: 1em +} + +body { + color: #212529; + background-color: #fff; + font-family: "Nimbus Sans L", Helvetica, sans-serif; +} + +img, video { + display: block; + max-width: 80%; + box-shadow: 1px 1px 5px 0 rgba(0,0,0,.4); + margin: 0 auto +} + +figcaption { + text-align: center; + margin: 0 auto +} + +pre { + font-family: "Courier 10 Pitch", Courier, monospace; + background: #eee; + padding: .5rem; + margin: 0 -.5rem; + overflow-x: auto +} + +nav { + margin: 0 auto; + clear: both +} + +nav a:not(:first-child) { + margin-left: 1rem +} + +nav .brand { + font-size: 1.25rem; + position: relative; + top: 1px +} + +label { + display: inline-block; + margin-bottom: .25rem +} + +aside { + border-left-style: dotted; + padding: 1em +} + +h1 { + font-family: Literata, serif; +} + +h2 { + font-family: Literata, serif; +} + +h3 { + font-family: Literata, serif; +} + +h4 { + font-family: Literata, serif; +} + +header { + width: 50%; + margin-top: .5rem; +} + +table { + border-collapse: collapse; + border: 0px +} + +th { + border-bottom: 1px solid #212121 +} + +th, td { + padding: 5px; +} + +tr:nth-child(even) { + background-color: #f6f6f6 +} + +footer { + width: 50%; + margin: 0 0 1rem +} diff --git a/snag/static/style.css b/snag/static/style.css new file mode 100644 index 0000000..da1cb34 --- /dev/null +++ b/snag/static/style.css @@ -0,0 +1,18 @@ +body { font-family: sans-serif; background: #eee; } +a, h1, h2 { color: #377ba8; } +h1, h2 { font-family: 'Georgia', serif; margin: 0; } +h1 { border-bottom: 2px solid #eee; } +h2 { font-size: 1.2em; } + +.page { margin: 2em auto; width: 35em; border: 5px solid #ccc; + padding: 0.8em; background: white; } +.weather { list-style: none; margin: 0; padding: 0; } +.weather li { margin: 0.8em 1.2em; } +.weather li h2 { margin-left: -1em; } +.add-entry { font-size: 0.9em; border-bottom: 1px solid #ccc; } +.add-entry dl { font-weight: bold; } +.metanav { text-align: right; font-size: 0.8em; padding: 0.3em; + margin-bottom: 1em; background: #fafafa; } +.flash { background: #cee5F5; padding: 0.5em; + border: 1px solid #aacbe2; } +.error { background: #f0d6d6; padding: 0.5em; } |