@@ -2325,9 +2325,13 @@ function nightModeConfig(_app = false)
23252325 _app . classList . remove ( 'night-mode-white-blank-page' ) ;
23262326}
23272327
2328+ let comicContextMenuIndex = 0 ;
2329+
23282330// Show the comic context menu
23292331async function comicContextMenu ( path , mainPath , fromIndex = true , fromIndexNotMasterFolders = true , folder = false , gamepad = false )
23302332{
2333+ comicContextMenuIndex ++ ;
2334+
23312335 let isServer = fileManager . isServer ( path ) ;
23322336 if ( fileManager . isOpds ( path ) ) return ;
23332337
@@ -2383,25 +2387,42 @@ async function comicContextMenu(path, mainPath, fromIndex = true, fromIndexNotMa
23832387
23842388 if ( fromIndex || folder )
23852389 {
2386- try
2387- {
2388- const progress = await reading . progress . get ( path ) ;
2389- reading . progress . updateProgress ( path , progress ) ;
2390+ const currentIndex = comicContextMenuIndex ;
23902391
2391- markRead . style . display = ( progress . completed ) ? 'none' : 'block' ;
2392- markRead . setAttribute ( 'onclick' , 'reading.progress.read(\'' + escapeQuotes ( escapeBackSlash ( path ) , 'simples' ) + '\'); ') ;
2392+ markRead . classList . add ( 'disable-pointer' ) ;
2393+ markUnread . classList . add ( 'disable-pointer ') ;
23932394
2394- markUnread . style . display = ( progress . percent === 0 ) ? 'none' : 'block' ;
2395- markUnread . setAttribute ( 'onclick' , 'reading.progress.unread(\'' + escapeQuotes ( escapeBackSlash ( path ) , 'simples' ) + '\');' ) ;
2396-
2397- separatorMark . style . display = 'block' ;
2398- }
2399- catch ( error )
2400- {
2401- markRead . style . display = 'none' ;
2402- markUnread . style . display = 'none' ;
2403- separatorMark . style . display = 'none' ;
2404- }
2395+ ( async function ( ) {
2396+
2397+ try
2398+ {
2399+ const progress = await reading . progress . get ( path ) ;
2400+ reading . progress . updateProgress ( path , progress ) ;
2401+
2402+ if ( currentIndex !== comicContextMenuIndex )
2403+ return ;
2404+
2405+ dom . this ( markRead ) . class ( progress . completed , 'disable-pointer' ) ;
2406+ markRead . setAttribute ( 'onclick' , 'reading.progress.read(\'' + escapeQuotes ( escapeBackSlash ( path ) , 'simples' ) + '\');' ) ;
2407+
2408+ dom . this ( markUnread ) . class ( ( progress . percent === 0 ) , 'disable-pointer' ) ;
2409+ markUnread . setAttribute ( 'onclick' , 'reading.progress.unread(\'' + escapeQuotes ( escapeBackSlash ( path ) , 'simples' ) + '\');' ) ;
2410+
2411+ separatorMark . style . display = 'block' ;
2412+ }
2413+ catch ( error )
2414+ {
2415+ console . error ( error ) ;
2416+
2417+ if ( currentIndex !== comicContextMenuIndex )
2418+ return ;
2419+
2420+ markRead . style . display = 'none' ;
2421+ markUnread . style . display = 'none' ;
2422+ separatorMark . style . display = 'none' ;
2423+ }
2424+
2425+ } ) ( )
24052426 }
24062427 else
24072428 {
0 commit comments