11document . 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
72210function 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