Skip to content

Commit 7ab2da9

Browse files
committed
v2.2 Better 2HG event page handling + status area
1 parent ab9fbc4 commit 7ab2da9

4 files changed

Lines changed: 193 additions & 9 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Playerlist Podder is a Chrome extension that will generate Commander pods for Ma
99

1010
1. Navigate to your event's registration page in EventLink (the page that shows the "Registered Players" and "Companion App Lobby" sections).
1111
2. Register players into the event as you normally would.
12-
3. Once all players are showing up in the "Registered Players" section, click the Playerlist Podder extension icon in your Chrome toolbar to open the side panel.
12+
3. Once all players are showing up in the "Registered Players" or "Standby List" section, click the Playerlist Podder extension icon in your Chrome toolbar to open the side panel.
1313
4. Configure your settings, apply any necessary overrides, and generate your pods!
1414

1515
## Features & Configuration

manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"manifest_version": 3,
33
"name": "Playerlist Podder",
4-
"version": "2.1",
4+
"version": "2.2",
55
"description": "Creates Commander pods for playerlist-only events. Supports separate cEDH pods.",
66
"permissions": [
77
"scripting",

sidepanel.html

Lines changed: 47 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@
77
<style>
88
@font-face {
99
font-family: 'Beleren';
10-
src: url('https://cdn.jsdelivr.net/npm/@regularwave/beleren-bold-woff2/beleren-bold.woff2') format('woff2');
10+
src: url('https://cdn.jsdelivr.net/npm/@regularwave/beleren-bold-woff2@latest/fonts/Beleren-Bold-w2.woff2') format('woff2');
1111
font-weight: bold;
1212
font-style: normal;
13+
font-display: swap;
14+
text-rendering: optimizeLegibility;
1315
}
1416

1517
:root {
@@ -177,7 +179,48 @@
177179
display: flex;
178180
flex-direction: column;
179181
gap: 8px;
180-
margin-top: 8px;
182+
}
183+
184+
#statusContainer {
185+
display: flex;
186+
flex-direction: column;
187+
gap: 8px;
188+
}
189+
190+
.status-alert {
191+
background-color: rgba(239, 68, 68, 0.1);
192+
border: 1px solid #ef4444;
193+
border-radius: var(--radius);
194+
padding: 12px;
195+
display: flex;
196+
flex-direction: column;
197+
gap: 4px;
198+
animation: fadeIn 0.3s ease-in-out;
199+
}
200+
201+
.status-alert strong {
202+
color: #f87171;
203+
font-family: 'Beleren', system-ui, sans-serif;
204+
font-size: 0.95rem;
205+
letter-spacing: 0.5px;
206+
}
207+
208+
.status-alert span {
209+
color: var(--text-secondary);
210+
font-size: 0.85rem;
211+
line-height: 1.4;
212+
}
213+
214+
@keyframes fadeIn {
215+
from {
216+
opacity: 0;
217+
transform: translateY(-5px);
218+
}
219+
220+
to {
221+
opacity: 1;
222+
transform: translateY(0);
223+
}
181224
}
182225

