File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -169,6 +169,21 @@ class UserPreferences {
169169 } ) ;
170170 } ;
171171
172+ /**
173+ * Load and initialise checkbox-states for "watched" episodes.
174+ */
175+ var initWatchedStates = function ( ) {
176+ let watchedEpisodes = prefs . get ( UserPreferences . WATCHED_EPISODES , [ ] ) ;
177+ $ ( '.watchedToggle' ) . map ( function ( ) {
178+ let key = UserPreferences . getEpisodeKey ( this ) ;
179+ if ( watchedEpisodes . includes ( key ) ) {
180+ this . checked = true ;
181+ } else {
182+ this . checked = false ;
183+ }
184+ } ) ;
185+ }
186+
172187 var registerListeners = function ( ) {
173188 $ ( '.watchedToggle' ) . change ( updateWatched ) ;
174189
@@ -228,6 +243,7 @@ class UserPreferences {
228243 width : '100%' ,
229244 } ) ;
230245 registerListeners ( ) ;
246+ initWatchedStates ( ) ;
231247 setWatchedDisplayState ( prefs . get ( UserPreferences . HIDE_WATCHED , true ) ) ;
232248
233249 var colourSetting = Cookies . get ( 'colour' ) ;
You can’t perform that action at this time.
0 commit comments