Compare commits

...

117 commits

Author SHA1 Message Date
Andy Pan
b5a364d3a2 try to fix memory leaks
If the element is no longer in the DOM tree, stop its corresponding
setInterval in the next cycle.
2014-07-09 11:59:22 -04:00
Ryan McGeary
05a85b77f9 Merge pull request from ondrakula/patch-2
Update jquery.timeago.cs.js
2014-07-09 08:45:11 -04:00
ondrakula
0d2a2145b2 Update jquery.timeago.cs.js 2014-06-11 01:46:46 +02:00
Ryan McGeary
0399e804db Merge pull request from borkor/patch-1
Update jquery.timeago.rs.js
2014-06-05 08:38:38 -04:00
borkor
98d000543c Update jquery.timeago.rs.js 2014-06-05 13:50:12 +02:00
Ryan McGeary
c8b5b9365c Added codementor tracking to readme 2014-05-20 11:00:21 -04:00
Ryan McGeary
14ff438930 Updated help section in readme 2014-05-19 22:13:22 -04:00
Ryan McGeary
2409c9f88d Updated donation options in readme 2014-05-19 08:55:37 -04:00
Ryan McGeary
74736c8d07 Merge pull request from moreonion/master
Fix for Romanian and Turkish language files
2014-05-07 07:36:07 -04:00
more onion
4af2cf7135 Fix jquery.timeago.tr.js
Adjust Turkish language file to fit the others. File was being ignored because '$' wasn't mapped to 'jQuery'.
2014-05-07 11:14:18 +02:00
more onion
f7c9c359cd Fix jquery.timeago.ro.js
Adjust Romanian language file to fit the others. File was being ignored because '$' wasn't mapped to 'jQuery'.
2014-05-07 11:09:05 +02:00
Ryan McGeary
bf9d361e4e Bumped version to 1.4.1 2014-05-01 14:59:05 -04:00
Ryan McGeary
66d0ef5277 Added test for future cutoff dates
Ref 
2014-05-01 14:57:04 -04:00
Ryan McGeary
dd17e5598f Merge pull request from Nyholm/patch-1
Fixed bug with cutoff and allowFuture
2014-05-01 14:51:56 -04:00
Tobias Nyholm
6822da82d9 Fixed bug with cutoff and allowFuture
To reproduce the bug use these settings: 
```js
    $.timeago.settings.cutoff = 7 * 86400000;// one week in milliseconds
    $.timeago.settings.allowFuture = true
```
You will se that the cutoff have no effect on a future date.
2014-05-01 12:42:08 +02:00
Ryan McGeary
cb1b0fe977 Merge pull request from hillai/patch-2
Corrected the Hebrew translation
2014-04-25 08:19:46 -04:00
hillai
9b32f8cba6 Update jquery.timeago.he.js 2014-04-25 14:15:48 +03:00
Ryan McGeary
2245c795d0 Merge pull request from zfben/patch-1
update jquery.timeago.zh-CN.js
2014-04-16 13:48:11 -04:00
Ryan McGeary
ec51ad8132 Merge pull request from zfben/patch-2
update jquery.timeago.zh-TW.js
2014-04-16 13:47:35 -04:00
Ben
570327cf15 update jquery.timeago.zh-TW.js
Chinese don't use blank to separate words.
2014-04-16 13:42:11 -04:00
Ben
3a73f0fab1 update jquery.timeago.zh-CN.js
Chinese don't use blank to separate words.
2014-04-16 13:40:47 -04:00
Ryan McGeary
5d7684fbf8 Merge pull request from bryant1410/master
Added Spanish shortened locale
2014-04-14 22:13:43 -04:00
Santiago Castro
dc570fed47 Added Spanish shortened locale 2014-04-14 16:55:48 -03:00
Ryan McGeary
9fac817b07 Added license to bower.json 2014-03-30 10:29:40 -04:00
Ryan McGeary
b374bd6dfb Merge pull request from simi/czech
Use proper ISO 639-1 code for Czech translation.
2014-03-05 10:10:40 -05:00
Josef Šimánek
81f072ebb2 Use proper ISO 639-1 code for Czech translation. 2014-03-05 14:22:02 +01:00
Ryan McGeary
dceed3b1d9 Bumped version to 1.4.0 2014-03-03 09:27:11 -05:00
Ryan McGeary
fc90536dac Merge pull request from telerik/master
Added allowPast settings & tests
2014-03-03 09:23:53 -05:00
Ryan McGeary
61baa07698 Bumped version to 1.3.2 2014-02-27 10:08:17 -05:00
Ryan McGeary
4138f62c2b Added "main" entry to bower.json
Helps fix 
2014-02-27 09:39:03 -05:00
Ryan McGeary
c72634b73d Updated versions in bower.json 2014-02-26 14:53:23 -05:00
Ryan McGeary
cca5898e18 Merge branch 'master' into oscarotero-master
* master:
  Added contribution guidelines
  Added Vietnamese (vi) locale
  Bumped version to 1.3.1
  Added support for 2-digit time zone designators
  Changed wording of failed test messages
