@@ -127,11 +127,12 @@ function addImageToDom(querySelector, path, animation = true)
127
127
128
128
if ( animation )
129
129
{
130
- src . addClass ( 'a' ) ;
130
+ src . addClass ( 'a' , 'border' ) ;
131
131
cr . addClass ( 'a' ) ;
132
132
}
133
133
else
134
134
{
135
+ src . addClass ( 'border' ) ;
135
136
src . filter ( '.folder-poster-img' ) . addClass ( 'has-poster' ) ;
136
137
}
137
138
}
@@ -264,22 +265,22 @@ async function loadFilesIndexPage(file, animation, path, keepScroll, mainPath)
264
265
handlebarsContext . comicsReadingProgress = false ;
265
266
}
266
267
267
- if ( keepScroll > 1 )
268
+ /* if(keepScroll > 1)
268
269
template.contentRight().children().html(template.load('index.content.right.'+config.view+'.html')).scrollTop(keepScroll);
269
270
else
270
- template . contentRight ( ) . children ( ) . html ( template . load ( 'index.content.right.' + config . view + '.html' ) ) ;
271
+ template.contentRight().children().html(template.load('index.content.right.'+config.view+'.html'));*/
271
272
272
273
//template.loadContentRight('index.content.right.'+config.view+'.html', animation, keepScroll);
273
274
events . events ( ) ;
274
275
275
- return { files : pathFiles , readingProgress : readingProgress [ mainPath ] || { } } ;
276
+ return { files : pathFiles , readingProgress : readingProgress [ mainPath ] || { } , html : template . load ( 'index.content.right.' + config . view + '.html' ) } ;
276
277
277
278
} ) . catch ( function ( error ) {
278
279
279
280
console . error ( error ) ;
280
281
dom . compressedError ( error ) ;
281
282
282
- return { files : [ ] , readingProgress : { } } ;
283
+ return { files : [ ] , readingProgress : { } , html : '' } ;
283
284
284
285
} ) ;
285
286
@@ -469,7 +470,7 @@ async function loadIndexPage(animation = true, path = false, content = false, ke
469
470
if ( fromDeepLoad && Date . now ( ) - fromDeepLoadNow < 300 )
470
471
{
471
472
template . _barHeader ( ) . firstElementChild . innerHTML = template . load ( 'index.header.html' ) ;
472
- template . _contentRight ( ) . firstElementChild . innerHTML = template . load ( 'index.content.right.loading.html' ) ;
473
+ // template._contentRight().firstElementChild.innerHTML = template.load('index.content.right.loading.html');
473
474
}
474
475
else
475
476
{
@@ -492,23 +493,64 @@ async function loadIndexPage(animation = true, path = false, content = false, ke
492
493
cache . stopQueue ( ) ;
493
494
queue . stop ( 'folderThumbnails' ) ;
494
495
496
+ // Get comic reading progress image
497
+ let readingProgress = storage . get ( 'readingProgress' ) ;
498
+ readingProgress = readingProgress [ mainPath ] || { } ;
499
+
500
+ let containsCompressed = fileManager . containsCompressed ( path ) ;
501
+
502
+ let openContinueReading = false ;
503
+ let openFirstImage = ( ( ! containsCompressed && config . whenOpenFolderFirstImageOrContinueReading ) || ( containsCompressed && config . whenOpenFileFirstImageOrContinueReading ) ) ? true : false ;
504
+
505
+ if ( ( config . whenOpenFolderContinueReading || config . whenOpenFileContinueReading || config . whenOpenFolderFirstImageOrContinueReading || config . whenOpenFileFirstImageOrContinueReading ) && ! fromGoBack && ! disableIgnoreSingleFolders && readingProgress && readingProgress . lastReading > 0 )
506
+ {
507
+ let isParentPath = fileManager . isParentPath ( path , readingProgress . path ) ;
508
+
509
+ if ( ( ! containsCompressed && ( config . whenOpenFolderContinueReading || config . whenOpenFolderFirstImageOrContinueReading ) ) && isParentPath )
510
+ openContinueReading = true ;
511
+ else if ( ( containsCompressed && ( config . whenOpenFileContinueReading || config . whenOpenFileFirstImageOrContinueReading ) ) && isParentPath )
512
+ openContinueReading = true ;
513
+ }
514
+
495
515
let file = fileManager . file ( path ) ;
496
- let indexData = await loadFilesIndexPage ( file , animation , path , keepScroll , mainPath ) ;
497
- file . destroy ( ) ;
498
516
499
- if ( config . whenOpenFolderContinueReading && ! fromGoBack && ! disableIgnoreSingleFolders && indexData . readingProgress && indexData . readingProgress . lastReading > 0 )
517
+ if ( openContinueReading )
500
518
{
501
519
fromDeepLoadNow = Date . now ( ) ;
502
520
indexPathControlA . pop ( ) ;
503
521
504
- if ( indexData . readingProgress . ebook )
505
- reading . setNextOpenChapterProgress ( indexData . readingProgress . chapterIndex , indexData . readingProgress . chapterProgress ) ;
522
+ if ( readingProgress . ebook )
523
+ reading . setNextOpenChapterProgress ( readingProgress . chapterIndex , readingProgress . chapterProgress ) ;
506
524
507
- dom . openComic ( true , indexData . readingProgress . path , indexData . readingProgress . mainPath , false , false , false , true ) ;
525
+ console . log ( readingProgress ) ;
526
+
527
+ dom . openComic ( true , readingProgress . path , mainPath , false , false , false , true ) ;
528
+
529
+ file . destroy ( ) ;
508
530
509
531
return ;
510
532
}
511
- else if ( config . ignoreSingleFoldersLibrary && ! fromGoBack && ! disableIgnoreSingleFolders && indexData . files . length == 1 && ( indexData . files [ 0 ] . folder || indexData . files [ 0 ] . compressed ) )
533
+ else if ( openFirstImage )
534
+ {
535
+ let first = await file . images ( 1 ) ;
536
+
537
+ if ( first )
538
+ {
539
+ fromDeepLoadNow = Date . now ( ) ;
540
+ indexPathControlA . pop ( ) ;
541
+
542
+ dom . openComic ( true , first . path , mainPath , false , false , false , true ) ;
543
+
544
+ file . destroy ( ) ;
545
+
546
+ return ;
547
+ }
548
+ }
549
+
550
+ let indexData = await loadFilesIndexPage ( file , animation , path , keepScroll , mainPath ) ;
551
+ file . destroy ( ) ;
552
+
553
+ if ( config . ignoreSingleFoldersLibrary && ! fromGoBack && ! disableIgnoreSingleFolders && indexData . files . length == 1 && ( indexData . files [ 0 ] . folder || indexData . files [ 0 ] . compressed ) )
512
554
{
513
555
fromDeepLoadNow = Date . now ( ) ;
514
556
indexPathControlA . pop ( ) ;
@@ -518,6 +560,11 @@ async function loadIndexPage(animation = true, path = false, content = false, ke
518
560
return ;
519
561
}
520
562
563
+ let contentRightScroll = template . contentRight ( ) . children ( ) . html ( indexData . html ) ;
564
+
565
+ if ( keepScroll > 1 )
566
+ contentRightScroll . scrollTop ( keepScroll ) ;
567
+
521
568
cache . resumeQueue ( ) ;
522
569
queue . resume ( 'folderThumbnails' ) ;
523
570
}
@@ -1375,14 +1422,13 @@ async function openComic(animation = true, path = true, mainPath = true, end = f
1375
1422
1376
1423
if ( fromDeepLoad && Date . now ( ) - fromDeepLoadNow < 300 )
1377
1424
{
1378
- template . _contentLeft ( ) . firstElementChild . innerHTML = template . load ( 'reading.content.left.html' ) ;
1379
- template . _contentRight ( ) . firstElementChild . innerHTML = template . load ( 'reading.content.right.html' ) ;
1380
1425
template . _barHeader ( ) . firstElementChild . innerHTML = template . load ( 'reading.header.html' ) ;
1381
1426
}
1382
1427
else
1383
1428
{
1384
- template . loadContentLeft ( 'reading.content.left.html' , true ) ;
1385
- template . loadContentRight ( 'reading.content.right.html' , true ) ;
1429
+ if ( ! template . _contentRight ( ) . querySelector ( '.loading' ) )
1430
+ template . loadContentRight ( 'reading.content.right.html' , true ) ;
1431
+
1386
1432
template . loadHeader ( 'reading.header.html' , true ) ;
1387
1433
}
1388
1434
@@ -1408,7 +1454,7 @@ async function openComic(animation = true, path = true, mainPath = true, end = f
1408
1454
{
1409
1455
await file . makeAvailable ( [ { path : compressedFile } ] ) ;
1410
1456
isEbook = true ;
1411
- files = [ ] ;
1457
+ // files = [];
1412
1458
}
1413
1459
else
1414
1460
{
@@ -1500,34 +1546,52 @@ async function openComic(animation = true, path = true, mainPath = true, end = f
1500
1546
indexStart = comics [ i ] . index ;
1501
1547
}
1502
1548
1549
+ if ( isEbook )
1550
+ comics = [ ] ;
1551
+
1503
1552
handlebarsContext . comics = comics ;
1504
1553
handlebarsContext . previousComic = skipPreviousComic ;
1505
1554
handlebarsContext . nextComic = skipNextComic ;
1506
1555
reading . setCurrentComics ( comics ) ;
1507
1556
1557
+ handlebarsContext . loading = true ;
1558
+
1508
1559
if ( Date . now ( ) - now < 300 )
1509
1560
{
1510
- template . _contentLeft ( ) . firstElementChild . innerHTML = template . load ( 'reading.content.left.html' ) ;
1511
- template . _contentRight ( ) . firstElementChild . innerHTML = template . load ( 'reading.content.right.html' ) ;
1561
+ if ( template . _contentRight ( ) . querySelector ( '.loading' ) )
1562
+ {
1563
+ handlebarsContext . loading = false ;
1564
+ template . _contentRight ( ) . firstElementChild . insertAdjacentHTML ( 'beforeend' , template . load ( 'reading.content.right.html' ) ) ;
1565
+ }
1566
+ else
1567
+ {
1568
+ template . _contentRight ( ) . firstElementChild . innerHTML = template . load ( 'reading.content.right.html' ) ;
1569
+ }
1512
1570
}
1513
1571
else
1514
1572
{
1515
- template . loadContentLeft ( 'reading.content.left.html' , true ) ;
1516
1573
template . loadContentRight ( 'reading.content.right.html' , true ) ;
1517
1574
}
1518
1575
1576
+ template . loadContentLeft ( 'reading.content.left.html' , true ) ;
1577
+
1519
1578
if ( template . globalElement ( '.reading-elements-menus' ) . length == 0 ) template . loadGlobalElement ( 'reading.elements.menus.html' , 'menus' ) ;
1520
1579
1521
1580
floatingActionButton ( false ) ;
1522
1581
1523
1582
events . events ( ) ;
1524
1583
1584
+ reading . onLoad ( function ( ) {
1585
+
1586
+ cache . resumeQueue ( ) ;
1587
+
1588
+ } ) ;
1589
+
1525
1590
reading . read ( path , indexStart , end , isCanvas , isEbook , imagePath ) ;
1526
1591
reading . hideContent ( electronRemote . getCurrentWindow ( ) . isFullScreen ( ) , true ) ;
1527
1592
1528
1593
generateAppMenu ( ) ;
1529
-
1530
- cache . resumeQueue ( ) ;
1594
+
1531
1595
shortcuts . register ( 'reading' ) ;
1532
1596
gamepad . updateBrowsableItems ( 'reading-' + sha1 ( path ) ) ;
1533
1597
}
0 commit comments