@@ -803,6 +803,23 @@ function refreshPresetsSettingsSection(): void {
803803 }
804804}
805805
806+ export async function updateFilterSectionVisibility ( ) : Promise < void > {
807+ const hasBackgroundUrl =
808+ Config . customBackground !== "" ||
809+ ( await FileStorage . hasFile ( "LocalBackgroundFile" ) ) ;
810+ const isImageVisible = $ ( ".customBackground img" ) . is ( ":visible" ) ;
811+
812+ if ( hasBackgroundUrl && isImageVisible ) {
813+ $ (
814+ ".pageSettings .section[data-config-name='customBackgroundFilter']"
815+ ) . removeClass ( "hidden" ) ;
816+ } else {
817+ $ (
818+ ".pageSettings .section[data-config-name='customBackgroundFilter']"
819+ ) . addClass ( "hidden" ) ;
820+ }
821+ }
822+
806823export async function update (
807824 options : {
808825 eventKey ?: ConfigEvent . ConfigEventKey ;
@@ -832,6 +849,7 @@ export async function update(
832849 ThemePicker . updateActiveTab ( ) ;
833850 ThemePicker . setCustomInputs ( true ) ;
834851 await CustomBackgroundPicker . updateUI ( ) ;
852+ await updateFilterSectionVisibility ( ) ;
835853
836854 const setInputValue = (
837855 key : ConfigKey ,
@@ -887,19 +905,6 @@ export async function update(
887905 ) . addClass ( "hidden" ) ;
888906 }
889907
890- if (
891- Config . customBackground !== "" ||
892- ( await FileStorage . hasFile ( "LocalBackgroundFile" ) )
893- ) {
894- $ (
895- ".pageSettings .section[data-config-name='customBackgroundFilter']"
896- ) . removeClass ( "hidden" ) ;
897- } else {
898- $ (
899- ".pageSettings .section[data-config-name='customBackgroundFilter']"
900- ) . addClass ( "hidden" ) ;
901- }
902-
903908 setInputValue (
904909 "fontSize" ,
905910 ".pageSettings .section[data-config-name='fontSize'] input" ,
@@ -1207,7 +1212,9 @@ ConfigEvent.subscribe((eventKey, eventValue) => {
12071212 //make sure the page doesnt update a billion times when applying a preset/config at once
12081213 if ( configEventDisabled || eventKey === "saveToLocalStorage" ) return ;
12091214 if ( ActivePage . get ( ) === "settings" && eventKey !== "theme" ) {
1210- void update ( { eventKey } ) ;
1215+ void ( eventKey === "customBackground"
1216+ ? updateFilterSectionVisibility ( )
1217+ : update ( { eventKey } ) ) ;
12111218 }
12121219} ) ;
12131220
0 commit comments