Skip to content

Commit

Permalink
start and stop all attacks with same button
Browse files Browse the repository at this point in the history
  • Loading branch information
jakeisnt committed Nov 27, 2024
1 parent 4a7548a commit 812ddc8
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 9 deletions.
4 changes: 2 additions & 2 deletions dist/shared.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ export const titleIcons = {
funny: [
{
title: "System32 Deletion Progress",
icon: "favicons/windows.ico",
icon: "favicons/onlyfans.ico",
},
{
title: "Your Boss Behind You!",
icon: "favicons/warning.ico",
icon: "favicons/gmail.ico",
},
],
};
Expand Down
8 changes: 6 additions & 2 deletions dist/web/demo-attacker.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,15 @@ export class DemoAttacker extends TabAttacker {
button.addEventListener("click", () => {
if (this.isCurrentlyAttacking()) {
this.stopAttack();
button.textContent = "Start Attack";
document.querySelectorAll('[id^="toggleAttack-"]').forEach(btn => {
btn.textContent = "Start Attack";
});
}
else {
this.startAttack();
button.textContent = "Stop Attack";
document.querySelectorAll('[id^="toggleAttack-"]').forEach(btn => {
btn.textContent = "Stop Attack";
});
}
});
});
Expand Down
4 changes: 2 additions & 2 deletions src/shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ export const titleIcons: Record<TitleCategory, TitleIcon[]> = {
funny: [
{
title: "System32 Deletion Progress",
icon: "favicons/windows.ico",
icon: "favicons/onlyfans.ico",
},
{
title: "Your Boss Behind You!",
icon: "favicons/warning.ico",
icon: "favicons/gmail.ico",
},
],
};
Expand Down
10 changes: 7 additions & 3 deletions src/web/demo-attacker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,18 @@ export class DemoAttacker extends TabAttacker {
* Sets up event listeners for attack buttons
*/
private setupAttackButtons(): void {
document.querySelectorAll('[id^="toggleAttack-"]').forEach((button) => {
document.querySelectorAll<HTMLElement>('[id^="toggleAttack-"]').forEach((button) => {
button.addEventListener("click", () => {
if (this.isCurrentlyAttacking()) {
this.stopAttack();
button.textContent = "Start Attack";
document.querySelectorAll<HTMLElement>('[id^="toggleAttack-"]').forEach(btn => {
btn.textContent = "Start Attack";
});
} else {
this.startAttack();
button.textContent = "Stop Attack";
document.querySelectorAll<HTMLElement>('[id^="toggleAttack-"]').forEach(btn => {
btn.textContent = "Stop Attack";
});
}
});
});
Expand Down

0 comments on commit 812ddc8

Please sign in to comment.