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
be70f716
Commit
be70f716
authored
Nov 27, 2012
by
Randall Leeds
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
code style
- less instance-wide state - shorter lines (< 80 columns) - consistentCamelCase
parent
0a537623
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
11 deletions
+15
-11
annotator.host.coffee
h/js/src/annotator.host.coffee
+8
-3
controllers.coffee
h/js/src/controllers.coffee
+7
-8
No files found.
h/js/src/annotator.host.coffee
View file @
be70f716
...
...
@@ -69,9 +69,14 @@ class Annotator.Host extends Annotator
@
frame
.
css
({
"width"
:
""
,
"margin-left"
:
""
})
setFrameWidth
:
(
width
)
=>
@
frame
.
css
({
"width"
:
width
,
"margin-left"
:
(
-
1
)
*
width
})
addtoFrameWidth
:
(
width
,
innerWidth
)
=>
if
isNaN
(
parseInt
(
@
frame
[
0
].
style
.
width
))
then
old
=
innerWidth
else
old
=
parseInt
(
@
frame
[
0
].
style
.
width
)
@
frame
.
css
({
"width"
:
(
old
+
width
),
"margin-left"
:
(
-
1
)
*
(
old
+
width
)
})
addToFrameWidth
:
(
width
,
innerWidth
)
=>
if
isNaN
(
parseInt
(
@
frame
[
0
].
style
.
width
))
old
=
innerWidth
else
old
=
parseInt
(
@
frame
[
0
].
style
.
width
)
@
frame
.
css
width
:
old
+
width
'margin-left'
:
-
(
old
+
width
)
getHighlights
:
=>
highlights
:
$
(
@
wrapper
).
find
(
'.annotator-hl'
).
map
->
offset
:
$
(
this
).
offset
()
...
...
h/js/src/controllers.coffee
View file @
be70f716
...
...
@@ -5,7 +5,6 @@ class Hypothesis extends Annotator
this
::
hash
=
-
1
# * cheap UUID :cake:
this
::
cache
=
{}
# * object cache
this
::
visible
=
false
# * Whether the sidebar is visible
this
::
dragstartposX
=
0
# * Frame's draggin start position
this
::
lastWidth
=
0
# * Frame's width before close
# Plugin configuration
...
...
@@ -170,6 +169,7 @@ class Hypothesis extends Annotator
this
_setupDocumentEvents
:
->
dragStart
=
0
@
element
.
find
(
'#toolbar .tri'
).
click
=>
if
@
visible
this
.
hide
()
...
...
@@ -177,14 +177,13 @@ class Hypothesis extends Annotator
if
@
viewer
.
isShown
()
and
@
bucket
==
-
1
this
.
_fillDynamicBucket
()
this
.
show
()
document
.
getElementsByClassName
(
'tri'
)[
0
].
addEventListener
'dragstart'
,
(
event
)
=>
@
dragstartposX
=
event
.
screenX
document
.
getElementById
(
'toolbar'
).
addEventListener
'dragend'
,
(
event
)
=>
@
provider
.
add
toFrameWidth
(
@
dragstartposX
-
event
.
screenX
,
window
.
innerWidth
)
document
.
getElementById
(
'toolbar'
).
addEventListener
'drag'
,
(
event
)
=>
.
on
'dragstart'
,
(
event
)
=>
dragStart
=
event
.
screenX
.
on
'dragend'
,
(
event
)
=>
@
provider
.
add
ToFrameWidth
(
dragStart
-
event
.
screenX
),
window
.
innerWidth
.
on
'drag'
,
(
event
)
=>
if
event
.
screenX
>
0
@
provider
.
addtoFrameWidth
((
@
dragstartposX
-
event
.
screenX
),
window
.
innerWidth
)
@
dragstartposX
=
event
.
screenX
@
provider
.
addToFrameWidth
(
dragStart
-
event
.
screenX
),
window
.
innerWidth
this
_setupDynamicStyle
:
->
...
...
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