@@ -255,8 +255,8 @@ async function readFilesIndexPage(path, mainPath, fromGoBack, notAutomaticBrowsi
255255
256256 // Get comic reading progress image
257257 let _readingProgress = storage . get ( 'readingProgress' ) ;
258- let readingProgress = _readingProgress [ mainPath ] || false ;
259- let readingProgressCurrentPath = ( mainPath != path ) ? ( _readingProgress [ path ] || false ) : false ;
258+ let readingProgress = _readingProgress [ mainPath ] ?. path ? _readingProgress [ mainPath ] : false ;
259+ let readingProgressCurrentPath = ( mainPath != path ) ? ( _readingProgress [ path ] ?. path ? _readingProgress [ path ] : false ) : false ;
260260
261261 // const isCompressed = fileManager.isCompressed(fileManager.firstCompressedFile(path));
262262 const isCompressed = fileManager . isCompressed ( path ) ;
@@ -327,6 +327,11 @@ async function readFilesIndexPage(path, mainPath, fromGoBack, notAutomaticBrowsi
327327 {
328328 let first ;
329329
330+ if ( file . files )
331+ file . files = fileManager . sort ( file . files , { extraKey : 'Reading' } ) ;
332+
333+ file . updateConfig ( { sort : { extraKey : 'Reading' } } ) ;
334+
330335 try
331336 {
332337 first = await file . images ( 1 ) ;
@@ -372,8 +377,8 @@ async function loadFilesIndexPage(files, file, animation, path, keepScroll, main
372377 // Get comic reading progress image
373378 let _readingProgress = storage . get ( 'readingProgress' ) ;
374379
375- let readingProgress = _readingProgress [ mainPath ] || false ;
376- let readingProgressCurrentPath = ( mainPath != path ) ? ( _readingProgress [ path ] || false ) : false ;
380+ let readingProgress = _readingProgress [ mainPath ] ?. path ? _readingProgress [ mainPath ] : false ;
381+ let readingProgressCurrentPath = ( mainPath != path ) ? ( _readingProgress [ path ] ?. path ? _readingProgress [ path ] : false ) : false ;
377382
378383 if ( files )
379384 {
@@ -2033,6 +2038,8 @@ function setCurrentPageVars(page, _indexLabel = false)
20332038 extraKey = 'RecentlyOpened' ;
20342039 else if ( page == 'index' )
20352040 extraKey = 'Index' ;
2041+ else if ( page == 'reading' )
2042+ extraKey = 'Reading' ;
20362043
20372044 const sortAndViewOpds = config . sortAndView . opds || defaultSortAndView ;
20382045
@@ -2044,7 +2051,7 @@ function setCurrentPageVars(page, _indexLabel = false)
20442051 view : sortAndView ? sortAndView . view : config [ 'view' + extraKey ] ,
20452052 sort : sortAndView ? sortAndView . sort : config [ 'sort' + extraKey ] ,
20462053 sortInvert : sortAndView ? sortAndView . sortInvert : config [ 'sortInvert' + extraKey ] ,
2047- foldersFirst : sortAndView ? false : ( config [ 'foldersFirst' + extraKey ] || false ) ,
2054+ foldersFirst : sortAndView ? true : ( config [ 'foldersFirst' + extraKey ] || false ) ,
20482055 boxes : ( page == 'recently-opened' || page == 'browsing' ) ? false : true ,
20492056 continueReading : sortAndView ? sortAndView . continueReading : config [ 'continueReading' + extraKey ] ,
20502057 recentlyAdded : sortAndView ? sortAndView . recentlyAdded : config [ 'recentlyAdded' + extraKey ] ,
@@ -2097,6 +2104,8 @@ function changeView(mode, page)
20972104 extraKey = 'RecentlyOpened' ;
20982105 else if ( page == 'index' )
20992106 extraKey = 'Index' ;
2107+ else if ( page == 'reading' )
2108+ extraKey = 'Reading' ;
21002109
21012110 if ( mode != config [ 'view' + extraKey ] )
21022111 {
@@ -2148,6 +2157,8 @@ function changeViewModuleSize(size, end, page)
21482157 extraKey = 'RecentlyOpened' ;
21492158 else if ( page == 'index' )
21502159 extraKey = 'Index' ;
2160+ else if ( page == 'reading' )
2161+ extraKey = 'Reading' ;
21512162
21522163 if ( size != config [ 'viewModuleSize' + extraKey ] )
21532164 {
@@ -2209,6 +2220,8 @@ function changeSort(type, mode, page)
22092220 extraKey = 'RecentlyOpened' ;
22102221 else if ( page == 'index' )
22112222 extraKey = 'Index' ;
2223+ else if ( page == 'reading' )
2224+ extraKey = 'Reading' ;
22122225
22132226 if ( type == 1 )
22142227 {
@@ -2642,6 +2655,8 @@ async function openComic(animation = true, path = true, mainPath = true, end = f
26422655 fileManager . revokeAllObjectURL ( ) ;
26432656 workers . clean ( 'convertImageToBlob' ) ;
26442657
2658+ dom . setCurrentPageVars ( 'reading' ) ;
2659+
26452660 // Start reading comic
26462661 if ( config . readingStartReadingInFullScreen && ! fromNextAndPrev && ! fromGoBack )
26472662 {
@@ -2676,7 +2691,7 @@ async function openComic(animation = true, path = true, mainPath = true, end = f
26762691
26772692 try
26782693 {
2679- files = await file . read ( { filtered : false } ) ;
2694+ files = await file . read ( { filtered : false , sort : { extraKey : 'Reading' } } ) ;
26802695 }
26812696 catch ( error )
26822697 {
0 commit comments