2014-02-26 14:49:15 -05:00
Ryan McGeary
2780816e44 Added contribution guidelines 2014-02-26 14:48:54 -05:00
=
300555d699 Added Vietnamese (vi) locale 2014-02-26 14:48:54 -05:00
Ryan McGeary
ed44a62689 Bumped version to 1.3.1 2014-02-26 14:48:54 -05:00
Ryan McGeary
500b808f7b Added support for 2-digit time zone designators
Fixes 
2014-02-26 14:48:54 -05:00
Ryan McGeary
c4a132d6b2 Changed wording of failed test messages 2014-02-26 14:48:54 -05:00
Rich Hildebrand
d0e161a164 Added docs for "allowPast" setting. 2014-02-25 13:53:50 -05:00
Rich Hildebrand
9d6c2c6b64 Added "allowPast" setting. 2014-02-25 13:53:37 -05:00
Rich Hildebrand
873f0f7c10 Added a test for allowFuture = false
No change to existing functionality. Just testing existing behavior.
2014-02-25 11:35:21 -05:00
Ryan McGeary
8946a5eb49 Added contribution guidelines 2014-02-13 15:48:03 -05:00
Ryan McGeary
f6c1dd4d0f Merge pull request from Phoenixheart/master
Added Vietnamese (vi) locale
2014-01-14 05:52:52 -08:00
=
61e23e15a7 Added Vietnamese (vi) locale 2014-01-14 15:32:40 +08:00
Ryan McGeary
96d4406fcc Bumped version to 1.3.1 2013-12-26 12:57:56 -05:00
Ryan McGeary
ef0ffa0df0 Added support for 2-digit time zone designators
Fixes 
2013-12-26 12:57:56 -05:00
Ryan McGeary
54a466d81b Changed wording of failed test messages 2013-12-26 12:57:56 -05:00
Oscar Otero
9128386996 Create bower.json 2013-12-02 18:58:33 +01:00
Ryan McGeary
ad8e3d0e64 Merge pull request from oscarotero/master
Created galician locale
2013-12-02 04:56:06 -08:00
Oscar Otero
694074d374 Create jquery.timeago.gl.js 2013-12-02 10:48:54 +01:00
Ryan McGeary
e3c239d5a4 Moved knockout extension to contrib 2013-12-01 19:14:52 -05:00
Ryan McGeary
36f4640018 Merge pull request from bryantlikes/patch-1
Adding a knockout binding extension
2013-12-01 16:14:05 -08:00
bryantlikes
5b7b9f7c85 Adding a knockout binding extension
Simple knockout binding extension for knockout bindings with timeago and momentjs. Usage is <div data-bind='timeago: mytimeprop'  />
2013-11-30 17:22:33 -08:00
Ryan McGeary
eb71dbca5b Moved jv locale to locales dir 2013-11-09 08:04:19 -05:00
Ryan McGeary
a6bf461d1f Merge pull request from PedroNorte/patch-1
Update jquery.timeago.pt-br.js
2013-10-30 15:22:24 -07:00
PedroNorte
2f2260cee8 Update jquery.timeago.pt-br.js
Removing the pleonasm of having both "há" and "atrás"
2013-10-30 12:02:35 +00:00
Ryan McGeary
c7251759fd Merge pull request from tinggalklik/patch-1
Create  jquery.timeago.jv.js
2013-10-21 10:03:28 -07:00
Sakdurunge Caraka
d5ab36adcb Create jquery.timeago.jv.js
Time in Javanesse
2013-10-21 01:37:12 +07:00
Ryan McGeary
9dc7ae6c8e Merge pull request from alanmeira/master
Added FromNow prefix and fixed locales to work with dates in future
2013-10-07 14:25:30 -07:00
Alan Meira
53a64c0322 Added FromNow prefix and fixed locales to work with dates in future 2013-10-07 18:18:45 -03:00
Ryan McGeary
f512100060 Merge pull request from DvdGiessen/update-title-attr
Added support for updating locale titles
2013-10-07 08:12:25 -07:00
Ryan McGeary
5a989f4b2b Merge pull request from BeenaShetty/patch-1
Syntax issue
2013-10-07 07:23:34 -07:00
BeenaShetty
38de8b99a9 Syntax issue
Syntax issue on line number 10 i.e '°'. So removed that
2013-10-07 12:41:48 +05:30
Ryan McGeary
a018eaa5f0 Merge pull request from jonoskar/master
Add Icelandic locale
2013-09-30 15:14:55 -07:00
Jón Óskar Erlendsson
ea347d24c6 add Icelandinc locale 2013-09-27 21:09:36 +00:00
Ryan McGeary
61980c6e22 Merge pull request from enterprisey/master
Added 'dispose' action
2013-07-31 19:14:46 -07:00
Dave
1a763d5e46 Add tests for 'dispose' action 2013-07-30 12:25:56 -04:00
Dave
3b895714a6 Add 'dispose' action
- use with elements about to be removed from the DOM or that otherwise
no longer require updating
- only clears interval; leaves node as-is
- usage: $('.timeago').timeago('dispose');
2013-07-30 12:25:49 -04:00
Ryan McGeary
49aeb6bf07 Merge pull request from nebkam/patch-1
Added Serbian Latin translation
2013-07-09 08:55:23 -07:00
nebkam
60369ec505 Added Serbian Latin translation 2013-07-09 17:14:21 +02:00
Ryan McGeary
ea26675d40 Merge pull request from oree/estonian-locale
Estonian locale
2013-06-26 17:31:29 -07:00
Eero Raun
f799625f8d Estonian translation with better word cases, detection of future and past. 2013-06-27 00:57:36 +03:00
Eero Raun
658893df50 Estonian translation 2013-06-27 00:57:22 +03:00
Ryan McGeary
f41cfd0c6c Bumped version to 1.3.0 2013-06-16 10:37:40 -04:00
Ryan McGeary
9dab7dbc5a Merge pull request from borski/feature/updatefromdom
Adding $(el).timeago('updateFromDOM') function
2013-06-16 07:31:20 -07:00
Michael Borohovski
30d5b47d5b Adding .timeago('updateFromDOM') function 2013-06-12 19:46:49 +00:00
Daniël van de Giessen
eee58806aa Added support for updating locale titles
The 'update' method now also updates the "title"-attribute when 'localeTitle' is enabled.
2013-06-12 13:25:52 +03:00
Ryan McGeary
d52af89018 Fixed Indonesian locale
Fixes 
2013-05-18 18:36:44 -04:00
Ryan McGeary
f2afbeaf78 Bumped version to v1.2.0 2013-05-18 18:27:54 -04:00
Ryan McGeary
2f2fb8f39a Merge pull request from shish/cutoff-setting
Cutoff setting for leaving older dates alone. [Rebase]
2013-05-18 15:24:00 -07:00
Martin Solli
efdbae1c1f Cutoff setting for leaving older dates alone.
The cutoff setting, if set to something other than 0, ensures that dates
older than this number of milliseconds is not touched by timeago.
2013-05-18 13:54:06 +01:00
Ryan McGeary
e69b93c378 Added gittip donation link 2013-05-14 11:54:25 -04:00
Ryan McGeary
0893f9d4f2 Merge pull request from forabi/patch-1
Update jquery.timeago.ar.js
2013-05-05 05:12:21 -07:00
Muhammad Fawwaz Orabi
6b2314815d Update jquery.timeago.ar.js 2013-05-05 05:21:27 +03:00
Muhammad Fawwaz Orabi
3a6c719328 Update jquery.timeago.ar.js 2013-05-05 05:17:27 +03:00
Ryan McGeary
c212eb3f46 Merge pull request from igloro/patch-1
Lithuanian
2013-04-30 06:26:32 -07:00
igloro
7c1496f0a8 Lithuanian
Lithuanian timeago
2013-04-30 16:25:54 +03:00
Ryan McGeary
c4884c8b54 Added bitcoin donation address 2013-04-19 10:22:19 -04:00
Ryan McGeary
2773b7e4be Readme tweak to force republishing of broken gh-page 2013-04-09 17:32:19 -04:00
Ryan McGeary
c04bd3181b Merge pull request from Stylaa/patch-1
Missing Semicolon
2013-03-31 14:40:35 -07:00
Philipp
e21aad7fe1 Missing Semicolon 2013-04-01 00:10:53 +03:00
Ryan McGeary
9944acbad9 Merge pull request from mclion/patch-1
Slovenian translation
2013-03-31 06:09:21 -07:00
Marko McLion
335dac0d63 Slovenian translation 2013-03-31 04:59:32 +03:00
Ryan McGeary
4dad17f90e Merge pull request from kiafaldorius/localeTitle
add setting to set the title to Date#toLocaleString
2013-03-20 04:50:09 -07:00
Hong
fb4035864d add setting to set the title to Date#toLocaleString 2013-03-19 20:53:55 -07:00
Ryan McGeary
783066c2d9 Merge pull request from znz/update-locales-ja
Update locales/jquery.timeago.ja.js
2013-03-08 06:43:50 -08:00
Kazuhiro NISHIYAMA
83e05ef694 Update locales/jquery.timeago.ja.js
fix mistranslations and unify styles
2013-03-08 15:14:37 +09:00
Ryan McGeary
72c9a9fa77 Added version changes to readme 2013-03-06 09:47:47 -05:00
Ryan McGeary
ef05c3ea33 Bumped version to 1.1.0 2013-03-06 09:46:32 -05:00
Ryan McGeary
7373b70c3b Removed unused monitoring behavior from Rakefile 2013-03-06 09:44:42 -05:00
Ryan McGeary
ed6487a801 Removed unused qunit_setup 2013-03-06 09:42:55 -05:00
Ryan McGeary
c499fe9a9d Realigned whitespace 2013-03-06 09:41:52 -05:00
Ryan McGeary
fcca1b70e2 Merge pull request from 1st8/update-feature
implement timeago('update', 'iso8601') function
2013-03-06 06:40:05 -08:00
Christoph
ad19edc9b5 implement timeago('update', 'datestr') function
refactor initializer function to support different named functions
refactor init to use single each loop like the other functions
2013-03-06 13:41:13 +01:00
Ryan McGeary
db9651b797 Removed public symlink
Fixes 
Fixes 
2013-02-26 10:24:53 -05:00
Ryan McGeary
5be224e370 Added license file 2013-02-23 12:48:36 -05:00
Ryan McGeary
5f346ef5d4 Added basic changelog to readme 2013-02-21 22:56:31 -05:00
Ryan McGeary
ed4b94d8e0 Merge pull request from iCross/patch-1
Update locales/jquery.timeago.zh-TW.js
2013-02-05 08:23:49 -08:00
iCross
082301b769 Update locales/jquery.timeago.zh-TW.js
wording
2013-02-06 00:10:00 +08:00
Ryan McGeary
de2fbdae3f Upgraded test suite to qunit 1.11.0 2013-02-01 17:13:59 -05:00
Ryan McGeary
2c40976eac Merge pull request from pavolzbell/patch-1
Add Slovak locale
2013-02-01 07:56:02 -08:00
Pavol Zbell
a20a2c863c Add Slovak locale 2013-02-01 06:06:54 -08:00
Ryan McGeary
4c37962663 Bumped version to 1.0.2 2013-01-24 14:43:42 -05:00
Ryan McGeary
f9a31fcafc Realigned AMD wrapper 2013-01-24 14:42:01 -05:00
Ryan McGeary
8425e598c3 Merge pull request from genexp/master
Adds AMD wrapper
2013-01-24 14:38:35 -05:00
Ryan McGeary
6664d31831 Merge pull request from dgageot/ShortenFrenchLocale
Shortened French Locale
2013-01-23 03:55:36 -08:00
David Gageot
47936fedfc Shortened French Locale 2013-01-23 10:07:12 +01:00
Brian Corrigan
0dda6d92a1 Adds AMD wrapper
This is handy for working with RequireJS setups that use jQuery in noConflict mode.  Without it this plugin continually tries to access the global object.
2013-01-18 22:26:07 -05:00
41 changed files with 892 additions and 1749 deletions

1
.gitignore vendored
View file

@ -1,2 +1,3 @@
.bundle
vendor/ruby
public

37
CONTRIBUTING.md Normal file
View file

