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
48233d84
Commit
48233d84
authored
Mar 24, 2015
by
Randall Leeds
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2079 from hypothesis/simplify-code
Simplify code
parents
20822425
f848fe44
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
17 deletions
+5
-17
monkey.coffee
h/static/scripts/annotator/monkey.coffee
+0
-6
toolbar.coffee
h/static/scripts/annotator/plugin/toolbar.coffee
+1
-1
guest.coffee
h/static/scripts/guest.coffee
+4
-10
No files found.
h/static/scripts/annotator/monkey.coffee
View file @
48233d84
...
...
@@ -9,12 +9,6 @@ Util = Annotator.Util
delete
Annotator
.
prototype
.
events
[
".annotator-hl mouseover"
]
delete
Annotator
.
prototype
.
events
[
".annotator-hl mouseout"
]
# Add createHighlight
Annotator
.
prototype
.
createHighlight
=
->
annotation
=
{
$highlight
:
true
}
this
.
publish
(
'beforeAnnotationCreated'
,
[
annotation
])
annotation
# Override setupAnnotation
Annotator
.
prototype
.
setupAnnotation
=
(
annotation
)
->
# If this is a new annotation, we might have to add the targets
...
...
h/static/scripts/annotator/plugin/toolbar.coffee
View file @
48233d84
...
...
@@ -55,7 +55,7 @@ class Annotator.Plugin.Toolbar extends Annotator.Plugin
"click"
:
(
event
)
=>
event
.
preventDefault
()
event
.
stopPropagation
()
@
annotator
.
addComment
()
@
annotator
.
onAdderClick
target
:
dataset
:
action
:
"comment"
]
@
buttons
=
$
(
makeButton
(
item
)
for
item
in
items
)
...
...
h/static/scripts/guest.coffee
View file @
48233d84
...
...
@@ -244,7 +244,8 @@ module.exports = class Annotator.Guest extends Annotator
annotation
createHighlight
:
->
annotation
=
super
annotation
=
$highlight
:
true
this
.
publish
'beforeAnnotationCreated'
,
[
annotation
]
this
.
plugins
.
CrossFrame
.
sync
([
annotation
])
annotation
...
...
@@ -368,13 +369,6 @@ module.exports = class Annotator.Guest extends Annotator
@
visibleHighlights
=
shouldShowHighlights
# Might not be needed anymore. Perhaps should just use on adderclick or perhaps new note?
addComment
:
->
@
adder
.
hide
()
this
.
setupAnnotation
(
this
.
createAnnotation
())
Annotator
.
Util
.
getGlobal
().
getSelection
().
removeAllRanges
()
this
.
triggerShowFrame
()
# Open the sidebar
triggerShowFrame
:
->
@
crossframe
?
.
notify
method
:
'open'
...
...
@@ -395,8 +389,8 @@ module.exports = class Annotator.Guest extends Annotator
onAdderMousedown
:
->
onAdderClick
:
(
event
)
=>
event
.
preventDefault
()
event
.
stopPropagation
()
event
.
preventDefault
?
()
event
.
stopPropagation
?
()
@
adder
.
hide
()
switch
event
.
target
.
dataset
.
action
when
'highlight'
...
...
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