|
2424 | 2424 | } |
2425 | 2425 |
|
2426 | 2426 | // Add theme toggle button as floating button |
2427 | | - function addThemeToggleToMainArea() { |
| 2427 | + function addThemeToggleToAuxNav() { |
2428 | 2428 | if (!document.getElementById('main-theme-toggle')) { |
2429 | 2429 | const themeButton = document.createElement('button'); |
2430 | 2430 | themeButton.id = 'main-theme-toggle'; |
|
2434 | 2434 |
|
2435 | 2435 | // Style the button to be clearly visible |
2436 | 2436 | themeButton.style.cssText = ` |
2437 | | - position: fixed !important; |
2438 | 2437 | top: 80px !important; |
2439 | 2438 | right: calc(50% - 440px) !important; |
2440 | | - z-index: 9999 !important; |
2441 | 2439 | background: #6b7280 !important; |
2442 | 2440 | color: white !important; |
2443 | 2441 | border: none !important; |
|
2446 | 2444 | font-size: 16px !important; |
2447 | 2445 | cursor: pointer !important; |
2448 | 2446 | box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3) !important; |
2449 | | - display: flex !important; |
2450 | 2447 | align-items: center !important; |
2451 | 2448 | gap: 8px !important; |
2452 | 2449 | font-weight: 500 !important; |
|
2481 | 2478 | updateMainThemeButton(); |
2482 | 2479 | updateNavigationThemeLink(); |
2483 | 2480 | }); |
2484 | | - |
2485 | | - document.body.appendChild(themeButton); |
| 2481 | + |
| 2482 | + |
| 2483 | + const auxNavList = document.querySelector('.aux-nav-list'); |
| 2484 | + // Creat a list item to wrap teh themeButton with |
| 2485 | + const listItem = document.createElement('li'); |
| 2486 | + listItem.className = 'aux-nav-list-item'; |
| 2487 | + listItem.appendChild(themeButton); |
| 2488 | + // Append to aux navigation |
| 2489 | + auxNavList.appendChild(listItem); |
2486 | 2490 | updateMainThemeButton(); |
2487 | 2491 | } |
2488 | 2492 | } |
|
2506 | 2510 | } |
2507 | 2511 |
|
2508 | 2512 | // Add main theme button after page loads |
2509 | | - setTimeout(addThemeToggleToMainArea, 200); |
| 2513 | + setTimeout(addThemeToggleToAuxNav, 200); |
2510 | 2514 |
|
2511 | 2515 | // Function to update navigation theme link |
2512 | 2516 | function updateNavigationThemeLink() { |
|
0 commit comments