|
145 | 145 | .button{ |
146 | 146 | z-index:99; |
147 | 147 | } |
| 148 | + .top-right-button { |
| 149 | + position: absolute; |
| 150 | + top: 20px; |
| 151 | + right: 20px; |
| 152 | + background-color: #007bff; |
| 153 | + color: white; |
| 154 | + border: none; |
| 155 | + padding: 12px 20px; |
| 156 | + font-size: 16px; |
| 157 | + border-radius: 5px; |
| 158 | + cursor: pointer; |
| 159 | + z-index: 100; |
| 160 | + transition: background-color 0.3s ease-in-out; |
| 161 | +} |
| 162 | + |
| 163 | +.top-right-button:hover { |
| 164 | + background-color: #0056b3; |
| 165 | +} |
| 166 | + |
148 | 167 | </style> |
149 | 168 | </head> |
150 | 169 | <!-- <body class="occupied-glow"> --> |
|
160 | 179 | </div> |
161 | 180 | </div> |
162 | 181 |
|
163 | | - |
| 182 | + <button id="flush" class="top-right-button">Flush Queue</button> |
164 | 183 |
|
165 | 184 | <div class="map-container"> |
166 | 185 | <img src="https://i.ibb.co/tMQ1mTy6/map.png" alt="Map"> |
|
181 | 200 |
|
182 | 201 | // Constants |
183 | 202 | const REFRESH_INTERVAL = 60000; // 1 minute refresh interval |
184 | | -const teacherName = "jmort1021@gmail.com"; |
185 | 203 | let teacherEmail = localStorage.getItem('teacherEmail') || teacherName; |
| 204 | +const teacherName = teacherEmail; |
| 205 | + |
186 | 206 | const tinkleURL = javaURI + '/api/tinkle/add'; |
187 | 207 | const deleteOptions = { ...fetchOptions2, method: 'POST' }; |
188 | 208 |
|
|
192 | 212 | return storedUsers ? JSON.parse(storedUsers) : {}; |
193 | 213 | } |
194 | 214 |
|
| 215 | +// Flush Queue |
| 216 | +document.getElementById('flush').addEventListener('click', async function() { |
| 217 | + const currentAway = document.getElementById('current-away').textContent.trim(); |
| 218 | + |
| 219 | + if (currentAway !== 'Nobody') { |
| 220 | + // Remove current user from queue |
| 221 | + await removeFromQueue(); |
| 222 | + removeUser(currentAway); |
| 223 | + document.getElementById('current-away').innerHTML = 'Nobody'; |
| 224 | + checkStatusAndUpdateUI(); |
| 225 | + } else { |
| 226 | + // Remove next person from queue |
| 227 | + await removeFromQueue(); |
| 228 | + } |
| 229 | +}); |
| 230 | + |
195 | 231 | // Save users to localStorage |
196 | 232 | function saveUsers() { |
197 | 233 | localStorage.setItem('users', JSON.stringify(users)); |
|
0 commit comments