Created
June 3, 2010 13:56
-
-
Save spangenberg/423918 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
calculateTimeDiff = (el) -> | |
el = $(el || document.body) | |
el.getElements("[calculate-time]").each (el) -> | |
date = el.get "calculate-time" | |
parsedDate = new Date.parse date | |
timeDiffInWords = parsedDate.timeDiffInWords() | |
el.set "text", timeDiffInWords |
This file contains hidden or 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
window.addEvent "domready", -> | |
calculateTimeDiff() | |
calculateTimeDiff.periodical 60000 |
This file contains hidden or 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
<span calculate-time="Thu, 03 Jun 2010 13:25:11 +0000">Thu, 03 Jun 2010 13:25:11 +0000</span> | |
<span calculate-time="Wed, 02 Jun 2010 16:14:39 +0000">Wed, 02 Jun 2010 16:14:39 +0000</span> |
This file contains hidden or 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
# optional | |
MooTools.lang.setLanguage 'de-DE' | |
# list all languages | |
alert MooTools.lang.list() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Tested with MooTools Core 1.2.4 and MooTools More 1.2.4.4.