48 lines
1.3 KiB
PHP
48 lines
1.3 KiB
PHP
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<link rel="stylesheet" href="<?=url('/static/style/fonts.css')?>">
|
|
</head>
|
|
<body>
|
|
<style>
|
|
div {
|
|
border: 1px solid silver;
|
|
margin-bottom: .5rem;
|
|
padding: .5rem;
|
|
background: rgba(0, 0, 0, 0.75);
|
|
color: white;
|
|
word-break: break-all;
|
|
}
|
|
div > small {
|
|
color: gray;
|
|
}
|
|
div > p {
|
|
margin: 0;
|
|
margin-top: .5rem;
|
|
}
|
|
</style>
|
|
|
|
<?php foreach($messages as $message): ?>
|
|
<div>
|
|
<small><?=gmdate("D M j G:i:s Y", $message['date']);?> <span style="color: yellow"><?=htmlspecialchars($message['nick'])?></span> says:</small>
|
|
<p><?=htmlspecialchars($message['text'])?></p>
|
|
</div>
|
|
<?php endforeach; ?>
|
|
|
|
<script>
|
|
let hash = '';
|
|
setInterval(async () => {
|
|
let new_hash = await fetch('sync').then((response) => response.json());
|
|
if (hash == '') {
|
|
hash = new_hash;
|
|
}
|
|
if (new_hash !== hash) {
|
|
document.location.reload();
|
|
}
|
|
}, 2000);
|
|
</script>
|
|
</body>
|
|
</html>
|