New function to count the actual page of the current chapter

pull/690/head
WS64 10 years ago
parent 1de31b9184
commit cc81d49cc9

@ -111,7 +111,7 @@ function ReaderToc:_getChapterPagesLeft(pageno,pages)
j=0
if #self.toc > 0 then
for i=1, #self.toc do
for i = 1, #self.toc do
v = self.toc[i]
if v.page > pageno then
j = v.page
@ -119,13 +119,45 @@ function ReaderToc:_getChapterPagesLeft(pageno,pages)
end
end
end
if j==0 then
return pages-pageno
if j == 0 then
if pages > 0 then
return pages-pageno
else
return ""
end
else
return j-pageno-1
end
end
function ReaderToc:_getChapterPagesDone(pageno)
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
break
end
j = v.page
end
end
if j < 2 then
return ""
else
return j-pageno
end
end
function ReaderToc:onShowToc()
if not self.toc then

Loading…
Cancel
Save