readerannotation: info methods

reviewable/pr11563/r21
hius07 3 weeks ago committed by GitHub
parent 0ebc6f2271
commit b0877922ce
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -397,4 +397,29 @@ function ReaderAnnotation:addItem(item)
return index
end
-- info
function ReaderAnnotation:hasAnnotations()
return #self.annotations > 0
end
function ReaderAnnotation:getNumberOfAnnotations()
return #self.annotations
end
function ReaderAnnotation:getNumberOfHighlightsAndNotes() -- for Statistics plugin
local highlights = 0
local notes = 0
for _, item in ipairs(self.annotations) do
if item.drawer then
if item.note then
notes = notes + 1
else
highlights = highlights + 1
end
end
end
return highlights, notes
end
return ReaderAnnotation

Loading…
Cancel
Save