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
3fe7a118
Commit
3fe7a118
authored
Apr 10, 2013
by
Randall Leeds
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/367-fix-race-condition' into develop
parents
87aa825e
37d3d014
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
56 additions
and
54 deletions
+56
-54
services.coffee
h/js/services.coffee
+56
-54
No files found.
h/js/services.coffee
View file @
3fe7a118
...
...
@@ -132,58 +132,7 @@ class Hypothesis extends Annotator
origin
:
$location
.
search
().
xdm
scope
:
'annotator:panel'
window
:
$window
.
parent
onReady
:
=>
patch_update
=
(
store
)
=>
# When the store plugin finishes a request, update the annotation
# using a monkey-patched update function which updates the threading
# if the annotation has a newly-assigned id and ensures that the id
# is enumerable.
store
.
updateAnnotation
=
(
annotation
,
data
)
=>
if
annotation
.
id
?
and
annotation
.
id
!=
data
.
id
# Update the id table for the threading
thread
=
@
threading
.
getContainer
annotation
.
id
thread
.
message
.
id
=
data
.
id
@
threading
.
idTable
[
data
.
id
]
=
thread
delete
@
threading
.
idTable
[
annotation
.
id
]
# The id is no longer temporary and should be serialized
# on future Store requests.
Object
.
defineProperty
annotation
,
'id'
,
configurable
:
true
enumerable
:
true
writable
:
true
# If the annotation is loaded in a view, switch the view
# to reference the new id.
search
=
$location
.
search
()
if
search
?
and
search
.
id
==
annotation
.
id
search
.
id
=
data
.
id
$location
.
search
(
search
).
replace
()
# Update the annotation with the new data
annotation
=
angular
.
extend
annotation
,
data
# Give angular a chance to react
$rootScope
.
$digest
()
# Get the location of the annotated document
@
provider
.
call
method
:
'getHref'
success
:
(
href
)
=>
options
=
angular
.
extend
{},
(
@
options
.
Store
or
{}),
annotationData
:
uri
:
href
loadFromSearch
:
limit
:
1000
uri
:
href
this
.
addPlugin
'Store'
,
options
patch_update
this
.
plugins
.
Store
console
.
log
"Loaded annotions for '"
+
href
+
"'."
for
href
in
this
.
getSynonymURLs
href
console
.
log
"Also loading annotations for: "
+
href
this
.
plugins
.
Store
.
_apiRequest
'search'
,
uri
:
href
,
(
data
)
=>
console
.
log
"Found "
+
data
.
total
+
" annotations here.."
this
.
plugins
.
Store
.
_onLoadAnnotationsFromSearch
data
onReady
:
=>
console
.
log
"Sidepanel: channel is ready"
# Dodge toolbars [DISABLE]
#@provider.getMaxBottom (max) =>
...
...
@@ -348,8 +297,61 @@ class Hypothesis extends Annotator
@
element
.
find
(
'#toolbar'
).
removeClass
(
'shown'
)
.
find
(
'.tri'
).
attr
(
'draggable'
,
false
)
serviceDiscovery
:
(
options
)
=>
angular
.
extend
@
options
,
Store
:
options
patch_update
:
(
store
)
=>
# When the store plugin finishes a request, update the annotation
# using a monkey-patched update function which updates the threading
# if the annotation has a newly-assigned id and ensures that the id
# is enumerable.
store
.
updateAnnotation
=
(
annotation
,
data
)
=>
if
annotation
.
id
?
and
annotation
.
id
!=
data
.
id
# Update the id table for the threading
thread
=
@
threading
.
getContainer
annotation
.
id
thread
.
message
.
id
=
data
.
id
@
threading
.
idTable
[
data
.
id
]
=
thread
delete
@
threading
.
idTable
[
annotation
.
id
]
# The id is no longer temporary and should be serialized
# on future Store requests.
Object
.
defineProperty
annotation
,
'id'
,
configurable
:
true
enumerable
:
true
writable
:
true
# If the annotation is loaded in a view, switch the view
# to reference the new id.
search
=
$location
.
search
()
if
search
?
and
search
.
id
==
annotation
.
id
search
.
id
=
data
.
id
$location
.
search
(
search
).
replace
()
# Update the annotation with the new data
annotation
=
angular
.
extend
annotation
,
data
# Give angular a chance to react
$rootScope
.
$digest
()
serviceDiscovery
:
(
options
)
=>
angular
.
extend
@
options
,
Store
:
options
# Get the location of the annotated document
@
provider
.
call
method
:
'getHref'
success
:
(
href
)
=>
options
=
angular
.
extend
{},
(
@
options
.
Store
or
{}),
annotationData
:
uri
:
href
loadFromSearch
:
limit
:
1000
uri
:
href
this
.
addPlugin
'Store'
,
options
this
.
patch_update
this
.
plugins
.
Store
console
.
log
"Loaded annotions for '"
+
href
+
"'."
for
href
in
this
.
getSynonymURLs
href
console
.
log
"Also loading annotations for: "
+
href
this
.
plugins
.
Store
.
_apiRequest
'search'
,
uri
:
href
,
(
data
)
=>
console
.
log
"Found "
+
data
.
total
+
" annotations here.."
this
.
plugins
.
Store
.
_onLoadAnnotationsFromSearch
data
class
DraftProvider
drafts
:
[]
...
...
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