Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
coopwire-hypothesis
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
孙灵跃 Leon Sun
coopwire-hypothesis
Commits
22501ba0
Commit
22501ba0
authored
Sep 11, 2013
by
Randall Leeds
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Various small fixes to solidify multi-frame work
parent
7b55bc6d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
61 deletions
+28
-61
guest.coffee
h/js/guest.coffee
+6
-2
host.coffee
h/js/host.coffee
+1
-44
heatmap.coffee
h/js/plugin/heatmap.coffee
+7
-2
services.coffee
h/js/services.coffee
+14
-13
No files found.
h/js/guest.coffee
View file @
22501ba0
...
...
@@ -105,9 +105,13 @@ class Annotator.Guest extends Annotator
_setupViewer
:
->
this
_setupEditor
:
->
this
showViewer
:
(
annotation
)
=>
@
plugins
.
Bridge
.
showViewer
annotation
showViewer
:
(
annotations
)
=>
@
panel
?
.
notify
method
:
"showViewer"
,
params
:
(
a
.
id
for
a
in
annotations
)
updateViewer
:
(
annotations
)
=>
@
panel
?
.
notify
method
:
"updateViewer"
,
params
:
(
a
.
id
for
a
in
annotations
)
showEditor
:
(
annotation
)
=>
@
plugins
.
Bridge
.
showEditor
annotation
updateViewer
:
(
annotations
)
=>
@
plugins
.
Bridge
.
updateViewer
annotations
checkForStartSelection
:
(
event
)
=>
# Override to prevent Annotator choking when this ties to access the
...
...
h/js/host.coffee
View file @
22501ba0
...
...
@@ -33,10 +33,6 @@ class Annotator.Host extends Annotator.Guest
_setupXDM
:
(
options
)
->
channel
=
super
# Set dynamic bucket mode on the sidebar
setDynamicBucketMode
:
(
value
)
->
@
panel
?
.
notify
method
:
'setDynamicBucketMode'
,
params
:
value
channel
...
...
@@ -115,45 +111,6 @@ class Annotator.Host extends Annotator.Guest
'margin-left'
:
"
#{
m
}
px"
width
:
"
#{
w
}
px"
showViewer
:
(
annotations
)
=>
@
panel
?
.
notify
method
:
"showViewer"
,
params
:
(
a
.
id
for
a
in
annotations
)
updateViewer
:
(
annotations
)
=>
@
panel
?
.
notify
method
:
"updateViewer"
,
params
:
(
a
.
id
for
a
in
annotations
)
showEditor
:
(
annotation
)
=>
@
plugins
.
Bridge
.
showEditor
annotation
createFakeCommentRange
:
->
posSelector
=
type
:
"TextPositionSelector"
start
:
@
domMapper
.
corpus
.
length
-
1
end
:
@
domMapper
.
corpus
.
length
anchor
=
this
.
findAnchorFromPositionSelector
selector
:
[
posSelector
]
anchor
.
range
# Override for setupAnnotation
setupAnnotation
:
(
annotation
)
->
# Set up annotation as usual
annotation
=
super
(
annotation
)
# Does it have proper highlights?
unless
annotation
.
highlights
?
.
length
or
annotation
.
references
?
.
length
or
annotation
.
target
?
.
length
# No highlights and no references means that this is a comment,
# or re-attachment has failed, but we'll skip orphaned annotations.
# Get a fake range at the end of the document, and highlight it
range
=
this
.
createFakeCommentRange
()
hl
=
this
.
highlightRange
range
# Register this highlight for the annotation, and vica versa
$
.
merge
annotation
.
highlights
,
hl
$
(
hl
).
data
(
'annotation'
,
annotation
)
annotation
# Switch off dynamic bucket mode
this
.
setDynamicBucketMode
false
addToken
:
(
token
)
=>
@
api
.
notify
...
...
@@ -201,4 +158,4 @@ class Annotator.Host extends Annotator.Guest
this
.
subscribe
(
'annotationEditorSubmit'
,
save
)
# Display the editor.
this
.
showEditor
(
annotation
,
position
)
this
.
showEditor
(
annotation
,
position
)
\ No newline at end of file
h/js/plugin/heatmap.coffee
View file @
22501ba0
...
...
@@ -60,7 +60,12 @@ class Annotator.Plugin.Heatmap extends Annotator.Plugin
'annotationsLoaded'
]
for
event
in
events
@
annotator
.
subscribe
event
,
this
.
_update
if
event
is
'annotationCreated'
@
annotator
.
subscribe
event
,
=>
@
dynamicBucket
=
false
this
.
_update
()
else
@
annotator
.
subscribe
event
,
this
.
_update
@
element
.
on
'click'
,
(
event
)
=>
event
.
stopPropagation
()
...
...
@@ -229,7 +234,7 @@ class Annotator.Plugin.Heatmap extends Annotator.Plugin
max
=
0
for
b
in
@
buckets
info
=
b
.
reduce
(
info
,
a
)
->
subtotal
=
(
a
.
thread
?
.
flattenChildren
()
?
.
length
or
0
)
subtotal
=
a
.
reply_count
or
0
return
{
top
:
info
.
top
+
1
replies
:
(
info
.
replies
or
0
)
+
subtotal
...
...
h/js/services.coffee
View file @
22501ba0
...
...
@@ -199,23 +199,21 @@ class Hypothesis extends Annotator
.
bind
(
'back'
,
=>
# This guy does stuff when you "back out" of the interface.
# (Currently triggered by a click on the source page.)
return
unless
drafts
.
discard
()
$rootScope
.
$apply
=>
this
.
hide
()
)
.
bind
(
'setDynamicBucketMode'
,
(
ctx
,
value
)
=>
$rootScope
.
$apply
=>
this
.
setDynamicBucketMode
value
$rootScope
.
$apply
=>
return
unless
drafts
.
discard
()
this
.
hide
()
)
.
bind
(
'open'
,
=>
# Pop out the sidebar
$rootScope
.
$apply
=>
this
.
show
())
$rootScope
.
$apply
=>
this
.
show
()
)
.
bind
(
'showViewer'
,
(
ctx
,
tag
s
=
[])
=>
.
bind
(
'showViewer'
,
(
ctx
,
id
s
=
[])
=>
this
.
showViewer
((
@
threading
.
getContainer
id
).
message
for
id
in
ids
)
)
.
bind
(
'updateViewer'
,
(
ctx
,
tag
s
=
[])
=>
.
bind
(
'updateViewer'
,
(
ctx
,
id
s
=
[])
=>
this
.
updateViewer
((
@
threading
.
getContainer
id
).
message
for
id
in
ids
)
)
...
...
@@ -352,9 +350,6 @@ class Hypothesis extends Annotator
hide
:
=>
@
element
.
scope
().
frame
.
visible
=
false
setDynamicBucketMode
:
(
value
)
=>
@
element
.
scope
().
dynamicBucket
=
value
patch_store
:
->
$location
=
@
element
.
injector
().
get
'$location'
$rootScope
=
@
element
.
injector
().
get
'$rootScope'
...
...
@@ -381,6 +376,9 @@ class Hypothesis extends Annotator
# if the annotation has a newly-assigned id and ensures that the id
# is enumerable.
Store
.
prototype
.
updateAnnotation
=
(
annotation
,
data
)
=>
unless
Object
.
keys
(
data
).
length
return
if
annotation
.
id
?
and
annotation
.
id
!=
data
.
id
# Update the id table for the threading
thread
=
@
threading
.
getContainer
annotation
.
id
...
...
@@ -404,6 +402,7 @@ class Hypothesis extends Annotator
# Update the annotation with the new data
annotation
=
angular
.
extend
annotation
,
data
@
plugins
.
Bridge
?
.
updateAnnotation
annotation
# Give angular a chance to react
$rootScope
.
$digest
()
...
...
@@ -430,7 +429,9 @@ class Hypothesis extends Annotator
for
ref
in
(
annotation
.
references
?
.
slice
().
reverse
()
or
[])
rel
=
(
@
threading
.
getContainer
ref
).
message
if
rel
?
@
element
.
injector
().
get
(
'$timeout'
)
(
=>
this
.
updateAnnotation
rel
),
10
$timeout
=
@
element
.
injector
().
get
(
'$timeout'
)
$timeout
(
=>
@
plugins
.
Bridge
.
updateAnnotation
rel
),
10
this
.
updateAncestors
(
rel
)
break
# Only the nearest existing ancestor, the rest is by induction.
serviceDiscovery
:
(
options
)
=>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment