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
dd307c61
Commit
dd307c61
authored
Mar 17, 2013
by
Randall Leeds
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix highlights for jschannel
parent
22260caf
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
26 deletions
+20
-26
controllers.coffee
h/js/controllers.coffee
+7
-14
host.coffee
h/js/inject/host.coffee
+4
-4
services.coffee
h/js/services.coffee
+9
-8
No files found.
h/js/controllers.coffee
View file @
dd307c61
...
...
@@ -56,17 +56,11 @@ class App
unless
$location
.
path
()
==
'/viewer'
and
$location
.
search
()
?
.
id
?
provider
.
notify
method
:
'setActiveHighlights'
params
:
heatmap
.
buckets
[
bucket
]
?
.
map
(
a
)
=>
a
.
id
params
:
heatmap
.
buckets
[
bucket
]
?
.
map
(
a
)
=>
a
.
$
$tag
# Gets rid of them after
.
on
'mouseout'
,
=>
if
$location
.
path
()
==
'/viewer'
unless
$location
.
search
()
?
.
id
?
bucket
=
heatmap
.
buckets
[
$location
.
search
()
?
.
bucket
]
provider
.
notify
method
:
'setActiveHighlights'
params
:
bucket
?
.
map
(
a
)
=>
a
.
id
else
if
$location
.
path
()
==
'/viewer'
and
not
$location
.
search
()
?
.
id
?
provider
.
notify
method
:
'setActiveHighlights'
# Does one of a few things when a tab is clicked depending on type
...
...
@@ -147,7 +141,6 @@ class App
else
plugins
.
Permissions
.
setUser
(
null
)
delete
plugins
.
Auth
provider
.
setActiveHighlights
[]
if
annotator
.
plugins
.
Store
?
for
annotation
in
annotator
.
dumpAnnotations
()
provider
.
deleteAnnotation
annotation
...
...
@@ -364,13 +357,13 @@ class Viewer
search
.
id
=
annotation
.
id
$location
.
search
(
search
).
replace
()
$scope
.
focus
=
(
annotation
=
$scope
.
annotations
)
->
$scope
.
focus
=
(
annotation
)
->
if
$routeParams
.
id
?
highlights
=
[
$
routeParams
.
id
]
highlights
=
[
$
scope
.
thread
.
message
.
annotation
.
$
$tag
]
else
if
angular
.
isArray
annotation
highlights
=
(
a
.
id
for
a
in
annotation
when
a
?
)
highlights
=
(
a
.
$
$tag
for
a
in
annotation
when
a
?
)
else
if
angular
.
isObject
annotation
highlights
=
[
annotation
.
id
]
highlights
=
[
annotation
.
$
$tag
]
else
highlights
=
[]
provider
.
notify
method
:
'setActiveHighlights'
,
params
:
highlights
...
...
@@ -389,7 +382,7 @@ class Viewer
$scope
.
focus
$scope
.
thread
.
message
.
annotation
else
$scope
.
detail
=
false
$scope
.
focus
$scope
.
annotations
$scope
.
focus
[]
angular
.
module
(
'h.controllers'
,
[])
...
...
h/js/inject/host.coffee
View file @
dd307c61
...
...
@@ -60,7 +60,7 @@ class Annotator.Host extends Annotator
formatted
parser
:
(
annotation
)
=>
parsed
=
{}
for
k
,
v
of
annotation
when
k
in
[
'
id'
,
'
quote'
,
'ranges'
]
for
k
,
v
of
annotation
when
k
in
[
'quote'
,
'ranges'
]
parsed
[
k
]
=
v
parsed
...
...
@@ -103,15 +103,15 @@ class Annotator.Host extends Annotator
highlights
:
$
(
@
wrapper
).
find
(
'.annotator-hl'
).
map
->
offset
:
$
(
this
).
offset
()
height
:
$
(
this
).
outerHeight
(
true
)
data
:
$
(
this
).
data
(
'annotation'
).
id
data
:
$
(
this
).
data
(
'annotation'
).
$
$tag
.
get
()
offset
:
$
(
window
).
scrollTop
()
)
.
bind
(
'setActiveHighlights'
,
(
ctx
,
id
s
=
[])
=>
.
bind
(
'setActiveHighlights'
,
(
ctx
,
tag
s
=
[])
=>
@
wrapper
.
find
(
'.annotator-hl'
)
.
each
->
if
$
(
this
).
data
(
'annotation'
).
id
in
id
s
if
$
(
this
).
data
(
'annotation'
).
$
$tag
in
tag
s
$
(
this
).
addClass
(
'annotator-hl-active'
)
else
if
not
$
(
this
).
hasClass
(
'annotator-hl-temporary'
)
$
(
this
).
removeClass
(
'annotator-hl-active'
)
...
...
h/js/services.coffee
View file @
dd307c61
...
...
@@ -72,6 +72,7 @@ class Hypothesis extends Annotator
references
:
annotation
.
thread
?
.
split
'/'
# Update the heatmap when the host is updated or annotations are loaded
bridge
=
@
plugins
.
Bridge
heatmap
=
@
plugins
.
Heatmap
for
event
in
[
'hostUpdated'
,
'annotationsLoaded'
]
this
.
subscribe
event
,
=>
...
...
@@ -79,10 +80,10 @@ class Hypothesis extends Annotator
method
:
'getHighlights'
success
:
({
highlights
,
offset
})
->
heatmap
.
updateHeatmap
highlights
:
highlights
.
map
(
hl
)
->
thread
=
(
threading
.
getContainer
hl
.
data
)
hl
.
data
=
thread
.
message
?
.
annotation
hl
highlights
:
for
hl
in
highlights
when
hl
.
data
annotation
=
bridge
.
cache
[
hl
.
data
]
angular
.
extend
hl
,
data
:
annotation
offset
:
offset
_setupXDM
:
->
...
...
@@ -96,7 +97,7 @@ class Hypothesis extends Annotator
window
:
$window
.
parent
formatter
:
(
annotation
)
=>
formatted
=
{}
for
k
,
v
of
annotation
when
k
in
[
'
id'
,
'
quote'
,
'ranges'
]
for
k
,
v
of
annotation
when
k
in
[
'quote'
,
'ranges'
]
formatted
[
k
]
=
v
formatted
parser
:
(
annotation
)
=>
...
...
@@ -256,10 +257,10 @@ class Hypothesis extends Annotator
_setupEditor
:
->
this
setupAnnotation
:
(
annotation
)
->
# Delagate to Annotator implementation after we give it a valid array of
# ranges. This is needed until Annotator stops assuming ranges need to be
# added.
# This is needed until Annotator stops assuming ranges and highlights
# are always added.
unless
annotation
.
ranges
?
annotation
.
highlights
=
[]
annotation
.
ranges
=
[]
# Assign a temporary id if necessary
...
...
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