@@ -486,41 +486,40 @@ async function loadFilesIndexPage(files, file, animation, path, keepScroll, main
486486
487487 handlebarsContext . comics = pathFiles ;
488488
489- // Comic reading progress
490- if ( readingProgress )
491- {
492- let sha = readingProgress . sha ;
493- let thumbnail = thumbnails [ sha ] ;
489+ const processReadingProgress = function ( progress ) {
490+
491+ const sha = progress . sha ;
492+ const thumbnail = thumbnails [ sha ] ;
493+
494+ progress . sha = sha ;
495+ progress . thumbnail = ( thumbnail . cache ) ? thumbnail . path : '' ;
496+ progress . mainPath = mainPath ;
497+ progress . pathText = returnTextPath ( progress . path , mainPath , true , ! progress . ebook ) ;
498+ progress . exists = fileManager . simpleExists ( progress . path ) ;
499+
500+ const path = p . dirname ( progress . path ) ;
501+ const folder = ( fs . existsSync ( path ) && fs . statSync ( path ) . isDirectory ( ) ) ? true : false ;
502+
503+ progress . contextMenu = {
504+ path : path ,
505+ folder : folder || fileManager . isCompressed ( path ) ,
506+ } ;
507+
508+ return progress ;
494509
495- readingProgress . sha = sha ;
496- readingProgress . thumbnail = ( thumbnail . cache ) ? thumbnail . path : '' ;
497- readingProgress . mainPath = mainPath ;
498- readingProgress . pathText = returnTextPath ( readingProgress . path , mainPath , true , ! readingProgress . ebook ) ;
499- readingProgress . exists = fileManager . simpleExists ( readingProgress . path ) ;
500- handlebarsContext . comicsReadingProgress = readingProgress ;
501510 }
511+
512+ // Comic reading progress
513+ if ( readingProgress )
514+ handlebarsContext . comicsReadingProgress = processReadingProgress ( readingProgress ) ;
502515 else
503- {
504516 handlebarsContext . comicsReadingProgress = false ;
505- }
506517
507518 // Current folder reading progress
508519 if ( readingProgressCurrentPath && ( ! readingProgress || readingProgress . path !== readingProgressCurrentPath . path ) )
509- {
510- let sha = readingProgressCurrentPath . sha ;
511- let thumbnail = thumbnails [ sha ] ;
512-
513- readingProgressCurrentPath . sha = sha ;
514- readingProgressCurrentPath . thumbnail = ( thumbnail . cache ) ? thumbnail . path : '' ;
515- readingProgressCurrentPath . mainPath = mainPath ;
516- readingProgressCurrentPath . pathText = returnTextPath ( readingProgressCurrentPath . path , path , true , ! readingProgressCurrentPath . ebook ) ;
517- readingProgressCurrentPath . exists = fileManager . simpleExists ( readingProgressCurrentPath . path ) ;
518- handlebarsContext . comicsReadingProgressCurrentPath = readingProgressCurrentPath ;
519- }
520+ handlebarsContext . comicsReadingProgressCurrentPath = processReadingProgress ( readingProgressCurrentPath ) ;
520521 else
521- {
522522 handlebarsContext . comicsReadingProgressCurrentPath = false ;
523- }
524523
525524 if ( ! pathFiles . length && fileManager . isServer ( path ) && serverClient . serverLastError ( ) )
526525 {
0 commit comments