From 809ef46e1174900e47cf0f1a6cb25eda22bb7718 Mon Sep 17 00:00:00 2001 From: Miodec Date: Sun, 9 Oct 2022 01:30:27 +0200 Subject: [PATCH] removing filter buttons when closign account page readding buttons when opening the account page back --- frontend/src/ts/account/result-filters.ts | 61 +++++++++++++---------- frontend/src/ts/pages/account.ts | 2 + 2 files changed, 38 insertions(+), 25 deletions(-) diff --git a/frontend/src/ts/account/result-filters.ts b/frontend/src/ts/account/result-filters.ts index 4955dab0e..563b8a4f8 100644 --- a/frontend/src/ts/account/result-filters.ts +++ b/frontend/src/ts/account/result-filters.ts @@ -664,34 +664,45 @@ $(".pageAccount .topFilters .button.toggleAdvancedFilters").on("click", () => { ); }); -Misc.getLanguageList().then((languages) => { - languages.forEach((language) => { - $( - ".pageAccount .content .filterButtons .buttonsAndTitle.languages .buttons" - ).append( - `
${language.replace( - "_", - " " - )}
` - ); +export function appendButtons(): void { + Misc.getLanguageList().then((languages) => { + languages.forEach((language) => { + $( + ".pageAccount .content .filterButtons .buttonsAndTitle.languages .buttons" + ).append( + `
${language.replace( + "_", + " " + )}
` + ); + }); }); -}); -$( - ".pageAccount .content .filterButtons .buttonsAndTitle.funbox .buttons" -).append(`
none
`); -Misc.getFunboxList().then((funboxModes) => { - funboxModes.forEach((funbox) => { - $( - ".pageAccount .content .filterButtons .buttonsAndTitle.funbox .buttons" - ).append( - `
${funbox.name.replace( - /_/g, - " " - )}
` - ); + $( + ".pageAccount .content .filterButtons .buttonsAndTitle.funbox .buttons" + ).append(`
none
`); + Misc.getFunboxList().then((funboxModes) => { + funboxModes.forEach((funbox) => { + $( + ".pageAccount .content .filterButtons .buttonsAndTitle.funbox .buttons" + ).append( + `
${funbox.name.replace( + /_/g, + " " + )}
` + ); + }); }); -}); +} + +export function removeButtons(): void { + $( + ".pageAccount .content .filterButtons .buttonsAndTitle.languages .buttons" + ).empty(); + $( + ".pageAccount .content .filterButtons .buttonsAndTitle.funbox .buttons" + ).empty(); +} $(".pageAccount .topFilters .button.createFilterPresetBtn").on("click", () => { startCreateFilterPreset(); diff --git a/frontend/src/ts/pages/account.ts b/frontend/src/ts/pages/account.ts index dd5efc364..b0633ffa1 100644 --- a/frontend/src/ts/pages/account.ts +++ b/frontend/src/ts/pages/account.ts @@ -1136,8 +1136,10 @@ export const page = new Page( }, async () => { reset(); + ResultFilters.removeButtons(); }, async () => { + ResultFilters.appendButtons(); if (DB.getSnapshot().results == undefined) { $(".pageLoading .fill, .pageAccount .fill").css("width", "0%"); $(".pageAccount .content").addClass("hidden");