From b0877922ce561b64550806555f41f6ad49f19315 Mon Sep 17 00:00:00 2001 From: hius07 <62179190+hius07@users.noreply.github.com> Date: Sun, 14 Apr 2024 09:17:17 +0300 Subject: [PATCH] readerannotation: info methods --- .../apps/reader/modules/readerannotation.lua | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/frontend/apps/reader/modules/readerannotation.lua b/frontend/apps/reader/modules/readerannotation.lua index a7d8a81e6..45da875e4 100644 --- a/frontend/apps/reader/modules/readerannotation.lua +++ b/frontend/apps/reader/modules/readerannotation.lua @@ -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