Skip to content

Commit

Permalink
fix: prevent jitterclicking causing invalid results
Browse files Browse the repository at this point in the history
  • Loading branch information
JasonGrace2282 authored and alanzhu0 committed Oct 6, 2024
1 parent f217ea9 commit 5fa219a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion intranet/static/js/dashboard/announcements.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,11 @@ function announcementToggle() {
announcement.remove();
const numAnnouncementsSpan = $(".num-club-announcements");
const numAnnouncements = numAnnouncementsSpan.text().match(/\d+/);
numAnnouncementsSpan.text(numAnnouncements - 1);
// 15 is the cap, and prevent clicking on the button too fast
if(numAnnouncements != 15 && !announcement.hasClass("announcement-read")) {
numAnnouncementsSpan.text(numAnnouncements - 1);
announcement.addClass("announcement-read");
}
$(".club-announcements:has(.club-announcements-content:not(:has(.announcement)))").slideUp(350);
}, 450);
} else {
Expand Down

0 comments on commit 5fa219a

Please sign in to comment.