updated event handlers

This commit is contained in:
Miodec 2022-10-16 20:40:02 +02:00
parent bcde597841
commit 23b3cf1a73
5 changed files with 25 additions and 21 deletions

View file

@ -1,11 +1,19 @@
$(document.body).on("click", "#supportMeButton, #supportMeAboutButton", () => {
function show(): void {
$("#supportMeWrapper")
.css("opacity", 0)
.removeClass("hidden")
.animate({ opacity: 1 }, 125);
}
$("#supportMeButton").on("click", () => {
show();
});
$(document.body).on("click", "#supportMeWrapper", () => {
$(".pageAbout").on("click", "#supportMeAboutButton", () => {
show();
});
$("#popups").on("click", "#supportMeWrapper", () => {
$("#supportMeWrapper")
.css("opacity", 1)
.animate({ opacity: 0 }, 125, () => {
@ -13,7 +21,7 @@ $(document.body).on("click", "#supportMeWrapper", () => {
});
});
$(document.body).on("click", "#supportMeWrapper .button.ads", () => {
$("#popups").on("click", "#supportMeWrapper .button.ads", () => {
$("#supportMeWrapper")
.css("opacity", 1)
.animate({ opacity: 0 }, 125, () => {
@ -21,7 +29,7 @@ $(document.body).on("click", "#supportMeWrapper .button.ads", () => {
});
});
$(document.body).on("click", "#supportMeWrapper a.button", () => {
$("#popups").on("click", "#supportMeWrapper a.button", () => {
$("#supportMeWrapper")
.css("opacity", 1)
.animate({ opacity: 0 }, 125, () => {
@ -29,15 +37,11 @@ $(document.body).on("click", "#supportMeWrapper a.button", () => {
});
});
$(document.body).on(
"keypress",
"#supportMeButton, #supportMeAboutButton",
(e) => {
if (e.key === "Enter") {
$(e.currentTarget).trigger("click");
}
$(document).on("keypress", "#supportMeButton, #supportMeAboutButton", (e) => {
if (e.key === "Enter") {
$(e.currentTarget).trigger("click");
}
);
});
$(document).on("keydown", (e) => {
if (e.key === "Escape" && !$("#supportMeWrapper").hasClass("hidden")) {

View file

@ -40,16 +40,16 @@ function hide(): void {
});
}
$(document.body).on("click", "#newVersionIndicator", () => {
$("#bottom").on("click", "#newVersionIndicator", () => {
$("#newVersionIndicator").addClass("hidden");
});
$(document.body).on("click", ".version", (e) => {
$("#bottom").on("click", ".version", (e) => {
if (e.shiftKey) return;
show();
});
$(document.body).on("click", "#versionHistoryWrapper", (e) => {
$("#popups").on("click", "#versionHistoryWrapper", (e) => {
if ($(e.target).attr("id") === "versionHistoryWrapper") {
hide();
}

View file

@ -179,7 +179,7 @@ $(document).on("keypress", "#practiseWordsButton", (event) => {
}
});
$(document.body).on("click", "#practiseWordsButton", () => {
$("#popups").on("click", "#practiseWordsButton", () => {
showPopup();
});

View file

@ -315,7 +315,7 @@ $(document).on("keypress", "#watchReplayButton", (event) => {
}
});
$(document.body).on("click", "#watchReplayButton", () => {
$(".pageTest").on("click", "#watchReplayButton", () => {
toggleReplayDisplay();
});

View file

@ -969,7 +969,7 @@ export function highlightBadWord(index: number, showError: boolean): void {
$($("#words .word")[index]).addClass("error");
}
$(document.body).on("click", "#saveScreenshotButton", () => {
$(".pageTest").on("click", "#saveScreenshotButton", () => {
screenshot();
});
@ -1000,7 +1000,7 @@ $(".pageTest #toggleBurstHeatmap").on("click", async () => {
UpdateConfig.setBurstHeatmap(!Config.burstHeatmap);
});
$(document).on("mouseleave", "#resultWordsHistory .words .word", () => {
$(".pageTest").on("mouseleave", "#resultWordsHistory .words .word", () => {
$(".wordInputAfter").remove();
});
@ -1008,7 +1008,7 @@ $("#wpmChart").on("mouseleave", () => {
$(".wordInputAfter").remove();
});
$(document).on("mouseenter", "#resultWordsHistory .words .word", (e) => {
$(".pageTest").on("mouseenter", "#resultWordsHistory .words .word", (e) => {
if (resultVisible) {
const input = $(e.currentTarget).attr("input");
const burst = parseInt(<string>$(e.currentTarget).attr("burst"));
@ -1053,7 +1053,7 @@ $(document).on("keypress", "#showWordHistoryButton", (event) => {
}
});
$(document.body).on("click", "#showWordHistoryButton", () => {
$(".pageTest").on("click", "#showWordHistoryButton", () => {
toggleResultWords();
});