Files
xTeVe/ts/logs.ts
T
nathan 3532679235
continuous-integration/drone/push Build is failing
Phase 5c: CSS layers and light theme
- html/css split into tokens.css (custom properties), base.css (reset,
  typography, focus, skip link), components.css (buttons, inputs, tables,
  status cards, popups, menu, log lines) and layout.css (shell, sidebar,
  header, breakpoints); screen.css removed. Selectors and declarations
  moved as-is; three pairs of conflicting rules resolved in favour of the
  one that already won the cascade, two empty rules dropped.
- Every literal colour outside tokens.css is now a token (category badge
  borders excepted). color-scheme set so native controls follow.
- Light theme under prefers-color-scheme: light, with explicit
  data-theme="light"/"dark" overrides on :root for a future toggle.
  Body text 13.6:1, muted text 5.4:1, accent 5.1:1 on the light background.
- HTML: lang="en" everywhere, one h1 per page, maintenance page uses
  <main>, an id typo fixed.
2026-09-26 13:34:51 +10:00

74 lines
1.3 KiB
TypeScript

class Log {
createLog(entry:string):any {
var element = document.createElement("PRE");
if (entry.indexOf("WARNING") != -1) {
element.className = "warningMsg"
}
if (entry.indexOf("ERROR") != -1) {
element.className = "errorMsg"
}
if (entry.indexOf("DEBUG") != -1) {
element.className = "debugMsg"
}
element.textContent = entry
return element
}
}
function showLogs(bottom:boolean) {
var log = new Log()
var logs = SERVER["log"]["log"]
var div = document.getElementById("content_log")
var wrapper = document.getElementById("box-wrapper") as HTMLElement
var shouldStickToBottom:boolean = bottom
div.innerHTML = ""
if (wrapper != null && shouldStickToBottom == false) {
var distanceToBottom:number = wrapper.scrollHeight - wrapper.scrollTop - wrapper.clientHeight
if (distanceToBottom < 80) {
shouldStickToBottom = true
}
}
var keys = getObjKeys(logs)
keys.forEach(logID => {
var entry = log.createLog(logs[logID])
div.append(entry)
});
setTimeout(function(){
if (shouldStickToBottom == true && wrapper != null) {
wrapper.scrollTop = wrapper.scrollHeight;
}
}, 10);
}
function resetLogs() {
var cmd = "resetLogs"
var data = new Object()
var server:Server = new Server(cmd)
server.request(data)
}