mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2024-09-20 15:26:15 +08:00
updated event handlers
This commit is contained in:
parent
bcde597841
commit
23b3cf1a73
|
@ -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")) {
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -179,7 +179,7 @@ $(document).on("keypress", "#practiseWordsButton", (event) => {
|
|||
}
|
||||
});
|
||||
|
||||
$(document.body).on("click", "#practiseWordsButton", () => {
|
||||
$("#popups").on("click", "#practiseWordsButton", () => {
|
||||
showPopup();
|
||||
});
|
||||
|
||||
|
|
|
@ -315,7 +315,7 @@ $(document).on("keypress", "#watchReplayButton", (event) => {
|
|||
}
|
||||
});
|
||||
|
||||
$(document.body).on("click", "#watchReplayButton", () => {
|
||||
$(".pageTest").on("click", "#watchReplayButton", () => {
|
||||
toggleReplayDisplay();
|
||||
});
|
||||
|
||||
|
|
|
@ -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();
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in a new issue