mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-02-26 15:54:35 +08:00
🗑️Replace deprecated functions (#3285) devkennyy
* replace deprecated click() * ⚡️ Replace deprecated `select` calls. * ⚡️ Replace deprecated `mousedown` calls * ⚡️ Replace deprecated `change` calls
This commit is contained in:
parent
0dd2539bf7
commit
186ef70a26
15 changed files with 21 additions and 19 deletions
|
@ -29,7 +29,7 @@ function showInput(
|
|||
$("#commandInput input").attr("command", "");
|
||||
$("#commandInput input").attr("command", command);
|
||||
if (defaultValue != "") {
|
||||
$("#commandInput input").select();
|
||||
$("#commandInput input").trigger("select");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -98,7 +98,7 @@ export async function show(): Promise<void> {
|
|||
},
|
||||
100,
|
||||
() => {
|
||||
$("#apeKeysPopup textarea").trigger("focus").select();
|
||||
$("#apeKeysPopup textarea").trigger("focus").trigger("select");
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
|
@ -74,7 +74,7 @@ export function show(): void {
|
|||
.css("opacity", 0)
|
||||
.removeClass("hidden")
|
||||
.animate({ opacity: 1 }, 100, () => {
|
||||
$("#customTestDurationPopup input").trigger("focus").select();
|
||||
$("#customTestDurationPopup input").trigger("focus").trigger("select");
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ export function show(): void {
|
|||
}, 150);
|
||||
}
|
||||
|
||||
$(`${popup} .delimiterCheck input`).change(() => {
|
||||
$(`${popup} .delimiterCheck input`).on("change", () => {
|
||||
let delimiter;
|
||||
if ($(`${popup} .delimiterCheck input`).prop("checked")) {
|
||||
delimiter = "|";
|
||||
|
@ -84,13 +84,13 @@ export function isVisible(): boolean {
|
|||
return !$(wrapper).hasClass("hidden");
|
||||
}
|
||||
|
||||
$(wrapper).mousedown((e) => {
|
||||
$(wrapper).on("mousedown", (e) => {
|
||||
if ($(e.target).attr("id") === "customTextPopupWrapper") {
|
||||
hide();
|
||||
}
|
||||
});
|
||||
|
||||
$(`${popup} .inputs .checkbox input`).change(() => {
|
||||
$(`${popup} .inputs .checkbox input`).on("change", () => {
|
||||
if ($(`${popup} .checkbox input`).prop("checked")) {
|
||||
$(`${popup} .inputs .randomInputFields`).removeClass("hidden");
|
||||
} else {
|
||||
|
@ -100,7 +100,7 @@ $(`${popup} .inputs .checkbox input`).change(() => {
|
|||
|
||||
$(`${popup} textarea`).on("keypress", (e) => {
|
||||
if (e.code === "Enter" && e.ctrlKey) {
|
||||
$(`${popup} .button.apply`).click();
|
||||
$(`${popup} .button.apply`).trigger("click");
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ export function show(value: string): void {
|
|||
.removeClass("hidden")
|
||||
.animate({ opacity: 1 }, 100, () => {
|
||||
$("#customThemeShare input").trigger("focus");
|
||||
$("#customThemeShare input").select();
|
||||
$("#customThemeShare input").trigger("select");
|
||||
$("#customThemeShare input").trigger("focus");
|
||||
});
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ export function show(): void {
|
|||
.css("opacity", 0)
|
||||
.removeClass("hidden")
|
||||
.animate({ opacity: 1 }, 100, () => {
|
||||
$("#customWordAmountPopup input").trigger("focus").select();
|
||||
$("#customWordAmountPopup input").trigger("focus").trigger("select");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ export function show(credential: UserCredential): void {
|
|||
.css("opacity", 0)
|
||||
.removeClass("hidden")
|
||||
.animate({ opacity: 1 }, 100, () => {
|
||||
$("#googleSignUpPopup input").trigger("focus").select();
|
||||
$("#googleSignUpPopup input").trigger("focus").trigger("select");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ export function show(mode: string, config?: string): void {
|
|||
.removeClass("hidden")
|
||||
.animate({ opacity: 1 }, 100, () => {
|
||||
$("#settingsImportWrapper input").trigger("focus");
|
||||
$("#settingsImportWrapper input").select();
|
||||
$("#settingsImportWrapper input").trigger("select");
|
||||
$("#settingsImportWrapper input").trigger("focus");
|
||||
});
|
||||
}
|
||||
|
|
|
@ -8,7 +8,9 @@ export function show(): void {
|
|||
.css("opacity", 0)
|
||||
.removeClass("hidden")
|
||||
.animate({ opacity: 1 }, 100, () => {
|
||||
$("#newResultFilterPresetPopup input").trigger("focus").select();
|
||||
$("#newResultFilterPresetPopup input")
|
||||
.trigger("focus")
|
||||
.trigger("select");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -58,7 +58,7 @@ export async function show(options = defaultOptions): Promise<void> {
|
|||
.css("opacity", 0)
|
||||
.removeClass("hidden")
|
||||
.animate({ opacity: 1 }, noAnim ? 0 : 100, () => {
|
||||
$("#quoteReportPopup textarea").trigger("focus").select();
|
||||
$("#quoteReportPopup textarea").trigger("focus").trigger("select");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -242,7 +242,7 @@ export async function show(clearText = true): Promise<void> {
|
|||
.removeClass("hidden")
|
||||
.animate({ opacity: 1 }, 100, () => {
|
||||
if (clearText) {
|
||||
$("#quoteSearchPopup input").trigger("focus").select();
|
||||
$("#quoteSearchPopup input").trigger("focus").trigger("select");
|
||||
}
|
||||
updateResults(quoteSearchInputValue);
|
||||
});
|
||||
|
|
|
@ -49,7 +49,7 @@ $(document).on(
|
|||
}
|
||||
);
|
||||
|
||||
$("#savedTextsPopupWrapper").mousedown((e) => {
|
||||
$("#savedTextsPopupWrapper").on("mousedown", (e) => {
|
||||
if ($(e.target).attr("id") === "savedTextsPopupWrapper") {
|
||||
hide();
|
||||
}
|
||||
|
|
|
@ -239,7 +239,7 @@ export function hide(): void {
|
|||
});
|
||||
}
|
||||
|
||||
$("#simplePopupWrapper").mousedown((e) => {
|
||||
$("#simplePopupWrapper").on("mousedown", (e) => {
|
||||
if ($(e.target).attr("id") === "simplePopupWrapper") {
|
||||
if (activePopup) return activePopup.hide();
|
||||
$("#simplePopupWrapper")
|
||||
|
|
|
@ -83,7 +83,7 @@ async function apply(set: boolean): Promise<void> {
|
|||
hide();
|
||||
}
|
||||
|
||||
$("#wordFilterPopupWrapper").mousedown((e) => {
|
||||
$("#wordFilterPopupWrapper").on("mousedown", (e) => {
|
||||
if ($(e.target).attr("id") === "wordFilterPopupWrapper") {
|
||||
hide();
|
||||
}
|
||||
|
@ -93,7 +93,7 @@ $("#wordFilterPopup .languageInput").one("select2:open", function () {
|
|||
$("input.select2-search__field").prop("placeholder", "search");
|
||||
});
|
||||
|
||||
$("#wordFilterPopupWrapper .button").mousedown((e) => {
|
||||
$("#wordFilterPopupWrapper .button").on("mousedown", (e) => {
|
||||
$("#wordFilterPopupWrapper .loadingIndicator").removeClass("hidden");
|
||||
$("#wordFilterPopupWrapper .button").addClass("hidden");
|
||||
setTimeout(() => {
|
||||
|
|
|
@ -151,7 +151,7 @@ $("#practiseWordsPopupWrapper").on("click", (e) => {
|
|||
|
||||
$("#practiseWordsPopup .button").on("keypress", (e) => {
|
||||
if (e.key === "Enter") {
|
||||
$(e.currentTarget).click();
|
||||
$(e.currentTarget).trigger("click");
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in a new issue