vendor/assets/javascripts/jquery.timeago.js in rails-timeago-1.0.0 vs vendor/assets/javascripts/jquery.timeago.js in rails-timeago-1.1.0

- old
+ new

@@ -1,20 +1,20 @@ /** -* 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"). -* -* @name timeago -* @version 0.10.0 -* @requires jQuery v1.2.3+ -* @author Ryan McGeary -* @license MIT License - http://www.opensource.org/licenses/mit-license.php -* -* For usage and examples, visit: -* http://timeago.yarp.com/ -* -* Copyright (c) 2008-2011, Ryan McGeary (ryanonjavascript -[at]- mcgeary [*dot*] org) -*/ + * 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"). + * + * @name timeago + * @version 0.11 + * @requires jQuery v1.2.3+ + * @author Ryan McGeary + * @license MIT License - http://www.opensource.org/licenses/mit-license.php + * + * For usage and examples, visit: + * http://timeago.yarp.com/ + * + * Copyright (c) 2008-2011, Ryan McGeary (ryanonjavascript -[at]- mcgeary [*dot*] org) + */ (function($) { $.timeago = function(timestamp) { if (timestamp instanceof Date) { return inWords(timestamp); } else if (typeof timestamp === "string") { @@ -43,10 +43,11 @@ days: "%d days", month: "about a month", months: "%d months", year: "about a year", years: "%d years", + wordSeparator: " ", numbers: [] } }, inWords: function(distanceMillis) { var $l = this.settings.strings; @@ -74,18 +75,18 @@ var words = seconds < 45 && substitute($l.seconds, Math.round(seconds)) || seconds < 90 && substitute($l.minute, 1) || minutes < 45 && substitute($l.minutes, Math.round(minutes)) || minutes < 90 && substitute($l.hour, 1) || hours < 24 && substitute($l.hours, Math.round(hours)) || - hours < 48 && substitute($l.day, 1) || - days < 30 && substitute($l.days, Math.floor(days)) || - days < 60 && substitute($l.month, 1) || - days < 365 && substitute($l.months, Math.floor(days / 30)) || - years < 2 && substitute($l.year, 1) || - substitute($l.years, Math.floor(years)); + hours < 42 && substitute($l.day, 1) || + days < 30 && substitute($l.days, Math.round(days)) || + days < 45 && substitute($l.month, 1) || + days < 365 && substitute($l.months, Math.round(days / 30)) || + years < 1.5 && substitute($l.year, 1) || + substitute($l.years, Math.round(years)); - return $.trim([prefix, words, suffix].join(" ")); + return $.trim([prefix, words, suffix].join($l.wordSeparator)); }, parse: function(iso8601) { var s = $.trim(iso8601); s = s.replace(/\.\d\d\d+/,""); // remove milliseconds s = s.replace(/-/,"/").replace(/-/,"/"); @@ -141,6 +142,6 @@ } // fix for IE6 suckage document.createElement("abbr"); document.createElement("time"); -}(jQuery)); \ No newline at end of file +}(jQuery));