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
aadcef8f
Commit
aadcef8f
authored
May 17, 2012
by
Randall Leeds
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
re-org hypothesis.coffee
parent
0a7bdf0b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
46 additions
and
45 deletions
+46
-45
hypothesis.coffee
hypothesis/js/src/hypothesis.coffee
+46
-45
No files found.
hypothesis/js/src/hypothesis.coffee
View file @
aadcef8f
...
...
@@ -38,36 +38,6 @@ class Hypothesis extends Annotator
this
onHeatmapClick
:
(
event
)
=>
y
=
event
.
pageY
-
@
wrapper
.
offset
().
top
target
=
d3
.
bisect
(
@
heatmap
.
index
,
y
)
-
1
annotations
=
@
heatmap
.
buckets
[
target
]
this
.
showViewer
(
annotations
)
@
heatmap
.
updateHeatmap
()
showViewer
:
(
annotations
)
->
@
viewer
.
element
.
find
(
'.annotator-listing'
).
replaceWith
(
Handlebars
.
templates
[
'summaries'
]({
annotations
:
annotations
})
)
@
viewer
.
show
()
$
(
document
.
documentElement
).
addClass
(
'hyp-collapse'
)
@
sidebar
.
removeClass
(
'collapse'
)
showEditor
:
(
annotation
)
=>
if
@
plugins
.
Permissions
?
.
user
annotation
[
'user'
]
=
@
plugins
.
Permissions
.
user
@
editor
.
element
.
find
(
'.annotator-listing'
).
replaceWith
(
Handlebars
.
templates
[
'editor'
](
annotation
)
)
@
editor
.
load
(
annotation
)
$
(
document
.
documentElement
).
addClass
(
'hyp-collapse'
)
@
sidebar
.
removeClass
(
'collapse'
)
else
alert
(
"Not logged in!"
)
# Sets up the selection event listeners to watch mouse actions on the document.
#
# Returns itself for chaining.
...
...
@@ -80,11 +50,6 @@ class Hypothesis extends Annotator
)
this
_setupHeatmap
:
()
->
# Pull the heatmap into the sidebar
@
heatmap
=
@
plugins
.
Heatmap
this
_setupSidebar
:
()
->
# Create a sidebar if one does not exist. This is a singleton element --
# even if multiple instances of the app are loaded on a page (some day).
...
...
@@ -100,6 +65,11 @@ class Hypothesis extends Annotator
)
this
_setupHeatmap
:
()
->
# Pull the heatmap into the sidebar
@
heatmap
=
@
plugins
.
Heatmap
this
# Creates an instance of Annotator.Viewer and assigns it to the @viewer
# property, appends it to the @wrapper and sets up event listeners.
#
...
...
@@ -107,15 +77,15 @@ class Hypothesis extends Annotator
_setupViewer
:
->
@
viewer
=
new
Annotator
.
Viewer
(
readOnly
:
@
options
.
readOnly
)
@
viewer
.
hide
()
.
on
(
"edit"
,
this
.
onEditAnnotation
)
.
on
(
"delete"
,
this
.
onDeleteAnnotation
)
.
addField
({
load
:
(
field
,
annotation
)
=>
if
annotation
.
text
$
(
field
).
escape
(
annotation
.
text
)
else
$
(
field
).
html
(
"<i>
#{
_t
'No Comment'
}
</i>"
)
this
.
publish
(
'annotationViewerTextField'
,
[
field
,
annotation
])
.
on
(
"edit"
,
this
.
onEditAnnotation
)
.
on
(
"delete"
,
this
.
onDeleteAnnotation
)
.
addField
({
load
:
(
field
,
annotation
)
=>
if
annotation
.
text
$
(
field
).
escape
(
annotation
.
text
)
else
$
(
field
).
html
(
"<i>
#{
_t
'No Comment'
}
</i>"
)
this
.
publish
(
'annotationViewerTextField'
,
[
field
,
annotation
])
})
this
...
...
@@ -137,4 +107,35 @@ class Hypothesis extends Annotator
submit
:
(
field
,
annotation
)
->
annotation
.
text
=
$
(
field
).
find
(
'textarea'
).
val
()
})
this
\ No newline at end of file
this
onHeatmapClick
:
(
event
)
=>
y
=
event
.
pageY
-
@
wrapper
.
offset
().
top
target
=
d3
.
bisect
(
@
heatmap
.
index
,
y
)
-
1
annotations
=
@
heatmap
.
buckets
[
target
]
this
.
showViewer
(
annotations
)
@
heatmap
.
updateHeatmap
()
showViewer
:
(
annotations
)
->
@
viewer
.
element
.
find
(
'.annotator-listing'
).
replaceWith
(
Handlebars
.
templates
[
'summaries'
]({
annotations
:
annotations
})
)
@
viewer
.
show
()
$
(
document
.
documentElement
).
addClass
(
'hyp-collapse'
)
@
sidebar
.
removeClass
(
'collapse'
)
showEditor
:
(
annotation
)
=>
if
@
plugins
.
Permissions
?
.
user
annotation
[
'user'
]
=
@
plugins
.
Permissions
.
user
@
editor
.
element
.
find
(
'.annotator-listing'
).
replaceWith
(
Handlebars
.
templates
[
'editor'
](
annotation
)
)
@
editor
.
load
(
annotation
)
$
(
document
.
documentElement
).
addClass
(
'hyp-collapse'
)
@
sidebar
.
removeClass
(
'collapse'
)
else
alert
(
"Not logged in!"
)
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