Commit 1ed655fd authored by Randall Leeds's avatar Randall Leeds Committed by Aron Carroll

Remove unused dynamic bucket code

parent 94a56244
......@@ -140,13 +140,6 @@ class Annotator.Guest extends Annotator
.bind('onEditorHide', this.onEditorHide)
.bind('onEditorSubmit', this.onEditorSubmit)
.bind('setDynamicBucketMode', (ctx, value) =>
return unless @plugins.BucketBar
return if @plugins.BucketBar.dynamicBucket is value
@plugins.BucketBar.dynamicBucket = value
if value then @plugins.BucketBar._update()
)
.bind('focusAnnotations', (ctx, tags=[]) =>
for hl in @getHighlights()
if hl.annotation.$$tag in tags
......@@ -285,9 +278,6 @@ class Annotator.Guest extends Annotator
#
# toggle: should this toggle membership in an existing selection?
selectAnnotations: (annotations, toggle) =>
# Switch off dynamic mode; we are going to "Selection" scope
@plugins.BucketBar.dynamicBucket = false
if toggle
# Tell sidebar to add these annotations to the sidebar
this.toggleAnnotationSelection annotations
......
......@@ -27,9 +27,6 @@ class Annotator.Plugin.BucketBar extends Annotator.Plugin
# tab elements
tabs: null
# whether to update the viewer as the window is scrolled
dynamicBucket: true
constructor: (element, options) ->
super $(@html), options
......@@ -336,11 +333,9 @@ class Annotator.Plugin.BucketBar extends Annotator.Plugin
# If it's the upper tab, scroll to next anchor above
if (@isUpper bucket)
@dynamicBucket = true
@_jumpMinMax @buckets[bucket], "up"
# If it's the lower tab, scroll to next anchor below
else if (@isLower bucket)
@dynamicBucket = true
@_jumpMinMax @buckets[bucket], "down"
else
annotations = @buckets[bucket].slice()
......@@ -349,9 +344,6 @@ class Annotator.Plugin.BucketBar extends Annotator.Plugin
this._buildTabs(@tabs, @buckets)
if @dynamicBucket
@annotator.updateAnnotations this._getDynamicBucket()
_buildTabs: ->
@tabs.each (d, el) =>
el = $(el)
......@@ -376,22 +368,5 @@ class Annotator.Plugin.BucketBar extends Annotator.Plugin
if bucket
el.html("<div class='label'>#{bucketLength}</div>")
_getDynamicBucket: ->
top = window.pageYOffset
bottom = top + $(window).innerHeight()
anchors = @annotator.getHighlights()
visible = anchors.reduce (acc, hl) =>
if top <= hl.getTop() <= bottom
if hl.annotation not in acc
acc.push hl.annotation
acc
, []
isUpper: (i) => i == 1
isLower: (i) => i == @index.length - 2
isComment: (i) => i is @_getCommentBucket()
# Simulate clicking on the comments tab
commentClick: =>
@dynamicBucket = false
annotator.showAnnotations @buckets[@_getCommentBucket()]
isUpper: (i) -> i == 1
isLower: (i) -> i == @index.length - 2
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment