(path = false, mainPath = false, isComic = false, fromNextAndPrev = false, fromRecentlyOpened = false)
| 1665 | |
| 1666 | // This needs to be improved more, if is from fromNextAndPrev, consider changing the previous route/path |
| 1667 | function indexPathControl(path = false, mainPath = false, isComic = false, fromNextAndPrev = false, fromRecentlyOpened = false) |
| 1668 | { |
| 1669 | if(path === false || mainPath === false) |
| 1670 | { |
| 1671 | handlebarsContext.fromRecentlyOpened = fromRecentlyOpened; |
| 1672 | |
| 1673 | history.clean(); |
| 1674 | history.add({root: true, file: false, path: false, mainPath: false, isComic: false, indexLabel: prevIndexLabel, recentlyOpened: fromRecentlyOpened}); |
| 1675 | } |
| 1676 | else |
| 1677 | { |
| 1678 | mainPathR = addSepToEnd(p.dirname(mainPath)); |
| 1679 | |
| 1680 | const files = path.replace(new RegExp('^\s*'+pregQuote(mainPathR)), '').split(p.sep); |
| 1681 | const index = files.length - 1; |
| 1682 | |
| 1683 | const current = history.current(); |
| 1684 | |
| 1685 | if(index >= 0) |
| 1686 | { |
| 1687 | const page = {file: files[index], path: path, mainPath: mainPath, isComic: isComic, indexLabel: prevIndexLabel}; |
| 1688 | |
| 1689 | if(current && isComic && fromNextAndPrev && current.isComic) |
| 1690 | { |
| 1691 | history.update(page); |
| 1692 | } |
| 1693 | else if(!current || current.path !== path || current.mainPath !== mainPath || current.isComic !== isComic) |
| 1694 | { |
| 1695 | if(!history.fromGoForwards()) |
| 1696 | history.cleanForwards(); |
| 1697 | |
| 1698 | history.add(page); |
| 1699 | } |
| 1700 | else if(current && !current.root) |
| 1701 | { |
| 1702 | history.update(page); |
| 1703 | } |
| 1704 | } |
| 1705 | } |
| 1706 | |
| 1707 | const current = history.current(); |
| 1708 | |
| 1709 | if(!current.root) |
| 1710 | { |
| 1711 | if(!barBackStatus) |
| 1712 | { |
| 1713 | template.setHeaderDelay(); |
| 1714 | handlebarsContext.barBack = 'show'; |
| 1715 | |
| 1716 | dom.queryAll('.bar-left, .bar-back').css({animationDelay: ''}); |
| 1717 | dom.queryAll('.bar-left').removeClass('disable', 'active').addClass('show'); |
| 1718 | } |
| 1719 | else |
| 1720 | { |
| 1721 | handlebarsContext.barBack = 'active'; |
| 1722 | } |
| 1723 | |
| 1724 | barBackStatus = true; |
no test coverage detected