Skip to content

Commit

Permalink
Fixed a typo in coffee and generate the js by coffee.
Browse files Browse the repository at this point in the history
  • Loading branch information
poshboytl committed Aug 24, 2012
1 parent 7457a71 commit 6f104ff
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 18 deletions.
3 changes: 2 additions & 1 deletion lib/locales/timeago.en.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions lib/locales/timeago.es.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions lib/locales/timeago.fr.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion lib/locales/timeago.pt-br.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 10 additions & 9 deletions lib/locales/timeago.zh-cn.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 11 additions & 6 deletions lib/timeago.js
@@ -1,10 +1,9 @@
// Smart Time Ago v0.1.0

// Copyright 2012, Terry Tai, Pragmatic.ly
// https://pragmatic.ly/
// Licensed under the MIT license.
// https://github.com/pragmaticly/smart-time-ago/blob/master/LICENSE

// Generated by CoffeeScript 1.3.3
(function() {
var TimeAgo;

Expand Down Expand Up @@ -84,7 +83,7 @@
TimeAgo.prototype.timeAgoInWords = function(timeString) {
var absolutTime;
absolutTime = this.parse(timeString);
return this.distanceOfTimeInWords(absolutTime) + (this.options.lang.suffix);
return this.distanceOfTimeInWords(absolutTime) + ("" + this.options.lang.suffix);
};

TimeAgo.prototype.parse = function(iso8601) {
Expand Down Expand Up @@ -140,13 +139,19 @@
})();

$.fn.timeago = function(options) {
if (options == null) options = {};
if (options == null) {
options = {};
}
return this.each(function() {
var $this, data;
$this = $(this);
data = $this.data("timeago");
if (!data) $this.data("timeago", new TimeAgo(this, options));
if (typeof options === 'string') return data[options]();
if (!data) {
$this.data("timeago", new TimeAgo(this, options));
}
if (typeof options === 'string') {
return data[options]();
}
});
};

Expand Down
2 changes: 1 addition & 1 deletion src/timeago.coffee
Expand Up @@ -65,7 +65,7 @@ class TimeAgo

timeAgoInWords: (timeString) ->
absolutTime = @parse(timeString)
@distanceOfTimeInWords(absolutTime) + "#{@options.suffix}"
@distanceOfTimeInWords(absolutTime) + "#{@options.lang.suffix}"

parse: (iso8601) ->
timeStr = $.trim(iso8601)
Expand Down

0 comments on commit 6f104ff

Please sign in to comment.