@@ -2,7 +2,8 @@ const domPoster = require(p.join(appDir, 'scripts/dom/poster.js')),
2
2
domManager = require ( p . join ( appDir , 'scripts/dom/dom.js' ) ) ,
3
3
labels = require ( p . join ( appDir , 'scripts/dom/labels.js' ) ) ,
4
4
fileInfo = require ( p . join ( appDir , 'scripts/dom/file-info.js' ) ) ,
5
- search = require ( p . join ( appDir , 'scripts/dom/search.js' ) ) ;
5
+ search = require ( p . join ( appDir , 'scripts/dom/search.js' ) ) ,
6
+ boxes = require ( p . join ( appDir , 'scripts/dom/boxes.js' ) ) ;
6
7
7
8
/*Page - Index*/
8
9
@@ -239,6 +240,7 @@ async function loadFilesIndexPage(file, animation, path, keepScroll, mainPath)
239
240
mainPath : mainPath ,
240
241
poster : images . poster ,
241
242
images : images . images ,
243
+ addToQueue : images . addToQueue ,
242
244
folder : true ,
243
245
compressed : file . compressed ,
244
246
} ) ;
@@ -475,7 +477,7 @@ async function loadIndexPage(animation = true, path = false, content = false, ke
475
477
comics . push ( {
476
478
name : metadataPathName ( folder ) ,
477
479
path : folder . path ,
478
- added : Math . round ( fs . statSync ( folder . path ) . mtimeMs / 1000 ) ,
480
+ added : Math . round ( fs . statSync ( folder . path ) . ctimeMs / 1000 ) ,
479
481
folder : true ,
480
482
compressed : folder . compressed ,
481
483
fromMasterFolder : true ,
@@ -523,7 +525,7 @@ async function loadIndexPage(animation = true, path = false, content = false, ke
523
525
comics . push ( {
524
526
name : metadataPathName ( folder ) ,
525
527
path : folder . path ,
526
- added : folder . mtime ,
528
+ added : Math . round ( folder . mtime / 1000 ) ,
527
529
folder : true ,
528
530
compressed : folder . compressed ,
529
531
fromMasterFolder : true ,
@@ -621,13 +623,18 @@ async function loadIndexPage(animation = true, path = false, content = false, ke
621
623
comics [ i ] . sha = sha1 ( comics [ i ] . path ) ;
622
624
comics [ i ] . poster = images . poster ;
623
625
comics [ i ] . images = images . images ;
626
+ comics [ i ] . addToQueue = images . addToQueue ;
624
627
comics [ i ] . mainPath = comics [ i ] . path ;
625
628
}
626
629
}
627
630
628
631
// Avoid continue if another loadIndexPage has been run
629
632
if ( contentRightIndex != template . contentRightIndex ( ) ) return ;
630
633
634
+ dom . boxes . reset ( ) ;
635
+ if ( sort != 'last-reading' ) await dom . boxes . continueReading ( comics ) ;
636
+ if ( sort != 'last-add' ) await dom . boxes . recentlyAdded ( comics ) ;
637
+
631
638
handlebarsContext . comics = comics ;
632
639
handlebarsContext . comicsIndex = true ;
633
640
handlebarsContext . comicsReadingProgress = false ;
@@ -662,6 +669,7 @@ async function loadIndexPage(animation = true, path = false, content = false, ke
662
669
663
670
generateAppMenu ( ) ;
664
671
672
+ dom . boxes . reset ( ) ;
665
673
handlebarsContext . comics = [ ] ;
666
674
handlebarsContext . comicsIndex = false ;
667
675
handlebarsContext . comicsDeep2 = path . replace ( new RegExp ( '^\s*' + pregQuote ( mainPathR ) ) , '' ) . split ( p . sep ) . length >= 2 ? true : false ;
@@ -828,7 +836,7 @@ function loadIndexContentLeft(animation)
828
836
for ( let i = 0 , len = masterFolders . length ; i < len ; i ++ )
829
837
{
830
838
_masterFolders . push ( {
831
- id : 'masterFolder -' + i ,
839
+ id : 'master-folder -' + i ,
832
840
key : i ,
833
841
name : p . basename ( masterFolders [ i ] ) ,
834
842
path : masterFolders [ i ] ,
@@ -905,13 +913,13 @@ function loadIndexContentLeft(animation)
905
913
906
914
function loadIndexHeader ( title = false , animation = true )
907
915
{
908
- handlebarsContext . indexHeaderTitle = title || language . global . comics ;
916
+ handlebarsContext . indexHeaderTitle = title || language . global . library ;
909
917
template . loadHeader ( 'index.header.html' , animation ) ;
910
918
}
911
919
912
920
function indexHeader ( title = false )
913
921
{
914
- handlebarsContext . indexHeaderTitle = title || language . global . comics ;
922
+ handlebarsContext . indexHeaderTitle = title || language . global . library ;
915
923
return template . load ( 'index.header.html' ) ;
916
924
}
917
925
@@ -1016,8 +1024,8 @@ function headerPath(path, mainPath, windowTitle = false)
1016
1024
path . push ( { name : metadataPathName ( { path : _path , name : files [ i ] } , true ) , path : _path , mainPath : mainPath } ) ;
1017
1025
}
1018
1026
1019
- if ( config . showLibraryPath )
1020
- path . unshift ( { name : language . global . library , path : '' , mainPath : '' } ) ;
1027
+ if ( config . showLibraryPath && ( isFromLibrary || isFromIndexLabel || isFromRecentlyOpened ) )
1028
+ path . unshift ( { name : labels . getName ( isFromIndexLabel , isFromRecentlyOpened ) , path : '' , mainPath : '' } ) ;
1021
1029
1022
1030
let len = path . length ;
1023
1031
@@ -1193,7 +1201,7 @@ async function getFolderThumbnails(path, index = 0, start = 0, end = 99999)
1193
1201
{
1194
1202
if ( error . message && / n o t C a c h e O n l y / . test ( error . message ) )
1195
1203
{
1196
- addToQueue = true ;
1204
+ addToQueue = 1 ;
1197
1205
}
1198
1206
else
1199
1207
{
@@ -1204,7 +1212,7 @@ async function getFolderThumbnails(path, index = 0, start = 0, end = 99999)
1204
1212
}
1205
1213
else
1206
1214
{
1207
- addToQueue = true ;
1215
+ addToQueue = 2 ;
1208
1216
}
1209
1217
1210
1218
if ( addToQueue )
@@ -1223,7 +1231,7 @@ async function getFolderThumbnails(path, index = 0, start = 0, end = 99999)
1223
1231
} , path , folderSha ) ;
1224
1232
}
1225
1233
1226
- return { poster : poster , images : images } ;
1234
+ return { poster : poster , images : images , addToQueue : addToQueue } ;
1227
1235
}
1228
1236
1229
1237
function calculateVisibleItems ( view , scrollTop = false )
@@ -1234,6 +1242,8 @@ function calculateVisibleItems(view, scrollTop = false)
1234
1242
if ( rect . width == 0 || rect . height == 0 )
1235
1243
rect = { width : window . innerWidth , height : window . innerHeight } ;
1236
1244
1245
+ console . log ( scrollTop ) ;
1246
+
1237
1247
scrollTop = scrollTop || 0 ; // element.scrollTop;
1238
1248
1239
1249
let start = 0 ;
@@ -1299,6 +1309,17 @@ function indexPathControlGoBack()
1299
1309
}
1300
1310
}
1301
1311
1312
+ function goStartPath ( )
1313
+ {
1314
+ if ( isFromIndexLabel && ! isFromRecentlyOpened )
1315
+ indexLabel = isFromIndexLabel ;
1316
+
1317
+ if ( isFromRecentlyOpened )
1318
+ recentlyOpened . load ( true ) ;
1319
+ else
1320
+ loadIndexPage ( true , false ) ;
1321
+ }
1322
+
1302
1323
function indexPathControlGoForwards ( )
1303
1324
{
1304
1325
if ( indexPathControlForwards . length > 0 )
@@ -2418,6 +2439,7 @@ module.exports = {
2418
2439
indexPathControlA : function ( ) { return indexPathControlA } ,
2419
2440
indexPathControlGoBack : indexPathControlGoBack ,
2420
2441
indexPathControlGoForwards : indexPathControlGoForwards ,
2442
+ goStartPath : goStartPath ,
2421
2443
selectElement : selectElement ,
2422
2444
openComic : openComic ,
2423
2445
nextComic : function ( ) { return skipNextComic } ,
@@ -2449,6 +2471,7 @@ module.exports = {
2449
2471
search : search ,
2450
2472
labels : labels ,
2451
2473
fileInfo : fileInfo ,
2474
+ boxes : boxes ,
2452
2475
this : domManager . this ,
2453
2476
query : domManager . query ,
2454
2477
queryAll : domManager . queryAll ,
0 commit comments