text-align: center;
font-size: 7pt;
color: #818789;
- padding-top: 50px;
+ padding-top: 2em;
}
.key {
font-weight: bold;
color: #313739;
}
+ form {
+ text-align: center;
+ }
+ input {
+ font-size: 18pt;
+ font-weight: bold;
+ }
</style>
</head>
<body>
<!-- TODO:
- live display
- - localstorage
- show red lines for reboots -->
<h1 id="title"></h1>
<div id="diventry"><table id="tableentry"></table></div>
<form>
- <input id="head" type="button" value="|<" onclick="entriesLoadHead();"/>
- <input id="previous" type="button" value="<<" onclick="entriesLoadPrevious();"/>
- <input id="next" type="button" value=">>" onclick="entriesLoadNext();"/>
- <input id="tail" type="button" value=">|" onclick="entriesLoadTail();"/>
+ <input id="head" type="button" value="⇤" onclick="entriesLoadHead();" title="First Page"/>
+ <input id="previous" type="button" value="←" onclick="entriesLoadPrevious();" title="Previous Page"/>
+ <input id="next" type="button" value="→" onclick="entriesLoadNext();" title="Next Page"/>
+ <input id="tail" type="button" value="⇥" onclick="entriesLoadTail();" title="Last Page"/>
- <input id="more" type="button" value="More" onclick="entriesMore();"/>
- <input id="less" type="button" value="Less" onclick="entriesLess();"/>
+ <input id="more" type="button" value="+" onclick="entriesMore();" title="More Entries"/>
+ <input id="less" type="button" value="-" onclick="entriesLess();" title="Fewer Entries"/>
</form>
<div id="keynav">
- <span class="key">→, j, SPACE</span>: Next Page
- <span class="key">←, k, BACKSPACE</span>: Previous Page
<span class="key">g</span>: First Page
+ <span class="key">←, k, BACKSPACE</span>: Previous Page
+ <span class="key">→, j, SPACE</span>: Next Page
<span class="key">G</span>: Last Page
<span class="key">+</span>: More entries
<span class="key">-</span>: Fewer entries
var first_cursor = null;
var last_cursor = null;
- function setCookie(name, value, msec) {
- var d = new Date();
- d.setMilliseconds(d.getMilliseconds() + msec);
- var v = escape(value) + "; expires=" + d.toUTCString();
- document.cookie = name + "=" + value;
- }
-
- function getCookie(name) {
- var i, l;
- l = document.cookie.split(";");
- for (i in l) {
- var x, y, j;
- j = l[i].indexOf("=");
- x = l[i].substr(0, j);
- y = l[i].substr(j+1);
- if (x == name)
- return unescape(y);
- }
- return null;
- }
-
function getNEntries() {
var n;
- n = getCookie("n_entries");
+ n = window.localStorage["n_entries"];
if (n == null)
return 50;
- return parseInt(n);
+ n = parseInt(n);
+ if (n < 10)
+ return 10;
+ if (n > 1000)
+ return 1000;
+ return n;
}
function showNEntries(n) {
function setNEntries(n) {
if (n < 10)
- n = 10;
- else if (n > 1000)
- n = 1000;
-
- setCookie("n_entries", n.toString(), 30*24*60*60*1000);
+ return 10;
+ if (n > 1000)
+ return 1000;
+ window.localStorage["n_entries"] = n.toString();
showNEntries(n);
}
}
function entriesLoad(range) {
+
+ if (range == null)
+ range = window.localStorage["cursor"] + ":0";
+ if (range == null)
+ range = "";
+
var request = new XMLHttpRequest();
request.open("GET", "/entries");
request.onreadystatechange = entriesOnResult;
else if (d.SYSLOG_PID != undefined)
buf += "[" + escapeHTML(d.SYSLOG_PID) + "]";
- buf += '</td><td class="' + clazz + '"><a href="#entry" onclick="onMessageClick(\'' + lc + '\');">';
+ buf += '</td><td class="' + clazz + '"><a href="#entry" onclick="onMessageClick(\'' + d.__CURSOR + '\');">';
if (d.MESSAGE == null)
buf += "[blob data]";
logs.innerHTML = '<tbody>' + buf + '</tbody>';
- if (fc != null)
+ if (fc != null) {
first_cursor = fc;
+ window.localStorage["cursor"] = fc;
+ }
if (lc != null)
last_cursor = lc;
}
}
}
+ function onMouseWheel(event) {
+ if (event.detail < 0 || event.wheelDelta > 0)
+ entriesLoadPrevious();
+ else
+ entriesLoadNext();
+ }
+
machineLoad();
- entriesLoad("");
+ entriesLoad(null);
showNEntries(getNEntries());
document.onkeyup = onKeyUp;
+
+ logs = document.getElementById("divlogs");
+ logs.addEventListener("mousewheel", onMouseWheel, false);
+ logs.addEventListener("DOMMouseScroll", onMouseWheel, false);
</script>
</body>
</html>