From f5337dcad056e1f3cfde31c7b7d843c0f3841131 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 30 Dec 2016 15:04:26 +0530 Subject: [PATCH] Simplification --- src/pyj/read_book/toc.pyj | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/pyj/read_book/toc.pyj b/src/pyj/read_book/toc.pyj index a9dce0864d..5b989a27b3 100644 --- a/src/pyj/read_book/toc.pyj +++ b/src/pyj/read_book/toc.pyj @@ -127,19 +127,19 @@ def current_toc_anchor_map(tam, anchor_funcs): def update_visible_toc_anchors(toc_anchor_map, anchor_funcs): tam = current_toc_anchor_map(toc_anchor_map, anchor_funcs) - prev = before = after = None + before = after = None visible_anchors = {} has_visible = False for anchor_id in tam.pos_map: pos = tam.pos_map[anchor_id] visibility = anchor_funcs.visibility(pos) - if visibility is 0: - before = prev + if visibility < 0: + before = anchor_id + elif visibility is 0: has_visible = True visible_anchors[anchor_id] = True elif visibility > 0: after = anchor_id break - prev = anchor_id return {'visible_anchors':visible_anchors, 'has_visible':has_visible, 'before':before, 'after':after}