diff --git a/add.html b/add.html
index 9b991d2..273c84f 100644
--- a/add.html
+++ b/add.html
@@ -553,6 +553,18 @@
const list = raw && Array.isArray(raw.data) ? raw.data : Array.isArray(raw) ? raw : [raw].filter(Boolean);
const servers = list.filter(function(s) { return s && s.server; });
sel.innerHTML = '';
+ // Determine overall select styling based on lowest availability
+ var minAvail = Infinity;
+ servers.forEach(function(s) {
+ var a = parseInt(s['Seats Available'], 10) || 0;
+ if (a < minAvail) minAvail = a;
+ });
+ sel.classList.remove('low-seats', 'no-seats');
+ if (minAvail <= 0) {
+ sel.classList.add('no-seats');
+ } else if (minAvail < 10) {
+ sel.classList.add('low-seats');
+ }
servers.forEach(function(s) {
const server = s.server || '';
const available = parseInt(s['Seats Available'], 10) || 0;
@@ -564,19 +576,14 @@
opt.disabled = true;
opt.style.color = '#ff4444';
opt.style.fontWeight = '600';
- sel.classList.remove('low-seats');
- sel.classList.add('no-seats');
} else if (available < 10) {
opt.textContent = label + ' (available ' + available + ')';
opt.style.color = '#ff9900';
opt.style.fontWeight = '600';
- sel.classList.add('low-seats');
- sel.classList.remove('no-seats');
} else {
opt.textContent = label + ' (available ' + available + ')';
opt.style.color = '';
opt.style.fontWeight = '';
- sel.classList.remove('low-seats', 'no-seats');
}
sel.appendChild(opt);
});
diff --git a/assets/js/script.js b/assets/js/script.js
index 7e6fcc7..02b2054 100644
--- a/assets/js/script.js
+++ b/assets/js/script.js
@@ -656,6 +656,19 @@ async function initServerLocations() {
// Clear existing options
sel.innerHTML = "";
+ // Determine overall select styling based on lowest availability
+ var minAvail = Infinity;
+ servers.forEach(function (s) {
+ var a = parseInt(s["Seats Available"], 10) || 0;
+ if (a < minAvail) minAvail = a;
+ });
+ sel.classList.remove("low-seats", "no-seats");
+ if (minAvail <= 0) {
+ sel.classList.add("no-seats");
+ } else if (minAvail < 10) {
+ sel.classList.add("low-seats");
+ }
+
servers.forEach(function (s) {
const server = s.server || "";
const available = parseInt(s["Seats Available"], 10) || 0;
@@ -669,21 +682,16 @@ async function initServerLocations() {
opt.disabled = true;
opt.style.color = "#ff4444";
opt.style.fontWeight = "600";
- sel.classList.remove("low-seats");
- sel.classList.add("no-seats");
} else if (available < 10) {
// Low seats — orange with count
opt.textContent = label + " (available " + available + ")";
opt.style.color = "#ff9900";
opt.style.fontWeight = "600";
- sel.classList.add("low-seats");
- sel.classList.remove("no-seats");
} else {
// Plenty of seats
opt.textContent = label + " (available " + available + ")";
opt.style.color = "";
opt.style.fontWeight = "";
- sel.classList.remove("low-seats", "no-seats");
}
sel.appendChild(opt);