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
305d94e7
Commit
305d94e7
authored
Sep 22, 2013
by
Randall Leeds
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make the toolbar a plugin
parent
904addb8
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
23 deletions
+14
-23
guest.coffee
h/js/guest.coffee
+0
-5
host.coffee
h/js/host.coffee
+4
-4
toolbar.coffee
h/js/plugin/toolbar.coffee
+10
-14
No files found.
h/js/guest.coffee
View file @
305d94e7
...
...
@@ -25,12 +25,7 @@ class Annotator.Guest extends Annotator
.
appendTo
(
@
wrapper
)
.
addClass
(
'annotator-frame annotator-outer annotator-collapsed'
)
unless
@
options
.
light
@
toolbar
=
new
Annotator
.
Toolbar
()
@
toolbar
.
element
.
appendTo
(
@
frame
)
delete
@
options
.
app
delete
@
options
.
light
this
.
addPlugin
'Bridge'
,
formatter
:
(
annotation
)
=>
...
...
h/js/host.coffee
View file @
305d94e7
...
...
@@ -26,11 +26,11 @@ class Annotator.Host extends Annotator.Guest
app
.
appendTo
(
@
frame
)
if
@
toolbar
@
toolbar
.
hide
()
if
@
toolbar
?
@
toolbar
.
addClass
'annotator-hide'
app
.
on
(
'mouseenter'
,
=>
@
toolbar
.
show
()
)
.
on
(
'mouseleave'
,
=>
@
toolbar
.
hide
()
)
.
on
(
'mouseenter'
,
=>
@
toolbar
.
removeClass
'annotator-hide'
)
.
on
(
'mouseleave'
,
=>
@
toolbar
.
addClass
'annotator-hide'
)
if
@
plugins
.
Heatmap
?
this
.
_setupDragEvents
()
...
...
h/js/toolbar.coffee
→
h/js/
plugin/
toolbar.coffee
View file @
305d94e7
$
=
Annotator
.
$
class
Annotator
.
Toolbar
extends
Annotator
.
Widget
class
Annotator
.
Plugin
.
Toolbar
extends
Annotator
.
Plugin
html
:
'<div class="annotator-toolbar"></div>'
options
:
...
...
@@ -49,8 +50,13 @@ class Annotator.Toolbar extends Annotator.Widget
window
.
annotator
.
addComment
()
]
constructor
:
(
options
)
->
super
$
(
@
html
)[
0
],
options
pluginInit
:
->
@
annotator
.
toolbar
=
@
toolbar
=
$
(
@
html
)
if
@
options
.
container
?
$
(
@
options
.
container
).
append
@
toolbar
else
$
(
@
element
).
append
@
toolbar
@
buttons
=
@
options
.
items
.
reduce
(
buttons
,
item
)
=>
button
=
$
(
'<a></a>'
)
.
attr
(
'href'
,
''
)
...
...
@@ -60,15 +66,5 @@ class Annotator.Toolbar extends Annotator.Widget
.
data
(
'state'
,
false
)
buttons
.
add
button
,
$
()
@
element
.
append
(
@
buttons
)
.
wrapInner
(
'<ul></ul>'
)
@
toolbar
.
append
(
@
buttons
).
wrapInner
(
'<ul></ul>'
)
@
buttons
.
wrap
(
'<li></li>'
)
show
:
->
@
element
.
removeClass
@
classes
.
hide
this
hide
:
->
@
element
.
addClass
@
classes
.
hide
this
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