Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
def0f628
Commit
def0f628
authored
Jun 26, 2017
by
Bryce Johnson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove initTimeagoTimeout and let timeago.js update timeagos internally.
MR: !12468
parent
6205e457
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
22 deletions
+4
-22
app/assets/javascripts/lib/utils/datetime_utility.js
app/assets/javascripts/lib/utils/datetime_utility.js
+3
-21
app/assets/javascripts/main.js
app/assets/javascripts/main.js
+1
-1
No files found.
app/assets/javascripts/lib/utils/datetime_utility.js
View file @
def0f628
...
...
@@ -112,29 +112,11 @@ window.dateFormat = dateFormat;
return
timefor
;
};
w
.
gl
.
utils
.
cachedTimeagoElements
=
[];
w
.
gl
.
utils
.
renderTimeago
=
function
(
$els
)
{
if
(
!
$els
&&
!
w
.
gl
.
utils
.
cachedTimeagoElements
.
length
)
{
w
.
gl
.
utils
.
cachedTimeagoElements
=
[].
slice
.
call
(
document
.
querySelectorAll
(
'
.js-timeago-render
'
));
}
else
if
(
$els
)
{
w
.
gl
.
utils
.
cachedTimeagoElements
=
w
.
gl
.
utils
.
cachedTimeagoElements
.
concat
(
$els
.
toArray
());
}
w
.
gl
.
utils
.
cachedTimeagoElements
.
forEach
(
gl
.
utils
.
updateTimeagoText
);
};
w
.
gl
.
utils
.
updateTimeagoText
=
function
(
el
)
{
const
formattedDate
=
gl
.
utils
.
getTimeago
().
format
(
el
.
getAttribute
(
'
datetime
'
),
lang
);
if
(
el
.
textContent
!==
formattedDate
)
{
el
.
textContent
=
formattedDate
;
}
};
w
.
gl
.
utils
.
initTimeagoTimeout
=
function
()
{
gl
.
utils
.
renderTimeago
();
const
timeagoEls
=
$els
||
document
.
querySelectorAll
(
'
.js-timeago-render
'
);
gl
.
utils
.
timeagoTimeout
=
setTimeout
(
gl
.
utils
.
initTimeagoTimeout
,
1000
);
// timeago.js sets timeouts internally for each timeago value to be updated in real time
gl
.
utils
.
getTimeago
().
render
(
timeagoEls
);
};
w
.
gl
.
utils
.
getDayDifference
=
function
(
a
,
b
)
{
...
...
app/assets/javascripts/main.js
View file @
def0f628
...
...
@@ -358,7 +358,7 @@ $(function () {
gl
.
awardsHandler
=
new
AwardsHandler
();
new
Aside
();
gl
.
utils
.
initTimeagoTimeout
();
gl
.
utils
.
renderTimeago
();
$
(
document
).
trigger
(
'
init.scrolling-tabs
'
);
});
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