vendor/assets/javascripts/jquery.timeago.js in rails-timeago-2.14.0 vs vendor/assets/javascripts/jquery.timeago.js in rails-timeago-2.15.0

- old
+ new

@@ -1,11 +1,11 @@ /** * 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 1.5.2 + * @version 1.5.3 * @requires jQuery v1.2.3+ * @author Ryan McGeary * @license MIT License - http://www.opensource.org/licenses/mit-license.php * * For usage and examples, visit: @@ -151,11 +151,13 @@ } }, update: function(timestamp) { var date = (timestamp instanceof Date) ? timestamp : $t.parse(timestamp); $(this).data('timeago', { datetime: date }); - if ($t.settings.localeTitle) $(this).attr("title", date.toLocaleString()); + if ($t.settings.localeTitle) { + $(this).attr("title", date.toLocaleString()); + } refresh.apply(this); }, updateFromDOM: function() { $(this).data('timeago', { datetime: $t.parse( $t.isTime(this) ? $(this).attr("datetime") : $(this).attr("title") ) }); refresh.apply(this); @@ -191,11 +193,15 @@ } var data = prepareData(this); if (!isNaN(data.datetime)) { - if ( $s.cutoff == 0 || Math.abs(distance(data.datetime)) < $s.cutoff) { - $(this).text(inWords(data.datetime, ($(this).attr('lang')) ? $(this).attr('lang') : $t.settings.lang)); + if ( $s.cutoff === 0 || Math.abs(distance(data.datetime)) < $s.cutoff) { + $(this).text(inWords(data.datetime, ($(this).attr('lang') ? $(this).attr('lang') : $t.settings.lang))); + } else { + if ($(this).attr('title').length > 0) { + $(this).text($(this).attr('title')); + } } } return this; }