Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
82 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Desc | ||
# nn分前をjsで表示する | ||
# `.js-time-ago`クラスのついた要素の`data-time-ago-at`属性を時刻に変換 | ||
# Usage: | ||
# <abbr class="js-time-ago" data-time-ago-at="2014-03-12 00:27:57 +0900"></abbr> | ||
# Example: | ||
# <abbr class="js-time-ago" data-time-ago-at="2014-03-12 00:27:57 +0900">a minute ago</abbr> | ||
|
||
$ -> | ||
renderTimeAgo = -> | ||
$('.js-time-ago').each -> | ||
$this = $(@) | ||
$this.text moment($this.data('time-ago-at')).fromNow() | ||
|
||
setInterval(renderTimeAgo, 1000 * 10) | ||
renderTimeAgo() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters