Skip to content

Commit 6938f19

Browse files
committed
New: Continue reading and Recently added section in library, favorites, labels, etc
1 parent 2715976 commit 6938f19

36 files changed

+387
-157
lines changed

languages/ca.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
"comics": {
7575
"continueReading": "Continuar llegint",
7676
"continueReadingNotExists": "El fitxer desat a continuar llegint no existeix actualment",
77+
"recentlyAdded": "Afegit recentment",
7778
"emptyIndex": "No hi ha cap còmic en la biblioteca",
7879
"emptyFolder": "No hi ha cap arxiu compatible en aquesta carpeta",
7980
"emptyRecentlyOpened": "No hi ha fitxers oberts recentment",
@@ -244,7 +245,7 @@
244245
"useTheFirstImageAsPoster": "Utilitzar la primera imatge com a pòster (Només si no n'hi ha cap actualment)",
245246
"showFullPathLibrary": "Mostrar la ruta completa a l'obrir els còmics de la biblioteca",
246247
"showFullPathOpened": "Mostrar la ruta completa a l'obrir un arxiu o carpeta",
247-
"showLibraryPath": "Mostra la biblioteca a la ruta de la capçalera"
248+
"showLibraryPath": "Mostra la biblioteca, favorits, etiquetes, etc a la ruta de la capçalera"
248249
},
249250
"startupBehavior": {
250251
"main": "Comportament d'inici",

languages/cs.json

+1
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
"comics": {
7575
"continueReading": "Pokračovat ve čtení",
7676
"continueReadingNotExists": "",
77+
"recentlyAdded": "",
7778
"emptyIndex": "V této sbírce nejsou žádné komiksy.",
7879
"emptyFolder": "V této složce nejsou žádné kompatibilní soubory.",
7980
"emptyRecentlyOpened": "",

languages/de.json

+1
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
"comics": {
7575
"continueReading": "Lesen fortsetzen",
7676
"continueReadingNotExists": "",
77+
"recentlyAdded": "",
7778
"emptyIndex": "In dieser Kollektion gibt es keine Comics.",
7879
"emptyFolder": "In diesem Ordner gibt es keine kompatiblen Dateien.",
7980
"emptyRecentlyOpened": "",

languages/en.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
"comics": {
7575
"continueReading": "Continue reading",
7676
"continueReadingNotExists": "The file saved in continue reading does not currently exist",
77+
"recentlyAdded": "Recently added",
7778
"emptyIndex": "There are no comics in the library",
7879
"emptyFolder": "There is no compatible file in this folder",
7980
"emptyRecentlyOpened": "No recently opened files",
@@ -244,7 +245,7 @@
244245
"useTheFirstImageAsPoster": "Use the first image as a poster (Only if there is none currently)",
245246
"showFullPathLibrary": "Show full path when opening library comics",
246247
"showFullPathOpened": "Show full path when opening a file or folder",
247-
"showLibraryPath": "Show library in header path"
248+
"showLibraryPath": "Show library, favorites, labesl, etc in header path"
248249
},
249250
"startupBehavior": {
250251
"main": "Startup behavior",

languages/es.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
"comics": {
7575
"continueReading": "Continuar leyendo",
7676
"continueReadingNotExists": "El archivo guardado en continuar leyendo no existe actualmente",
77+
"recentlyAdded": "Añadido recientemente",
7778
"emptyIndex": "No hay ningún cómic en la biblioteca",
7879
"emptyFolder": "No hay ningún archivo compatible en esta carpeta",
7980
"emptyRecentlyOpened": "No hay archivos abiertos recientemente",
@@ -244,7 +245,7 @@
244245
"useTheFirstImageAsPoster": "Utilizar la primera imagen como póster (Solo si no hay ninguno actualmente)",
245246
"showFullPathLibrary": "Mostrar la ruta completa al abrir los cómics de la biblioteca",
246247
"showFullPathOpened": "Mostrar la ruta completa al abrir un archivo o carpeta",
247-
"showLibraryPath": "Mostrar la biblioteca en la ruta del encabezado"
248+
"showLibraryPath": "Mostrar la biblioteca, favoritos, etiquetas, etc en la ruta del encabezado"
248249
},
249250
"startupBehavior": {
250251
"main": "Comportamiento de inicio",

languages/fr.json

+1
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
"comics": {
7575
"continueReading": "Continuer à lire",
7676
"continueReadingNotExists": "",
77+
"recentlyAdded": "",
7778
"emptyIndex": "Il n'y a aucun comics dans cette collection.",
7879
"emptyFolder": "Il n'y a aucun fichier compatible dans ce dossier.",
7980
"emptyRecentlyOpened": "",

languages/hu.json

+1
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
"comics": {
7575
"continueReading": "Folytatás",
7676
"continueReadingNotExists": "",
77+
"recentlyAdded": "",
7778
"emptyIndex": "Ebben a gyűjteményben nincsenek képregények.",
7879
"emptyFolder": "Ebben a mappában nincsenek megfelelő fájlok.",
7980
"emptyRecentlyOpened": "",

languages/it.json

+1
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
"comics": {
7575
"continueReading": "Continua a leggere",
7676
"continueReadingNotExists": "",
77+
"recentlyAdded": "",
7778
"emptyIndex": "Non ci sono fumetti in questa raccolta.",
7879
"emptyFolder": "Non ci sono file compatibili in questa cartella.",
7980
"emptyRecentlyOpened": "",

languages/ja.json

+1
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
"comics": {
7575
"continueReading": "続きを読む",
7676
"continueReadingNotExists": "",
77+
"recentlyAdded": "",
7778
"emptyIndex": "このコレクションには本がありません",
7879
"emptyFolder": "このフォルダには閲覧可能なファイルがありません",
7980
"emptyRecentlyOpened": "",

languages/ko.json

+1
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
"comics": {
7575
"continueReading": "",
7676
"continueReadingNotExists": "",
77+
"recentlyAdded": "",
7778
"emptyIndex": "",
7879
"emptyFolder": "",
7980
"emptyRecentlyOpened": "",

languages/pt-br.json

+1
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
"comics": {
7575
"continueReading": "Continue lendo",
7676
"continueReadingNotExists": "",
77+
"recentlyAdded": "",
7778
"emptyIndex": "Não há quadrinhos nesta coleção.",
7879
"emptyFolder": "Não há arquivo compatível nesta pasta.",
7980
"emptyRecentlyOpened": "",

languages/ru.json

+1
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
"comics": {
7575
"continueReading": "Продолжить чтение",
7676
"continueReadingNotExists": "",
77+
"recentlyAdded": "",
7778
"emptyIndex": "В этом сборнике нет комиксов.",
7879
"emptyFolder": "В этой папке нет совместимых файлов.",
7980
"emptyRecentlyOpened": "",

languages/sv.json

+1
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
"comics": {
7575
"continueReading": "Fortsätt läsa",
7676
"continueReadingNotExists": "Filen som är sparad i \"Fortsätt läsa\" finns inte",
77+
"recentlyAdded": "",
7778
"emptyIndex": "Det finns inga serier i biblioteket",
7879
"emptyFolder": "Det finns ingen kompatibel fil i denna mapp",
7980
"emptyRecentlyOpened": "Inga nyligen öppnade filer",

languages/th.json

+1
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
"comics": {
7575
"continueReading": "อ่านต่อ",
7676
"continueReadingNotExists": "ไม่พบไฟล์ที่บันทึกในการอ่านต่ออยู่อีกต่อไป",
77+
"recentlyAdded": "",
7778
"emptyIndex": "ไม่มีคอมมิกส์ในห้องสมุด",
7879
"emptyFolder": "ไม่มีไฟล์ที่รองรับในโฟลเดอร์นี้",
7980
"emptyRecentlyOpened": "ไม่มีไฟล์ที่เปิดล่าสุด",

languages/vi.json

+1
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
"comics": {
7575
"continueReading": "Đọc tiếp",
7676
"continueReadingNotExists": "",
77+
"recentlyAdded": "",
7778
"emptyIndex": "Chưa có truyện trong bộ sưu tập",
7879
"emptyFolder": "Không có tệp tương thích trong thư mục",
7980
"emptyRecentlyOpened": "Chưa mở tệp nào gần đây",

languages/zh-hans.json

+1
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
"comics": {
7575
"continueReading": "继续阅读",
7676
"continueReadingNotExists": "继续阅读中保存的文件当前不存在",
77+
"recentlyAdded": "",
7778
"emptyIndex": "库里还没有漫画。",
7879
"emptyFolder": "此文件夹中没有兼容的文件。",
7980
"emptyRecentlyOpened": "没有最近打开的文件。",

languages/zh-hant.json

+1
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
"comics": {
7575
"continueReading": "繼續閱讀",
7676
"continueReadingNotExists": "",
77+
"recentlyAdded": "",
7778
"emptyIndex": "收藏夾裡還沒有漫畫。",
7879
"emptyFolder": "這個檔案夾裡沒有可讀檔案。",
7980
"emptyRecentlyOpened": "",

scripts/dom.js

+34-11
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ const domPoster = require(p.join(appDir, 'scripts/dom/poster.js')),
22
domManager = require(p.join(appDir, 'scripts/dom/dom.js')),
33
labels = require(p.join(appDir, 'scripts/dom/labels.js')),
44
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'));
67

78
/*Page - Index*/
89

@@ -239,6 +240,7 @@ async function loadFilesIndexPage(file, animation, path, keepScroll, mainPath)
239240
mainPath: mainPath,
240241
poster: images.poster,
241242
images: images.images,
243+
addToQueue: images.addToQueue,
242244
folder: true,
243245
compressed: file.compressed,
244246
});
@@ -475,7 +477,7 @@ async function loadIndexPage(animation = true, path = false, content = false, ke
475477
comics.push({
476478
name: metadataPathName(folder),
477479
path: folder.path,
478-
added: Math.round(fs.statSync(folder.path).mtimeMs / 1000),
480+
added: Math.round(fs.statSync(folder.path).ctimeMs / 1000),
479481
folder: true,
480482
compressed: folder.compressed,
481483
fromMasterFolder: true,
@@ -523,7 +525,7 @@ async function loadIndexPage(animation = true, path = false, content = false, ke
523525
comics.push({
524526
name: metadataPathName(folder),
525527
path: folder.path,
526-
added: folder.mtime,
528+
added: Math.round(folder.mtime / 1000),
527529
folder: true,
528530
compressed: folder.compressed,
529531
fromMasterFolder: true,
@@ -621,13 +623,18 @@ async function loadIndexPage(animation = true, path = false, content = false, ke
621623
comics[i].sha = sha1(comics[i].path);
622624
comics[i].poster = images.poster;
623625
comics[i].images = images.images;
626+
comics[i].addToQueue = images.addToQueue;
624627
comics[i].mainPath = comics[i].path;
625628
}
626629
}
627630

628631
// Avoid continue if another loadIndexPage has been run
629632
if(contentRightIndex != template.contentRightIndex()) return;
630633

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+
631638
handlebarsContext.comics = comics;
632639
handlebarsContext.comicsIndex = true;
633640
handlebarsContext.comicsReadingProgress = false;
@@ -662,6 +669,7 @@ async function loadIndexPage(animation = true, path = false, content = false, ke
662669

663670
generateAppMenu();
664671

672+
dom.boxes.reset();
665673
handlebarsContext.comics = [];
666674
handlebarsContext.comicsIndex = false;
667675
handlebarsContext.comicsDeep2 = path.replace(new RegExp('^\s*'+pregQuote(mainPathR)), '').split(p.sep).length >= 2 ? true : false;
@@ -828,7 +836,7 @@ function loadIndexContentLeft(animation)
828836
for(let i = 0, len = masterFolders.length; i < len; i++)
829837
{
830838
_masterFolders.push({
831-
id: 'masterFolder-'+i,
839+
id: 'master-folder-'+i,
832840
key: i,
833841
name: p.basename(masterFolders[i]),
834842
path: masterFolders[i],
@@ -905,13 +913,13 @@ function loadIndexContentLeft(animation)
905913

906914
function loadIndexHeader(title = false, animation = true)
907915
{
908-
handlebarsContext.indexHeaderTitle = title || language.global.comics;
916+
handlebarsContext.indexHeaderTitle = title || language.global.library;
909917
template.loadHeader('index.header.html', animation);
910918
}
911919

912920
function indexHeader(title = false)
913921
{
914-
handlebarsContext.indexHeaderTitle = title || language.global.comics;
922+
handlebarsContext.indexHeaderTitle = title || language.global.library;
915923
return template.load('index.header.html');
916924
}
917925

@@ -1016,8 +1024,8 @@ function headerPath(path, mainPath, windowTitle = false)
10161024
path.push({name: metadataPathName({path: _path, name: files[i]}, true), path: _path, mainPath: mainPath});
10171025
}
10181026

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: ''});
10211029

10221030
let len = path.length;
10231031

@@ -1193,7 +1201,7 @@ async function getFolderThumbnails(path, index = 0, start = 0, end = 99999)
11931201
{
11941202
if(error.message && /notCacheOnly/.test(error.message))
11951203
{
1196-
addToQueue = true;
1204+
addToQueue = 1;
11971205
}
11981206
else
11991207
{
@@ -1204,7 +1212,7 @@ async function getFolderThumbnails(path, index = 0, start = 0, end = 99999)
12041212
}
12051213
else
12061214
{
1207-
addToQueue = true;
1215+
addToQueue = 2;
12081216
}
12091217

12101218
if(addToQueue)
@@ -1223,7 +1231,7 @@ async function getFolderThumbnails(path, index = 0, start = 0, end = 99999)
12231231
}, path, folderSha);
12241232
}
12251233

1226-
return {poster: poster, images: images};
1234+
return {poster: poster, images: images, addToQueue: addToQueue};
12271235
}
12281236

12291237
function calculateVisibleItems(view, scrollTop = false)
@@ -1234,6 +1242,8 @@ function calculateVisibleItems(view, scrollTop = false)
12341242
if(rect.width == 0 || rect.height == 0)
12351243
rect = {width: window.innerWidth, height: window.innerHeight};
12361244

1245+
console.log(scrollTop);
1246+
12371247
scrollTop = scrollTop || 0; // element.scrollTop;
12381248

12391249
let start = 0;
@@ -1299,6 +1309,17 @@ function indexPathControlGoBack()
12991309
}
13001310
}
13011311

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+
13021323
function indexPathControlGoForwards()
13031324
{
13041325
if(indexPathControlForwards.length > 0)
@@ -2418,6 +2439,7 @@ module.exports = {
24182439
indexPathControlA: function(){return indexPathControlA},
24192440
indexPathControlGoBack: indexPathControlGoBack,
24202441
indexPathControlGoForwards: indexPathControlGoForwards,
2442+
goStartPath: goStartPath,
24212443
selectElement: selectElement,
24222444
openComic: openComic,
24232445
nextComic: function(){return skipNextComic},
@@ -2449,6 +2471,7 @@ module.exports = {
24492471
search: search,
24502472
labels: labels,
24512473
fileInfo: fileInfo,
2474+
boxes: boxes,
24522475
this: domManager.this,
24532476
query: domManager.query,
24542477
queryAll: domManager.queryAll,

scripts/dom/boxes.js

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
2+
async function box(comics, title, order, orderKey = false, orderKey2 = false)
3+
{
4+
comics.sort(function(a, b){
5+
return -(dom.orderBy(a, b, order, orderKey, orderKey2));
6+
});
7+
8+
const maxItems = Math.floor((window.innerWidth - 16) / 116);
9+
10+
comics = comics.slice(0, maxItems);
11+
const len = comics.length;
12+
13+
// Find images here
14+
for(let i = 0; i < len; i++)
15+
{
16+
if(comics[i].addToQueue === 2)
17+
{
18+
const images = await dom.getFolderThumbnails(comics[i].path);
19+
20+
comics[i].poster = images.poster;
21+
comics[i].images = images.images;
22+
}
23+
24+
console.log(comics[i].added);
25+
}
26+
27+
const box = {
28+
title: title,
29+
comics: comics,
30+
};
31+
32+
if(len)
33+
handlebarsContext.boxes.push(box);
34+
}
35+
36+
function continueReading(comics)
37+
{
38+
return box(comics, language.comics.continueReading, 'real-numeric', 'readingProgress', 'lastReading');
39+
}
40+
41+
function recentlyAdded(comics)
42+
{
43+
return box(comics, language.comics.recentlyAdded, 'real-numeric', 'added');
44+
}
45+
46+
function reset()
47+
{
48+
handlebarsContext.boxes = [];
49+
}
50+
51+
module.exports = {
52+
continueReading: continueReading,
53+
recentlyAdded: recentlyAdded,
54+
reset: reset,
55+
};

0 commit comments

Comments
 (0)