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
a7ddb6d6
Commit
a7ddb6d6
authored
Oct 09, 2013
by
Randall Leeds
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Sync toolbar button state to sidebar truth
parent
32aa6eaa
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
9 deletions
+21
-9
guest.coffee
h/js/guest.coffee
+5
-1
toolbar.coffee
h/js/plugin/toolbar.coffee
+14
-8
services.coffee
h/js/services.coffee
+2
-0
No files found.
h/js/guest.coffee
View file @
a7ddb6d6
...
...
@@ -109,10 +109,14 @@ class Annotator.Guest extends Annotator
}
)
.
bind
(
'setTool'
,
(
ctx
,
name
)
=>
this
.
setTool
name
)
.
bind
(
'setTool'
,
(
ctx
,
name
)
=>
this
.
setTool
name
this
.
publish
'setTool'
,
name
)
.
bind
(
'setVisibleHighlights'
,
(
ctx
,
state
)
=>
this
.
setVisibleHighlights
state
this
.
publish
'setVisibleHighlights'
,
state
)
scanDocument
:
(
reason
=
"something happened"
)
=>
...
...
h/js/plugin/toolbar.coffee
View file @
a7ddb6d6
...
...
@@ -3,6 +3,8 @@ $ = Annotator.$
class
Annotator
.
Plugin
.
Toolbar
extends
Annotator
.
Plugin
events
:
'updateNotificationCounter'
:
'onUpdateNotificationCounter'
'setTool'
:
'onSetTool'
'setVisibleHighlights'
:
'onSetVisibleHighlights'
html
:
element
:
'<div class="annotator-toolbar"></div>'
...
...
@@ -28,10 +30,6 @@ class Annotator.Plugin.Toolbar extends Annotator.Plugin
event
.
stopPropagation
()
state
=
not
window
.
annotator
.
visibleHighlights
window
.
annotator
.
setVisibleHighlights
state
if
state
$
(
event
.
target
).
addClass
(
'pushed'
)
else
$
(
event
.
target
).
removeClass
(
'pushed'
)
,
"title"
:
"Highlighting Mode"
"class"
:
"highlighter-icon"
...
...
@@ -41,10 +39,6 @@ class Annotator.Plugin.Toolbar extends Annotator.Plugin
state
=
not
(
window
.
annotator
.
tool
is
'highlight'
)
tool
=
if
state
then
'highlight'
else
'comment'
window
.
annotator
.
setTool
tool
if
state
$
(
event
.
target
).
addClass
(
'pushed'
)
else
$
(
event
.
target
).
removeClass
(
'pushed'
)
,
"title"
:
"New Comment"
"class"
:
"commenter-icon"
...
...
@@ -93,3 +87,15 @@ class Annotator.Plugin.Toolbar extends Annotator.Plugin
@
notificationCounter
.
text
(
"+
#{
count
}
"
)
else
@
notificationCounter
.
text
(
''
)
onSetTool
:
(
name
)
->
if
name
is
'highlight'
$
(
@
buttons
[
2
]).
addClass
(
'pushed'
)
else
$
(
@
buttons
[
2
]).
removeClass
(
'pushed'
)
onSetVisibleHighlights
:
(
state
)
->
if
state
$
(
@
buttons
[
1
]).
addClass
(
'pushed'
)
else
$
(
@
buttons
[
1
]).
removeClass
(
'pushed'
)
h/js/services.coffee
View file @
a7ddb6d6
...
...
@@ -450,6 +450,7 @@ class Hypothesis extends Annotator
setTool
:
(
name
)
=>
return
if
name
is
@
tool
@
tool
=
name
this
.
publish
'setTool'
,
name
for
p
in
@
providers
p
.
channel
.
notify
method
:
'setTool'
...
...
@@ -458,6 +459,7 @@ class Hypothesis extends Annotator
setVisibleHighlights
:
(
state
)
=>
return
if
state
is
@
visibleHighlights
@
visibleHighlights
=
state
this
.
publish
'setVisibleHighlights'
,
state
for
p
in
@
providers
p
.
channel
.
notify
method
:
'setVisibleHighlights'
...
...
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