mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
Update readertoc.lua
Add "pages left to next chapter" to minibar
This commit is contained in:
@@ -98,6 +98,35 @@ function ReaderToc:getTocTitleOfCurrentPage()
|
||||
return self:getTocTitleByPage(self.pageno)
|
||||
end
|
||||
|
||||
function ReaderToc:_getChapterPagesLeft(pageno,pages)
|
||||
if not self.toc then
|
||||
-- build toc when needed.
|
||||
self:fillToc()
|
||||
end
|
||||
|
||||
-- no table of content
|
||||
if #self.toc == 0 then
|
||||
return ""
|
||||
end
|
||||
|
||||
j=0
|
||||
if #self.toc > 0 then
|
||||
for i=1, #self.toc do
|
||||
v = self.toc[i]
|
||||
if v.page > pageno then
|
||||
j = v.page
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
if j==0 then
|
||||
return pages-pageno
|
||||
else
|
||||
return j-pageno-1
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function ReaderToc:onShowToc()
|
||||
if not self.toc then
|
||||
self:fillToc()
|
||||
|
||||
Reference in New Issue
Block a user