From 186ef70a2620f7e317f5d68a3c212b9bbe30daab Mon Sep 17 00:00:00 2001 From: smunky <105208736+devkennyy@users.noreply.github.com> Date: Mon, 4 Jul 2022 01:37:45 +1000 Subject: [PATCH] =?UTF-8?q?=F0=9F=97=91=EF=B8=8FReplace=20deprecated=20fun?= =?UTF-8?q?ctions=20(#3285)=20devkennyy?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * replace deprecated click() * ⚡️ Replace deprecated `select` calls. * ⚡️ Replace deprecated `mousedown` calls * ⚡️ Replace deprecated `change` calls --- frontend/src/ts/elements/commandline.ts | 2 +- frontend/src/ts/popups/ape-keys-popup.ts | 2 +- frontend/src/ts/popups/custom-test-duration-popup.ts | 2 +- frontend/src/ts/popups/custom-text-popup.ts | 8 ++++---- frontend/src/ts/popups/custom-theme-popup.ts | 2 +- frontend/src/ts/popups/custom-word-amount-popup.ts | 2 +- frontend/src/ts/popups/google-sign-up-popup.ts | 2 +- frontend/src/ts/popups/import-export-settings-popup.ts | 2 +- frontend/src/ts/popups/new-result-filter-preset-popup.ts | 4 +++- frontend/src/ts/popups/quote-report-popup.ts | 2 +- frontend/src/ts/popups/quote-search-popup.ts | 2 +- frontend/src/ts/popups/saved-texts-popup.ts | 2 +- frontend/src/ts/popups/simple-popups.ts | 2 +- frontend/src/ts/popups/word-filter-popup.ts | 4 ++-- frontend/src/ts/test/practise-words.ts | 2 +- 15 files changed, 21 insertions(+), 19 deletions(-) diff --git a/frontend/src/ts/elements/commandline.ts b/frontend/src/ts/elements/commandline.ts index 634375ea8..5a1cf4921 100644 --- a/frontend/src/ts/elements/commandline.ts +++ b/frontend/src/ts/elements/commandline.ts @@ -29,7 +29,7 @@ function showInput( $("#commandInput input").attr("command", ""); $("#commandInput input").attr("command", command); if (defaultValue != "") { - $("#commandInput input").select(); + $("#commandInput input").trigger("select"); } } diff --git a/frontend/src/ts/popups/ape-keys-popup.ts b/frontend/src/ts/popups/ape-keys-popup.ts index 8290d55d8..93fb2f8bb 100644 --- a/frontend/src/ts/popups/ape-keys-popup.ts +++ b/frontend/src/ts/popups/ape-keys-popup.ts @@ -98,7 +98,7 @@ export async function show(): Promise { }, 100, () => { - $("#apeKeysPopup textarea").trigger("focus").select(); + $("#apeKeysPopup textarea").trigger("focus").trigger("select"); } ); } diff --git a/frontend/src/ts/popups/custom-test-duration-popup.ts b/frontend/src/ts/popups/custom-test-duration-popup.ts index 4620c7c30..ccf0e15b1 100644 --- a/frontend/src/ts/popups/custom-test-duration-popup.ts +++ b/frontend/src/ts/popups/custom-test-duration-popup.ts @@ -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"); }); } diff --git a/frontend/src/ts/popups/custom-text-popup.ts b/frontend/src/ts/popups/custom-text-popup.ts index 5ebba53a5..88e2b8457 100644 --- a/frontend/src/ts/popups/custom-text-popup.ts +++ b/frontend/src/ts/popups/custom-text-popup.ts @@ -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"); } }); diff --git a/frontend/src/ts/popups/custom-theme-popup.ts b/frontend/src/ts/popups/custom-theme-popup.ts index fdd849664..de89f7d60 100644 --- a/frontend/src/ts/popups/custom-theme-popup.ts +++ b/frontend/src/ts/popups/custom-theme-popup.ts @@ -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"); }); } diff --git a/frontend/src/ts/popups/custom-word-amount-popup.ts b/frontend/src/ts/popups/custom-word-amount-popup.ts index 615315a7b..4b2c440ca 100644 --- a/frontend/src/ts/popups/custom-word-amount-popup.ts +++ b/frontend/src/ts/popups/custom-word-amount-popup.ts @@ -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"); }); } } diff --git a/frontend/src/ts/popups/google-sign-up-popup.ts b/frontend/src/ts/popups/google-sign-up-popup.ts index c22c26e05..daeba4452 100644 --- a/frontend/src/ts/popups/google-sign-up-popup.ts +++ b/frontend/src/ts/popups/google-sign-up-popup.ts @@ -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"); }); } } diff --git a/frontend/src/ts/popups/import-export-settings-popup.ts b/frontend/src/ts/popups/import-export-settings-popup.ts index 15a2f2f13..8ccae0772 100644 --- a/frontend/src/ts/popups/import-export-settings-popup.ts +++ b/frontend/src/ts/popups/import-export-settings-popup.ts @@ -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"); }); } diff --git a/frontend/src/ts/popups/new-result-filter-preset-popup.ts b/frontend/src/ts/popups/new-result-filter-preset-popup.ts index ec543de28..41fa5d530 100644 --- a/frontend/src/ts/popups/new-result-filter-preset-popup.ts +++ b/frontend/src/ts/popups/new-result-filter-preset-popup.ts @@ -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"); }); } } diff --git a/frontend/src/ts/popups/quote-report-popup.ts b/frontend/src/ts/popups/quote-report-popup.ts index c357787db..f9fcd1485 100644 --- a/frontend/src/ts/popups/quote-report-popup.ts +++ b/frontend/src/ts/popups/quote-report-popup.ts @@ -58,7 +58,7 @@ export async function show(options = defaultOptions): Promise { .css("opacity", 0) .removeClass("hidden") .animate({ opacity: 1 }, noAnim ? 0 : 100, () => { - $("#quoteReportPopup textarea").trigger("focus").select(); + $("#quoteReportPopup textarea").trigger("focus").trigger("select"); }); } } diff --git a/frontend/src/ts/popups/quote-search-popup.ts b/frontend/src/ts/popups/quote-search-popup.ts index e869adb7f..2f9f7d6c3 100644 --- a/frontend/src/ts/popups/quote-search-popup.ts +++ b/frontend/src/ts/popups/quote-search-popup.ts @@ -242,7 +242,7 @@ export async function show(clearText = true): Promise { .removeClass("hidden") .animate({ opacity: 1 }, 100, () => { if (clearText) { - $("#quoteSearchPopup input").trigger("focus").select(); + $("#quoteSearchPopup input").trigger("focus").trigger("select"); } updateResults(quoteSearchInputValue); }); diff --git a/frontend/src/ts/popups/saved-texts-popup.ts b/frontend/src/ts/popups/saved-texts-popup.ts index b53715f67..e0de06586 100644 --- a/frontend/src/ts/popups/saved-texts-popup.ts +++ b/frontend/src/ts/popups/saved-texts-popup.ts @@ -49,7 +49,7 @@ $(document).on( } ); -$("#savedTextsPopupWrapper").mousedown((e) => { +$("#savedTextsPopupWrapper").on("mousedown", (e) => { if ($(e.target).attr("id") === "savedTextsPopupWrapper") { hide(); } diff --git a/frontend/src/ts/popups/simple-popups.ts b/frontend/src/ts/popups/simple-popups.ts index 492000ef4..078a039dd 100644 --- a/frontend/src/ts/popups/simple-popups.ts +++ b/frontend/src/ts/popups/simple-popups.ts @@ -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") diff --git a/frontend/src/ts/popups/word-filter-popup.ts b/frontend/src/ts/popups/word-filter-popup.ts index 43e8c58a8..0ae821034 100644 --- a/frontend/src/ts/popups/word-filter-popup.ts +++ b/frontend/src/ts/popups/word-filter-popup.ts @@ -83,7 +83,7 @@ async function apply(set: boolean): Promise { 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(() => { diff --git a/frontend/src/ts/test/practise-words.ts b/frontend/src/ts/test/practise-words.ts index 4b190dc8e..d5bf62709 100644 --- a/frontend/src/ts/test/practise-words.ts +++ b/frontend/src/ts/test/practise-words.ts @@ -151,7 +151,7 @@ $("#practiseWordsPopupWrapper").on("click", (e) => { $("#practiseWordsPopup .button").on("keypress", (e) => { if (e.key === "Enter") { - $(e.currentTarget).click(); + $(e.currentTarget).trigger("click"); } });