Skip to content

Commit 0b1ff53

Browse files
authored
Update cert.html
1 parent 52a914d commit 0b1ff53

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

web/cert.html

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,13 @@
99
</head>
1010
<body>
1111
<div class="content-area">
12+
<div class="sidebar-container">
1213
<div class="sidebar">
1314
<div onclick="window.location.href = 'index.html';" class="sidebar-item">ProStore Installer</div>
1415
<div onclick="window.location.href = 'cert.html';" class="sidebar-item active">Certificate Manager</div>
1516
<div onclick="window.location.href = 'converter.html';" class="sidebar-item">Certificate Converter</div>
1617
</div>
18+
</div>
1719

1820
<div class="panel">
1921
<h1 class="title">Certificate Manager</h1>
@@ -54,5 +56,46 @@ <h2 id="modalName"></h2>
5456
</div>
5557

5658
<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+
57100
</body>
58101
</html>

0 commit comments

Comments
 (0)