@ -0,0 +1,37 @@
## Want to Contribute?
Found an issue? Thank you for helping out by reporting it. Please describe the
problem, what you tried, what you expected to see, and what you actually
experienced. Please [re-read the documentation](http://timeago.yarp.com/) to
make sure you're using the API as designed, but if you found something that's
broken, we really appreciate your efforts in letting us know. Bonus points for
submitting a failing test case to help us diagnose and potentially fix the
issue.
## Want to Contribute?
Awesome. We love help, but before getting started, please read:
**[Don't "Push" Your Pull Requests](http://www.igvita.com/2011/12/19/dont-push-your-pull-requests/)**
## Ready for a Pull-Request?
1. Fork the repo.
2. Run the tests. Run `rake` or open `open test/index.html`. We only take pull
requests with passing tests, and it's great to know that you started from a
clean slate.
3. Add a test for your change. Only refactoring and documentation change
require no new tests. If you are adding functionality or fixing a bug, we
need a test!
4. Make the test pass.
5. Push to your fork (hopefully this comes from a topical branch) and submit a
pull request.
At this point you're waiting on us. Please keep in mind that OSS maintainers
are often very busy. We'll do our best to at least comment on issues and
pull-requests as soon as possible, but sometimes life gets in the way. We may
also suggest some changes or improvements or alternatives.

View file

@ -1,3 +0,0 @@
source "http://rubygems.org"
gem "fssm", "0.2.0"

View file

@ -1,10 +0,0 @@
GEM
remote: http://rubygems.org/
specs:
fssm (0.2.0)
PLATFORMS
ruby
DEPENDENCIES
fssm (= 0.2.0)

22
LICENSE.txt Normal file
View file

@ -0,0 +1,22 @@
Copyright (c) 2008-2013 Ryan McGeary
MIT License
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View file

@ -4,6 +4,27 @@ Timeago is a jQuery plugin that makes it easy to support automatically updating
fuzzy timestamps (e.g. "4 minutes ago" or "about 1 day ago") from ISO 8601
formatted dates and times embedded in your HTML (à la microformats).
## How You Can Help
**If you like this project, please help. [Donate via Gittip][gittip] or [buy me a coffee with Bitcoin][bitcoin].**<br>
[![Gittip](http://img.shields.io/gittip/rmm5t.svg)][gittip]
[![Bitcoin](http://img.shields.io/badge/bitcoin-buy%20me%20a%20coffee-brightgreen.svg)][bitcoin]
**[Bitcoin][bitcoin]**: `1rmm5tv6f997JK5bLcGbRCZyVjZUPkQ2m`<br>
[![Bitcoin Donation][bitcoin-qr-small]][bitcoin-qr-big]
## Need Help?
**You can [book a session with me on Codementor][codementor].**<br>
[![Book a Codementor session](http://img.shields.io/badge/codementor-book%20a%20session-orange.svg)][codementor]
[gittip]: https://www.gittip.com/rmm5t/ "Donate to rmm5t for open source!"
[bitcoin]: https://blockchain.info/address/1rmm5tv6f997JK5bLcGbRCZyVjZUPkQ2m "Buy rmm5t a coffee for open source!"
[bitcoin-scheme]: bitcoin:1rmm5tv6f997JK5bLcGbRCZyVjZUPkQ2m?amount=0.01&label=Coffee%20to%20rmm5t%20for%20Open%20Source "Buy rmm5t a coffee for open source!"
[bitcoin-qr-small]: http://chart.apis.google.com/chart?cht=qr&chs=150x150&chl=bitcoin%3A1rmm5tv6f997JK5bLcGbRCZyVjZUPkQ2m%3Famount%3D0.01%26label%3DCoffee%2520to%2520rmm5t%2520for%2520Open%2520Source
[bitcoin-qr-big]: http://chart.apis.google.com/chart?cht=qr&chs=500x500&chl=bitcoin%3A1rmm5tv6f997JK5bLcGbRCZyVjZUPkQ2m%3Famount%3D0.01%26label%3DCoffee%2520to%2520rmm5t%2520for%2520Open%2520Source
[codementor]: https://www.codementor.io/rmm5t?utm_campaign=profile&utm_source=button-rmm5t&utm_medium=shields "Book a session with rmm5t on Codementor!"
## Usage
First, load jQuery and the plugin:
@ -13,7 +34,8 @@ First, load jQuery and the plugin:
<script src="jquery.timeago.js" type="text/javascript"></script>
```
Now, let's attach it to your timestamps on DOM ready - put this in the head section:
Now, let's attach it to your timestamps on DOM ready - put this in the head
section:
```html
<script type="text/javascript">
@ -49,6 +71,33 @@ As time passes, the timestamps will automatically update.
**For different language configurations**: visit the [`locales`](https://github.com/rmm5t/jquery-timeago/tree/master/locales) directory.
## Changes
| Version | Notes |
|---------|---------------------------------------------------------------------------------|
| 1.4.x | ([compare][compare-1.4]) Added allowPast setting |
| 1.3.x | ([compare][compare-1.3]) Added updateFromDOM function; bug fixes; bower support |
| 1.2.x | ([compare][compare-1.2]) Added cutoff setting |
| 1.1.x | ([compare][compare-1.1]) Added update function |
| 1.0.x | ([compare][compare-1.0]) locale updates; bug fixes; AMD wrapper |
| 0.11.x | ([compare][compare-0.11]) natural rounding; locale updates; |
| 0.10.x | ([compare][compare-0.10]) locale updates |
| 0.9.x | ([compare][compare-0.9]) microsecond support; bug fixes |
| 0.8.x | ([compare][compare-0.8]) `<time>` element support; bug fixes |
| 0.7.x | ([compare][compare-0.7]) locale function overrides; unit tests |
| ... | ... |
[compare-1.4]: https://github.com/rmm5t/jquery-timeago/compare/v1.3.2...v1.4.1
[compare-1.3]: https://github.com/rmm5t/jquery-timeago/compare/v1.2.0...v1.3.2
[compare-1.2]: https://github.com/rmm5t/jquery-timeago/compare/v1.1.0...v1.2.0
[compare-1.1]: https://github.com/rmm5t/jquery-timeago/compare/v1.0.2...v1.1.0
[compare-1.0]: https://github.com/rmm5t/jquery-timeago/compare/v0.11.4...v1.0.2
[compare-0.11]: https://github.com/rmm5t/jquery-timeago/compare/v0.10.1...v0.11.4
[compare-0.10]: https://github.com/rmm5t/jquery-timeago/compare/v0.9.3...v0.10.1
[compare-0.9]: https://github.com/rmm5t/jquery-timeago/compare/v0.8.2...v0.9.3
[compare-0.8]: https://github.com/rmm5t/jquery-timeago/compare/v0.7.2...v0.8.2
[compare-0.7]: https://github.com/rmm5t/jquery-timeago/compare/v0.6.2...v0.7.2
## Author
[Ryan McGeary](http://ryan.mcgeary.org) ([@rmm5t](http://twitter.com/rmm5t))

View file

@ -1,6 +1,6 @@
require "bundler/setup"
task :default => :watch
task :default => :test
desc "Publish \"marketing\" docs"
task :publish do
@ -11,36 +11,7 @@ task :publish do
sh("git push --tags")
end
desc "Build everything"
task :build do
rebuild_coffee
end
desc "Watch for changes and test the site"
task :watch => :build do
sh("open test/index.html")
monitor
end
desc "Open your default browser with the test page"
task :test do
sh("open test/index.html")
end
def rebuild_coffee(base = nil, relative = "**/*.coffee")
sh("coffee -c #{relative}")
end
def monitor
require "fssm"
puts ">>> Monitoring for changes. Press Ctrl-C to Stop."
FSSM.monitor do
path "." do
glob "**/*.coffee"
update &method(:rebuild_coffee)
delete &method(:rebuild_coffee)
create &method(:rebuild_coffee)
end
end
end

13
bower.json Normal file
View file

@ -0,0 +1,13 @@
{
"name": "jquery-timeago",
"version": "1.4.1",
"license": "MIT",
"main": "jquery.timeago.js",
"ignore": [
"test",
"vendor"
],
"dependencies": {
"jquery": ">=1.4"
}
}

14
contrib/timeago-koext.js Normal file
View file

@ -0,0 +1,14 @@
ko.bindingHandlers.timeago = {
init: function (element, valueAccessor, allBindingsAccessor, viewModel, bindingContext) {
var value = valueAccessor();
var valueUnwrapped = ko.unwrap(value);
element.title = moment(valueUnwrapped).toISOString();
$(element).timeago();
},
update: function (element, valueAccessor, allBindingsAccessor, viewModel, bindingContext) {
var value = valueAccessor();
var valueUnwrapped = ko.unwrap(value);
element.title = moment(valueUnwrapped).toISOString();
$(element).timeago('update', element.title);
}
}

View file

@ -116,6 +116,15 @@ jQuery.timeago(jQuery("abbr#some_id")); //=> &quot;<span id="prog_element"></spa
<pre>
jQuery.timeago.settings.allowFuture = true;</pre>
<p class="how">
To disable timestamps in the past, use the <tt>allowPast</tt> setting.
This setting is set to true by default. When set to false, if the time is in the past then instead of displaying a message like "5 minutes ago" a static message will be displayed.
The staic message displayed can be configured with the <tt>strings.inPast</tt> setting:
</p>
<pre>
jQuery.timeago.settings.strings.inPast = "time has elapsed";
jQuery.timeago.settings.allowPast = false;</pre>
<h3>Excusez-moi?</h3>
<p>
Yes, timeago has locale/i18n/language support. Here are some <a href="https://github.com/rmm5t/jquery-timeago/tree/master/locales">configuration examples</a>. Please submit a <a href="https://github.com/rmm5t/jquery-timeago">GitHub pull request</a> for corrections or additional languages.

View file

@ -3,7 +3,7 @@
* updating fuzzy timestamps (e.g. "4 minutes ago" or "about 1 day ago").
*
* @name timeago
* @version 1.0.1
* @version 1.4.1
* @requires jQuery v1.2.3+
* @author Ryan McGeary
* @license MIT License - http://www.opensource.org/licenses/mit-license.php
@ -13,7 +13,16 @@
*
* Copyright (c) 2008-2013, Ryan McGeary (ryan -[at]- mcgeary [*dot*] org)
*/
(function($) {
(function (factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(['jquery'], factory);
} else {
// Browser globals
factory(jQuery);
}
}(function ($) {
$.timeago = function(timestamp) {
if (timestamp instanceof Date) {
return inWords(timestamp);
@ -30,12 +39,16 @@
$.extend($.timeago, {
settings: {
refreshMillis: 60000,
allowPast: true,
allowFuture: false,
localeTitle: false,
cutoff: 0,
strings: {
prefixAgo: null,
prefixFromNow: null,
suffixAgo: "ago",
suffixFromNow: "from now",
inPast: 'any moment now',
seconds: "less than a minute",
minute: "about a minute",
minutes: "%d minutes",
@ -51,7 +64,12 @@
numbers: []
}
},
inWords: function(distanceMillis) {
if(!this.settings.allowPast && ! this.settings.allowFuture) {
throw 'timeago allowPast and allowFuture settings can not both be set to false.';
}
var $l = this.settings.strings;
var prefix = $l.prefixAgo;
var suffix = $l.suffixAgo;
@ -62,6 +80,10 @@
}
}
if(!this.settings.allowPast && distanceMillis >= 0) {
return this.settings.strings.inPast;
}
var seconds = Math.abs(distanceMillis) / 1000;
var minutes = seconds / 60;
var hours = minutes / 60;
@ -90,12 +112,14 @@
if ($l.wordSeparator === undefined) { separator = " "; }
return $.trim([prefix, words, suffix].join(separator));
},
parse: function(iso8601) {
var s = $.trim(iso8601);
s = s.replace(/\.\d+/,""); // remove milliseconds
s = s.replace(/-/,"/").replace(/-/,"/");
s = s.replace(/T/," ").replace(/Z/," UTC");
s = s.replace(/([\+\-]\d\d)\:?(\d\d)/," $1$2"); // -04:00 -> -0400
s = s.replace(/([\+\-]\d\d)$/," $100"); // +09 -> +0900
return new Date(s);
},
datetime: function(elem) {
@ -108,21 +132,63 @@
}
});
$.fn.timeago = function() {
var self = this;
self.each(refresh);
var $s = $t.settings;
if ($s.refreshMillis > 0) {
setInterval(function() { self.each(refresh); }, $s.refreshMillis);
// functions that can be called via $(el).timeago('action')
// init is default when no action is given
// functions are called with context of a single element
var functions = {
init: function(){
var refresh_el = $.proxy(refresh, this);
refresh_el();
var $s = $t.settings;
if ($s.refreshMillis > 0) {
this._timeagoInterval = setInterval(refresh_el, $s.refreshMillis);
}
},
update: function(time){
var parsedTime = $t.parse(time);
$(this).data('timeago', { datetime: parsedTime });
if($t.settings.localeTitle) $(this).attr("title", parsedTime.toLocaleString());
refresh.apply(this);
},
updateFromDOM: function(){
$(this).data('timeago', { datetime: $t.parse( $t.isTime(this) ? $(this).attr("datetime") : $(this).attr("title") ) });
refresh.apply(this);
},
dispose: function () {
if (this._timeagoInterval) {
window.clearInterval(this._timeagoInterval);
this._timeagoInterval = null;
}
}
return self;
};
$.fn.timeago = function(action, options) {
var fn = action ? functions[action] : functions.init;
if(!fn){
throw new Error("Unknown function name '"+ action +"' for timeago");
}
// each over objects here and call the requested function
this.each(function(){
fn.call(this, options);
});
return this;
};
function refresh() {
//check if it's still visible
if(!$.contains(document.documentElement,this)){
//stop if it has been removed
$(this).timeago("dispose");
return this;
}
var data = prepareData(this);
var $s = $t.settings;
if (!isNaN(data.datetime)) {
$(this).text(inWords(data.datetime));
if ( $s.cutoff == 0 || Math.abs(distance(data.datetime)) < $s.cutoff) {
$(this).text(inWords(data.datetime));
}
}
return this;
}
@ -132,7 +198,9 @@
if (!element.data("timeago")) {
element.data("timeago", { datetime: $t.datetime(element) });
var text = $.trim(element.text());
if (text.length > 0 && !($t.isTime(element) && element.attr("title"))) {
if ($t.settings.localeTitle) {
element.attr("title", element.data('timeago').datetime.toLocaleString());
} else if (text.length > 0 && !($t.isTime(element) && element.attr("title"))) {
element.attr("title", text);
}
}
@ -150,4 +218,4 @@
// fix for IE6 suckage
document.createElement("abbr");
document.createElement("time");
}(jQuery));
}));

View file

@ -1,32 +1,96 @@
// Language: Arabic
// Translated By Khaled Attia < Khal3d.com >
(function() {
function numpf(num, w, x, y, z) {
if( num == 0 ) {
return w;
} else if( num == 2 ) {
return x;
} else if( num >= 3 && num <= 10) {
return y; // 3:10
} else {
return z; // 11+
}
function numpf(n, a) {
return a[plural=n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 && n%100<=10 ? 3 : n%100>=11 ? 4 : 5];
}
jQuery.timeago.settings.strings = {
jQuery.timeago.settings.strings = {
prefixAgo: "منذ",
prefixFromNow: "يتبقى",
prefixFromNow: "بعد",
suffixAgo: null,
suffixFromNow: null, // null OR "من الآن"
seconds: function(value) { return numpf(value, "لحظات", "ثانيتين", "%d ثواني", "%d ثانيه"); },
minute: "دقيقة",
minutes: function(value) { return numpf(value, null, "دقيقتين", "%d دقائق", "%d دقيقة"); },
hour: "ساعة",
hours: function(value) { return numpf(value, null, "ساعتين", "%d ساعات", "%d ساعة"); },
day: "يوم",
days: function(value) { return numpf(value, null, "يومين", "%d أيام", "%d يوم"); },
month: "شهر",
months: function(value) { return numpf(value, null, "شهرين", "%d أشهر", "%d شهر"); },
year: "سنه",
years: function(value) { return numpf(value, null, "سنتين", "%d سنوات", "%d سنه"); }
second: function(value) { return numpf(value, [
'أقل من ثانية',
'ثانية واحدة',
'ثانيتين',
'%d ثوانٍ',
'%d ثانية',
'%d ثانية']); },
seconds: function(value) { return numpf(value, [
'أقل من ثانية',
'ثانية واحدة',
'ثانيتين',
'%d ثوانٍ',
'%d ثانية',
'%d ثانية']); },
minute: function(value) { return numpf(value, [
'أقل من دقيقة',
'دقيقة واحدة',
'دقيقتين',
'%d دقائق',
'%d دقيقة',
'دقيقة']); },
minutes: function(value) { return numpf(value, [
'أقل من دقيقة',
'دقيقة واحدة',
'دقيقتين',
'%d دقائق',
'%d دقيقة',
'دقيقة']); },
hour: function(value) { return numpf(value, [
'أقل من ساعة',
'ساعة واحدة',
'ساعتين',
'%d ساعات',
'%d ساعة',
'%d ساعة']); },
hours: function(value) { return numpf(value, [
'أقل من ساعة',
'ساعة واحدة',
'ساعتين',
'%d ساعات',
'%d ساعة',
'%d ساعة']); },
day: function(value) { return numpf(value, [
'أقل من يوم',
'يوم واحد',
'يومين',
'%d أيام',
'%d يومًا',
'%d يوم']); },
days: function(value) { return numpf(value, [
'أقل من يوم',
'يوم واحد',
'يومين',
'%d أيام',
'%d يومًا',
'%d يوم']); },
month: function(value) { return numpf(value, [
'أقل من شهر',
'شهر واحد',
'شهرين',
'%d أشهر',
'%d شهرًا',
'%d شهر']); },
months: function(value) { return numpf(value, [
'أقل من شهر',
'شهر واحد',
'شهرين',
'%d أشهر',
'%d شهرًا',
'%d شهر']); },
year: function(value) { return numpf(value, [
'أقل من عام',
'عام واحد',
'%d عامين',
'%d أعوام',
'%d عامًا']);
},
years: function(value) { return numpf(value, [
'أقل من عام',
'عام واحد',
'عامين',
'%d أعوام',
'%d عامًا',
'%d عام']);}
};
})();
})();

View file

@ -0,0 +1,24 @@
// Czech
(function() {
function f(n, d, a) {
return a[d>=0 ? 0 : a.length==2 || n<5 ? 1 : 2];
}
jQuery.timeago.settings.strings = {
prefixAgo: 'před',
prefixFromNow: 'za',
suffixAgo: null,
suffixFromNow: null,
seconds: function(n, d) {return f(n, d, ['méně než minutou', 'méně než minutu'])},
minute: function(n, d) {return f(n, d, ['minutou', 'minutu'])},
minutes: function(n, d) {return f(n, d, ['%d minutami', '%d minuty', '%d minut'])},
hour: function(n, d) {return f(n, d, ['hodinou', 'hodinu'])},
hours: function(n, d) {return f(n, d, ['%d hodinami', '%d hodiny', '%d hodin'])},
day: function(n, d) {return f(n, d, ['%d dnem', '%d den'])},
days: function(n, d) {return f(n, d, ['%d dny', '%d dny', '%d dní'])},
month: function(n, d) {return f(n, d, ['%d měsícem', '%d měsíc'])},
months: function(n, d) {return f(n, d, ['%d měsící', '%d měsíce', '%d měsíců'])},
year: function(n, d) {return f(n, d, ['%d rokem', '%d rok'])},
years: function(n, d) {return f(n, d, ['%d lety', '%d roky', '%d let'])}
};
})();

View file

@ -1,18 +0,0 @@
// Czech
jQuery.timeago.settings.strings = {
prefixAgo: "před",
prefixFromNow: null,
suffixAgo: null,
suffixFromNow: null,
seconds: "méně než minutou",
minute: "minutou",
minutes: "%d minutami",
hour: "hodinou",
hours: "%d hodinami",
day: "1 dnem",
days: "%d dny",
month: "1 měsícem",
months: "%d měsíci",
year: "1 rokem",
years: "%d roky"
};

View file

@ -0,0 +1,20 @@
// Spanish shortened
jQuery.timeago.settings.strings = {
prefixAgo: null,
prefixFromNow: null,
suffixAgo: "",
suffixFromNow: "",
seconds: "1m",
minute: "1m",
minutes: "%dm",
hour: "1h",
hours: "%dh",
day: "1d",
days: "%dd",
month: "1me",
months: "%dme",
year: "1a",
years: "%da",
wordSeparator: " ",
numbers: []
};

View file

@ -0,0 +1,18 @@
// Estonian
jQuery.timeago.settings.strings = {
prefixAgo: null,
prefixFromNow: null,
suffixAgo: "tagasi",
suffixFromNow: "pärast",
seconds: function(n, d) { return d < 0 ? "vähem kui minuti aja" : "vähem kui minut aega" },
minute: function(n, d) { return d < 0 ? "umbes minuti aja" : "umbes minut aega" },
minutes: function(n, d) { return d < 0 ? "%d minuti" : "%d minutit" },
hour: function(n, d) { return d < 0 ? "umbes tunni aja" : "umbes tund aega" },
hours: function(n, d) { return d < 0 ? "%d tunni" : "%d tundi" },
day: function(n, d) { return d < 0 ? "umbes päeva" : "umbes päev" },
days: function(n, d) { return d < 0 ? "%d päeva" : "%d päeva" },
month: function(n, d) { return d < 0 ? "umbes kuu aja" : "umbes kuu aega" },
months: function(n, d) { return d < 0 ? "%d kuu" : "%d kuud" },
year: function(n, d) { return d < 0 ? "umbes aasta aja" : "umbes aasta aega" },
years: function(n, d) { return d < 0 ? "%d aasta" : "%d aastat" }
};

View file

@ -0,0 +1,16 @@
// French shortened
jQuery.timeago.settings.strings = {
prefixAgo: "il y a",
prefixFromNow: "d'ici",
seconds: "moins d'une minute",
minute: "une minute",
minutes: "%d minutes",
hour: "une heure",
hours: "%d heures",
day: "un jour",
days: "%d jours",
month: "un mois",
months: "%d mois",
year: "un an",
years: "%d ans"
};

View file

@ -0,0 +1,18 @@
// Galician
jQuery.timeago.settings.strings = {
prefixAgo: "hai",
prefixFromNow: "dentro de",
suffixAgo: "",
suffixFromNow: "",
seconds: "menos dun minuto",
minute: "un minuto",
minutes: "uns %d minutos",
hour: "unha hora",
hours: "%d horas",
day: "un día",
days: "%d días",
month: "un mes",
months: "%d meses",
year: "un ano",
years: "%d anos"
};

View file

@ -1,7 +1,7 @@
// Hebrew
jQuery.timeago.settings.strings = {
prefixAgo: "לפני",
prefixFromNow: "מעכשיו",
prefixFromNow: "עוד",
suffixAgo: "",
suffixFromNow: "",
seconds: "פחות מדקה",
@ -15,4 +15,4 @@ jQuery.timeago.settings.strings = {
months: "%d חודשים",
year: "שנה",
years: "%d שנים"
};
};

View file

@ -12,7 +12,7 @@ jQuery.timeago.settings.strings = {
day: "sehari",
days: "%d hari",
month: "sekitar sebulan",
months: "%d tahun",
months: "%d bulan",
year: "sekitar setahun",
years: "%d tahun"
};
};

View file

@ -0,0 +1,19 @@
jQuery.timeago.settings.strings = {
prefixAgo: "fyrir",
prefixFromNow: "eftir",
suffixAgo: "síðan",
suffixFromNow: null,
seconds: "minna en mínútu",
minute: "mínútu",
minutes: "%d mínútum",
hour: "klukkutíma",
hours: "um %d klukkutímum",
day: "degi",
days: "%d dögum",
month: "mánuði",
months: "%d mánuðum",
year: "ári",
years: "%d árum",
wordSeparator: " ",
numbers: []
};

View file

@ -4,16 +4,16 @@ jQuery.timeago.settings.strings = {
prefixFromNow: "今から",
suffixAgo: "前",
suffixFromNow: "後",
seconds: "ほんの数秒",
minute: "約分",
seconds: "1 分未満",
minute: "約 1 分",
minutes: "%d 分",
hour: "大体一時間",
hours: "大体 %d 時間位",
day: "日",
days: "%d 日ほど",
month: "大体一ヶ月",
months: "%d ヶ月ほど",
year: "1年前",
years: "%d 年",
hour: "約 1 時間",
hours: "約 %d 時間",
day: "約 1 日",
days: "%d 日",
month: "約 1 月",
months: "約 %d 月",
year: "約 1 年",
years: "%d 年",
wordSeparator: ""
};
};

View file

@ -0,0 +1,18 @@
// Javanesse (Boso Jowo)
jQuery.timeago.settings.strings = {
prefixAgo: null,
prefixFromNow: null,
suffixAgo: "kepungkur",
suffixFromNow: "seko saiki",
seconds: "kurang seko sakmenit",
minute: "kurang luwih sakmenit",
minutes: "%d menit",
hour: "kurang luwih sakjam",
hours: "kurang luwih %d jam",
day: "sedina",
days: "%d dina",
month: "kurang luwih sewulan",
months: "%d wulan",
year: "kurang luwih setahun",
years: "%d tahun"
};

View file

@ -0,0 +1,20 @@
//Lithuanian
jQuery.timeago.settings.strings = {
prefixAgo: "prieš",
prefixFromNow: null,
suffixAgo: null,
suffixFromNow: "nuo dabar",
seconds: "%d sek.",
minute: "min.",
minutes: "%d min.",
hour: "val.",
hours: "%d val.",
day: "1 d.",
days: "%d d.",
month: "mėn.",
months: "%d mėn.",
year: "metus",
years: "%d metus",
wordSeparator: " ",
numbers: []
};

View file

@ -1,16 +1,18 @@
// Brazilian Portuguese
jQuery.timeago.settings.strings = {
suffixAgo: "atrás",
suffixFromNow: "nesse momento",
prefixAgo: "há",
prefixFromNow: "em",
suffixAgo: null,
suffixFromNow: null,
seconds: "alguns segundos",
minute: "há um minuto",
minutes: "%d minutos",
hour: "uma hora",
hours: "%d horas",
day: "um dia",
days: "%d dias",
month: "um mês",
months: "%d meses",
year: "um ano",
years: "%d anos"
minute: "um minuto",
minutes: "%d minutos",
hour: "uma hora",
hours: "%d horas",
day: "um dia",
days: "%d dias",
month: "um mês",
months: "%d meses",
year: "um ano",
years: "%d anos"
};

View file

@ -1,5 +1,5 @@
// Romanian
$.timeago.settings.strings = {
jQuery.timeago.settings.strings = {
prefixAgo: "acum",
prefixFromNow: "in timp de",
suffixAgo: "",
@ -15,4 +15,4 @@ $.timeago.settings.strings = {
months: "%d luni",
year: "un an",
years: "%d ani"
};
};

View file

@ -0,0 +1,49 @@
// Serbian
(function () {
var numpf;
numpf = function (n, f, s, t) {
var n10;
n10 = n % 10;
if (n10 === 1 && (n === 1 || n > 20)) {
return f;
} else if (n10 > 1 && n10 < 5 && (n > 20 || n < 10)) {
return s;
} else {
return t;
}
};
jQuery.timeago.settings.strings = {
prefixAgo: "pre",
prefixFromNow: "za",
suffixAgo: null,
suffixFromNow: null,
second: "sekund",
seconds: function (value) {
return numpf(value, "%d sekund", "%d sekunde", "%d sekundi");
},
minute: "oko minut",
minutes: function (value) {
return numpf(value, "%d minut", "%d minuta", "%d minuta");
},
hour: "oko jedan sat",
hours: function (value) {
return numpf(value, "%d sat", "%d sata", "%d sati");
},
day: "jedan dan",
days: function (value) {
return numpf(value, "%d dan", "%d dana", "%d dana");
},
month: "mesec dana",
months: function (value) {
return numpf(value, "%d mesec", "%d meseca", "%d meseci");
},
year: "godinu dana",
years: function (value) {
return numpf(value, "%d godinu", "%d godine", "%d godina");
},
wordSeparator: " "
};
}).call(this);

View file

@ -0,0 +1,18 @@
// Slovak
jQuery.timeago.settings.strings = {
prefixAgo: "pred",
prefixFromNow: null,
suffixAgo: null,
suffixFromNow: null,
seconds: "menej než minútou",
minute: "minútou",
minutes: "%d minútami",
hour: "hodinou",
hours: "%d hodinami",
day: "1 dňom",
days: "%d dňami",
month: "1 mesiacom",
months: "%d mesiacmi",
year: "1 rokom",
years: "%d rokmi"
};

View file

@ -0,0 +1,44 @@
// Slovenian with support for dual
(function () {
var numpf;
numpf = function (n, d, m) {
if (n == 2) {
return d;
} else {
return m;
}
};
jQuery.timeago.settings.strings = {
prefixAgo: "pred",
prefixFromNow: "čez",
suffixAgo: null,
suffixFromNow: null,
second: "sekundo",
seconds: function (value) {
return numpf(value, "%d sekundama", "%d sekundami");
},
minute: "minuto",
minutes: function (value) {
return numpf(value, "%d minutama", "%d minutami");
},
hour: "uro",
hours: function (value) {
return numpf(value, "%d urama", "%d urami");
},
day: "dnevom",
days: function (value) {
return numpf(value, "%d dnevi", "%d dnevi");
},
month: "enim mescem",
months: function (value) {
return numpf(value, "%d mesecema", "%d meseci");
},
year: "enim letom",
years: function (value) {
return numpf(value, "%d letoma", "%d leti");
},
wordSeparator: " "
};
}).call(this);

View file

@ -1,5 +1,5 @@
// Turkish
jQuery.extend($.timeago.settings.strings, {
jQuery.timeago.settings.strings = {
suffixAgo: 'önce',
suffixFromNow: null,
seconds: '1 dakikadan',
@ -13,4 +13,4 @@ jQuery.extend($.timeago.settings.strings, {
months: '%d ay',
year: '1 yıl',
years: '%d yıl'
});
};

View file

@ -0,0 +1,20 @@
// Vietnamese
jQuery.timeago.settings.strings = {
prefixAgo: 'cách đây',
prefixFromNow: null,
suffixAgo: null,
suffixFromNow: "trước",
seconds: "chưa đến một phút",
minute: "khoảng một phút",
minutes: "%d phút",
hour: "khoảng một tiếng",
hours: "khoảng %d tiếng",
day: "một ngày",
days: "%d ngày",
month: "khoảng một tháng",
months: "%d tháng",
year: "khoảng một năm",
years: "%d năm",
wordSeparator: " ",
numbers: []
};

View file

@ -4,17 +4,17 @@ jQuery.timeago.settings.strings = {
prefixFromNow: "从现在开始",
suffixAgo: "之前",
suffixFromNow: null,
seconds: "不到 1 分钟",
minute: "大约 1 分钟",
minutes: "%d 分钟",
hour: "大约 1 小时",
hours: "大约 %d 小时",
day: "1 天",
days: "%d 天",
month: "大约 1 个月",
months: "%d 月",
year: "大约 1 年",
years: "%d 年",
seconds: "不到1分钟",
minute: "大约1分钟",
minutes: "%d分钟",
hour: "大约1小时",
hours: "大约%d小时",
day: "1天",
days: "%d天",
month: "大约1个月",
months: "%d月",
year: "大约1年",
years: "%d年",
numbers: [],
wordSeparator: ""
};
};

View file

@ -4,17 +4,17 @@ jQuery.timeago.settings.strings = {
prefixFromNow: "從現在開始",
suffixAgo: "之前",
suffixFromNow: null,
seconds: "不到 1 分鐘",
minute: "大約 1 分鐘",
minutes: "%d 分鐘",
hour: "大約 1 小時",
hours: "大約 %d 小時",
day: "1 天",
days: "%d 天",
month: "大約 1 個月",
months: "%d 月",
year: "大約 1 年",
years: "%d 年",
seconds: "不到1分鐘",
minute: "大約1分鐘",
minutes: "%d分鐘",
hour: "大約1小時",
hours: "%d小時",
day: "大約1天",
days: "%d天",
month: "大約1個月",
months: "%d月",
year: "大約1年",
years: "%d年",
numbers: [],
wordSeparator: ""
};
};

1
public
View file

@ -1 +0,0 @@
.

View file

@ -1,26 +1,13 @@
<!DOCTYPE html>
<html>
<head>
<title>JavaScript unit test file</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<!-- use http://code.jquery.com/jquery-latest.js for the latest jQuery -->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script>
<!-- http://dev.jquery.com/view/trunk/qunit/testrunner.js -->
<script src="qunit.js" type="text/javascript"></script>
<script src="../jquery.timeago.js" type="text/javascript"></script>
<!-- http://dev.jquery.com/view/trunk/qunit/testsuite.css -->
<link rel="stylesheet" href="qunit.css" type="text/css" media="screen" />
<meta charset="utf-8">
<title>jQuery-Timeago Test Suite</title>
<link rel="stylesheet" href="http://code.jquery.com/qunit/qunit-1.11.0.css">
</head>
<body>
<h1 id="qunit-header">jquery-timeago Test Suite</h1>
<h2 id="qunit-banner"></h2>
<div id="qunit-testrunner-toolbar"></div>
<h2 id="qunit-userAgent"></h2>
<ol id="qunit-tests"></ol>
<div id="qunit"></div>
<div id="qunit-fixture"></div>
<div id="main">
<h2>Short term</h2>
@ -76,6 +63,16 @@
<p><time id="testTimeTitle" class="timeago" datetime="2012-05-07T10:06:02+02:00" title="May 10, 2012 10:06">May 10, 2012</time></p>
<p><time id="testTimeTitle2" class="timeago" datetime="2012-05-07T10:06:02+02:00">May 10, 2012</time></p>
<h2>Cutoff</h2>
<p>Date that is before a past cutoff: <abbr class="timeago cutoff doCutoffPast" title="1978-12-18">(this should be displayed)</abbr></p>
<p>Date that is after a past cutoff: <abbr class="timeago loaded cutoff dontCutoffPast">(you shouldn't see this)</abbr></p>
<p>Date that is past a future cutoff: <abbr class="timeago cutoff doCutoffFuture" title="2999-12-18">(this should be displayed)</abbr></p>
<p>Date that is before a future cutoff: <abbr class="timeago loaded cutoff dontCutoffFuture">(you shouldn't see this)</abbr></p>
<h2>Errors</h2>
<p>Bad (letters): <abbr class="bad timeago" title="bleh">(this should be displayed)</abbr>.</p>
@ -97,6 +94,7 @@
<li><abbr id="testParsing9" class="todate" title="1978-12-18 17:17:00.021432Z"></abbr> [from Z with microseconds]</li>
<li><abbr id="testParsing10" class="todate" title="1978-12-18 17:17:00.0Z"></abbr> [from Z with tenths of a second]</li>
<li><abbr id="testParsing11" class="todate" title="1978-12-18 17:17:00.02Z"></abbr> [from Z with hundreths of a second]</li>
<li><abbr id="testParsing12" class="todate" title="1978-12-19T02:17:00+09"></abbr> [from +09]</li>
</ul>
<h2>Wording</h2>
@ -195,8 +193,28 @@
<li><abbr id="testMillisSettings8" class="tomillis" title="90"></abbr> [90 sec]</li>
<li><abbr id="testMillisSettings9" class="tomillis" title="120"></abbr> [120 sec]</li>
</ul>
<h2>Do Not Allow Future</h2>
<ul>
<li><abbr id="testAllowFutureFalse1" class="doNotAllowFuture" title="2012-01-01T09:24:17Z">(you shouldn't see this)</abbr></li>
</ul>
<h2>Do Not Allow Past</h2>
<ul>
<li><abbr id="testAllowPastFalse1" class="doNotAllowPast" title="2008-01-01T09:24:17Z">(you shouldn't see this)</abbr></li>
<li><abbr id="testAllowPastAndFutureFalse" title="2008-01-01T09:24:17Z"></abbr></li>
</ul>
<h2>Disposal</h2>
<p><abbr class="disposal disposed"></abbr></p>
<p><abbr class="disposal notDisposed"></abbr></p>
</div>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script src="http://code.jquery.com/qunit/qunit-1.11.0.js"></script>
<script src="../jquery.timeago.js"></script>
<script src="test_helpers.js" type="text/javascript"></script>
<script type="text/javascript">
//<![CDATA[
@ -222,9 +240,13 @@
prepareDynamicDates();
$("abbr.timeago").timeago();
$("abbr.timeago").not("abbr.cutoff").timeago();
$("time.timeago").timeago();
loadCutoffSetting();
$("abbr.cutoff").timeago();
unloadCutoffSetting();
var tooltip = $("#testTooltip").data("timeago");
$("abbr.todate").each(function () {
@ -238,6 +260,16 @@
$("abbr.tonumbers").each(toWords);
unloadNumbers();
loadDoNotAllowFuture();
$("abbr.doNotAllowFuture").timeago();
unloadDoNotAllowFuture();
loadDoNotAllowPast();
$("abbr.doNotAllowPast").timeago();
unloadDoNotAllowPast();
setupDisposal();
loadYoungOldYears();
$("abbr.toyoungold").each(toWords);
@ -301,6 +333,32 @@
ok(tooltip.datetime, "datetime set");
});
module("Cutoff");
test("should not change dates older than cutoff setting", function () {
ok(testElements("abbr.doCutoffPast", function (element) {
return (element.html() === "(this should be displayed)");
}), "Cutoff setting working fine");
});
test("should change dates newer than cutoff setting", function () {
ok(testElements("abbr.dontCutoffPast", function (element) {
return (element.html() === "less than a minute ago");
}), "Cutoff setting working fine");
});
test("should not change dates older than cutoff setting", function () {
ok(testElements("abbr.doCutoffFuture", function (element) {
return (element.html() === "(this should be displayed)");
}), "Cutoff setting working fine");
});
test("should change dates newer than cutoff setting", function () {
ok(testElements("abbr.dontCutoffFuture", function (element) {
return (element.html() === "less than a minute ago");
}), "Cutoff setting working fine");
});
module("Tooltip");
test("should set title to original text contents", function () {
@ -326,154 +384,159 @@
test("From Z", function () {
var time = $("#testParsing1");
ok((time.html().match(correctMatch)), "Correctly parsed " + time.attr("title"));
ok((time.html().match(correctMatch)), "Incorrectly parsed " + time.attr("title"));
});
test("From -00:00", function () {
var time = $("#testParsing2");
ok((time.html().match(correctMatch)), "Correctly parsed " + time.attr("title"));
ok((time.html().match(correctMatch)), "Incorrectly parsed " + time.attr("title"));
});
test("From -05:00", function () {
var time = $("#testParsing3");
ok((time.html().match(correctMatch)), "Correctly parsed " + time.attr("title"));
ok((time.html().match(correctMatch)), "Incorrectly parsed " + time.attr("title"));
});
test("From -0500", function () {
var time = $("#testParsing4");
ok((time.html().match(correctMatch)), "Correctly parsed " + time.attr("title"));
ok((time.html().match(correctMatch)), "Incorrectly parsed " + time.attr("title"));
});
test("From +09:00", function () {
var time = $("#testParsing5");
ok((time.html().match(correctMatch)), "Correctly parsed " + time.attr("title"));
ok((time.html().match(correctMatch)), "Incorrectly parsed " + time.attr("title"));
});
test("From +0900", function () {
var time = $("#testParsing6");
ok((time.html().match(correctMatch)), "Correctly parsed " + time.attr("title"));
ok((time.html().match(correctMatch)), "Incorrectly parsed " + time.attr("title"));
});
test("From blank TZ", function () {
var time = $("#testParsing7");
var correctMatch = /Mon, 18 Dec 1978 \d\d:17:00 (GMT|UTC)/;
ok((time.html().match(correctMatch)), "Correctly parsed " + time.attr("title"));
ok((time.html().match(correctMatch)), "Incorrectly parsed " + time.attr("title"));
});
test("From Z with milliseconds", function () {
var time = $("#testParsing8");
ok((time.html().match(correctMatch)), "Correctly parsed " + time.attr("title"));
ok((time.html().match(correctMatch)), "Incorrectly parsed " + time.attr("title"));
});
test("From Z with microseconds", function () {
var time = $("#testParsing9");
ok((time.html().match(correctMatch)), "Correctly parsed " + time.attr("title"));
ok((time.html().match(correctMatch)), "Incorrectly parsed " + time.attr("title"));
});
test("From Z with tenths of a second", function () {
var time = $("#testParsing10");
ok((time.html().match(correctMatch)), "Correctly parsed " + time.attr("title"));
ok((time.html().match(correctMatch)), "Incorrectly parsed " + time.attr("title"));
});
test("From Z with hundreths of a second", function () {
var time = $("#testParsing11");
ok((time.html().match(correctMatch)), "Correctly parsed " + time.attr("title"));
ok((time.html().match(correctMatch)), "Incorrectly parsed " + time.attr("title"));
});
test("From +09", function () {
var time = $("#testParsing12");
ok((time.html().match(correctMatch)), "Incorrectly parsed " + time.attr("title"));
});
module("Wording");
test("-120 min", function () {
ok(($("#testWording1").html() === "about 2 hours from now"), "Correctly parsed");
ok(($("#testWording1").html() === "about 2 hours from now"), "Incorrectly parsed");
});
test("-60 sec", function () {
ok(($("#testWording2").html() === "about a minute from now"), "Correctly parsed");
ok(($("#testWording2").html() === "about a minute from now"), "Incorrectly parsed");
});
test("-30 sec", function () {
ok(($("#testWording3").html() === "less than a minute from now"), "Correctly parsed");
ok(($("#testWording3").html() === "less than a minute from now"), "Incorrectly parsed");
});
test("-1 sec", function () {
ok(($("#testWording4").html() === "less than a minute from now"), "Correctly parsed");
ok(($("#testWording4").html() === "less than a minute from now"), "Incorrectly parsed");
});
test("0 sec", function () {
ok(($("#testWording5").html() === "less than a minute ago"), "Correctly parsed");
ok(($("#testWording5").html() === "less than a minute ago"), "Incorrectly parsed");
});
test("30 sec", function () {
ok(($("#testWording6").html() === "less than a minute ago"), "Correctly parsed");
ok(($("#testWording6").html() === "less than a minute ago"), "Incorrectly parsed");
});
test("45 sec", function () {
ok(($("#testWording7").html() === "about a minute ago"), "Correctly parsed");
ok(($("#testWording7").html() === "about a minute ago"), "Incorrectly parsed");
});
test("90 sec", function () {
ok(($("#testWording8").html() === "2 minutes ago"), "Correctly parsed");
ok(($("#testWording8").html() === "2 minutes ago"), "Incorrectly parsed");
});
test("120 sec", function () {
ok(($("#testWording9").html() === "2 minutes ago"), "Correctly parsed");
ok(($("#testWording9").html() === "2 minutes ago"), "Incorrectly parsed");
});
test("45 min", function () {
ok(($("#testWording10").html() === "about an hour ago"), "Correctly parsed");
ok(($("#testWording10").html() === "about an hour ago"), "Incorrectly parsed");
});
test("89 min", function () {
ok(($("#testWording11").html() === "about an hour ago"), "Correctly parsed");
ok(($("#testWording11").html() === "about an hour ago"), "Incorrectly parsed");
});
test("90 min", function () {
ok(($("#testWording12").html() === "about 2 hours ago"), "Correctly parsed");
ok(($("#testWording12").html() === "about 2 hours ago"), "Incorrectly parsed");
});
test("120 min", function () {
ok(($("#testWording13").html() === "about 2 hours ago"), "Correctly parsed");
ok(($("#testWording13").html() === "about 2 hours ago"), "Incorrectly parsed");
});
test("1380 min", function () {
ok(($("#testWording14").html() === "about 23 hours ago"), "Correctly parsed");
ok(($("#testWording14").html() === "about 23 hours ago"), "Incorrectly parsed");
});
test("25 hours", function () {
ok(($("#testWording15").html() === "a day ago"), "Correctly parsed");
ok(($("#testWording15").html() === "a day ago"), "Incorrectly parsed");
});
test("41 hour", function () {
ok(($("#testWording16a").html() === "a day ago"), "Correctly parsed");
ok(($("#testWording16a").html() === "a day ago"), "Incorrectly parsed");
});
test("42 hours", function () {
ok(($("#testWording16b").html() === "2 days ago"), "Correctly parsed");
ok(($("#testWording16b").html() === "2 days ago"), "Incorrectly parsed");
});
test("48 hours", function () {
ok(($("#testWording16c").html() === "2 days ago"), "Correctly parsed");
ok(($("#testWording16c").html() === "2 days ago"), "Incorrectly parsed");
});
test("696 hours", function () {
ok(($("#testWording17").html() === "29 days ago"), "Correctly parsed");
ok(($("#testWording17").html() === "29 days ago"), "Incorrectly parsed");
});
test("30 days", function () {
ok(($("#testWording18").html() === "about a month ago"), "Correctly parsed");
ok(($("#testWording18").html() === "about a month ago"), "Incorrectly parsed");
});
test("190 days", function () {
ok(($("#testWording19").html() === "6 months ago"), "Correctly parsed");
ok(($("#testWording19").html() === "6 months ago"), "Incorrectly parsed");
});
test("366 days", function () {
ok(($("#testWording20").html() === "about a year ago"), "Correctly parsed");
ok(($("#testWording20").html() === "about a year ago"), "Incorrectly parsed");
});
test("725 days", function () {
ok(($("#testWording21").html() === "2 years ago"), "Correctly parsed");
ok(($("#testWording21").html() === "2 years ago"), "Incorrectly parsed");
});
test("1095 days", function () {
ok(($("#testWording22").html() === "3 years ago"), "Correctly parsed");
ok(($("#testWording22").html() === "3 years ago"), "Incorrectly parsed");
});
module("Settings");
@ -568,6 +631,58 @@
ok($("#testNoSpaces1").html().match(/^2minutesago$/), "Settings correctly applied");
ok($("#testNullSpaces1").html().match(/^2minutesago$/), "Settings correctly applied");
});
module("Allow Future and Past");
// if allowFuture is false, then a minute into the future is actually reported as a minute in the past.
// we did not want to alter the current behavior and break backwards compatability
test("allow future false with a future date moves time backwards", function () {
equal($("#testAllowFutureFalse1").html(), "2 years ago");
});
test("allow future false with a future date moves time backwards", function () {
equal($("#testAllowPastFalse1").html(), "in the past");
});
test("throws if allowPast and allowFuture are both false", function () {
// setup
var origAllowFuture = $.timeago.settings.allowFuture;
var origAllowPast = $.timeago.settings.allowPast;
$.timeago.settings.allowFuture = false;
$.timeago.settings.allowPast = false;
try {
throws(function () {
$("#testAllowPastAndFutureFalse").timeago();
});
} finally {
// teardown
$.timeago.settings.allowFuture = origAllowFuture;
$.timeago.settings.allowPast = origAllowPast;
}
});
module("Disposal");
asyncTest("disposal", function() {
$(".disposal.disposed").timeago('dispose');
var initialTime_disposedTimeago = $(".disposal.disposed").html();
var initialTime_activeTimeago = $(".disposal.notDisposed").html();
expect(2);
setTimeout(function() {
var updatedTime_disposedTimeago = $(".disposal.disposed").html();
var updatedTime_activeTimeago = $(".disposal.notDisposed").html();
ok(initialTime_disposedTimeago === updatedTime_disposedTimeago, "A disposed timeago didn't get updated");
ok(initialTime_activeTimeago !== updatedTime_activeTimeago, "A non-disposed timeago continued to be updated");
// Dispose still-active timeago
$(".disposal.notDisposed").timeago('dispose');
resetRefreshMillis();
start();
}, 50);
});
})(jQuery);
//]]>
</script>

View file

@ -1,196 +0,0 @@
/** Font Family and Sizes */
#qunit-tests, #qunit-header, #qunit-banner, #qunit-testrunner-toolbar, #qunit-userAgent, #qunit-testresult {
font-family: "Helvetica Neue Light", "HelveticaNeue-Light", "Helvetica Neue", Calibri, Helvetica, Arial;
}
#qunit-testrunner-toolbar, #qunit-userAgent, #qunit-testresult, #qunit-tests li { font-size: small; }
#qunit-tests { font-size: smaller; }
/** Resets */
#qunit-tests, #qunit-tests ol, #qunit-header, #qunit-banner, #qunit-userAgent, #qunit-testresult {
margin: 0;
padding: 0;
}
/** Header */
#qunit-header {
padding: 0.5em 0 0.5em 1em;
color: #8699a4;
background-color: #0d3349;
font-size: 1.5em;
line-height: 1em;
font-weight: normal;
border-radius: 15px 15px 0 0;
-moz-border-radius: 15px 15px 0 0;
-webkit-border-top-right-radius: 15px;
-webkit-border-top-left-radius: 15px;
}
#qunit-header a {
text-decoration: none;
color: #c2ccd1;
}
#qunit-header a:hover,
#qunit-header a:focus {
color: #fff;
}
#qunit-banner {
height: 5px;
}
#qunit-testrunner-toolbar {
padding: 0em 0 0.5em 2em;
}
#qunit-userAgent {
padding: 0.5em 0 0.5em 2.5em;
background-color: #2b81af;
color: #fff;
text-shadow: rgba(0, 0, 0, 0.5) 2px 2px 1px;
}
/** Tests: Pass/Fail */
#qunit-tests {
list-style-position: inside;
}
#qunit-tests li {
padding: 0.4em 0.5em 0.4em 2.5em;
border-bottom: 1px solid #fff;
list-style-position: inside;
}
#qunit-tests li strong {
cursor: pointer;
}
#qunit-tests ol {
margin-top: 0.5em;
padding: 0.5em;
background-color: #fff;
border-radius: 15px;
-moz-border-radius: 15px;
-webkit-border-radius: 15px;
box-shadow: inset 0px 2px 13px #999;
-moz-box-shadow: inset 0px 2px 13px #999;
-webkit-box-shadow: inset 0px 2px 13px #999;
}
#qunit-tests table {
border-collapse: collapse;
margin-top: .2em;
}
#qunit-tests th {
text-align: right;
vertical-align: top;
padding: 0 .5em 0 0;
}
#qunit-tests td {
vertical-align: top;
}
#qunit-tests pre {
margin: 0;
white-space: pre-wrap;
word-wrap: break-word;
}
#qunit-tests del {
background-color: #e0f2be;
color: #374e0c;
text-decoration: none;
}
#qunit-tests ins {
background-color: #ffcaca;
color: #500;
text-decoration: none;
}
/*** Test Counts */
#qunit-tests b.counts { color: black; }
#qunit-tests b.passed { color: #5E740B; }
#qunit-tests b.failed { color: #710909; }
#qunit-tests li li {
margin: 0.5em;
padding: 0.4em 0.5em 0.4em 0.5em;
background-color: #fff;
border-bottom: none;
list-style-position: inside;
}
/*** Passing Styles */
#qunit-tests li li.pass {
color: #5E740B;
background-color: #fff;
border-left: 26px solid #C6E746;
}
#qunit-tests .pass { color: #528CE0; background-color: #D2E0E6; }
#qunit-tests .pass .test-name { color: #366097; }
#qunit-tests .pass .test-actual,
#qunit-tests .pass .test-expected { color: #999999; }
#qunit-banner.qunit-pass { background-color: #C6E746; }
/*** Failing Styles */
#qunit-tests li li.fail {
color: #710909;
background-color: #fff;
border-left: 26px solid #EE5757;
}
#qunit-tests .fail { color: #000000; background-color: #EE5757; }
#qunit-tests .fail .test-name,
#qunit-tests .fail .module-name { color: #000000; }
#qunit-tests .fail .test-actual { color: #EE5757; }
#qunit-tests .fail .test-expected { color: green; }
#qunit-banner.qunit-fail,
#qunit-testrunner-toolbar { background-color: #EE5757; }
/** Footer */
#qunit-testresult {
padding: 0.5em 0.5em 0.5em 2.5em;
color: #2b81af;
background-color: #D2E0E6;
border-radius: 0 0 15px 15px;
-moz-border-radius: 0 0 15px 15px;
-webkit-border-bottom-right-radius: 15px;
-webkit-border-bottom-left-radius: 15px;
}
/** Fixture */
#qunit-fixture {
position: absolute;
top: -10000px;
left: -10000px;
}

