changeset 72:bce0480721c1

minor
author Franklin Schmidt <fschmidt@gmail.com>
date Sat, 08 Mar 2025 17:29:57 -0700
parents 2206c20e91d2
children a63faf49e1d7
files src/chat.css src/chat.js src/index.html.luan
diffstat 3 files changed, 8 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/src/chat.css	Thu Mar 06 20:43:54 2025 -0700
+++ b/src/chat.css	Sat Mar 08 17:29:57 2025 -0700
@@ -161,6 +161,10 @@
 	margin-left: 4px;
 }
 
+span[is_online=true] {
+	background-color: green;
+}
+
 span[unread] {
 	font-size: small;
 	display: inline-block;
--- a/src/chat.js	Thu Mar 06 20:43:54 2025 -0700
+++ b/src/chat.js	Sat Mar 08 17:29:57 2025 -0700
@@ -245,19 +245,10 @@
 		if( online[id] < old )
 			delete online[id];
 	}
-	let a = [];
-	for( let id in online ) {
-		a.push( `span[online="${id}"]` );
-	}
-	let style = document.querySelector('style[online]');
-	if( a.length === 0 ) {
-		style.innerHTML = '';
-	} else {
-		style.innerHTML = `
-			${a.join(', ')} {
-				background-color: green;
-			}
-`		;
+	let spans = document.querySelectorAll('span[online]');
+	for( let span of spans ) {
+		let id = span.getAttribute('online');
+		span.setAttribute('is_online',!!online[id]);
 	}
 }
 
--- a/src/index.html.luan	Thu Mar 06 20:43:54 2025 -0700
+++ b/src/index.html.luan	Sat Mar 08 17:29:57 2025 -0700
@@ -33,7 +33,6 @@
 		<style>
 			@import "chat.css?s=<%=started%>";
 		</style>
-		<style online></style>
 		<script src="chat.js?s=<%=started%>"></script>
 	</head>
 	<body>