|
14 | 14 | statusApiUrl: 'https://status.opennetworked.org/api/status', // Placeholder API |
15 | 15 | animationDuration: 15000, // 15 seconds for marquee |
16 | 16 | checkInterval: 300000, // 5 minutes status check |
17 | | - position: 'top', // 'top' or 'bottom' |
18 | | - insertMode: 'static' // 'static' (top of page) or 'fixed' (floating) |
| 17 | + position: 'bottom' // 'top' or 'bottom' |
19 | 18 | }; |
20 | 19 |
|
21 | 20 | // Global state |
|
160 | 159 | const createBannerStyles = () => { |
161 | 160 | const style = document.createElement('style'); |
162 | 161 | style.id = 'opennetwork-banner-styles'; |
163 | | - |
164 | | - const isStatic = CONFIG.insertMode === 'static'; |
165 | | - |
166 | 162 | style.textContent = ` |
167 | 163 | .opennetwork-banner { |
168 | | - ${isStatic ? 'position: relative; width: 100%;' : `position: fixed; ${CONFIG.position}: 0; left: 0; right: 0;`} |
| 164 | + position: fixed; |
| 165 | + ${CONFIG.position}: 0; |
| 166 | + left: 0; |
| 167 | + right: 0; |
169 | 168 | background: linear-gradient(135deg, #000000ff 0%, #000000ff 100%); |
170 | 169 | color: white; |
171 | 170 | font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif; |
172 | 171 | font-size: 13px; |
173 | 172 | line-height: 1.4; |
174 | | - ${isStatic ? '' : 'z-index: 999999;'} |
175 | | - box-shadow: ${isStatic ? '0 2px 8px rgba(0,0,0,0.1)' : CONFIG.position === 'bottom' ? '0 -2px 12px rgba(0,0,0,0.15)' : '0 2px 12px rgba(0,0,0,0.15)'}; |
176 | | - ${isStatic ? '' : `border-${CONFIG.position === 'bottom' ? 'top' : 'bottom'}: 1px solid rgba(255,255,255,0.1);`} |
| 173 | + z-index: 999999; |
| 174 | + box-shadow: ${CONFIG.position === 'bottom' ? '0 -2px 12px rgba(0,0,0,0.15)' : '0 2px 12px rgba(0,0,0,0.15)'}; |
| 175 | + border-${CONFIG.position === 'bottom' ? 'top' : 'bottom'}: 1px solid rgba(255,255,255,0.1); |
177 | 176 | backdrop-filter: blur(10px); |
178 | 177 | -webkit-backdrop-filter: blur(10px); |
179 | 178 | transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); |
180 | | - padding: 10px 16px; |
181 | | - min-height: 44px; |
| 179 | + padding: 8px 16px; |
| 180 | + min-height: 40px; |
182 | 181 | display: flex; |
183 | 182 | align-items: center; |
184 | | - ${isStatic ? 'margin: 0; border-bottom: 1px solid rgba(255,255,255,0.1);' : ''} |
185 | 183 | } |
186 | 184 | |
187 | 185 | .opennetwork-banner:hover { |
188 | | - background: linear-gradient(135deg, #1a1a1aff 0%, #1a1a1aff 100%); |
189 | | - ${isStatic ? 'box-shadow: 0 4px 12px rgba(0,0,0,0.15);' : `transform: translateY(${CONFIG.position === 'bottom' ? '-1px' : '1px'});`} |
190 | | - } |
191 | | - |
192 | | - ${isStatic ? ` |
193 | | - body.opennetwork-banner-active { |
194 | | - margin-top: 0 !important; |
195 | | - padding-top: 0 !important; |
| 186 | + background: linear-gradient(135deg, #000000ff 0%, #000000ff 100%); |
| 187 | + transform: translateY(${CONFIG.position === 'bottom' ? '-1px' : '1px'}); |
196 | 188 | } |
197 | | - ` : ''} |
198 | 189 | |
199 | 190 | .on-banner-content { |
200 | 191 | display: flex; |
|
215 | 206 | } |
216 | 207 | |
217 | 208 | .on-flag-logo { |
218 | | - width: 22px; |
219 | | - height: 22px; |
| 209 | + width: 20px; |
| 210 | + height: 20px; |
220 | 211 | margin-right: 12px; |
221 | 212 | border-radius: 3px; |
222 | 213 | box-shadow: 0 2px 4px rgba(0,0,0,0.2); |
|
259 | 250 | display: flex; |
260 | 251 | align-items: center; |
261 | 252 | background: rgba(255,255,255,0.1); |
262 | | - padding: 6px 10px; |
| 253 | + padding: 4px 8px; |
263 | 254 | border-radius: 20px; |
264 | 255 | font-size: 12px; |
265 | 256 | font-weight: 500; |
|
298 | 289 | 50% { opacity: 0.7; } |
299 | 290 | } |
300 | 291 | |
301 | | - @keyframes slideInTop { |
302 | | - from { |
303 | | - opacity: 0; |
304 | | - transform: translateY(-100%); |
305 | | - } |
306 | | - to { |
307 | | - opacity: 1; |
308 | | - transform: translateY(0); |
309 | | - } |
310 | | - } |
311 | | - |
312 | | - @keyframes slideInBottom { |
| 292 | + @keyframes slideIn { |
313 | 293 | from { |
314 | 294 | opacity: 0; |
315 | | - transform: translateY(100%); |
| 295 | + transform: translateY(${CONFIG.position === 'bottom' ? '100%' : '-100%'}); |
316 | 296 | } |
317 | 297 | to { |
318 | 298 | opacity: 1; |
|
321 | 301 | } |
322 | 302 | |
323 | 303 | .opennetwork-banner.on-animate-in { |
324 | | - animation: ${isStatic ? 'slideInTop' : CONFIG.position === 'bottom' ? 'slideInBottom' : 'slideInTop'} 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards; |
| 304 | + animation: slideIn 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards; |
325 | 305 | } |
326 | 306 | |
327 | 307 | /* Responsive design */ |
328 | 308 | @media (max-width: 768px) { |
329 | 309 | .opennetwork-banner { |
330 | 310 | font-size: 12px; |
331 | | - padding: 8px 12px; |
332 | | - min-height: 40px; |
| 311 | + padding: 6px 12px; |
| 312 | + min-height: 36px; |
333 | 313 | } |
334 | 314 | |
335 | 315 | .on-flag-logo { |
336 | | - width: 18px; |
337 | | - height: 18px; |
| 316 | + width: 16px; |
| 317 | + height: 16px; |
338 | 318 | margin-right: 8px; |
339 | 319 | } |
340 | 320 | |
341 | 321 | .on-status { |
342 | 322 | font-size: 11px; |
343 | | - padding: 4px 8px; |
| 323 | + padding: 3px 6px; |
344 | 324 | } |
345 | 325 | |
346 | 326 | .on-left-section { |
|
351 | 331 | @media (max-width: 480px) { |
352 | 332 | .opennetwork-banner { |
353 | 333 | font-size: 11px; |
354 | | - padding: 6px 8px; |
355 | | - min-height: 36px; |
| 334 | + padding: 5px 8px; |
356 | 335 | } |
357 | 336 | |
358 | 337 | .on-status-text { |
359 | 338 | display: none; |
360 | 339 | } |
361 | 340 | |
362 | 341 | .on-status { |
363 | | - width: 24px; |
364 | | - height: 24px; |
| 342 | + width: 20px; |
| 343 | + height: 20px; |
365 | 344 | justify-content: center; |
366 | 345 | padding: 0; |
367 | 346 | border-radius: 50%; |
|
392 | 371 | const styles = createBannerStyles(); |
393 | 372 | document.head.appendChild(styles); |
394 | 373 |
|
395 | | - // Insert banner based on mode |
396 | | - if (CONFIG.insertMode === 'static') { |
397 | | - // Insert at the very top of the page |
398 | | - if (document.body.firstChild) { |
399 | | - document.body.insertBefore(banner, document.body.firstChild); |
400 | | - } else { |
401 | | - document.body.appendChild(banner); |
402 | | - } |
403 | | - // Add body class for any additional styling needs |
404 | | - document.body.classList.add('opennetwork-banner-active'); |
405 | | - } else { |
406 | | - // Add as floating banner (original behavior) |
407 | | - document.body.appendChild(banner); |
408 | | - } |
| 374 | + // Add banner to body |
| 375 | + document.body.appendChild(banner); |
409 | 376 |
|
410 | 377 | // Setup event listeners |
411 | 378 | window.addEventListener('resize', checkTextOverflow); |
|
422 | 389 | updateStatusIndicator(newStatus.status, newStatus.message); |
423 | 390 | }, CONFIG.checkInterval); |
424 | 391 |
|
425 | | - console.log('OpenNetwork Banner initialized for:', domain, `(${CONFIG.insertMode} mode)`); |
| 392 | + console.log('OpenNetwork Banner initialized for:', domain); |
426 | 393 | }; |
427 | 394 |
|
428 | 395 | const destroyBanner = () => { |
|
431 | 398 | banner = null; |
432 | 399 | } |
433 | 400 |
|
434 | | - // Remove body class if it was added |
435 | | - document.body.classList.remove('opennetwork-banner-active'); |
436 | | - |
437 | 401 | if (statusCheck) { |
438 | 402 | clearInterval(statusCheck); |
439 | 403 | statusCheck = null; |
|
0 commit comments