File diff suppressed because it is too large Load diff

View file

@ -1,23 +0,0 @@
setupFn = -> null
window.setup = (fn) ->
setupFn = fn
window.moreSetup = (fn) ->
origSetup = setupFn
setup ->
origSetup.call(this)
fn.call(this)
window.clearSetup = ->
setup -> null
originalModule = window.module
window.module = (description) ->
clearSetup()
originalModule(description)
originalTest = window.test
window.test = (description, testFn) ->
setupSnapshot = setupFn
originalTest description, ->
context = {}
setupSnapshot.call(context)
testFn.call(context)

View file

@ -1,38 +0,0 @@
(function() {
var originalModule, originalTest, setupFn;
setupFn = function() {
return null;
};
window.setup = function(fn) {
return (setupFn = fn);
};
window.moreSetup = function(fn) {
var origSetup;
origSetup = setupFn;
return setup(function() {
origSetup.call(this);
return fn.call(this);
});
};
window.clearSetup = function() {
return setup(function() {
return null;
});
};
originalModule = window.module;
window.module = function(description) {
clearSetup();
return originalModule(description);
};
originalTest = window.test;
window.test = function(description, testFn) {
var setupSnapshot;
setupSnapshot = setupFn;
return originalTest(description, function() {
var context;
context = {};
setupSnapshot.call(context);
return testFn.call(context);
});
};
}).call(this);

