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
67496a77
Commit
67496a77
authored
Sep 16, 2013
by
Ujvari Gergely
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Redirect user and tag stream to stream/ and remove their template.
parent
23f6b4d7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
97 deletions
+0
-97
stream.coffee
h/js/stream.coffee
+0
-97
No files found.
h/js/stream.coffee
deleted
100644 → 0
View file @
23f6b4d7
get_quote
=
(
annotation
)
->
if
annotation
.
quote
?
then
return
annotation
.
quote
if
not
'target'
in
annotation
then
return
''
quote
=
'(Reply annotation)'
for
target
in
annotation
[
'target'
]
for
selector
in
target
[
'selector'
]
if
selector
[
'type'
]
is
'TextQuoteSelector'
quote
=
selector
[
'exact'
]
+
' '
quote
class
Stream
path
:
window
.
location
.
protocol
+
'//'
+
window
.
location
.
hostname
+
':'
+
window
.
location
.
port
+
'/__streamer__'
this
.
$inject
=
[
'$location'
,
'$scope'
,
'$timeout'
,
'streamfilter'
]
constructor
:
(
$location
,
$scope
,
$timeout
,
streamfilter
)
->
$scope
.
annotations
=
[]
urlParts
=
$location
.
absUrl
().
split
(
'/'
)
$scope
.
filterValue
=
urlParts
.
pop
()
filterType
=
urlParts
.
pop
()
if
filterType
==
"t"
$scope
.
filterDescription
=
"Annotations with tag '
#{
$scope
.
filterValue
}
'"
filterClause
=
'tags:i#'
+
$scope
.
filterValue
else
$scope
.
filterDescription
=
"Annotations by user '
#{
$scope
.
filterValue
}
'"
filterClause
=
'user:i='
+
$scope
.
filterValue
# Generate client ID
buffer
=
new
Array
(
16
)
uuid
.
v4
null
,
buffer
,
0
@
clientID
=
uuid
.
unparse
buffer
$scope
.
filter
=
streamfilter
.
setPastDataHits
(
150
)
.
setMatchPolicyIncludeAny
()
.
setClausesParse
(
filterClause
)
.
getFilter
()
$scope
.
manage_new_data
=
(
data
,
action
)
=>
for
annotation
in
data
annotation
.
action
=
action
annotation
.
quote
=
get_quote
annotation
annotation
.
_share_link
=
window
.
location
.
protocol
+
'//'
+
window
.
location
.
hostname
+
':'
+
window
.
location
.
port
+
"/a/"
+
annotation
.
id
annotation
.
_anim
=
'fade'
switch
action
when
'create'
,
'past'
unless
annotation
in
$scope
.
annotations
$scope
.
annotations
.
unshift
annotation
when
'update'
index
=
0
for
ann
in
$scope
.
annotations
if
ann
.
id
is
annotation
.
id
# Remove the original
$scope
.
annotations
.
splice
index
,
1
# Put back the edited
$scope
.
annotations
.
unshift
annotation
break
index
+=
1
when
'delete'
for
ann
in
$scope
.
annotations
if
ann
.
id
is
annotation
.
id
$scope
.
annotations
.
splice
index
,
1
break
index
+=
1
$scope
.
open
=
=>
$scope
.
sock
=
new
SockJS
(
@
path
)
$scope
.
sock
.
onopen
=
=>
sockmsg
=
filter
:
$scope
.
filter
clientID
:
@
clientID
$scope
.
sock
.
send
JSON
.
stringify
sockmsg
$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
.
open
()
angular
.
module
(
'h.stream'
,[
'h.streamfilter'
,
'h.filters'
,
'h.directives'
,
'bootstrap'
])
.
controller
(
'StreamCtrl'
,
Stream
)
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