Add today script

This commit is contained in:
Niles Rogoff 2017-08-06 22:48:02 -07:00
parent cdff7cffa5
commit 9493af369e
No known key found for this signature in database
GPG Key ID: B78B908F23430F80
2 changed files with 57 additions and 13 deletions

View File

@ -277,10 +277,33 @@ master.append("""
}
document.onkeydown = key;
document.onkeyup = keyup;
var ol = function ol() {
request = new XMLHttpRequest();
request.onreadystatechange = function() {
if(request.readyState === 4) {
if(request.status === 200) {
var messages = request.responseText.split("\\n");
var div = document.getElementById("today")
for (var i = 0; i < messages.length; i++) {
if (messages[i].trim().length == 0) continue;
var span = document.createElement("span")
span.classList.add("message")
span.style.marginTop = (5 * i).toString() + "px";
span.innerText = messages[i]
div.appendChild(span);
div.appendChild(document.createElement("br"));
}
}
}
}
request.open('GET', 'http://127.0.0.1/today', true);
request.send(null);
}
</script></head>""")
master.append("""<body class=""><div id="content">""")
master.append("""<body class="" onLoad='ol();'><div id="content">""")
for f in l:
master.append(rhtml(f, ""))
master.append("""</div><div id="pi" onclick='pi();'>π</div></body></html>""")
master.append("""</div><div id="today"></div><div id="pi" onclick='pi();'>π</div></body></html>""")
master = "\n".join(master)
print(master)

View File

@ -1,22 +1,18 @@
body {
font-family:helvetica;
background:url("background.png") no-repeat center/cover fixed;
}
#content {
width:90%;
margin-left:auto;
margin-right:auto;
top:50px;
font-family: "Camcorder Monospaced", "Helvetica", sans-serif;
height:90%;
/*color: #595959;*/
/*color: #eeeeee;*/
color: rgba(238,238,238, 0.8);
}
#content {
margin-left: 5%;
margin-top: 50px;
font-family: "Camcorder Monospaced", "Helvetica", sans-serif;
position:relative;
top:50px;
font-size: 24px;
}
a {
font-size: 24px;
/*color: #595959;*/
color: #eeeeee;
transition: color .1s;
@ -37,7 +33,7 @@ a:hover {
}
input {
font-size: 1.5em;
font-size: 1em;
outline: none;
border: solid 1px #ddd;
padding: 10px;
@ -46,3 +42,28 @@ input {
box-shadow: 0 0 10px 1px #27454F;
border: solid 4px #27454F;
}
#today {
margin-left: 50px;
position: absolute;
bottom: 50px;
font-family: "Helvetica", sans-serif;
font-size: 16px;
/*
box-shadow: 0 0 10px 1px #27454F;
background-color: rgba(39, 69, 79, 0.9);
*/
padding: 8px;
display: inline-block;
/*font-weight: bold;**/
line-height: 1.6;
width: 80%;
/*color: lightred;*/
}
.message {
height: 0px;
position: absolute;
border-left: 25px solid rgba(238,238,238, 0.8);
border-bottom: 25px solid #1A1210;
padding-right: 8px;
}