View file

@ -22,6 +22,19 @@ function unloadNumbers() {
jQuery.timeago.settings.strings.numbers = [];
}
function loadCutoffSetting() {
jQuery.timeago.settings.cutoff = 7*24*60*60*1000;
}
function unloadCutoffSetting() {
jQuery.timeago.settings.cutoff = 0;
}
function setupDisposal() {
jQuery.timeago.settings.refreshMillis = 50;
$('abbr.disposal').attr("title", iso8601(new Date())).timeago();
}
function loadPigLatin() {
jQuery.timeago.settings.strings = {
suffixAgo: "ago-hay",
@ -76,6 +89,10 @@ function loadRussian() {
})();
}
function resetRefreshMillis() {
jQuery.timeago.settings.refreshMillis = 60000;
}
function loadMillis() {
var millisSubstitution = function(number, millis) { return millis + " milliseconds"; };
jQuery.timeago.settings.strings = {
@ -114,3 +131,49 @@ function loadYoungOldYears() {
years: function(value) { return (value < 21) ? "%d young years" : "%d old years"; }
});
}
function loadDoNotAllowFuture() {
var mockDateToUse = "2010-01-01";
$.timeago.settings.allowFuture = false;
enableMockedDate(mockDateToUse);
}
function unloadDoNotAllowFuture() {
$.timeago.settings.allowFuture = true;
disableMockedDate();
}
function loadDoNotAllowPast() {
var mockDateToUse = "2010-01-01";
$.timeago.settings.allowFuture = true;
$.timeago.settings.allowPast = false;
$.timeago.settings.strings.inPast = "in the past";
enableMockedDate(mockDateToUse);
}
function unloadDoNotAllowPast() {
$.timeago.settings.allowFuture = true;
$.timeago.settings.allowPast = true;
disableMockedDate();
}
function enableMockedDate(dateToReturn) {
var mockDate = dateToReturn;
window.NativeDate = Date;
window.Date = function () {
if(arguments.length === 0) {
return new window.NativeDate(mockDate);
} else if(arguments.length === 1) {
return new window.NativeDate(arguments[0]);
} else if(arguments.length === 7) {
return new window.NativeDate(arguments[0], arguments[1], arguments[2], arguments[3], arguments[4], arguments[5], arguments[6]);
} else {
throw "Mocking Date with this number of parameters is not implemented.";
}
}
}
function disableMockedDate() {
window.Date = window.NativeDate;
delete window.NativeDate;
}

View file

@ -1,6 +1,6 @@
{
"name": "timeago",
"version": "1.0.1",
"version": "1.4.1",
"title": "jQuery Timeago",
"author": {
"name": "Ryan McGeary",