(path, _return = false)
| 3499 | |
| 3500 | //Check if a path is a bookmarks |
| 3501 | function isBookmark(path, _return = false) |
| 3502 | { |
| 3503 | path = p.relative(dom.history.mainPath, path); |
| 3504 | let i = false; |
| 3505 | |
| 3506 | if(readingIsEbook) |
| 3507 | { |
| 3508 | let _path = path.replace(/\?page=[0-9]+$/, ''); |
| 3509 | let page = app.extract(/\?page=([0-9]+)$/, path, 1); |
| 3510 | |
| 3511 | page = _ebook.pages[page]; |
| 3512 | |
| 3513 | let min = page.chapterProgressSize == page.chapterProgress ? 0 : page.chapterProgress - (page.chapterProgressSize / 2); |
| 3514 | let max = page.chapterProgress + (page.chapterProgressSize / 2); |
| 3515 | |
| 3516 | for(let key in readingCurrentBookmarks) |
| 3517 | { |
| 3518 | let bookmark = readingCurrentBookmarks[key]; |
| 3519 | |
| 3520 | if(bookmark.path === _path && bookmark.chapterProgress >= min && bookmark.chapterProgress < max) |
| 3521 | { |
| 3522 | i = key; |
| 3523 | break; |
| 3524 | } |
| 3525 | } |
| 3526 | } |
| 3527 | else |
| 3528 | { |
| 3529 | for(let key in readingCurrentBookmarks) |
| 3530 | { |
| 3531 | if(readingCurrentBookmarks[key].path === path) |
| 3532 | { |
| 3533 | i = key; |
| 3534 | break; |
| 3535 | } |
| 3536 | } |
| 3537 | } |
| 3538 | |
| 3539 | if(_return) |
| 3540 | return i; |
| 3541 | |
| 3542 | if(i !== false) |
| 3543 | { |
| 3544 | activeBookmark(true); |
| 3545 | return true; |
| 3546 | } |
| 3547 | else |
| 3548 | { |
| 3549 | activeBookmark(false); |
| 3550 | return false; |
| 3551 | } |
| 3552 | } |
| 3553 | |
| 3554 | //Create and delete bookmarks |
| 3555 | function createAndDeleteBookmark(index = false) |
no test coverage detected