Improved page template

This commit is contained in:
rxi 2014-04-10 12:33:18 +01:00
parent 82d2afc1f4
commit b1f6294222

View File

@ -37,21 +37,71 @@ end
local pagetemplate = [[ local pagetemplate = [[
<!doctype html>
<html> <html>
<head> <head>
<meta http-equiv="x-ua-compatible" content="IE=Edge"/>
<title>lovebird</title> <title>lovebird</title>
<style> <style>
#input { width: 600px } body {
#output { width: 600px; height: 400px; overflow-y: scroll } margin: 0px;
font-family: helvetica, verdana, sans;
background: #FFFFFF;
}
form {
margin-bottom: 0px;
}
#header {
background: #101010;
height: 25px;
color:#F0F0F0;
padding: 8px
}
#title {
float: left;
font-size: 20px;
}
#status {
float: right;
font-size: 14px;
padding-top: 4px;
}
#content {
position: absolute;
margin: 12px;
top: 40px; bottom: 0px; left: 0px; right: 0px;
background: #F0F0F0;
border: 1px solid #E0E0E0;
}
#input {
position: absolute;
margin: 10px;
bottom: 0px; left: 0px; right: 0px;
}
#inputbox {
width: 100%;
}
#output {
overflow-y: scroll;
position: absolute;
margin: 10px;
top: 0px; bottom: 36px; left: 0px; right: 0px;
}
</style> </style>
</head> </head>
<body> <body>
<div id="output"> <div id="header">
<?lua echo(lovebird.buffer) ?> <div id="title">lovebird</div>
<div id="status">connected</div>
</div> </div>
<div id="content">
<div id="output"> <?lua echo(lovebird.buffer) ?> </div>
<div id="input">
<form method="post"> <form method="post">
<input id="input" name="input" type="text" autofocus></input> <input id="inputbox" name="input" type="text" autofocus></input>
</form> </form>
</div>
</div>
<script> <script>
/* Scroll output to bottom */ /* Scroll output to bottom */
var scrolloutput = function() { var scrolloutput = function() {
@ -72,6 +122,7 @@ local pagetemplate = [[
} }
req.open("GET", "/buffer", true); req.open("GET", "/buffer", true);
req.send(); req.send();
console.log(req);
} }
setInterval(refresh, <?lua echo(lovebird.refreshrate) ?> * 1000); setInterval(refresh, <?lua echo(lovebird.refreshrate) ?> * 1000);
</script> </script>