Here we also set autoDispose to false. This is an option that was introduced sometime after our last bump. Default is true and it disposes timeago object if it is not in DOM. But that is the way we initialize timeago objects, therefore if we have autoDispose=true then they will be disposed before they inserted in DOM. So by using autoDispose=false we enforce previous behavior that worked fine for us.
34 lines
1.3 KiB
JavaScript
34 lines
1.3 KiB
JavaScript
// @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL-v3-or-Later
|
|
|
|
/* Copyright (c) 2010-2011, Diaspora Inc. This file is
|
|
* licensed under the Affero General Public License version 3 or later. See
|
|
* the COPYRIGHT file.
|
|
*/
|
|
(function() {
|
|
Diaspora.Widgets.TimeAgo = function() {
|
|
this.subscribe("widget/ready", function() {
|
|
if (Diaspora.I18n.language !== "en") {
|
|
$.timeago.settings.lang = Diaspora.I18n.language;
|
|
$.timeago.settings.strings[Diaspora.I18n.language] = {};
|
|
$.each($.timeago.settings.strings.en, function(index) {
|
|
if (index === "numbers") {
|
|
$.timeago.settings.strings[Diaspora.I18n.language][index] = [];
|
|
} else if (index === "minutes" ||
|
|
index === "hours" ||
|
|
index === "days" ||
|
|
index === "months" ||
|
|
index === "years") {
|
|
$.timeago.settings.strings[Diaspora.I18n.language][index] = function(value) {
|
|
return Diaspora.I18n.t("timeago." + index, {count: value});
|
|
};
|
|
} else {
|
|
$.timeago.settings.strings[Diaspora.I18n.language][index] = Diaspora.I18n.t("timeago." + index);
|
|
}
|
|
});
|
|
}
|
|
|
|
$.timeago.settings.autoDispose = false;
|
|
});
|
|
};
|
|
})();
|
|
// @license-end
|