183226
.footer {
@@ -266,6 +309,8 @@
266309
</div>
267310
</div>
268311

312+
<div id="statusContainer"></div>
313+
269314
<div class="action-group">
270315
<div class="row">
271316
<button id="podOvrdButton" class="btn-secondary col">Show Pod & cEDH Overrides</button>

sidepanel.js

Lines changed: 144 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,37 @@
11
document.addEventListener('DOMContentLoaded', function () {
22

3+
// detect page changes
4+
const runEventStateCheck = () => {
5+
chrome.tabs.query({ active: true, currentWindow: true }, (tabs) => {
6+
if (!tabs[0] || !tabs[0].url || !tabs[0].url.includes('eventlink.wizards.com')) {
7+
document.getElementById('statusContainer').style.display = 'none';
8+
lastStateStr = "";
9+
return;
10+
}
11+
12+
chrome.scripting.executeScript({
13+
target: { tabId: tabs[0].id },
14+
func: checkEventState,
15+
}, (results) => {
16+
if (results && results[0] && results[0].result) {
17+
updateStatusArea(results[0].result);
18+
}
19+
});
20+
});
21+
};
22+
23+
// run immediately on load, then check every 1.5 seconds
24+
runEventStateCheck();
25+
setInterval(runEventStateCheck, 1500);
26+
27+
328
document.getElementById("genPodsButton").addEventListener("click", () => {
429
let preferPodOverflow = document.getElementById("prefThrees").checked ? 3 : 5;
530
let maxFourSeats = document.getElementById("maxSeats").valueAsNumber;
631
let reportHeader = document.getElementById("podReportHeader").value;
732

833
chrome.tabs.query({ active: true, currentWindow: true }, (tabs) => {
9-
if (!tabs[0]) return;
34+
if (!tabs[0] || !tabs[0].url || !tabs[0].url.includes('eventlink.wizards.com')) return;
1035
chrome.scripting.executeScript({
1136
target: { tabId: tabs[0].id },
1237
func: genPods,
@@ -17,7 +42,7 @@ document.addEventListener('DOMContentLoaded', function () {
1742

1843
document.getElementById("podOvrdButton").addEventListener("click", () => {
1944
chrome.tabs.query({ active: true, currentWindow: true }, (tabs) => {
20-
if (!tabs[0]) return;
45+
if (!tabs[0] || !tabs[0].url || !tabs[0].url.includes('eventlink.wizards.com')) return;
2146
chrome.scripting.executeScript({
2247
target: { tabId: tabs[0].id },
2348
func: podOvrd,
@@ -27,7 +52,7 @@ document.addEventListener('DOMContentLoaded', function () {
2752

2853
document.getElementById("clearOvrdButton").addEventListener("click", () => {
2954
chrome.tabs.query({ active: true, currentWindow: true }, (tabs) => {
30-
if (!tabs[0]) return;
55+
if (!tabs[0] || !tabs[0].url || !tabs[0].url.includes('eventlink.wizards.com')) return;
3156
chrome.scripting.executeScript({
3257
target: { tabId: tabs[0].id },
3358
func: clearOvrd,
@@ -67,7 +92,120 @@ document.addEventListener('DOMContentLoaded', function () {
6792
prefFives.addEventListener('change', saveSettings);
6893
}, false);
6994

95+
let lastStateStr = "";
96+
97+
// status area
98+
function updateStatusArea(state) {
99+
const stateStr = JSON.stringify(state);
100+
if (stateStr === lastStateStr) return;
101+
lastStateStr = stateStr;
102+
const container = document.getElementById('statusContainer');
103+
let htmlContent = '';
104+
let hasWarning = false;
105+
106+
if (state.lobbyCount > 0) {
107+
hasWarning = true;
108+
htmlContent += `
109+
<div class="status-alert">
110+
<strong>App Lobby Players Detected</strong>
111+
<span>You have ${state.lobbyCount} player(s) still in the Companion App Lobby. Move them to the Standby/Registered list to include them in pods.</span>
112+
</div>
113+
`;
114+
}
115+
116+
if (state.is2HG && state.teamCount > 0) {
117+
hasWarning = true;
118+
htmlContent += `
119+
<div class="status-alert">
120+
<strong>Registered Teams Detected</strong>
121+
<span>You have ${state.teamCount} registered team(s). Playerlist Podder cannot see players in teams - use the EventLink 'Unregister Team' button to move them back to the Standby List.</span>
122+
</div>
123+
`;
124+
}
125+
126+
container.innerHTML = htmlContent;
127+
container.style.display = hasWarning ? 'flex' : 'none';
128+
}
129+
130+
70131
// inject functions
132+
function checkEventState() {
133+
let lobbyCount = 0;
134+
let teamCount = 0;
135+
let is2HG = false;
136+
137+
// detect if this is a 2HG/Team layout
138+
if (document.querySelector('.standby-list') || document.querySelector('.team-registration-body__teams')) {
139+
is2HG = true;
140+
}
141+
142+
// check the Companion Lobby count
143+
const lobbyContainer = document.querySelector('.companion-lobby');
144+
const lobbyAmountEl = document.querySelector('.companion-lobby__amounts strong');
145+
if (lobbyAmountEl) {
146+
lobbyCount = parseInt(lobbyAmountEl.innerText, 10) || 0;
147+
}
148+
149+
// check the Registered Teams count
150+
const teamsContainer = document.querySelector('.registered-team-list');
151+
const teamsAmountEl = document.querySelector('.registered-team-list__header .counts');
152+
153+
if (teamsAmountEl) {
154+
teamCount = parseInt(teamsAmountEl.innerText, 10) || 0;
155+
} else if (document.querySelectorAll('.registered-team').length > 0) {
156+
teamCount = document.querySelectorAll('.registered-team').length;
157+
}
158+
159+
// inject CSS animation if it doesn't exist yet
160+
if (!document.getElementById('playerlist-podder-pulse-css')) {
161+
const style = document.createElement('style');
162+
style.id = 'playerlist-podder-pulse-css';
163+
style.innerHTML = `
164+
@keyframes podderRedPulse {
165+
0% {
166+
box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
167+
background-color: rgba(239, 68, 68, 0.05);
168+
}
169+
50% {
170+
background-color: rgba(239, 68, 68, 0.18);
171+
}
172+
70% {
173+
box-shadow: 0 0 0 10px rgba(239, 68, 68, 0);
174+
}
175+
100% {
176+
box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
177+
background-color: rgba(239, 68, 68, 0.05);
178+
}
179+
}
180+
.podder-warning-pulse {
181+
animation: podderRedPulse 2s ease-in-out infinite !important;
182+
border: 2px solid #ef4444 !important;
183+
border-radius: 6px;
184+
}
185+
`;
186+
document.head.appendChild(style);
187+
}
188+
189+
// pulse the teams container red if teams exist
190+
if (teamsContainer) {
191+
if (teamCount > 0) {
192+
teamsContainer.classList.add('podder-warning-pulse');
193+
} else {
194+
teamsContainer.classList.remove('podder-warning-pulse');
195+
}
196+
}
197+
198+
// pulse the lobby container red if lobby players exist
199+
if (lobbyContainer) {
200+
if (lobbyCount > 0) {
201+
lobbyContainer.classList.add('podder-warning-pulse');
202+
} else {
203+
lobbyContainer.classList.remove('podder-warning-pulse');
204+
}
205+
}
206+
207+
return { lobbyCount, teamCount, is2HG };
208+
}
71209

72210
function clearOvrd() {
73211
const overrideInputs = document.querySelectorAll('.playerlistpodderoverrideinput');
@@ -136,7 +274,6 @@ function podOvrd() {
136274
containerDiv.style.alignItems = "center";
137275
containerDiv.style.justifyContent = "center";
138276
containerDiv.style.gap = "8px";
139-
140277
containerDiv.style.width = "110px";
141278
containerDiv.style.minWidth = "110px";
142279
containerDiv.style.flexShrink = "0";
@@ -309,9 +446,11 @@ function genPods(preferPodOverflow, maxFourSeats, reportHeader) {
309446
<style>
310447
@font-face {
311448
font-family: 'Beleren';
312-
src: url('https://cdn.jsdelivr.net/npm/@regularwave/beleren-bold-woff2/beleren-bold.woff2') format('woff2');
449+
src: url('https://cdn.jsdelivr.net/npm/@regularwave/beleren-bold-woff2@latest/fonts/Beleren-Bold-w2.woff2') format('woff2');
313450
font-weight: bold;
314451
font-style: normal;
452+
font-display: swap;
453+
text-rendering: optimizeLegibility;
315454
}
316455
body {
317456
font-family: system-ui, -apple-system, sans-serif;

0 commit comments

Comments
 (0)