Skip to content

Commit

Permalink
Bug-fix for announcement bar
Browse files Browse the repository at this point in the history
  • Loading branch information
imlayered committed Oct 30, 2024
1 parent db0ab87 commit 64f4d44
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ <h1><a href="https://layeredy.com"><img src="https://cdn.layeredy.com/uptimematr
</button>
</div>
<div class="copyright">
Status page by <a href="https://uptimematrix.com" target="_blank"><strong>UptimeMatrix</strong>
Status page by <a href="https://uptimematrix.com" target="_blank"><strong>UptimeMatrix</strong> <!-- You can disable this in data.json (but please don't! Support open source projects!) -->
</div>
</div>
<script src="script.js"></script>
Expand Down
9 changes: 4 additions & 5 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ document.addEventListener("DOMContentLoaded", () => {
return response.json();
})
.then((data) => {
if (data.sections.announcementBar)
updateAnnouncementBar(data.announcement);
updateAnnouncementBar(data.sections.announcementBar, data.announcement);
updateOverallStatus(
data.services,
data.RandomOperationalMessage,
Expand Down Expand Up @@ -145,9 +144,9 @@ function displayErrorMessage() {
`;
}

function updateAnnouncementBar(announcement) {
function updateAnnouncementBar(isEnabled, announcement) {
const announcementBar = document.getElementById("announcement-bar");
if (announcement && announcement.text) {
if (isEnabled && announcement && announcement.text) {
announcementBar.textContent = announcement.text;
announcementBar.style.display = "block";
} else {
Expand Down Expand Up @@ -206,7 +205,7 @@ function updateOverallStatus(services, RandomOperationalMessage, data) {
statusText =
successMessages[Math.floor(Math.random() * successMessages.length)];
} else {
statusText = "All systems are operational";
statusText = "All systems operational";
}
statusIcon = "✓";
} else {
Expand Down

0 comments on commit 64f4d44

Please sign in to comment.