updated event handlers

This commit is contained in:
Miodec 2022-10-16 18:39:12 +02:00
parent fe7d9d5fb0
commit 76db73427f

View file

@ -789,9 +789,9 @@ function toggleSettingsGroup(groupName: string): void {
}
}
$(document).on(
$(".pageSettings .section.paceCaret").on(
"focusout",
".pageSettings .section.paceCaret input.customPaceCaretSpeed",
"input.customPaceCaretSpeed",
() => {
UpdateConfig.setPaceCaretCustomSpeed(
parseInt(
@ -803,7 +803,7 @@ $(document).on(
}
);
$(document).on("click", ".pageSettings .section.paceCaret .button.save", () => {
$(".pageSettings .section.paceCaret").on("click", ".button.save", () => {
UpdateConfig.setPaceCaretCustomSpeed(
parseInt(
$(
@ -813,9 +813,9 @@ $(document).on("click", ".pageSettings .section.paceCaret .button.save", () => {
);
});
$(document).on(
$(".pageSettings .section.minWpm").on(
"focusout",
".pageSettings .section.minWpm input.customMinWpmSpeed",
"input.customMinWpmSpeed",
() => {
UpdateConfig.setMinWpmCustomSpeed(
parseInt(
@ -827,7 +827,7 @@ $(document).on(
}
);
$(document).on("click", ".pageSettings .section.minWpm .button.save", () => {
$(".pageSettings .section.minWpm").on("click", ".button.save", () => {
UpdateConfig.setMinWpmCustomSpeed(
parseInt(
$(".pageSettings .section.minWpm input.customMinWpmSpeed").val() as string
@ -835,19 +835,7 @@ $(document).on("click", ".pageSettings .section.minWpm .button.save", () => {
);
});
$(document).on(
"focusout",
".pageSettings .section.minAcc input.customMinAcc",
() => {
UpdateConfig.setMinAccCustom(
parseInt(
$(".pageSettings .section.minAcc input.customMinAcc").val() as string
)
);
}
);
$(document).on("click", ".pageSettings .section.minAcc .button.save", () => {
$(".pageSettings .section.minAcc").on("focusout", "input.customMinAcc", () => {
UpdateConfig.setMinAccCustom(
parseInt(
$(".pageSettings .section.minAcc input.customMinAcc").val() as string
@ -855,9 +843,17 @@ $(document).on("click", ".pageSettings .section.minAcc .button.save", () => {
);
});
$(document).on(
$(".pageSettings .section.minAcc").on("click", ".button.save", () => {
UpdateConfig.setMinAccCustom(
parseInt(
$(".pageSettings .section.minAcc input.customMinAcc").val() as string
)
);
});
$(".pageSettings .section.minBurst").on(
"focusout",
".pageSettings .section.minBurst input.customMinBurst",
"input.customMinBurst",
() => {
UpdateConfig.setMinBurstCustomSpeed(
parseInt(
@ -869,7 +865,7 @@ $(document).on(
}
);
$(document).on("click", ".pageSettings .section.minBurst .button.save", () => {
$(".pageSettings .section.minBurst").on("click", ".button.save", () => {
UpdateConfig.setMinBurstCustomSpeed(
parseInt(
$(".pageSettings .section.minBurst input.customMinBurst").val() as string
@ -877,19 +873,8 @@ $(document).on("click", ".pageSettings .section.minBurst .button.save", () => {
);
});
// Commented because started using combo-box for choosing languages instead of grouped buttons
// languages
// $(document).on(
// "click",
// ".pageSettings .section.languageGroups .button",
// (e) => {
// const group = $(e.currentTarget).attr("group");
// LanguagePicker.setActiveGroup(group, true);
// }
// );
//funbox
$(document).on("click", ".pageSettings .section.funbox .button", (e) => {
$(".pageSettings .section.funbox").on("click", ".button", (e) => {
const funbox = <string>$(e.currentTarget).attr("funbox");
const type = <MonkeyTypes.FunboxObjectType>$(e.currentTarget).attr("type");
Funbox.setFunbox(funbox, type);
@ -897,9 +882,9 @@ $(document).on("click", ".pageSettings .section.funbox .button", (e) => {
});
//tags
$(document).on(
$(".pageSettings .section.tags").on(
"click",
".pageSettings .section.tags .tagsList .tag .tagButton",
".tagsList .tag .tagButton",
(e) => {
const target = e.currentTarget;
const tagid = $(target).parent(".tag").attr("id") as string;
@ -908,9 +893,9 @@ $(document).on(
}
);
$(document).on(
$(".pageSettings .section.presets").on(
"click",
".pageSettings .section.presets .presetsList .preset .presetButton",
".presetsList .preset .presetButton",
(e) => {
const target = e.currentTarget;
const presetid = $(target).parent(".preset").attr("id") as string;
@ -1039,9 +1024,9 @@ $(".pageSettings .section.updateCookiePreferences .button").on("click", () => {
CookiePopup.showSettings();
});
$(document).on(
$(".pageSettings .section.autoSwitchThemeInputs").on(
"change",
`.pageSettings .section.autoSwitchThemeInputs select.light`,
`select.light`,
(e) => {
const target = $(e.currentTarget);
if (target.hasClass("disabled") || target.hasClass("no-auto-handle")) {
@ -1051,9 +1036,9 @@ $(document).on(
}
);
$(document).on(
$(".pageSettings .section.autoSwitchThemeInputs").on(
"change",
`.pageSettings .section.autoSwitchThemeInputs select.dark`,
`select.dark`,
(e) => {
const target = $(e.currentTarget);
if (target.hasClass("disabled") || target.hasClass("no-auto-handle")) {