diff --git a/public/javascripts/widgets/timeago.js b/public/javascripts/widgets/timeago.js index c1647b925..142c46f4f 100644 --- a/public/javascripts/widgets/timeago.js +++ b/public/javascripts/widgets/timeago.js @@ -9,14 +9,22 @@ Diaspora.widgets.add("timeago", function() { Diaspora.widgets.subscribe("stream/scrolled", this.updateTimeAgo); Diaspora.widgets.subscribe("stream/reloaded", this.updateTimeAgo); + if(this.timeAgoElement().length) { + this.updateTimeAgo(); + } + if(Diaspora.widgets.i18n.language !== "en") { - $.each($.timeago.settings.strings, function(index, element) { + $.each($.timeago.settings.strings, function(index) { $.timeago.settings.strings[index] = Diaspora.widgets.i18n.t("timeago." + index); }); } }; - this.updateTimeAgo = function(selector) { - $((typeof selector === "string") ? selector : Diaspora.widgets.timeago.selector).timeago(); + this.timeAgoElement = function(selector) { + return $((typeof selector === "string") ? selector : this.selector); + }; + + this.updateTimeAgo = function() { + this.timeAgoElement().timeago(); }; });