|
9 | 9 | </head> |
10 | 10 | <body> |
11 | 11 | <div class="content-area"> |
| 12 | + <div class="sidebar-container"> |
12 | 13 | <div class="sidebar"> |
13 | 14 | <div onclick="window.location.href = 'index.html';" class="sidebar-item">ProStore Installer</div> |
14 | 15 | <div onclick="window.location.href = 'cert.html';" class="sidebar-item active">Certificate Manager</div> |
15 | 16 | <div onclick="window.location.href = 'converter.html';" class="sidebar-item">Certificate Converter</div> |
16 | 17 | </div> |
| 18 | + </div> |
17 | 19 |
|
18 | 20 | <div class="panel"> |
19 | 21 | <h1 class="title">Certificate Manager</h1> |
@@ -54,5 +56,46 @@ <h2 id="modalName"></h2> |
54 | 56 | </div> |
55 | 57 |
|
56 | 58 | <script src="certManager.js"></script> |
| 59 | + <script> |
| 60 | + (function() { |
| 61 | + // run only if the elements exist |
| 62 | + const container = document.querySelector('.sidebar-container'); |
| 63 | + const sidebar = container?.querySelector('.sidebar'); |
| 64 | + |
| 65 | + if (!container || !sidebar) return; |
| 66 | + |
| 67 | + // tiny threshold to avoid fractional-pixel issues |
| 68 | + const THRESH = 1; |
| 69 | + |
| 70 | + function updateGradientState() { |
| 71 | + // if no horizontal overflow, mark no-overflow |
| 72 | + if (sidebar.scrollWidth <= sidebar.clientWidth + THRESH) { |
| 73 | + container.classList.add('no-overflow'); |
| 74 | + container.classList.remove('scrolled-end'); |
| 75 | + return; |
| 76 | + } else { |
| 77 | + container.classList.remove('no-overflow'); |
| 78 | + } |
| 79 | + |
| 80 | + // if scrolled to the far right, hide gradient |
| 81 | + if (sidebar.scrollLeft + sidebar.clientWidth >= sidebar.scrollWidth - THRESH) { |
| 82 | + container.classList.add('scrolled-end'); |
| 83 | + } else { |
| 84 | + container.classList.remove('scrolled-end'); |
| 85 | + } |
| 86 | + } |
| 87 | + |
| 88 | + // listen to scroll + resize + orientation changes |
| 89 | + sidebar.addEventListener('scroll', updateGradientState, { passive: true }); |
| 90 | + window.addEventListener('resize', updateGradientState); |
| 91 | + window.addEventListener('orientationchange', updateGradientState); |
| 92 | + |
| 93 | + // run initial check once DOM is ready |
| 94 | + document.addEventListener('DOMContentLoaded', updateGradientState); |
| 95 | + // also run immediately in case script is after DOM |
| 96 | + updateGradientState(); |
| 97 | + })(); |
| 98 | +</script> |
| 99 | + |
57 | 100 | </body> |
58 | 101 | </html> |
0 commit comments