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");