Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions jquery.timeago.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,17 @@
years: "%d years",
wordSeparator: " ",
numbers: []
}
},
/**
* Secondary Fuzzing routine for post-processing.
* Should take in the element in question, the originally intended TimeAgo text and the distanceMillis between
* now and the given date.
*
* function(el, originalText, distanceMillis) {
* return originalText;
* }
*/
secondaryFuzzing: false
},

inWords: function(distanceMillis) {
Expand Down Expand Up @@ -193,7 +203,12 @@

if (!isNaN(data.datetime)) {
if ( $s.cutoff === 0 || Math.abs(distance(data.datetime)) < $s.cutoff) {
$(this).text(inWords(data.datetime));
if ($.timeago.settings.secondaryFuzzing) {
var datetime = data.datetime;
$(this).text($.timeago.settings.secondaryFuzzing(this, inWords(datetime), distance(datetime)));
} else {
$(this).text(inWords(data.datetime));
}
} else {
if ($(this).attr('title').length > 0) {
$(this).text($(this).attr('title'));
Expand Down