Skip to content

Commit 72e8cc1

Browse files
committed
Fix: Reading progress was saved in different location when activating show full path
1 parent 8855fbe commit 72e8cc1

File tree

4 files changed

+24
-5
lines changed

4 files changed

+24
-5
lines changed

CHANGELOG.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
1616
- Improved touch screen navigation (swipe gesture, 2 finger zoom and reset zoom with 2 finger click) [`f848463`](https://github.com/ollm/OpenComic/commit/f84846399f1521c736b9b6e048f204513ac304da)
1717
- Improved detection of image edges when zoom is applied [`e7ec771`](https://github.com/ollm/OpenComic/commit/e7ec77104360b1e2ac2aa96d97b6c1d2cc2d6d01)
1818
- Frameless window (Full only in Windows and macOS) [`9c7346c`](https://github.com/ollm/OpenComic/commit/9c7346cb37fe3c7aed9200d49e27ed4c5bdbfc96)
19-
- Translate page names in PDFs
19+
- Translate page names in PDFs [`8855fbe`](https://github.com/ollm/OpenComic/commit/8855fbefd498352cc86e014677b19c160fcc8da5)
2020

2121
##### 🐛 Bug Fixes
2222

@@ -26,6 +26,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
2626
- RAR error on extract with files some special chars (Changed unrar to node-unrar-js) [`694fe27`](https://github.com/ollm/OpenComic/commit/694fe274982c0a9ad2421c6b226abceae1602c3a)
2727
- Cannot open filtered files with the keyboard [`f831749`](https://github.com/ollm/OpenComic/commit/f8317499a40e6fa45a75988ee1bea31a9135c9bf)
2828
- Some display errors when applying global zoom [`92b28c2`](https://github.com/ollm/OpenComic/commit/92b28c24f1a00544264fac03a336ad8268553fd5)
29+
- Reading progress was saved in different location when activating show full path
2930

3031
## [v1.0.0-beta.3](https://github.com/ollm/OpenComic/releases/tag/v1.0.0-beta.3) (09-10-2023)
3132

scripts/dom.js

+17-2
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,8 @@ async function loadIndexPage(animation = true, path = false, content = false, ke
313313

314314
if(!path)
315315
{
316+
dom.fromLibrary(true);
317+
316318
indexPathControl(false);
317319

318320
let sort = config.sortIndex;
@@ -414,7 +416,7 @@ async function loadIndexPage(animation = true, path = false, content = false, ke
414416
comics[key].sha = sha1(comics[key].path);
415417
comics[key].poster = images.poster;
416418
comics[key].images = images.images;
417-
comics[key].mainPath = config.showFullPathLibrary ? p.parse(comics[key].path).root : comics[key].path;
419+
comics[key].mainPath = comics[key].path;
418420
comics[key].readingProgress = readingProgress[comics[key].path] || {lastReading: 0};
419421
}
420422

@@ -561,9 +563,21 @@ function returnTextPath(path, mainPath, image = false)
561563
return path.join(image ? '<i class="material-icon navegation">chevron_right</i>' : ' / ');
562564
}
563565

566+
var isFromLibrary = true;
567+
568+
function fromLibrary(value)
569+
{
570+
isFromLibrary = value;
571+
}
572+
564573
function headerPath(path, mainPath)
565574
{
566-
mainPathR = addSepToEnd(p.dirname(mainPath));
575+
let _mainPath = mainPath;
576+
577+
if((config.showFullPathLibrary && isFromLibrary) || (config.showFullPathOpened && !isFromLibrary))
578+
_mainPath = p.parse(path).root;
579+
580+
mainPathR = addSepToEnd(p.dirname(_mainPath));
567581

568582
var files = path.replace(new RegExp('^\s*'+pregQuote(mainPathR)), '').split(p.sep);
569583

@@ -1547,6 +1561,7 @@ module.exports = {
15471561
currentPathScrollTop: function(){return currentPathScrollTop},
15481562
getFolderThumbnails: getFolderThumbnails,
15491563
translatePageName: translatePageName,
1564+
fromLibrary: fromLibrary,
15501565
search: search,
15511566
this: domManager.this,
15521567
query: domManager.query,

scripts/opencomic.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -1005,6 +1005,8 @@ function openComicDialog(folders = false)
10051005

10061006
}
10071007

1008+
var fromLibrary = true;
1009+
10081010
function openComic(filePath, animation = true)
10091011
{
10101012
if(pathIsSupported(filePath))
@@ -1035,13 +1037,13 @@ function openComic(filePath, animation = true)
10351037
if(mainPath === false)
10361038
mainPath = path;
10371039

1038-
mainPath = config.showFullPathOpened ? p.parse(mainPath).root : mainPath;
1039-
10401040
if(onReading)
10411041
reading.saveReadingProgress();
10421042

10431043
recentlyOpened.set(mainPath);
10441044

1045+
dom.fromLibrary(false);
1046+
10451047
if(selectImage)
10461048
dom.openComic(animation, path, mainPath);
10471049
else

scripts/recently-opened.js

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ async function reload()
1010

1111
async function load(animation = true, content = false)
1212
{
13+
dom.fromLibrary(false);
1314
dom.indexPathControl(false, false, false, false, true);
1415

1516
template.loadContentRight('index.content.right.loading.html', animation);

0 commit comments

Comments
 (0)