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
d72e8488
Commit
d72e8488
authored
Aug 25, 2014
by
Randall Leeds
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove unused displayer.coffee
parent
9b246e96
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
146 deletions
+0
-146
displayer.coffee
h/static/scripts/displayer.coffee
+0
-146
No files found.
h/static/scripts/displayer.coffee
deleted
100644 → 0
View file @
9b246e96
imports
=
[
'bootstrap'
'h.filters'
'h.directives'
'h.helpers'
'h.socket'
'h.searchfilters'
]
get_quote
=
(
annotation
)
->
if
not
'target'
in
annotation
then
return
''
quote
=
'(This is a reply annotation)'
for
target
in
annotation
[
'target'
]
for
selector
in
target
[
'selector'
]
if
selector
[
'type'
]
is
'TextQuoteSelector'
quote
=
selector
[
'exact'
]
+
' '
quote
class
Displayer
idTable
:
{}
this
.
$inject
=
[
'$element'
,
'$scope'
,
'$timeout'
,
'socket'
,
'streamfilter'
]
constructor
:
(
$element
,
$scope
,
$timeout
,
socket
,
streamfilter
)
->
$scope
.
root
=
document
.
init_annotation
$scope
.
annotation
=
$scope
.
root
.
annotation
$scope
.
annotations
=
[
$scope
.
annotation
]
$scope
.
annotation
.
replies
=
[]
$scope
.
annotation
.
reply_count
=
0
$scope
.
annotation
.
ref_length
=
if
$scope
.
annotation
.
references
?
then
$scope
.
annotation
.
references
.
length
else
0
$scope
.
full_deleted
=
false
@
idTable
[
$scope
.
annotation
.
id
]
=
$scope
.
annotation
filter
=
streamfilter
.
setPastDataNone
()
.
setMatchPolicyIncludeAny
()
.
addClause
(
'references'
,
'first_of'
,
$scope
.
annotation
.
id
,
true
)
.
addClause
(
'id'
,
'equals'
,
$scope
.
annotation
.
id
,
true
)
.
getFilter
()
$scope
.
change_annotation_content
=
(
id
,
new_annotation
)
=>
to_change
=
@
idTable
[
id
]
replies
=
to_change
.
replies
reply_count
=
to_change
.
reply_count
for
k
,
v
of
to_change
delete
to_change
.
k
angular
.
extend
to_change
,
new_annotation
to_change
.
replies
=
replies
to_change
.
reply_count
=
reply_count
$scope
.
open
=
->
$scope
.
sock
=
socket
()
$scope
.
sock
.
onopen
=
->
$scope
.
sock
.
send
(
JSON
.
stringify
({
filter
}))
$scope
.
sock
.
onclose
=
=>
$timeout
$scope
.
open
,
5000
$scope
.
sock
.
onmessage
=
(
msg
)
=>
console
.
log
'Got something'
console
.
log
msg
unless
msg
.
data
.
type
?
and
msg
.
data
.
type
is
'annotation-notification'
return
data
=
msg
.
data
.
payload
action
=
msg
.
data
.
options
.
action
unless
data
instanceof
Array
then
data
=
[
data
]
$scope
.
$apply
=>
$scope
.
manage_new_data
data
,
action
$scope
.
manage_new_data
=
(
data
,
action
)
=>
#sort annotations by creation date
data
.
sort
(
a
,
b
)
->
if
a
.
created
>
b
.
created
then
return
1
if
a
.
created
<
b
.
created
then
return
-
1
0
for
annotation
in
data
annotation
.
quote
=
get_quote
annotation
switch
action
when
'create'
,
'past'
#Ignore duplicates caused by server restarting
if
annotation
.
id
in
@
idTable
break
for
i
in
[
$scope
.
annotation
.
ref_length
..
annotation
.
references
.
length
-
1
]
reference
=
annotation
.
references
[
i
]
@
idTable
[
reference
].
reply_count
+=
1
replies
=
@
idTable
[
annotation
.
references
[
annotation
.
references
.
length
-
1
]].
replies
#Find the place to insert annotation
pos
=
0
for
reply
in
replies
if
reply
.
updated
<
annotation
.
updated
break
pos
+=
1
annotation
.
replies
=
[]
annotation
.
reply_count
=
0
@
idTable
[
annotation
.
id
]
=
annotation
replies
.
splice
pos
,
0
,
annotation
when
'update'
$scope
.
change_annotation_content
annotation
.
id
,
annotation
when
'delete'
if
'deleted'
in
annotation
#Redaction
$scope
.
change_annotation_content
annotation
.
id
,
annotation
else
#Real delete
unless
@
idTable
[
annotation
.
id
]
?
break
if
$scope
.
annotation
.
id
is
annotation
.
id
$scope
.
full_deleted
=
true
else
#Reply delete
#Update the reply counter for all referenced annotation
for
i
in
[
$scope
.
annotation
.
ref_length
..
annotation
.
references
.
length
-
1
]
reference
=
annotation
.
references
[
i
]
@
idTable
[
reference
].
reply_count
-=
1
replies
=
@
idTable
[
annotation
.
references
[
annotation
.
references
.
length
-
1
]].
replies
#Find the place to insert annotation
pos
=
replies
.
indexOf
@
idTable
[
annotation
.
id
]
replies
.
splice
pos
,
1
delete
@
idTable
[
annotation
.
id
]
if
$scope
.
annotation
.
referrers
?
$scope
.
manage_new_data
$scope
.
annotation
.
referrers
,
'past'
document
.
init_annotation
=
null
$scope
.
open
()
angular
.
module
(
'h.displayer'
,
imports
)
.
controller
(
'DisplayerCtrl'
,
Displayer
)
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