MS DH; update timeago if a timeago element on the page exists.
This commit is contained in:
parent
82ca293825
commit
7363bf3499
1 changed files with 11 additions and 3 deletions
|
|
@ -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();
|
||||
};
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue