From ee218ecd448147ff9720b93e4ef7eaa6f3790e34 Mon Sep 17 00:00:00 2001 From: Dan Hansen Date: Tue, 25 Jan 2011 22:21:42 -0600 Subject: [PATCH] get rid of the hacky callbacks --- public/javascripts/diaspora.js | 8 ++--- .../timeago_locale/jquery.timeago.cz.js | 18 ---------- .../timeago_locale/jquery.timeago.da.js | 18 ---------- .../timeago_locale/jquery.timeago.de.js | 19 ----------- .../timeago_locale/jquery.timeago.el.js | 18 ---------- .../timeago_locale/jquery.timeago.es.js | 18 ---------- .../timeago_locale/jquery.timeago.fr.js | 17 ---------- .../timeago_locale/jquery.timeago.he.js | 18 ---------- .../timeago_locale/jquery.timeago.hu.js | 18 ---------- .../timeago_locale/jquery.timeago.id.js | 18 ---------- .../timeago_locale/jquery.timeago.it.js | 16 --------- .../timeago_locale/jquery.timeago.ja.js | 18 ---------- .../timeago_locale/jquery.timeago.ko.js | 16 --------- .../timeago_locale/jquery.timeago.nl.js | 16 --------- .../timeago_locale/jquery.timeago.pl.js | 31 ----------------- .../timeago_locale/jquery.timeago.pt-PT.js | 16 --------- .../timeago_locale/jquery.timeago.ro.js | 18 ---------- .../timeago_locale/jquery.timeago.ru.js | 34 ------------------- .../timeago_locale/jquery.timeago.sv.js | 18 ---------- .../timeago_locale/jquery.timeago.zh-CN.js | 19 ----------- public/javascripts/widgets/i18n.js | 20 ----------- public/javascripts/widgets/timeago.js | 3 -- 22 files changed, 4 insertions(+), 391 deletions(-) delete mode 100644 public/javascripts/vendor/timeago_locale/jquery.timeago.cz.js delete mode 100644 public/javascripts/vendor/timeago_locale/jquery.timeago.da.js delete mode 100644 public/javascripts/vendor/timeago_locale/jquery.timeago.de.js delete mode 100644 public/javascripts/vendor/timeago_locale/jquery.timeago.el.js delete mode 100644 public/javascripts/vendor/timeago_locale/jquery.timeago.es.js delete mode 100644 public/javascripts/vendor/timeago_locale/jquery.timeago.fr.js delete mode 100644 public/javascripts/vendor/timeago_locale/jquery.timeago.he.js delete mode 100644 public/javascripts/vendor/timeago_locale/jquery.timeago.hu.js delete mode 100644 public/javascripts/vendor/timeago_locale/jquery.timeago.id.js delete mode 100644 public/javascripts/vendor/timeago_locale/jquery.timeago.it.js delete mode 100644 public/javascripts/vendor/timeago_locale/jquery.timeago.ja.js delete mode 100644 public/javascripts/vendor/timeago_locale/jquery.timeago.ko.js delete mode 100644 public/javascripts/vendor/timeago_locale/jquery.timeago.nl.js delete mode 100644 public/javascripts/vendor/timeago_locale/jquery.timeago.pl.js delete mode 100644 public/javascripts/vendor/timeago_locale/jquery.timeago.pt-PT.js delete mode 100644 public/javascripts/vendor/timeago_locale/jquery.timeago.ro.js delete mode 100644 public/javascripts/vendor/timeago_locale/jquery.timeago.ru.js delete mode 100644 public/javascripts/vendor/timeago_locale/jquery.timeago.sv.js delete mode 100644 public/javascripts/vendor/timeago_locale/jquery.timeago.zh-CN.js diff --git a/public/javascripts/diaspora.js b/public/javascripts/diaspora.js index b2e5d76b0..d0e89a5b1 100644 --- a/public/javascripts/diaspora.js +++ b/public/javascripts/diaspora.js @@ -22,11 +22,11 @@ Diaspora.widgetCollection.prototype.remove = function(widgetId) { }; Diaspora.widgetCollection.prototype.init = function() { - this.ready = true; - for(var widgetId in this.collection) { - this.collection[widgetId].start(); - } + this.ready = true; + for(var widgetId in this.collection) { + this.collection[widgetId].start(); } +} Diaspora.widgets = Diaspora.widgets || new Diaspora.widgetCollection(); diff --git a/public/javascripts/vendor/timeago_locale/jquery.timeago.cz.js b/public/javascripts/vendor/timeago_locale/jquery.timeago.cz.js deleted file mode 100644 index 0ed965013..000000000 --- a/public/javascripts/vendor/timeago_locale/jquery.timeago.cz.js +++ /dev/null @@ -1,18 +0,0 @@ -// Czech -jQuery.timeago.settings.strings = { - prefixAgo: "před", - prefixFromNow: null, - suffixAgo: null, - suffixFromNow: null, - seconds: "méně než minutou", - minute: "minutou", - minutes: "%d minutami", - hour: "hodinou", - hours: "%d hodinami", - day: "1 dnem", - days: "%d dny", - month: "1 měsícem", - months: "%d měsíci", - year: "1 rokem", - years: "%d roky" -}; diff --git a/public/javascripts/vendor/timeago_locale/jquery.timeago.da.js b/public/javascripts/vendor/timeago_locale/jquery.timeago.da.js deleted file mode 100644 index ff50e873f..000000000 --- a/public/javascripts/vendor/timeago_locale/jquery.timeago.da.js +++ /dev/null @@ -1,18 +0,0 @@ -// Danish -jQuery.timeago.settings.strings = { - prefixAgo: "for", - prefixFromNow: "om", - suffixAgo: "siden", - suffixFromNow: "", - seconds: "mindre end et minut", - minute: "ca. et minut", - minutes: "%d minutter", - hour: "ca. en time", - hours: "ca. %d timer", - day: "en dag", - days: "%d dage", - month: "ca. en måned", - months: "%d måneder", - year: "ca. et år", - years: "%d år" -}; \ No newline at end of file diff --git a/public/javascripts/vendor/timeago_locale/jquery.timeago.de.js b/public/javascripts/vendor/timeago_locale/jquery.timeago.de.js deleted file mode 100644 index b4573e826..000000000 --- a/public/javascripts/vendor/timeago_locale/jquery.timeago.de.js +++ /dev/null @@ -1,19 +0,0 @@ -// German -jQuery.timeago.settings.strings = { - prefixAgo: "vor", - prefixFromNow: "in", - suffixAgo: "", - suffixFromNow: "", - seconds: "wenigen Sekunden", - minute: "etwa einer Minute", - minutes: "%d Minuten", - hour: "etwa einer Stunde", - hours: "%d Stunden", - day: "etwa einem Tag", - days: "%d Tagen", - month: "etwa einem Monat", - months: "%d Monaten", - year: "etwa einem Jahr", - years: "%d Jahren" -}; - diff --git a/public/javascripts/vendor/timeago_locale/jquery.timeago.el.js b/public/javascripts/vendor/timeago_locale/jquery.timeago.el.js deleted file mode 100644 index 61aaafe49..000000000 --- a/public/javascripts/vendor/timeago_locale/jquery.timeago.el.js +++ /dev/null @@ -1,18 +0,0 @@ -// Greek -jQuery.timeago.settings.strings = { - prefixAgo: "πριν", - prefixFromNow: "σε", - suffixAgo: "", - suffixFromNow: "", - seconds: "λιγότερο από ένα λεπτό", - minute: "περίπου ένα λεπτό", - minutes: "%d λεπτά", - hour: "περίπου μία ώρα", - hours: "περίπου %d ώρες", - day: "μία μέρα", - days: "%d μέρες", - month: "περίπου ένα μήνα", - months: "%d μήνες", - year: "περίπου ένα χρόνο", - years: "%d χρόνια" -}; \ No newline at end of file diff --git a/public/javascripts/vendor/timeago_locale/jquery.timeago.es.js b/public/javascripts/vendor/timeago_locale/jquery.timeago.es.js deleted file mode 100644 index 00c6d0a6c..000000000 --- a/public/javascripts/vendor/timeago_locale/jquery.timeago.es.js +++ /dev/null @@ -1,18 +0,0 @@ -// Spanish -jQuery.timeago.settings.strings = { - prefixAgo: "hace", - prefixFromNow: "dentro de", - suffixAgo: "", - suffixFromNow: "", - seconds: "menos de un minuto", - minute: "un minuto", - minutes: "unos %d minutos", - hour: "una hora", - hours: "%d horas", - day: "un día", - days: "%d días", - month: "un mes", - months: "%d meses", - year: "un año", - years: "%d años" -}; \ No newline at end of file diff --git a/public/javascripts/vendor/timeago_locale/jquery.timeago.fr.js b/public/javascripts/vendor/timeago_locale/jquery.timeago.fr.js deleted file mode 100644 index 502834230..000000000 --- a/public/javascripts/vendor/timeago_locale/jquery.timeago.fr.js +++ /dev/null @@ -1,17 +0,0 @@ -// French -jQuery.timeago.settings.strings = { - // environ ~= about, it's optional - prefixAgo: "il y a", - prefixFromNow: "d'ici", - seconds: "moins d'une minute", - minute: "environ une minute", - minutes: "environ %d minutes", - hour: "environ une heure", - hours: "environ %d heures", - day: "environ un jour", - days: "environ %d jours", - month: "environ un mois", - months: "environ %d mois", - year: "un an", - years: "%d ans" -}; \ No newline at end of file diff --git a/public/javascripts/vendor/timeago_locale/jquery.timeago.he.js b/public/javascripts/vendor/timeago_locale/jquery.timeago.he.js deleted file mode 100644 index 9d5b6c6b0..000000000 --- a/public/javascripts/vendor/timeago_locale/jquery.timeago.he.js +++ /dev/null @@ -1,18 +0,0 @@ -// Hebrew -jQuery.timeago.settings.strings = { - prefixAgo: "לפני", - prefixFromNow: "מעכשיו", - suffixAgo: "", - suffixFromNow: "", - seconds: "פחות מדקה", - minute: "דקה", - minutes: "%d דקות", - hour: "שעה", - hours: "%d שעות", - day: "יום", - days: "%d ימים", - month: "חודש", - months: "%d חודשים", - year: "שנה", - years: "%d שנים" -}; \ No newline at end of file diff --git a/public/javascripts/vendor/timeago_locale/jquery.timeago.hu.js b/public/javascripts/vendor/timeago_locale/jquery.timeago.hu.js deleted file mode 100644 index 3079c22b7..000000000 --- a/public/javascripts/vendor/timeago_locale/jquery.timeago.hu.js +++ /dev/null @@ -1,18 +0,0 @@ -// Hungarian -jQuery.timeago.settings.strings = { - prefixAgo: null, - prefixFromNow: null, - suffixAgo: null, - suffixFromNow: null, - seconds: "kevesebb mint egy perce", - minute: "körülbelül egy perce", - minutes: "%d perce", - hour: "körülbelül egy órája", - hours: "körülbelül %d órája", - day: "körülbelül egy napja", - days: "%d napja", - month: "körülbelül egy hónapja", - months: "%d hónapja", - year: "körülbelül egy éve", - years: "%d éve" -}; \ No newline at end of file diff --git a/public/javascripts/vendor/timeago_locale/jquery.timeago.id.js b/public/javascripts/vendor/timeago_locale/jquery.timeago.id.js deleted file mode 100644 index 72c390971..000000000 --- a/public/javascripts/vendor/timeago_locale/jquery.timeago.id.js +++ /dev/null @@ -1,18 +0,0 @@ -// Indonesian -jQuery.timeago.settings.strings = { - prefixAgo: null, - prefixFromNow: null, - suffixAgo: "yang lalu", - suffixFromNow: "dari sekarang", - seconds: "kurang dari semenit", - minute: "sekitar satu menit", - minutes: "%d menit", - hour: "sekitar sejam", - hours: "sekitar %d jam", - day: "sehari", - days: "%d hari", - month: "sekitar sebulan", - months: "%d tahun", - year: "sekitar setahun", - years: "%d tahun" -}; \ No newline at end of file diff --git a/public/javascripts/vendor/timeago_locale/jquery.timeago.it.js b/public/javascripts/vendor/timeago_locale/jquery.timeago.it.js deleted file mode 100644 index 6308dd30c..000000000 --- a/public/javascripts/vendor/timeago_locale/jquery.timeago.it.js +++ /dev/null @@ -1,16 +0,0 @@ -// Italian -jQuery.timeago.settings.strings = { - suffixAgo: "fa", - suffixFromNow: "da ora", - seconds: "meno di un minuto", - minute: "circa un minuto", - minutes: "%d minuti", - hour: "circa un'ora", - hours: "circa %d ore", - day: "un giorno", - days: "%d giorni", - month: "circa un mese", - months: "%d mesi", - year: "circa un anno", - years: "%d anni" -}; \ No newline at end of file diff --git a/public/javascripts/vendor/timeago_locale/jquery.timeago.ja.js b/public/javascripts/vendor/timeago_locale/jquery.timeago.ja.js deleted file mode 100644 index cf7fd19fc..000000000 --- a/public/javascripts/vendor/timeago_locale/jquery.timeago.ja.js +++ /dev/null @@ -1,18 +0,0 @@ -// Japanese -jQuery.timeago.settings.strings = { - prefixAgo: "", - prefixFromNow: "今から", - suffixAgo: "前", - suffixFromNow: "後", - seconds: "ほんの数秒", - minute: "約一分", - minutes: "%d 分", - hour: "大体一時間", - hours: "大体 %d 時間位", - day: "一日", - days: "%d 日ほど", - month: "大体一ヶ月", - months: "%d ヶ月ほど", - year: "丁度一年(虎舞流w)", - years: "%d 年" -}; \ No newline at end of file diff --git a/public/javascripts/vendor/timeago_locale/jquery.timeago.ko.js b/public/javascripts/vendor/timeago_locale/jquery.timeago.ko.js deleted file mode 100644 index 5c50ba7d5..000000000 --- a/public/javascripts/vendor/timeago_locale/jquery.timeago.ko.js +++ /dev/null @@ -1,16 +0,0 @@ -// Korean -jQuery.timeago.settings.strings = { - suffixAgo: "전", - suffixFromNow: "후", - seconds: "1분 이내", - minute: "1분", - minutes: "%d분", - hour: "1시간", - hours: "%d시간", - day: "하루", - days: "%d일", - month: "한달", - months: "%d달", - year: "1년", - years: "%d년" -}; \ No newline at end of file diff --git a/public/javascripts/vendor/timeago_locale/jquery.timeago.nl.js b/public/javascripts/vendor/timeago_locale/jquery.timeago.nl.js deleted file mode 100644 index ca41bc5b7..000000000 --- a/public/javascripts/vendor/timeago_locale/jquery.timeago.nl.js +++ /dev/null @@ -1,16 +0,0 @@ -// Dutch -jQuery.timeago.settings.strings = { - suffixAgo: "geleden", - suffixFromNow: "vanaf nu", - seconds: "iets minder dan een minute", - minute: "ongeveer een minuut", - minutes: "%d minuten", - hour: "ongeveer een uur", - hours: "ongeveer %d uren", - day: "een dag", - days: "%d dagen", - month: "ongeveer een maand", - months: "%d maanden", - year: "ongeveer een jaar", - years: "%d jaar" -}; \ No newline at end of file diff --git a/public/javascripts/vendor/timeago_locale/jquery.timeago.pl.js b/public/javascripts/vendor/timeago_locale/jquery.timeago.pl.js deleted file mode 100644 index 21d26fc1c..000000000 --- a/public/javascripts/vendor/timeago_locale/jquery.timeago.pl.js +++ /dev/null @@ -1,31 +0,0 @@ -// Polish -(function() { - function numpf(n, s, t) { - // s - 2-4, 22-24, 32-34 ... - // t - 5-21, 25-31, ... - var n10 = n % 10; - if ( (n10 > 1) && (n10 < 5) && ( (n > 20) || (n < 10) ) ) { - return s; - } else { - return t; - } - } - - jQuery.timeago.settings.strings = { - prefixAgo: null, - prefixFromNow: "za", - suffixAgo: "temu", - suffixFromNow: null, - seconds: "mniej niż minutę", - minute: "minutę", - minutes: function(value) { return numpf(value, "%d minuty", "%d minut"); }, - hour: "godzinę", - hours: function(value) { return numpf(value, "%d godziny", "%d godzin"); }, - day: "dzień", - days: "%d dni", - month: "miesiąc", - months: function(value) { return numpf(value, "%d miesiące", "%d miesięcy"); }, - year: "rok", - years: function(value) { return numpf(value, "%d lata", "%d lat"); } - }; -})(); \ No newline at end of file diff --git a/public/javascripts/vendor/timeago_locale/jquery.timeago.pt-PT.js b/public/javascripts/vendor/timeago_locale/jquery.timeago.pt-PT.js deleted file mode 100644 index 416333c65..000000000 --- a/public/javascripts/vendor/timeago_locale/jquery.timeago.pt-PT.js +++ /dev/null @@ -1,16 +0,0 @@ -// Portuguese -jQuery.timeago.settings.strings = { - suffixAgo: "atrás", - suffixFromNow: "a partir de agora", - seconds: "menos de um minuto", - minute: "cerca de um minuto", - minutes: "%d minutos", - hour: "cerca de uma hora", - hours: "cerca de %d horas", - day: "um dia", - days: "%d dias", - month: "cerca de um mês", - months: "%d meses", - year: "cerca de um ano", - years: "%d anos" -}; \ No newline at end of file diff --git a/public/javascripts/vendor/timeago_locale/jquery.timeago.ro.js b/public/javascripts/vendor/timeago_locale/jquery.timeago.ro.js deleted file mode 100644 index 7d3773907..000000000 --- a/public/javascripts/vendor/timeago_locale/jquery.timeago.ro.js +++ /dev/null @@ -1,18 +0,0 @@ -// Romanian -$.timeago.settings.strings = { - prefixAgo: "acum", - prefixFromNow: "in timp de", - suffixAgo: "", - suffixFromNow: "", - seconds: "mai putin de un minut", - minute: "un minut", - minutes: "%d minute", - hour: "o ora", - hours: "%d ore", - day: "o zi", - days: "%d zile", - month: "o luna", - months: "%d luni", - year: "un an", - years: "%d ani" -}; diff --git a/public/javascripts/vendor/timeago_locale/jquery.timeago.ru.js b/public/javascripts/vendor/timeago_locale/jquery.timeago.ru.js deleted file mode 100644 index a8177dd33..000000000 --- a/public/javascripts/vendor/timeago_locale/jquery.timeago.ru.js +++ /dev/null @@ -1,34 +0,0 @@ -// Russian -(function() { - function numpf(n, f, s, t) { - // f - 1, 21, 31, ... - // s - 2-4, 22-24, 32-34 ... - // t - 5-20, 25-30, ... - var n10 = n % 10; - if ( (n10 == 1) && ( (n == 1) || (n > 20) ) ) { - return f; - } else if ( (n10 > 1) && (n10 < 5) && ( (n > 20) || (n < 10) ) ) { - return s; - } else { - return t; - } - } - - jQuery.timeago.settings.strings = { - prefixAgo: null, - prefixFromNow: "через", - suffixAgo: "назад", - suffixFromNow: null, - seconds: "меньше минуты", - minute: "минуту", - minutes: function(value) { return numpf(value, "%d минута", "%d минуты", "%d минут"); }, - hour: "час", - hours: function(value) { return numpf(value, "%d час", "%d часа", "%d часов"); }, - day: "день", - days: function(value) { return numpf(value, "%d день", "%d дня", "%d дней"); }, - month: "месяц", - months: function(value) { return numpf(value, "%d месяц", "%d месяца", "%d месяцев"); }, - year: "год", - years: function(value) { return numpf(value, "%d год", "%d года", "%d лет"); } - }; -})(); \ No newline at end of file diff --git a/public/javascripts/vendor/timeago_locale/jquery.timeago.sv.js b/public/javascripts/vendor/timeago_locale/jquery.timeago.sv.js deleted file mode 100644 index b5c394717..000000000 --- a/public/javascripts/vendor/timeago_locale/jquery.timeago.sv.js +++ /dev/null @@ -1,18 +0,0 @@ -// Swedish -jQuery.timeago.settings.strings = { - prefixAgo: "för", - prefixFromNow: "om", - suffixAgo: "sedan", - suffixFromNow: "", - seconds: "mindre än en minut", - minute: "ungefär en minut", - minutes: "%d minuter", - hour: "ungefär en timme", - hours: "ungefär %d timmar", - day: "en dag", - days: "%d dagar", - month: "ungefär en månad", - months: "%d månader", - year: "ungefär ett år", - years: "%d år" -}; \ No newline at end of file diff --git a/public/javascripts/vendor/timeago_locale/jquery.timeago.zh-CN.js b/public/javascripts/vendor/timeago_locale/jquery.timeago.zh-CN.js deleted file mode 100644 index 5487d95b2..000000000 --- a/public/javascripts/vendor/timeago_locale/jquery.timeago.zh-CN.js +++ /dev/null @@ -1,19 +0,0 @@ -// Simplified Chinese -jQuery.timeago.settings.strings = { - prefixAgo: null, - prefixFromNow: "从现在开始", - suffixAgo: "之前", - suffixFromNow: null, - seconds: "不到 1 分钟", - minute: "大约 1 分钟", - minutes: "%d 分钟", - hour: "大约 1 小时", - hours: "大约 %d 小时", - day: "1 天", - days: "%d 天", - month: "大约 1 个月", - months: "%d 月", - year: "大约 1 年", - years: "%d 年", - numbers: [] -} \ No newline at end of file diff --git a/public/javascripts/widgets/i18n.js b/public/javascripts/widgets/i18n.js index 755b539b4..02f246ae1 100644 --- a/public/javascripts/widgets/i18n.js +++ b/public/javascripts/widgets/i18n.js @@ -8,46 +8,26 @@ Diaspora.widgets.add("i18n", function() { this.start = $.noop; - this.callbacks = []; this.language = undefined; this.locale = undefined; - this.ready = false; this.loadLocale = function(locale, language) { - this.ready = true; this.language = language; if(typeof locale !== "undefined") { this.locale = locale; - this.triggerCallbacks(); return; } if(!this.locale) { function setLocale(data) { this.locale = $.parseJSON(data); - this.triggerCallbacks(); } $.getJSON("/localize", setLocale); } }; - this.triggerCallbacks = function() { - for(var i = 0; i < this.callbacks.length; i++) { - this.callbacks[i](); - } - }; - - this.onLocaleLoaded = function(callback) { - if(this.ready) { - callback(); - return; - } - - this.callbacks.push(callback); - }; - this.t = function(item, views) { var ret, _item = item.split("."); diff --git a/public/javascripts/widgets/timeago.js b/public/javascripts/widgets/timeago.js index 1926c7d4c..a9bac7691 100644 --- a/public/javascripts/widgets/timeago.js +++ b/public/javascripts/widgets/timeago.js @@ -7,8 +7,6 @@ */ Diaspora.widgets.add("timeago", function() { this.start = function() { - Diaspora.widgets.i18n.onLocaleLoaded(function() { - if(Diaspora.widgets.i18n.language === "en") { return; } @@ -32,7 +30,6 @@ Diaspora.widgets.add("timeago", function() { }; Diaspora.widgets.timeago.updateTimeAgo("abbr"); - }); }; this.updateTimeAgo = function(selector) {