Skip to content

Commit

Permalink
Remove extra alerts on small viewports
Browse files Browse the repository at this point in the history
  • Loading branch information
naiba committed Jan 27, 2024
1 parent bca6581 commit d6d2002
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -132,11 +132,19 @@
ws.onmessage = function (e) {
if (e.data) {
const data = JSON.parse(e.data)
console.log(data);
const styleIndexInner = styleIndex++
if (styleIndex >= styles.length) {
styleIndex = 0
}
const isViewportWidthLessThan1234px = window.innerWidth < 1234
if (isViewportWidthLessThan1234px) {
const alerts = document.querySelectorAll(".sticky-alerts .alert");
if (alerts) {
for (let i = alerts.length - 1; i > 1; i--) {
alerts[i].remove();
}
}
}
halfmoon.initStickyAlert({
content: getWelcome(data),
title: "无聊的沙雕 +1",
Expand Down

0 comments on commit d6d2002

Please sign in to comment.