timeago_js 3.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/assets/javascripts/timeago.js +258 -0
- data/assets/javascripts/timeago.locales.js +1 -0
- data/assets/javascripts/timeago/locales/ar.js +30 -0
- data/assets/javascripts/timeago/locales/be.js +55 -0
- data/assets/javascripts/timeago/locales/bg.js +18 -0
- data/assets/javascripts/timeago/locales/ca.js +18 -0
- data/assets/javascripts/timeago/locales/da.js +18 -0
- data/assets/javascripts/timeago/locales/de.js +18 -0
- data/assets/javascripts/timeago/locales/el.js +18 -0
- data/assets/javascripts/timeago/locales/en.js +18 -0
- data/assets/javascripts/timeago/locales/en_short.js +18 -0
- data/assets/javascripts/timeago/locales/es.js +18 -0
- data/assets/javascripts/timeago/locales/eu.js +18 -0
- data/assets/javascripts/timeago/locales/fi.js +18 -0
- data/assets/javascripts/timeago/locales/fr.js +18 -0
- data/assets/javascripts/timeago/locales/he.js +18 -0
- data/assets/javascripts/timeago/locales/hu.js +18 -0
- data/assets/javascripts/timeago/locales/in_BG.js +18 -0
- data/assets/javascripts/timeago/locales/in_HI.js +18 -0
- data/assets/javascripts/timeago/locales/in_ID.js +18 -0
- data/assets/javascripts/timeago/locales/it.js +18 -0
- data/assets/javascripts/timeago/locales/ja.js +18 -0
- data/assets/javascripts/timeago/locales/ko.js +18 -0
- data/assets/javascripts/timeago/locales/ml.js +18 -0
- data/assets/javascripts/timeago/locales/nb_NO.js +18 -0
- data/assets/javascripts/timeago/locales/nl.js +18 -0
- data/assets/javascripts/timeago/locales/nn_NO.js +18 -0
- data/assets/javascripts/timeago/locales/pl.js +38 -0
- data/assets/javascripts/timeago/locales/pt_BR.js +18 -0
- data/assets/javascripts/timeago/locales/ro.js +29 -0
- data/assets/javascripts/timeago/locales/ru.js +55 -0
- data/assets/javascripts/timeago/locales/sv.js +18 -0
- data/assets/javascripts/timeago/locales/ta.js +18 -0
- data/assets/javascripts/timeago/locales/th.js +18 -0
- data/assets/javascripts/timeago/locales/tr.js +18 -0
- data/assets/javascripts/timeago/locales/uk.js +44 -0
- data/assets/javascripts/timeago/locales/vi.js +18 -0
- data/assets/javascripts/timeago/locales/zh_CN.js +18 -0
- data/assets/javascripts/timeago/locales/zh_TW.js +18 -0
- data/lib/timeago_js.rb +4 -0
- data/lib/timeago_js/engine.rb +9 -0
- data/lib/timeago_js/version.rb +5 -0
- metadata +142 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 71275d111919371aebf9197f55d28e556d8590eb
|
4
|
+
data.tar.gz: b20434442347ffa3e49d8c58451ef12e5edd0f38
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 7cb0e15b2c35b12c335c9a573fef11c20a2fac2d538df6eb1915c2bd65bab325bd573df2f04ec9d6ea2fcd36a1b3ff61eb24c5003da5a187e09599adeb08554b
|
7
|
+
data.tar.gz: 9c2e15c760067b240dd387d53b0c8096d1f38b2201abe9450eacc547fc0ce9cc576dbfcd9819419d269203d16fb551f059dd2fdf209f7b5c605b1c0c738664c7
|
@@ -0,0 +1,258 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright (c) 2016 hustcc
|
3
|
+
* License: MIT
|
4
|
+
* Version: v3.0.0
|
5
|
+
* https://github.com/hustcc/timeago.js
|
6
|
+
**/
|
7
|
+
/* jshint expr: true */
|
8
|
+
!function (root, factory) {
|
9
|
+
if (typeof module === 'object' && module.exports) {
|
10
|
+
module.exports = factory(root); // nodejs support
|
11
|
+
module.exports['default'] = module.exports; // es6 support
|
12
|
+
}
|
13
|
+
else
|
14
|
+
root.timeago = factory(root);
|
15
|
+
}(typeof window !== 'undefined' ? window : this,
|
16
|
+
function () {
|
17
|
+
var indexMapEn = 'second_minute_hour_day_week_month_year'.split('_'),
|
18
|
+
indexMapZh = '秒_分钟_小时_天_周_月_年'.split('_'),
|
19
|
+
// build-in locales: en & zh_CN
|
20
|
+
locales = {
|
21
|
+
'en': function(number, index) {
|
22
|
+
if (index === 0) return ['just now', 'right now'];
|
23
|
+
var unit = indexMapEn[parseInt(index / 2)];
|
24
|
+
if (number > 1) unit += 's';
|
25
|
+
return [number + ' ' + unit + ' ago', 'in ' + number + ' ' + unit];
|
26
|
+
},
|
27
|
+
'zh_CN': function(number, index) {
|
28
|
+
if (index === 0) return ['刚刚', '片刻后'];
|
29
|
+
var unit = indexMapZh[parseInt(index / 2)];
|
30
|
+
return [number + unit + '前', number + unit + '后'];
|
31
|
+
}
|
32
|
+
},
|
33
|
+
// second, minute, hour, day, week, month, year(365 days)
|
34
|
+
SEC_ARRAY = [60, 60, 24, 7, 365/7/12, 12],
|
35
|
+
SEC_ARRAY_LEN = 6,
|
36
|
+
ATTR_DATETIME = 'datetime',
|
37
|
+
ATTR_DATA_TID = 'data-tid',
|
38
|
+
timers = {}; // real-time render timers
|
39
|
+
|
40
|
+
// format Date / string / timestamp to Date instance.
|
41
|
+
function toDate(input) {
|
42
|
+
if (input instanceof Date) return input;
|
43
|
+
if (!isNaN(input)) return new Date(toInt(input));
|
44
|
+
if (/^\d+$/.test(input)) return new Date(toInt(input));
|
45
|
+
input = (input || '').trim().replace(/\.\d+/, '') // remove milliseconds
|
46
|
+
.replace(/-/, '/').replace(/-/, '/')
|
47
|
+
.replace(/(\d)T(\d)/, '$1 $2').replace(/Z/, ' UTC') // 2017-2-5T3:57:52Z -> 2017-2-5 3:57:52UTC
|
48
|
+
.replace(/([\+\-]\d\d)\:?(\d\d)/, ' $1$2'); // -04:00 -> -0400
|
49
|
+
return new Date(input);
|
50
|
+
}
|
51
|
+
// change f into int, remove decimal. Just for code compression
|
52
|
+
function toInt(f) {
|
53
|
+
return parseInt(f);
|
54
|
+
}
|
55
|
+
// format the diff second to *** time ago, with setting locale
|
56
|
+
function formatDiff(diff, locale, defaultLocale) {
|
57
|
+
// if locale is not exist, use defaultLocale.
|
58
|
+
// if defaultLocale is not exist, use build-in `en`.
|
59
|
+
// be sure of no error when locale is not exist.
|
60
|
+
locale = locales[locale] ? locale : (locales[defaultLocale] ? defaultLocale : 'en');
|
61
|
+
// if (! locales[locale]) locale = defaultLocale;
|
62
|
+
var i = 0,
|
63
|
+
agoin = diff < 0 ? 1 : 0, // timein or timeago
|
64
|
+
total_sec = diff = Math.abs(diff);
|
65
|
+
|
66
|
+
for (; diff >= SEC_ARRAY[i] && i < SEC_ARRAY_LEN; i++) {
|
67
|
+
diff /= SEC_ARRAY[i];
|
68
|
+
}
|
69
|
+
diff = toInt(diff);
|
70
|
+
i *= 2;
|
71
|
+
|
72
|
+
if (diff > (i === 0 ? 9 : 1)) i += 1;
|
73
|
+
return locales[locale](diff, i, total_sec)[agoin].replace('%s', diff);
|
74
|
+
}
|
75
|
+
// calculate the diff second between date to be formated an now date.
|
76
|
+
function diffSec(date, nowDate) {
|
77
|
+
nowDate = nowDate ? toDate(nowDate) : new Date();
|
78
|
+
return (nowDate - toDate(date)) / 1000;
|
79
|
+
}
|
80
|
+
/**
|
81
|
+
* nextInterval: calculate the next interval time.
|
82
|
+
* - diff: the diff sec between now and date to be formated.
|
83
|
+
*
|
84
|
+
* What's the meaning?
|
85
|
+
* diff = 61 then return 59
|
86
|
+
* diff = 3601 (an hour + 1 second), then return 3599
|
87
|
+
* make the interval with high performace.
|
88
|
+
**/
|
89
|
+
function nextInterval(diff) {
|
90
|
+
var rst = 1, i = 0, d = Math.abs(diff);
|
91
|
+
for (; diff >= SEC_ARRAY[i] && i < SEC_ARRAY_LEN; i++) {
|
92
|
+
diff /= SEC_ARRAY[i];
|
93
|
+
rst *= SEC_ARRAY[i];
|
94
|
+
}
|
95
|
+
// return leftSec(d, rst);
|
96
|
+
d = d % rst;
|
97
|
+
d = d ? rst - d : rst;
|
98
|
+
return Math.ceil(d);
|
99
|
+
}
|
100
|
+
// get the datetime attribute, jQuery and DOM
|
101
|
+
function getDateAttr(node) {
|
102
|
+
if(node.dataset.timeago) return node.dataset.timeago; // data-timeago supported
|
103
|
+
return getAttr(node, ATTR_DATETIME);
|
104
|
+
}
|
105
|
+
function getAttr(node, name) {
|
106
|
+
if(node.getAttribute) return node.getAttribute(name); // native
|
107
|
+
if(node.attr) return node.attr(name); // jquery
|
108
|
+
}
|
109
|
+
function setTidAttr(node, val) {
|
110
|
+
if(node.setAttribute) return node.setAttribute(ATTR_DATA_TID, val); // native
|
111
|
+
if(node.attr) return node.attr(ATTR_DATA_TID, val); // jquery
|
112
|
+
}
|
113
|
+
function getTidFromNode(node) {
|
114
|
+
return getAttr(node, ATTR_DATA_TID);
|
115
|
+
}
|
116
|
+
/**
|
117
|
+
* timeago: the function to get `timeago` instance.
|
118
|
+
* - nowDate: the relative date, default is new Date().
|
119
|
+
* - defaultLocale: the default locale, default is en. if your set it, then the `locale` parameter of format is not needed of you.
|
120
|
+
*
|
121
|
+
* How to use it?
|
122
|
+
* var timeagoLib = require('timeago.js');
|
123
|
+
* var timeago = timeagoLib(); // all use default.
|
124
|
+
* var timeago = timeagoLib('2016-09-10'); // the relative date is 2016-09-10, so the 2016-09-11 will be 1 day ago.
|
125
|
+
* var timeago = timeagoLib(null, 'zh_CN'); // set default locale is `zh_CN`.
|
126
|
+
* var timeago = timeagoLib('2016-09-10', 'zh_CN'); // the relative date is 2016-09-10, and locale is zh_CN, so the 2016-09-11 will be 1天前.
|
127
|
+
**/
|
128
|
+
function Timeago(nowDate, defaultLocale) {
|
129
|
+
this.nowDate = nowDate;
|
130
|
+
// if do not set the defaultLocale, set it with `en`
|
131
|
+
this.defaultLocale = defaultLocale || 'en'; // use default build-in locale
|
132
|
+
// for dev test
|
133
|
+
// this.nextInterval = nextInterval;
|
134
|
+
}
|
135
|
+
// what the timer will do
|
136
|
+
Timeago.prototype.doRender = function(node, date, locale) {
|
137
|
+
var diff = diffSec(date, this.nowDate),
|
138
|
+
self = this,
|
139
|
+
tid;
|
140
|
+
// delete previously assigned timeout's id to node
|
141
|
+
node.innerHTML = formatDiff(diff, locale, this.defaultLocale);
|
142
|
+
// waiting %s seconds, do the next render
|
143
|
+
timers[tid = setTimeout(function() {
|
144
|
+
self.doRender(node, date, locale);
|
145
|
+
delete timers[tid];
|
146
|
+
}, Math.min(nextInterval(diff) * 1000, 0x7FFFFFFF))] = 0; // there is no need to save node in object.
|
147
|
+
// set attribute date-tid
|
148
|
+
setTidAttr(node, tid);
|
149
|
+
};
|
150
|
+
/**
|
151
|
+
* format: format the date to *** time ago, with setting or default locale
|
152
|
+
* - date: the date / string / timestamp to be formated
|
153
|
+
* - locale: the formated string's locale name, e.g. en / zh_CN
|
154
|
+
*
|
155
|
+
* How to use it?
|
156
|
+
* var timeago = require('timeago.js')();
|
157
|
+
* timeago.format(new Date(), 'pl'); // Date instance
|
158
|
+
* timeago.format('2016-09-10', 'fr'); // formated date string
|
159
|
+
* timeago.format(1473473400269); // timestamp with ms
|
160
|
+
**/
|
161
|
+
Timeago.prototype.format = function(date, locale) {
|
162
|
+
return formatDiff(diffSec(date, this.nowDate), locale, this.defaultLocale);
|
163
|
+
};
|
164
|
+
/**
|
165
|
+
* render: render the DOM real-time.
|
166
|
+
* - nodes: which nodes will be rendered.
|
167
|
+
* - locale: the locale name used to format date.
|
168
|
+
*
|
169
|
+
* How to use it?
|
170
|
+
* var timeago = require('timeago.js')();
|
171
|
+
* // 1. javascript selector
|
172
|
+
* timeago.render(document.querySelectorAll('.need_to_be_rendered'));
|
173
|
+
* // 2. use jQuery selector
|
174
|
+
* timeago.render($('.need_to_be_rendered'), 'pl');
|
175
|
+
*
|
176
|
+
* Notice: please be sure the dom has attribute `datetime`.
|
177
|
+
**/
|
178
|
+
Timeago.prototype.render = function(nodes, locale) {
|
179
|
+
if (nodes.length === undefined) nodes = [nodes];
|
180
|
+
for (var i = 0, len = nodes.length; i < len; i++) {
|
181
|
+
this.doRender(nodes[i], getDateAttr(nodes[i]), locale); // render item
|
182
|
+
}
|
183
|
+
};
|
184
|
+
/**
|
185
|
+
* setLocale: set the default locale name.
|
186
|
+
*
|
187
|
+
* How to use it?
|
188
|
+
* var timeago = require('timeago.js')();
|
189
|
+
* timeago.setLocale('fr');
|
190
|
+
**/
|
191
|
+
Timeago.prototype.setLocale = function(locale) {
|
192
|
+
this.defaultLocale = locale;
|
193
|
+
};
|
194
|
+
/**
|
195
|
+
* timeago: the function to get `timeago` instance.
|
196
|
+
* - nowDate: the relative date, default is new Date().
|
197
|
+
* - defaultLocale: the default locale, default is en. if your set it, then the `locale` parameter of format is not needed of you.
|
198
|
+
*
|
199
|
+
* How to use it?
|
200
|
+
* var timeagoFactory = require('timeago.js');
|
201
|
+
* var timeago = timeagoFactory(); // all use default.
|
202
|
+
* var timeago = timeagoFactory('2016-09-10'); // the relative date is 2016-09-10, so the 2016-09-11 will be 1 day ago.
|
203
|
+
* var timeago = timeagoFactory(null, 'zh_CN'); // set default locale is `zh_CN`.
|
204
|
+
* var timeago = timeagoFactory('2016-09-10', 'zh_CN'); // the relative date is 2016-09-10, and locale is zh_CN, so the 2016-09-11 will be 1天前.
|
205
|
+
**/
|
206
|
+
function timeagoFactory(nowDate, defaultLocale) {
|
207
|
+
return new Timeago(nowDate, defaultLocale);
|
208
|
+
}
|
209
|
+
/**
|
210
|
+
* register: register a new language locale
|
211
|
+
* - locale: locale name, e.g. en / zh_CN, notice the standard.
|
212
|
+
* - localeFunc: the locale process function
|
213
|
+
*
|
214
|
+
* How to use it?
|
215
|
+
* var timeagoFactory = require('timeago.js');
|
216
|
+
*
|
217
|
+
* timeagoFactory.register('the locale name', the_locale_func);
|
218
|
+
* // or
|
219
|
+
* timeagoFactory.register('pl', require('timeago.js/locales/pl'));
|
220
|
+
**/
|
221
|
+
timeagoFactory.register = function(locale, localeFunc) {
|
222
|
+
locales[locale] = localeFunc;
|
223
|
+
};
|
224
|
+
|
225
|
+
/**
|
226
|
+
* cancel: cancels one or all the timers which are doing real-time render.
|
227
|
+
*
|
228
|
+
* How to use it?
|
229
|
+
* For canceling all the timers:
|
230
|
+
* var timeagoFactory = require('timeago.js');
|
231
|
+
* var timeago = timeagoFactory();
|
232
|
+
* timeago.render(document.querySelectorAll('.need_to_be_rendered'));
|
233
|
+
* timeagoFactory.cancel(); // will stop all the timers, stop render in real time.
|
234
|
+
*
|
235
|
+
* For canceling single timer on specific node:
|
236
|
+
* var timeagoFactory = require('timeago.js');
|
237
|
+
* var timeago = timeagoFactory();
|
238
|
+
* var nodes = document.querySelectorAll('.need_to_be_rendered');
|
239
|
+
* timeago.render(nodes);
|
240
|
+
* timeagoFactory.cancel(nodes[0]); // will clear a timer attached to the first node, stop render in real time.
|
241
|
+
**/
|
242
|
+
timeagoFactory.cancel = function(node) {
|
243
|
+
var tid;
|
244
|
+
// assigning in if statement to save space
|
245
|
+
if (node) {
|
246
|
+
tid = getTidFromNode(node);
|
247
|
+
if (tid) {
|
248
|
+
clearTimeout(tid);
|
249
|
+
delete timers[tid];
|
250
|
+
}
|
251
|
+
} else {
|
252
|
+
for (tid in timers) clearTimeout(tid);
|
253
|
+
timers = {};
|
254
|
+
}
|
255
|
+
};
|
256
|
+
|
257
|
+
return timeagoFactory;
|
258
|
+
});
|
@@ -0,0 +1 @@
|
|
1
|
+
!function(s){function n(a){if(e[a])return e[a].exports;var t=e[a]={exports:{},id:a,loaded:!1};return s[a].call(t.exports,t,t.exports,n),t.loaded=!0,t.exports}var e={};return n.m=s,n.c=e,n.p="",n(0)}([function(s,n,e){for(var a=e(1),t=null,u=a.length-1;u>=0;u--)t=a[u],"en"!=t&&"zh_CN"!=t&&timeago.register(t,e(2)("./"+t))},function(s,n){s.exports=["ar","be","bg","ca","da","de","el","en","en_short","es","eu","fi","fr","he","hu","in_BG","in_HI","in_ID","it","ja","ko","ml","nb_NO","nl","nn_NO","pl","pt_BR","ro","ru","sv","ta","th","tr","uk","vi","zh_CN","zh_TW"]},function(s,n,e){function a(s){return e(t(s))}function t(s){return u[s]||function(){throw new Error("Cannot find module '"+s+"'.")}()}var u={"./ar":3,"./ar.js":3,"./be":4,"./be.js":4,"./bg":5,"./bg.js":5,"./ca":6,"./ca.js":6,"./da":7,"./da.js":7,"./de":8,"./de.js":8,"./el":9,"./el.js":9,"./en":10,"./en.js":10,"./en_short":11,"./en_short.js":11,"./es":12,"./es.js":12,"./eu":13,"./eu.js":13,"./fi":14,"./fi.js":14,"./fr":15,"./fr.js":15,"./he":16,"./he.js":16,"./hu":17,"./hu.js":17,"./in_BG":18,"./in_BG.js":18,"./in_HI":19,"./in_HI.js":19,"./in_ID":20,"./in_ID.js":20,"./it":21,"./it.js":21,"./ja":22,"./ja.js":22,"./ko":23,"./ko.js":23,"./locales":1,"./locales.js":1,"./ml":24,"./ml.js":24,"./nb_NO":25,"./nb_NO.js":25,"./nl":26,"./nl.js":26,"./nn_NO":27,"./nn_NO.js":27,"./pl":28,"./pl.js":28,"./pt_BR":29,"./pt_BR.js":29,"./ro":30,"./ro.js":30,"./ru":31,"./ru.js":31,"./sv":32,"./sv.js":32,"./ta":33,"./ta.js":33,"./th":34,"./th.js":34,"./tr":35,"./tr.js":35,"./uk":36,"./uk.js":36,"./vi":37,"./vi.js":37,"./zh_CN":38,"./zh_CN.js":38,"./zh_TW":39,"./zh_TW.js":39};a.keys=function(){return Object.keys(u)},a.resolve=t,s.exports=a,a.id=2},function(s,n){function e(s,n){return n<3?a[s][n-1]:n>=3&&n<=10?a[s][2]:a[s][3]}s.exports=function(s,n){if(0===n)return["منذ لحظات","بعد لحظات"];var a=e(Math.floor(n/2),s);return["منذ "+a,"بعد "+a]};var a=[["ثانية","ثانيتين","%s ثوان","%s ثانية"],["دقيقة","دقيقتين","%s دقائق","%s دقيقة"],["ساعة","ساعتين","%s ساعات","%s ساعة"],["يوم","يومين","%s أيام","%s يوماً"],["أسبوع","أسبوعين","%s أسابيع","%s أسبوعاً"],["شهر","شهرين","%s أشهر","%s شهراً"],["عام","عامين","%s أعوام","%s عاماً"]]},function(s,n){function e(s,n,e,a,t){var u=t%10,i=a;return 1===t?i=s:1===u&&t>20?i=n:u>1&&u<5&&(t>20||t<10)&&(i=e),i}var a=e.bind(null,"секунду","%s секунду","%s секунды","%s секунд"),t=e.bind(null,"хвіліну","%s хвіліну","%s хвіліны","%s хвілін"),u=e.bind(null,"гадзіну","%s гадзіну","%s гадзіны","%s гадзін"),i=e.bind(null,"дзень","%s дзень","%s дні","%s дзён"),r=e.bind(null,"тыдзень","%s тыдзень","%s тыдні","%s тыдняў"),o=e.bind(null,"месяц","%s месяц","%s месяцы","%s месяцаў"),m=e.bind(null,"год","%s год","%s гады","%s гадоў");s.exports=function(s,n){switch(n){case 0:return["толькі што","праз некалькі секунд"];case 1:return[a(s)+" таму","праз "+a(s)];case 2:case 3:return[t(s)+" таму","праз "+t(s)];case 4:case 5:return[u(s)+" таму","праз "+u(s)];case 6:case 7:return[i(s)+" таму","праз "+i(s)];case 8:case 9:return[r(s)+" таму","праз "+r(s)];case 10:case 11:return[o(s)+" таму","праз "+o(s)];case 12:case 13:return[m(s)+" таму","праз "+m(s)];default:return["",""]}}},function(s,n){s.exports=function(s,n){return[["току що","съвсем скоро"],["преди %s секунди","след %s секунди"],["преди 1 минута","след 1 минута"],["преди %s минути","след %s минути"],["преди 1 час","след 1 час"],["преди %s часа","след %s часа"],["преди 1 ден","след 1 ден"],["преди %s дни","след %s дни"],["преди 1 седмица","след 1 седмица"],["преди %s седмици","след %s седмици"],["преди 1 месец","след 1 месец"],["преди %s месеца","след %s месеца"],["преди 1 година","след 1 година"],["преди %s години","след %s години"]][n]}},function(s,n){s.exports=function(s,n){return[["fa un moment","d'aquí un moment"],["fa %s segons","d'aquí %s segons"],["fa 1 minut","d'aquí 1 minut"],["fa %s minuts","d'aquí %s minuts"],["fa 1 hora","d'aquí 1 hora"],["fa %s hores","d'aquí %s hores"],["fa 1 dia","d'aquí 1 dia"],["fa %s dies","d'aquí %s dies"],["fa 1 setmana","d'aquí 1 setmana"],["fa %s setmanes","d'aquí %s setmanes"],["fa 1 mes","d'aquí 1 mes"],["fa %s mesos","d'aquí %s mesos"],["fa 1 any","d'aquí 1 any"],["fa %s anys","d'aquí %s anys"]][n]}},function(s,n){s.exports=function(s,n){return[["for et øjeblik siden","om et øjeblik"],["for %s sekunder siden","om %s sekunder"],["for 1 minut siden","om 1 minut"],["for %s minutter siden","om %s minutter"],["for 1 time siden","om 1 time"],["for %s timer siden","om %s timer"],["for 1 dag siden","om 1 dag"],["for %s dage siden","om %s dage"],["for 1 uge siden","om 1 uge"],["for %s uger siden","om %s uger"],["for 1 måned siden","om 1 måned"],["for %s måneder siden","om %s måneder"],["for 1 år siden","om 1 år"],["for %s år siden","om %s år"]][n]}},function(s,n){s.exports=function(s,n){return[["gerade eben","vor einer Weile"],["vor %s Sekunden","in %s Sekunden"],["vor 1 Minute","in 1 Minute"],["vor %s Minuten","in %s Minuten"],["vor 1 Stunde","in 1 Stunde"],["vor %s Stunden","in %s Stunden"],["vor 1 Tag","in 1 Tag"],["vor %s Tagen","in %s Tagen"],["vor 1 Woche","in 1 Woche"],["vor %s Wochen","in %s Wochen"],["vor 1 Monat","in 1 Monat"],["vor %s Monaten","in %s Monaten"],["vor 1 Jahr","in 1 Jahr"],["vor %s Jahren","in %s Jahren"]][n]}},function(s,n){s.exports=function(s,n){return[["μόλις τώρα","σε λίγο"],["%s δευτερόλεπτα πριν","σε %s δευτερόλεπτα"],["1 λεπτό πριν","σε 1 λεπτό"],["%s λεπτά πριν","σε %s λεπτά"],["1 ώρα πριν","σε 1 ώρα"],["%s ώρες πριν","σε %s ώρες"],["1 μέρα πριν","σε 1 μέρα"],["%s μέρες πριν","σε %s μέρες"],["1 εβδομάδα πριν","σε 1 εβδομάδα"],["%s εβδομάδες πριν","σε %s εβδομάδες"],["1 μήνα πριν","σε 1 μήνα"],["%s μήνες πριν","σε %s μήνες"],["1 χρόνο πριν","σε 1 χρόνο"],["%s χρόνια πριν","σε %s χρόνια"]][n]}},function(s,n){s.exports=function(s,n){return[["just now","right now"],["%s seconds ago","in %s seconds"],["1 minute ago","in 1 minute"],["%s minutes ago","in %s minutes"],["1 hour ago","in 1 hour"],["%s hours ago","in %s hours"],["1 day ago","in 1 day"],["%s days ago","in %s days"],["1 week ago","in 1 week"],["%s weeks ago","in %s weeks"],["1 month ago","in 1 month"],["%s months ago","in %s months"],["1 year ago","in 1 year"],["%s years ago","in %s years"]][n]}},function(s,n){s.exports=function(s,n){return[["just now","right now"],["%ss ago","in %ss"],["1m ago","in 1m"],["%sm ago","in %sm"],["1h ago","in 1h"],["%sh ago","in %sh"],["1d ago","in 1d"],["%sd ago","in %sd"],["1w ago","in 1w"],["%sw ago","in %sw"],["1mo ago","in 1mo"],["%smo ago","in %smo"],["1yr ago","in 1yr"],["%syr ago","in %syr"]][n]}},function(s,n){s.exports=function(s,n){return[["justo ahora","en un rato"],["hace %s segundos","en %s segundos"],["hace 1 minuto","en 1 minuto"],["hace %s minutos","en %s minutos"],["hace 1 hora","en 1 hora"],["hace %s horas","en %s horas"],["hace 1 día","en 1 día"],["hace %s días","en %s días"],["hace 1 semana","en 1 semana"],["hace %s semanas","en %s semanas"],["hace 1 mes","en 1 mes"],["hace %s meses","en %s meses"],["hace 1 año","en 1 año"],["hace %s años","en %s años"]][n]}},function(s,n){s.exports=function(s,n){return[["orain","denbora bat barru"],["duela %s segundu","%s segundu barru"],["duela minutu 1","minutu 1 barru"],["duela %s minutu","%s minutu barru"],["duela ordu 1","ordu 1 barru"],["duela %s ordu","%s ordu barru"],["duela egun 1","egun 1 barru"],["duela %s egun","%s egun barru"],["duela aste 1","aste 1 barru"],["duela %s aste","%s aste barru"],["duela hillabete 1","hillabete 1 barru"],["duela %s hillabete","%s hillabete barru"],["duela urte 1","urte 1 barru"],["duela %s urte","%s urte barru"]][n]}},function(s,n){s.exports=function(s,n){return[["juuri äsken","juuri nyt"],["%s sekuntia sitten","%s sekunnin päästä"],["minuutti sitten","minuutin päästä"],["%s minuuttia sitten","%s minuutin päästä"],["tunti sitten","tunnin päästä"],["%s tuntia sitten","%s tunnin päästä"],["päivä sitten","päivän päästä"],["%s päivää sitten","%s päivän päästä"],["viikko sitten","viikon päästä"],["%s viikkoa sitten","%s viikon päästä"],["kuukausi sitten","kuukauden päästä"],["%s kuukautta sitten","%s kuukauden päästä"],["vuosi sitten","vuoden päästä"],["%s vuotta sitten","%s vuoden päästä"]][n]}},function(s,n){s.exports=function(s,n){return[["à l'instant","dans un instant"],["il y a %s secondes","dans %s secondes"],["il y a 1 minute","dans 1 minute"],["il y a %s minutes","dans %s minutes"],["il y a 1 heure","dans 1 heure"],["il y a %s heures","dans %s heures"],["il y a 1 jour","dans 1 jour"],["il y a %s jours","dans %s jours"],["il y a 1 semaine","dans 1 semaine"],["il y a %s semaines","dans %s semaines"],["il y a 1 mois","dans 1 mois"],["il y a %s mois","dans %s mois"],["il y a 1 an","dans 1 an"],["il y a %s ans","dans %s ans"]][n]}},function(s,n){s.exports=function(s,n){return[["זה עתה","עכשיו"],["לפני %s שניות","בעוד %s שניות"],["לפני דקה","בעוד דקה"],["לפני %s דקות","בעוד %s דקות"],["לפני שעה","בעוד שעה"],["לפני %s שעות","בעוד %s שעות"],["אתמול","מחר"],["לפני %s ימים","בעוד %s ימים"],["לפני שבוע","בעוד שבוע"],["לפני %s שבועות","בעוד %s שבועות"],["לפני חודש","בעוד חודש"],["לפני %s חודשים","בעוד %s חודשים"],["לפני שנה","בעוד שנה"],["לפני %s שנים","בעוד %s שנים"]][n]}},function(s,n){s.exports=function(s,n){return[["éppen most","éppen most"],["%s másodperce","%s másodpercen belül"],["1 perce","1 percen belül"],["%s perce","%s percen belül"],["1 órája","1 órán belül"],["%s órája","%s órán belül"],["1 napja","1 napon belül"],["%s napja","%s napon belül"],["1 hete","1 héten belül"],["%s hete","%s héten belül"],["1 hónapja","1 hónapon belül"],["%s hónapja","%s hónapon belül"],["1 éve","1 éven belül"],["%s éve","%s éven belül"]][n]}},function(s,n){s.exports=function(s,n){return[["এইমাত্র","একটা সময়"],["%s সেকেন্ড আগে","%s এর সেকেন্ডের মধ্যে"],["1 মিনিট আগে","1 মিনিটে"],["%s এর মিনিট আগে","%s এর মিনিটের মধ্যে"],["1 ঘন্টা আগে","1 ঘন্টা"],["%s ঘণ্টা আগে","%s এর ঘন্টার মধ্যে"],["1 দিন আগে","1 দিনের মধ্যে"],["%s এর দিন আগে","%s এর দিন"],["1 সপ্তাহ আগে","1 সপ্তাহের মধ্যে"],["%s এর সপ্তাহ আগে","%s সপ্তাহের মধ্যে"],["1 মাস আগে","1 মাসে"],["%s মাস আগে","%s মাসে"],["1 বছর আগে","1 বছরের মধ্যে"],["%s বছর আগে","%s বছরে"]][n]}},function(s,n){s.exports=function(s,n){return[["अभी","कुछ समय"],["%s सेकंड पहले","%s सेकंड में"],["1 मिनट पहले","1 मिनट में"],["%s मिनट पहले","%s मिनट में"],["1 घंटे पहले","1 घंटे में"],["%s घंटे पहले","%s घंटे में"],["1 दिन पहले","1 दिन में"],["%s दिन पहले","%s दिनों में"],["1 सप्ताह पहले","1 सप्ताह में"],["%s हफ्ते पहले","%s हफ्तों में"],["1 महीने पहले","1 महीने में"],["%s महीने पहले","%s महीनों में"],["1 साल पहले","1 साल में"],["%s साल पहले","%s साल में"]][n]}},function(s,n){s.exports=function(s,n){return[["baru saja","sebentar"],["%s detik yang lalu","dalam %s detik"],["1 menit yang lalu","dalam 1 menit"],["%s menit yang lalu","dalam %s menit"],["1 jam yang lalu","dalam 1 jam"],["%s jam yang lalu","dalam %s jam"],["1 hari yang lalu","dalam 1 hari"],["%s hari yang lalu","dalam %s hari"],["1 minggu yang lalu","dalam 1 minggu"],["%s minggu yang lalu","dalam %s minggu"],["1 bulan yang lalu","dalam 1 bulan"],["%s bulan yang lalu","dalam %s bulan"],["1 tahun yang lalu","dalam 1 tahun"],["%s tahun yang lalu","dalam %s tahun"]][n]}},function(s,n){s.exports=function(s,n){return[["poco fa","tra poco"],["%s secondi fa","%s secondi da ora"],["un minuto fa","un minuto da ora"],["%s minuti fa","%s minuti da ora"],["un'ora fa","un'ora da ora"],["%s ore fa","%s ore da ora"],["un giorno fa","un giorno da ora"],["%s giorni fa","%s giorni da ora"],["una settimana fa","una settimana da ora"],["%s settimane fa","%s settimane da ora"],["un mese fa","un mese da ora"],["%s mesi fa","%s mesi da ora"],["un anno fa","un anno da ora"],["%s anni fa","%s anni da ora"]][n]}},function(s,n){s.exports=function(s,n){return[["すこし前","すぐに"],["%s秒前","%s秒以内"],["1分前","1分以内"],["%s分前","%s分以内"],["1時間前","1時間以内"],["%s時間前","%s時間以内"],["1日前","1日以内"],["%s日前","%s日以内"],["1週間前","1週間以内"],["%s週間前","%s週間以内"],["1ヶ月前","1ヶ月以内"],["%sヶ月前","%sヶ月以内"],["1年前","1年以内"],["%s年前","%s年以内"]][n]}},function(s,n){s.exports=function(s,n){return[["방금","곧"],["%s초 전","%s초 후"],["1분 전","1분 후"],["%s분 전","%s분 후"],["1시간 전","1시간 후"],["%s시간 전","%s시간 후"],["1일 전","1일 후"],["%s일 전","%s일 후"],["1주일 전","1주일 후"],["%s주일 전","%s주일 후"],["1개월 전","1개월 후"],["%s개월 전","%s개월 후"],["1년 전","1년 후"],["%s년 전","%s년 후"]][n]}},function(s,n){s.exports=function(s,n){return[["ഇപ്പോള്","കുറച്ചു മുന്പ്"],["%s സെക്കന്റ്കള്ക്ക് മുന്പ്","%s സെക്കന്റില്"],["1 മിനിറ്റിനു മുന്പ്","1 മിനിറ്റില്"],["%s മിനിറ്റുകള്ക്ക് മുന്പ","%s മിനിറ്റില്"],["1 മണിക്കൂറിനു മുന്പ്","1 മണിക്കൂറില്"],["%s മണിക്കൂറുകള്ക്കു മുന്പ്","%s മണിക്കൂറില്"],["1 ഒരു ദിവസം മുന്പ്","1 ദിവസത്തില്"],["%s ദിവസങ്ങള്ക് മുന്പ്","%s ദിവസങ്ങള്ക്കുള്ളില്"],["1 ആഴ്ച മുന്പ്","1 ആഴ്ചയില്"],["%s ആഴ്ചകള്ക്ക് മുന്പ്","%s ആഴ്ചകള്ക്കുള്ളില്"],["1 മാസത്തിനു മുന്പ്","1 മാസത്തിനുള്ളില്"],["%s മാസങ്ങള്ക്ക് മുന്പ്","%s മാസങ്ങള്ക്കുള്ളില്"],["1 വര്ഷത്തിനു മുന്പ്","1 വര്ഷത്തിനുള്ളില്"],["%s വര്ഷങ്ങള്ക്കു മുന്പ്","%s വര്ഷങ്ങള്ക്കുല്ല്ളില്"]][n]}},function(s,n){s.exports=function(s,n){return[["akkurat nå","om litt"],["%s sekunder siden","om %s sekunder"],["1 minutt siden","om 1 minutt"],["%s minutter siden","om %s minutter"],["1 time siden","om 1 time"],["%s timer siden","om %s timer"],["1 dag siden","om 1 dag"],["%s dager siden","om %s dager"],["1 uke siden","om 1 uke"],["%s uker siden","om %s uker"],["1 måned siden","om 1 måned"],["%s måneder siden","om %s måneder"],["1 år siden","om 1 år"],["%s år siden","om %s år"]][n]}},function(s,n){s.exports=function(s,n){return[["recent","binnenkort"],["%s seconden geleden","binnen %s seconden"],["1 minuut geleden","binnen 1 minuut"],["%s minuten geleden","binnen %s minuten"],["1 uur geleden","binnen 1 uur"],["%s uren geleden","binnen %s uren"],["1 dag geleden","binnen 1 dag"],["%s dagen geleden","binnen %s dagen"],["1 week geleden","binnen 1 week"],["%s weken geleden","binnen %s weken"],["1 maand geleden","binnen 1 maand"],["%s maanden geleden","binnen %s maanden"],["1 jaar geleden","binnen 1 jaar"],["%s jaren geleden","binnen %s jaren"]][n]}},function(s,n){s.exports=function(s,n){return[["nett no","om litt"],["%s sekund sidan","om %s sekund"],["1 minutt sidan","om 1 minutt"],["%s minutt sidan","om %s minutt"],["1 time sidan","om 1 time"],["%s timar sidan","om %s timar"],["1 dag sidan","om 1 dag"],["%s dagar sidan","om %s dagar"],["1 veke sidan","om 1 veke"],["%s veker sidan","om %s veker"],["1 månad sidan","om 1 månad"],["%s månadar sidan","om %s månadar"],["1 år sidan","om 1 år"],["%s år sidan","om %s år"]][n]}},function(s,n){var e=[["w tej chwili","za chwilę"],["%s sekund temu","za %s sekund"],["1 minutę temu","za 1 minutę"],["%s minut temu","za %s minut"],["1 godzinę temu","za 1 godzinę"],["%s godzin temu","za %s godzin"],["1 dzień temu","za 1 dzień"],["%s dni temu","za %s dni"],["1 tydzień temu","za 1 tydzień"],["%s tygodni temu","za %s tygodni"],["1 miesiąc temu","za 1 miesiąc"],["%s miesięcy temu","za %s miesięcy"],["1 rok temu","za 1 rok"],["%s lat temu","za %s lat"],["%s sekundy temu","za %s sekundy"],["%s minuty temu","za %s minuty"],["%s godziny temu","za %s godziny"],["%s dni temu","za %s dni"],["%s tygodnie temu","za %s tygodnie"],["%s miesiące temu","za %s miesiące"],["%s lata temu","za %s lata"]];s.exports=function(s,n){return e[1&n?s%10>4||s%10<2||1===~~(s/10)%10?n:++n/2+13:n]}},function(s,n){s.exports=function(s,n){return[["agora mesmo","daqui um pouco"],["há %s segundos","em %s segundos"],["há um minuto","em um minuto"],["há %s minutos","em %s minutos"],["há uma hora","em uma hora"],["há %s horas","em %s horas"],["há um dia","em um dia"],["há %s dias","em %s dias"],["há uma semana","em uma semana"],["há %s semanas","em %s semanas"],["há um mês","em um mês"],["há %s meses","em %s meses"],["há um ano","em um ano"],["há %s anos","em %s anos"]][n]}},function(s,n){s.exports=function(s,n){var e=[["chiar acum","chiar acum"],["acum %s secunde","peste %s secunde"],["acum un minut","peste un minut"],["acum %s minute","peste %s minute"],["acum o oră","peste o oră"],["acum %s ore","peste %s ore"],["acum o zi","peste o zi"],["acum %s zile","peste %s zile"],["acum o săptămână","peste o săptămână"],["acum %s săptămâni","peste %s săptămâni"],["acum o lună","peste o lună"],["acum %s luni","peste %s luni"],["acum un an","peste un an"],["acum %s ani","peste %s ani"]];return s<20?e[n]:[e[n][0].replace("%s","%s de"),e[n][1].replace("%s","%s de")]}},function(s,n){function e(s,n,e,a,t){var u=t%10,i=a;return 1===t?i=s:1===u&&t>20?i=n:u>1&&u<5&&(t>20||t<10)&&(i=e),i}var a=e.bind(null,"секунду","%s секунду","%s секунды","%s секунд"),t=e.bind(null,"минуту","%s минуту","%s минуты","%s минут"),u=e.bind(null,"час","%s час","%s часа","%s часов"),i=e.bind(null,"день","%s день","%s дня","%s дней"),r=e.bind(null,"неделю","%s неделю","%s недели","%s недель"),o=e.bind(null,"месяц","%s месяц","%s месяца","%s месяцев"),m=e.bind(null,"год","%s год","%s года","%s лет");s.exports=function(s,n){switch(n){case 0:return["только что","через несколько секунд"];case 1:return[a(s)+" назад","через "+a(s)];case 2:case 3:return[t(s)+" назад","через "+t(s)];case 4:case 5:return[u(s)+" назад","через "+u(s)];case 6:return["вчера","завтра"];case 7:return[i(s)+" назад","через "+i(s)];case 8:case 9:return[r(s)+" назад","через "+r(s)];case 10:case 11:return[o(s)+" назад","через "+o(s)];case 12:case 13:return[m(s)+" назад","через "+m(s)];default:return["",""]}}},function(s,n){s.exports=function(s,n){return[["just nu","om en stund"],["%s sekunder sedan","om %s seconder"],["1 minut sedan","om 1 minut"],["%s minuter sedan","om %s minuter"],["1 timme sedan","om 1 timme"],["%s timmar sedan","om %s timmar"],["1 dag sedan","om 1 dag"],["%s dagar sedan","om %s dagar"],["1 vecka sedan","om 1 vecka"],["%s veckor sedan","om %s veckor"],["1 månad sedan","om 1 månad"],["%s månader sedan","om %s månader"],["1 år sedan","om 1 år"],["%s år sedan","om %s år"]][n]}},function(s,n){s.exports=function(s,n){return[["இப்போது","சற்று நேரம் முன்பு"],["%s நொடிக்கு முன்","%s நொடிகளில்"],["1 நிமிடத்திற்க்கு முன்","1 நிமிடத்தில்"],["%s நிமிடத்திற்க்கு முன்","%s நிமிடங்களில்"],["1 மணி நேரத்திற்கு முன்","1 மணி நேரத்திற்குள்"],["%s மணி நேரத்திற்கு முன்","%s மணி நேரத்திற்குள்"],["1 நாளுக்கு முன்","1 நாளில்"],["%s நாட்களுக்கு முன்","%s நாட்களில்"],["1 வாரத்திற்கு முன்","1 வாரத்தில்"],["%s வாரங்களுக்கு முன்","%s வாரங்களில்"],["1 மாதத்திற்கு முன்","1 மாதத்தில்"],["%s மாதங்களுக்கு முன்","%s மாதங்களில்"],["1 வருடத்திற்கு முன்","1 வருடத்தில்"],["%s வருடங்களுக்கு முன்","%s வருடங்களில்"]][n]}},function(s,n){s.exports=function(s,n){return[["เมื่อสักครู่นี้","อีกสักครู่"],["%s วินาทีที่แล้ว","ใน %s วินาที"],["1 นาทีที่แล้ว","ใน 1 นาที"],["%s นาทีที่แล้ว","ใน %s นาที"],["1 ชั่วโมงที่แล้ว","ใน 1 ชั่วโมง"],["%s ชั่วโมงที่แล้ว","ใน %s ชั่วโมง"],["1 วันที่แล้ว","ใน 1 วัน"],["%s วันที่แล้ว","ใน %s วัน"],["1 อาทิตย์ที่แล้ว","ใน 1 อาทิตย์"],["%s อาทิตย์ที่แล้ว","ใน %s อาทิตย์"],["1 เดือนที่แล้ว","ใน 1 เดือน"],["%s เดือนที่แล้ว","ใน %s เดือน"],["1 ปีที่แล้ว","ใน 1 ปี"],["%s ปีที่แล้ว","ใน %s ปี"]][n]}},function(s,n){s.exports=function(s,n){return[["az önce","şimdi"],["%s saniye önce","%s saniye içinde"],["1 dakika önce","1 dakika içinde"],["%s dakika önce","%s dakika içinde"],["1 saat önce","1 saat içinde"],["%s saat önce","%s saat içinde"],["1 gün önce","1 gün içinde"],["%s gün önce","%s gün içinde"],["1 hafta önce","1 hafta içinde"],["%s hafta önce","%s hafta içinde"],["1 ay önce","1 ay içinde"],["%s ay önce","%s ay içinde"],["1 yıl önce","1 yıl içinde"],["%s yıl önce","%s yıl içinde"]][n]}},function(s,n){function e(s,n,e,a,t){var u=t%10,i=a;return 1===t?i=s:1===u&&t>20?i=n:u>1&&u<5&&(t>20||t<10)&&(i=e),i}var a=e.bind(null,"секунду","%s секунду","%s секунди","%s секунд"),t=e.bind(null,"хвилину","%s хвилину","%s хвилини","%s хвилин"),u=e.bind(null,"годину","%s годину","%s години","%s годин"),i=e.bind(null,"день","%s день","%s дні","%s днів"),r=e.bind(null,"тиждень","%s тиждень","%s тиждні","%s тижднів"),o=e.bind(null,"місяць","%s місяць","%s місяці","%s місяців"),m=e.bind(null,"рік","%s рік","%s роки","%s років");s.exports=function(s,n){switch(n){case 0:return["щойно","через декілька секунд"];case 1:return[a(s)+" тому","через "+a(s)];case 2:case 3:return[t(s)+" тому","через "+t(s)];case 4:case 5:return[u(s)+" тому","через "+u(s)];case 6:case 7:return[i(s)+" тому","через "+i(s)];case 8:case 9:return[r(s)+" тому","через "+r(s)];case 10:case 11:return[o(s)+" тому","через "+o(s)];case 12:case 13:return[m(s)+" тому","через "+m(s)];default:return["",""]}}},function(s,n){s.exports=function(s,n){return[["vừa xong","một lúc"],["%s giây trước","trong %s giây"],["1 phút trước","trong 1 phút"],["%s phút trước","trong %s phút"],["1 giờ trước","trong 1 giờ"],["%s giờ trước","trong %s giờ"],["1 ngày trước","trong 1 ngày"],["%s ngày trước","trong %s ngày"],["1 tuần trước","trong 1 tuần"],["%s tuần trước","trong %s tuần"],["1 tháng trước","trong 1 tháng"],["%s tháng trước","trong %s tháng"],["1 năm trước","trong 1 năm"],["%s năm trước","trong %s năm"]][n]}},function(s,n){s.exports=function(s,n){return[["刚刚","片刻后"],["%s秒前","%s秒后"],["1分钟前","1分钟后"],["%s分钟前","%s分钟后"],["1小时前","1小时后"],["%s小时前","%s小时后"],["1天前","1天后"],["%s天前","%s天后"],["1周前","1周后"],["%s周前","%s周后"],["1月前","1月后"],["%s月前","%s月后"],["1年前","1年后"],["%s年前","%s年后"]][n]}},function(s,n){s.exports=function(s,n){return[["剛剛","片刻後"],["%s秒前","%s秒後"],["1分鐘前","1分鐘後"],["%s分鐘前","%s分鐘後"],["1小時前","1小時後"],["%s小時前","%s小時後"],["1天前","1天後"],["%s天前","%s天後"],["1周前","1周後"],["%s周前","%s周後"],["1月前","1月後"],["%s月前","%s月後"],["1年前","1年後"],["%s年前","%s年後"]][n]}}]);
|
@@ -0,0 +1,30 @@
|
|
1
|
+
(function() {
|
2
|
+
var _fn = function(number, index) {
|
3
|
+
if (index === 0) {
|
4
|
+
return [ 'منذ لحظات', 'بعد لحظات' ];
|
5
|
+
}
|
6
|
+
|
7
|
+
var timeStr = formatTime(Math.floor(index/2), number);
|
8
|
+
return ['منذ' + ' ' + timeStr, 'بعد' + ' ' + timeStr];
|
9
|
+
}
|
10
|
+
|
11
|
+
var timeTypes = [
|
12
|
+
[ 'ثانية', 'ثانيتين', '%s ثوان', '%s ثانية' ], // Seconds
|
13
|
+
[ 'دقيقة', 'دقيقتين', '%s دقائق', '%s دقيقة' ], // Minutes
|
14
|
+
[ 'ساعة', 'ساعتين', '%s ساعات', '%s ساعة' ], // Hours
|
15
|
+
[ 'يوم', 'يومين', '%s أيام', '%s يوماً' ], // Days
|
16
|
+
[ 'أسبوع', 'أسبوعين', '%s أسابيع', '%s أسبوعاً' ], // Weeks
|
17
|
+
[ 'شهر', 'شهرين', '%s أشهر', '%s شهراً' ], // Months
|
18
|
+
[ 'عام', 'عامين', '%s أعوام', '%s عاماً' ] // Years
|
19
|
+
];
|
20
|
+
|
21
|
+
function formatTime(type, n) {
|
22
|
+
if (n < 3)
|
23
|
+
return timeTypes[type][n-1];
|
24
|
+
else if (n >= 3 && n <= 10)
|
25
|
+
return timeTypes[type][2];
|
26
|
+
else
|
27
|
+
return timeTypes[type][3];
|
28
|
+
}
|
29
|
+
this.timeago.register('ar', _fn)
|
30
|
+
})();
|
@@ -0,0 +1,55 @@
|
|
1
|
+
(function() {
|
2
|
+
var seconds = formatNum.bind(null, 'секунду', '%s секунду', '%s секунды', '%s секунд'),
|
3
|
+
minutes = formatNum.bind(null, 'хвіліну', '%s хвіліну', '%s хвіліны', '%s хвілін'),
|
4
|
+
hours = formatNum.bind(null, 'гадзіну', '%s гадзіну', '%s гадзіны', '%s гадзін'),
|
5
|
+
days = formatNum.bind(null, 'дзень', '%s дзень', '%s дні', '%s дзён'),
|
6
|
+
weeks = formatNum.bind(null, 'тыдзень', '%s тыдзень', '%s тыдні', '%s тыдняў'),
|
7
|
+
months = formatNum.bind(null, 'месяц', '%s месяц', '%s месяцы', '%s месяцаў'),
|
8
|
+
years = formatNum.bind(null, 'год', '%s год', '%s гады', '%s гадоў');
|
9
|
+
|
10
|
+
var _fn = function(number, index) {
|
11
|
+
switch(index) {
|
12
|
+
case 0: return ['толькі што', 'праз некалькі секунд'];
|
13
|
+
case 1: return [seconds(number) + ' таму', 'праз ' + seconds(number)];
|
14
|
+
case 2:
|
15
|
+
case 3: return [minutes(number) + ' таму', 'праз ' + minutes(number)];
|
16
|
+
case 4:
|
17
|
+
case 5: return [hours(number) + ' таму', 'праз ' + hours(number)];
|
18
|
+
case 6:
|
19
|
+
case 7: return [days(number) + ' таму', 'праз ' + days(number)];
|
20
|
+
case 8:
|
21
|
+
case 9: return [weeks(number) + ' таму', 'праз ' + weeks(number)];
|
22
|
+
case 10:
|
23
|
+
case 11: return [months(number) + ' таму', 'праз ' + months(number)];
|
24
|
+
case 12:
|
25
|
+
case 13: return [years(number) + ' таму', 'праз ' + years(number)];
|
26
|
+
default: return ['', '']
|
27
|
+
}
|
28
|
+
};
|
29
|
+
|
30
|
+
/**
|
31
|
+
*
|
32
|
+
* @param f1 - 1
|
33
|
+
* @param f - 21, 31, ...
|
34
|
+
* @param s - 2-4, 22-24, 32-34 ...
|
35
|
+
* @param t - 5-20, 25-30, ...
|
36
|
+
* @param n
|
37
|
+
* @returns {string}
|
38
|
+
*/
|
39
|
+
function formatNum(f1, f, s, t, n) {
|
40
|
+
var n10 = n % 10,
|
41
|
+
str = t;
|
42
|
+
|
43
|
+
if (n === 1) {
|
44
|
+
str = f1;
|
45
|
+
} else if (n10 === 1 && n > 20) {
|
46
|
+
str = f;
|
47
|
+
} else if (n10 > 1 && n10 < 5 && (n > 20 || n < 10)) {
|
48
|
+
str = s;
|
49
|
+
}
|
50
|
+
|
51
|
+
return str;
|
52
|
+
}
|
53
|
+
|
54
|
+
this.timeago.register('be', _fn)
|
55
|
+
})();
|
@@ -0,0 +1,18 @@
|
|
1
|
+
this.timeago.register('bg', function(number, index) {
|
2
|
+
return [
|
3
|
+
['току що', 'съвсем скоро'],
|
4
|
+
['преди %s секунди', 'след %s секунди'],
|
5
|
+
['преди 1 минута', 'след 1 минута'],
|
6
|
+
['преди %s минути', 'след %s минути'],
|
7
|
+
['преди 1 час', 'след 1 час'],
|
8
|
+
['преди %s часа', 'след %s часа'],
|
9
|
+
['преди 1 ден', 'след 1 ден'],
|
10
|
+
['преди %s дни', 'след %s дни'],
|
11
|
+
['преди 1 седмица', 'след 1 седмица'],
|
12
|
+
['преди %s седмици', 'след %s седмици'],
|
13
|
+
['преди 1 месец', 'след 1 месец'],
|
14
|
+
['преди %s месеца', 'след %s месеца'],
|
15
|
+
['преди 1 година', 'след 1 година'],
|
16
|
+
['преди %s години', 'след %s години']
|
17
|
+
][index];
|
18
|
+
})
|
@@ -0,0 +1,18 @@
|
|
1
|
+
this.timeago.register('ca', function(number, index) {
|
2
|
+
return [
|
3
|
+
['fa un moment', 'd\'aquí un moment'],
|
4
|
+
['fa %s segons', 'd\'aquí %s segons'],
|
5
|
+
['fa 1 minut', 'd\'aquí 1 minut'],
|
6
|
+
['fa %s minuts', 'd\'aquí %s minuts'],
|
7
|
+
['fa 1 hora', 'd\'aquí 1 hora'],
|
8
|
+
['fa %s hores', 'd\'aquí %s hores'],
|
9
|
+
['fa 1 dia', 'd\'aquí 1 dia'],
|
10
|
+
['fa %s dies', 'd\'aquí %s dies'],
|
11
|
+
['fa 1 setmana', 'd\'aquí 1 setmana'],
|
12
|
+
['fa %s setmanes', 'd\'aquí %s setmanes'],
|
13
|
+
['fa 1 mes', 'd\'aquí 1 mes'],
|
14
|
+
['fa %s mesos', 'd\'aquí %s mesos'],
|
15
|
+
['fa 1 any', 'd\'aquí 1 any'],
|
16
|
+
['fa %s anys', 'd\'aquí %s anys']
|
17
|
+
][index];
|
18
|
+
})
|
@@ -0,0 +1,18 @@
|
|
1
|
+
this.timeago.register('da', function(number, index) {
|
2
|
+
return [
|
3
|
+
['for et øjeblik siden', 'om et øjeblik'],
|
4
|
+
['for %s sekunder siden', 'om %s sekunder'],
|
5
|
+
['for 1 minut siden', 'om 1 minut'],
|
6
|
+
['for %s minutter siden', 'om %s minutter'],
|
7
|
+
['for 1 time siden', 'om 1 time'],
|
8
|
+
['for %s timer siden', 'om %s timer'],
|
9
|
+
['for 1 dag siden', 'om 1 dag'],
|
10
|
+
['for %s dage siden', 'om %s dage'],
|
11
|
+
['for 1 uge siden', 'om 1 uge'],
|
12
|
+
['for %s uger siden', 'om %s uger'],
|
13
|
+
['for 1 måned siden', 'om 1 måned'],
|
14
|
+
['for %s måneder siden', 'om %s måneder'],
|
15
|
+
['for 1 år siden', 'om 1 år'],
|
16
|
+
['for %s år siden', 'om %s år']
|
17
|
+
][index];
|
18
|
+
})
|
@@ -0,0 +1,18 @@
|
|
1
|
+
this.timeago.register('de', function(number, index) {
|
2
|
+
return [
|
3
|
+
['gerade eben', 'vor einer Weile'],
|
4
|
+
['vor %s Sekunden', 'in %s Sekunden'],
|
5
|
+
['vor 1 Minute', 'in 1 Minute'],
|
6
|
+
['vor %s Minuten', 'in %s Minuten'],
|
7
|
+
['vor 1 Stunde', 'in 1 Stunde'],
|
8
|
+
['vor %s Stunden', 'in %s Stunden'],
|
9
|
+
['vor 1 Tag', 'in 1 Tag'],
|
10
|
+
['vor %s Tagen', 'in %s Tagen'],
|
11
|
+
['vor 1 Woche', 'in 1 Woche'],
|
12
|
+
['vor %s Wochen', 'in %s Wochen'],
|
13
|
+
['vor 1 Monat', 'in 1 Monat'],
|
14
|
+
['vor %s Monaten', 'in %s Monaten'],
|
15
|
+
['vor 1 Jahr', 'in 1 Jahr'],
|
16
|
+
['vor %s Jahren', 'in %s Jahren']
|
17
|
+
][index];
|
18
|
+
})
|
@@ -0,0 +1,18 @@
|
|
1
|
+
this.timeago.register('el', function(number, index) {
|
2
|
+
return [
|
3
|
+
['μόλις τώρα', 'σε λίγο'],
|
4
|
+
['%s δευτερόλεπτα πριν', 'σε %s δευτερόλεπτα'],
|
5
|
+
['1 λεπτό πριν', 'σε 1 λεπτό'],
|
6
|
+
['%s λεπτά πριν', 'σε %s λεπτά'],
|
7
|
+
['1 ώρα πριν', 'σε 1 ώρα'],
|
8
|
+
['%s ώρες πριν', 'σε %s ώρες'],
|
9
|
+
['1 μέρα πριν', 'σε 1 μέρα'],
|
10
|
+
['%s μέρες πριν', 'σε %s μέρες'],
|
11
|
+
['1 εβδομάδα πριν', 'σε 1 εβδομάδα'],
|
12
|
+
['%s εβδομάδες πριν', 'σε %s εβδομάδες'],
|
13
|
+
['1 μήνα πριν', 'σε 1 μήνα'],
|
14
|
+
['%s μήνες πριν', 'σε %s μήνες'],
|
15
|
+
['1 χρόνο πριν', 'σε 1 χρόνο'],
|
16
|
+
['%s χρόνια πριν', 'σε %s χρόνια']
|
17
|
+
][index];
|
18
|
+
})
|