Skip to content

Commit

Permalink
Simplify calculating the orphan flag
Browse files Browse the repository at this point in the history
  • Loading branch information
csillag committed Mar 25, 2015
1 parent 7b5c707 commit 0a03fac
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions h/static/scripts/annotator/monkey.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ Annotator.prototype.setupAnnotation = (annotation) ->
@selectedTargets = []

annotation.anchors = []
hasOrphanTarget = false
hasAnchoredTarget = false
hasAnchor = false

for t in annotation.target ? []
try
Expand All @@ -29,15 +28,13 @@ Annotator.prototype.setupAnnotation = (annotation) ->
if anchor?
t.diffHTML = anchor.diffHTML
t.diffCaseOnly = anchor.diffCaseOnly
hasAnchoredTarget = true
else
hasOrphanTarget = true
hasAnchor = true

catch exception
console.log "Error in setupAnnotation for", annotation.id,
":", exception.stack ? exception

if hasOrphanTarget and not hasAnchoredTarget
if annotation.target?.length and not hasAnchor
annotation.$orphan = true

annotation
Expand Down

0 comments on commit 0a03fac

Please sign in to comment.