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
6ddf99c2
Commit
6ddf99c2
authored
Nov 11, 2014
by
Gergely Ujvari
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Kill fuzzyTime filter
parent
089fcea3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
49 deletions
+0
-49
filters.coffee
h/static/scripts/filters.coffee
+0
-49
No files found.
h/static/scripts/filters.coffee
View file @
6ddf99c2
...
...
@@ -7,54 +7,6 @@ class Converter extends Markdown.Converter
text
.
replace
/<a href=/g
,
"<a target=
\"
_blank
\"
href="
fuzzyTime
=
(
date
,
next
=
false
)
->
return
''
if
not
date
delta
=
Math
.
round
((
+
new
Date
-
new
Date
(
date
))
/
1000
)
minute
=
60
hour
=
minute
*
60
day
=
hour
*
24
week
=
day
*
7
month
=
day
*
30
year
=
day
*
365
if
(
delta
<
30
)
fuzzy
=
'moments ago'
nextUpdate
=
30
-
delta
else
if
(
delta
<
minute
)
fuzzy
=
delta
+
' seconds ago'
nextUpdate
=
1
else
if
(
delta
<
2
*
minute
)
fuzzy
=
'a minute ago'
nextUpdate
=
2
*
minute
-
delta
else
if
(
delta
<
hour
)
fuzzy
=
Math
.
floor
(
delta
/
minute
)
+
' minutes ago'
nextUpdate
=
minute
else
if
(
Math
.
floor
(
delta
/
hour
)
==
1
)
fuzzy
=
'1 hour ago'
nextUpdate
=
hour
else
if
(
delta
<
day
)
fuzzy
=
Math
.
floor
(
delta
/
hour
)
+
' hours ago'
nextUpdate
=
hour
else
if
(
delta
<
day
*
2
)
fuzzy
=
'yesterday'
nextUpdate
=
2
*
day
-
delta
else
if
(
delta
<
month
)
fuzzy
=
Math
.
round
(
delta
/
day
)
+
' days ago'
nextUpdate
=
day
else
if
(
delta
<
year
)
fuzzy
=
Math
.
round
(
delta
/
month
)
+
' months ago'
nextUpdate
=
month
else
fuzzy
=
Math
.
round
(
delta
/
year
)
+
' years ago'
nextUpdate
=
year
if
next
nextUpdate
else
fuzzy
momentFilter
=
->
(
value
,
format
)
->
# Determine the timezone name and browser language.
...
...
@@ -80,6 +32,5 @@ persona = (user, part='username') ->
angular
.
module
(
'h'
)
.
filter
(
'converter'
,
->
(
new
Converter
()).
makeHtml
)
.
filter
(
'fuzzyTime'
,
->
fuzzyTime
)
.
filter
(
'moment'
,
momentFilter
)
.
filter
(
'persona'
,
->
persona
)
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