DRY up timeago.js, add license to i18n.js & timeago.js
This commit is contained in:
parent
7ed21930b4
commit
7216c8d5cb
2 changed files with 20 additions and 39 deletions
|
|
@ -1,15 +1,11 @@
|
|||
/**
|
||||
* Created by .
|
||||
* User: dan
|
||||
* Date: Jan 25, 2011
|
||||
* Time: 5:18:32 PM
|
||||
* To change this template use File | Settings | File Templates.
|
||||
/* Copyright (c) 2010, Diaspora Inc. This file is
|
||||
* licensed under the Affero General Public License version 3 or later. See
|
||||
* the COPYRIGHT file.
|
||||
*/
|
||||
Diaspora.widgets.add("i18n", function() {
|
||||
this.start = $.noop;
|
||||
|
||||
Diaspora.widgets.add("i18n", function() {
|
||||
this.language = "en";
|
||||
this.locale = {};
|
||||
this.locale = { };
|
||||
|
||||
this.loadLocale = function(locale, language) {
|
||||
this.language = language;
|
||||
|
|
|
|||
|
|
@ -1,41 +1,26 @@
|
|||
/**
|
||||
* Created by .
|
||||
* User: dan
|
||||
* Date: Jan 25, 2011
|
||||
* Time: 8:49:02 PM
|
||||
* To change this template use File | Settings | File Templates.
|
||||
/* Copyright (c) 2010, Diaspora Inc. This file is
|
||||
* licensed under the Affero General Public License version 3 or later. See
|
||||
* the COPYRIGHT file.
|
||||
*/
|
||||
|
||||
Diaspora.widgets.add("timeago", function() {
|
||||
this.selector = "abbr.timeago";
|
||||
|
||||
this.start = function() {
|
||||
InfiniteScroll.postScroll(function(){
|
||||
Diaspora.widgets.timeago.updateTimeAgo();
|
||||
});
|
||||
if(Diaspora.widgets.i18n.language === "en") {
|
||||
return;
|
||||
}
|
||||
InfiniteScroll.postScroll(function(){
|
||||
Diaspora.widgets.timeago.updateTimeAgo();
|
||||
});
|
||||
|
||||
jQuery.timeago.settings.strings = {
|
||||
prefixAgo: Diaspora.widgets.i18n.t("timeago.prefixAgo"),
|
||||
prefixFromNow: Diaspora.widgets.i18n.t("timeago.prefixFromNow"),
|
||||
suffixAgo: Diaspora.widgets.i18n.t("timeago.suffixAgo"),
|
||||
suffixFromNow: Diaspora.widgets.i18n.t("timeago.suffixFromNow"),
|
||||
seconds: Diaspora.widgets.i18n.t("timeago.seconds"),
|
||||
minute: Diaspora.widgets.i18n.t("timeago.minute"),
|
||||
minutes: Diaspora.widgets.i18n.t("timeago.minutes"),
|
||||
hour: Diaspora.widgets.i18n.t("timeago.hour"),
|
||||
hours: Diaspora.widgets.i18n.t("timeago.hours"),
|
||||
day: Diaspora.widgets.i18n.t("timeago.day"),
|
||||
days: Diaspora.widgets.i18n.t("timeago.days"),
|
||||
month: Diaspora.widgets.i18n.t("timeago.month"),
|
||||
months: Diaspora.widgets.i18n.t("timeago.months"),
|
||||
year: Diaspora.widgets.i18n.t("timeago.year"),
|
||||
years: Diaspora.widgets.i18n.t("timeago.years")
|
||||
};
|
||||
if(Diaspora.widgets.i18n.language === "en") {
|
||||
return;
|
||||
}
|
||||
|
||||
Diaspora.widgets.timeago.updateTimeAgo("abbr");
|
||||
$.each($.timeago.settings.strings, function(index, element) {
|
||||
$.timeago.settings.strings[index] = Diaspora.widgets.i18n.t("timeago." + element);
|
||||
});
|
||||
|
||||
|
||||
Diaspora.widgets.timeago.updateTimeAgo("abbr");
|
||||
};
|
||||
|
||||
this.updateTimeAgo = function(selector) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue