(chapterIndex, chapterProgress, animation = true)
| 1422 | |
| 1423 | // Go to ebook chapter progress |
| 1424 | function goToChapterProgress(chapterIndex, chapterProgress, animation = true) |
| 1425 | { |
| 1426 | nextOpenChapterProgress = false; |
| 1427 | let closest = false; |
| 1428 | |
| 1429 | for(let i = 0, len = _ebook.chaptersPages[chapterIndex].length; i < len; i++) |
| 1430 | { |
| 1431 | let diff = Math.abs(_ebook.chaptersPages[chapterIndex][i].chapterProgress - chapterProgress); |
| 1432 | |
| 1433 | if(closest === false || diff < closest.diff) |
| 1434 | { |
| 1435 | closest = { |
| 1436 | page: _ebook.chaptersPages[chapterIndex][i], |
| 1437 | diff: diff, |
| 1438 | }; |
| 1439 | } |
| 1440 | } |
| 1441 | |
| 1442 | if(closest.page) |
| 1443 | { |
| 1444 | let index = closest.page.index + 1; |
| 1445 | |
| 1446 | if(doublePage.active()) |
| 1447 | index = Math.ceil(index / 2); |
| 1448 | |
| 1449 | if(readingManga()) |
| 1450 | index = (indexNum - closest.page.index); |
| 1451 | |
| 1452 | reading.goToIndex(index, animation); |
| 1453 | } |
| 1454 | } |
| 1455 | |
| 1456 | //Go to the next comic page |
| 1457 | function goNext() |
no test coverage detected