handle span colour when there are fewer spans than users

This commit is contained in:
Tristan Schneider 2024-01-28 16:49:53 +01:00
parent 69753dac66
commit 82a487d3dd

11
owe.js
View File

@ -31,11 +31,14 @@ function loadSentences(alertIfNew = false, increaseUnread = true) {
// color
var spans = document.querySelector(".sentences").getElementsByTagName("span");
// we expect this to be from the user who's turn it is now
var histurnspan = spans[spans.length - config_data.users.length];
//console.log(histurnspan.getAttribute("style"));
document.getElementById("wordinput").setAttribute("style", histurnspan.getAttribute("style"));
if (spans.length >= config_data.users.length) {
var histurnspan = spans[spans.length - config_data.users.length];
//console.log(histurnspan.getAttribute("style"));
document.getElementById("wordinput").setAttribute("style", histurnspan.getAttribute("style"));
} else {
console.error('Not enough spans available for users.');
}
initializeLoginArea();
});
});