Codebase list libjs-jquery-timeago / 38470a8
Import upstream version 1.6.7+git20200616.1.4ada92e Debian Janitor 1 year, 5 months ago
12 changed file(s) with 131 addition(s) and 44 deletion(s). Raw diff Collapse all Expand all
+0
-13
.github/no-response.yml less more
0 # Configuration for probot-no-response - https://github.com/probot/no-response
1
2 # Number of days of inactivity before an Issue is closed for lack of response
3 daysUntilClose: 7
4 # Label requiring a response
5 responseRequiredLabel: more-information-needed
6 # Comment to post when closing an Issue for lack of response. Set to `false` to disable
7 closeComment: >
8 This issue has been automatically closed because there has been no response
9 to our request for more information from the original author. With only the
10 information that is currently in the issue, we don't have enough information
11 to take action. Please reach out if you have or find the answers we need so
12 that we can investigate further.
+0
-4
.gitignore less more
0 .bundle
1 vendor/ruby
2 public
3 node_modules/
55 Timeago is a jQuery plugin that makes it easy to support automatically updating
66 fuzzy timestamps (e.g. "4 minutes ago" or "about 1 day ago") from ISO 8601
77 formatted dates and times embedded in your HTML (à la microformats).
8
9 ---
10
11 **How You Can Help**
12
13 [![Square Cash](http://img.shields.io/badge/square%20cash-$rmm5t-brightgreen.svg)][square]
14 [![PayPal](http://img.shields.io/badge/paypal-rmm5t-blue.svg)][paypal]
15 [![Book a Codementor session](http://img.shields.io/badge/codementor-book%20a%20session-orange.svg)][codementor]
16
17 If you like this project, [buy me a coffee][paypal], or [book a session with me][codementor], or donate bitcoin: `1rmm5tv6f997JK5bLcGbRCZyVjZUPkQ2m`
18
19 [square]: https://cash.me/$rmm5t/5 "Donate to rmm5t for open source!"
20 [paypal]: https://www.paypal.me/rmm5t/5 "Donate to rmm5t for open source!"
21 [bitcoin]: bitcoin:1rmm5tv6f997JK5bLcGbRCZyVjZUPkQ2m?amount=0.01&label=Coffee%20to%20rmm5t%20for%20Open%20Source "Buy rmm5t a coffee for open source!"
22 [codementor]: https://www.codementor.io/rmm5t?utm_campaign=profile&utm_source=button-rmm5t&utm_medium=shields "Book a session with rmm5t on Codementor!"
23
24 [![Twitter](https://img.shields.io/twitter/follow/rmm5t.svg?style=social)](https://twitter.com/rmm5t)
25 [![Stack Overflow](https://img.shields.io/stackexchange/stackoverflow/r/8985.svg?style=social)](http://stackoverflow.com/users/8985/ryan-mcgeary)
268
279 ## Usage
2810
5840 <time class="timeago" datetime="2011-12-17T09:24:17Z" title="December 17, 2011">about 1 day ago</time>
5941 ```
6042
61 `<abbr>` elements are also supported (this is for
43 `<abbr>` elements (or any other HTML elements) are also supported (this is for
6244 [legacy microformat support](http://microformats.org/wiki/datetime-design-pattern)
6345 and was originally supported by the library before the `time` element was
6446 introduced to HTML5):
131131 <p class="how">
132132 To disable timestamps in the past, use the <tt>allowPast</tt> setting.
133133 This setting is set to true by default. When set to false, if the time is in the past then instead of displaying a message like "5 minutes ago" a static message will be displayed.
134 The staic message displayed can be configured with the <tt>strings.inPast</tt> setting:
134 The static message displayed can be configured with the <tt>strings.inPast</tt> setting:
135135 </p>
136136 <pre>
137137 jQuery.timeago.settings.strings.inPast = "time has elapsed";
168168
169169 <h3>What else?</h3>
170170 <p class="example">
171 The HTML5 <tt>time</tt> tag is strongly recommended, but the legacy <a href="http://microformats.org/wiki/datetime-design-pattern">datetime microformat</a> using the <tt>abbr</tt> tag is also supported:
171 The HTML5 <tt>time</tt> tag is strongly recommended, but the legacy <a href="http://microformats.org/wiki/datetime-design-pattern">datetime microformat</a> using the <tt>abbr</tt> tag ( or any other HTML element ) is also supported:
172172 </p>
173173 <pre>
174174 &lt;abbr class=&quot;<em>timeago</em>&quot; title=&quot;<em>2008-07-17T09:24:17Z</em>&quot;&gt;July 17, 2008&lt;/abbr&gt;</pre>
5050 prefixFromNow: null,
5151 suffixAgo: "ago",
5252 suffixFromNow: "from now",
53 inPast: 'any moment now',
53 inPast: "any moment now",
5454 seconds: "less than a minute",
5555 minute: "about a minute",
5656 minutes: "%d minutes",
1212 prefixFromNow: "in",
1313 suffixAgo: "",
1414 suffixFromNow: "",
15 inPast: "jetzt gleich",
1516 seconds: "wenigen Sekunden",
1617 minute: "etwa einer Minute",
1718 minutes: "%d Minuten",
0 (function (factory) {
1 if (typeof define === 'function' && define.amd) {
2 define(['jquery'], factory);
3 } else if (typeof module === 'object' && typeof module.exports === 'object') {
4 factory(require('jquery'));
5 } else {
6 factory(jQuery);
7 }
8 }(function (jQuery) {
9 // English (Template) -> Esperanto
10 jQuery.timeago.settings.strings = {
11 prefixAgo: "antaŭ",
12 prefixFromNow: null,
13 suffixAgo: null,
14 suffixFromNow: "de nun",
15 seconds: "malpli ol minuto",
16 minute: "ĉirkaŭ uno minuto",
17 minutes: "%d minutoj",
18 hour: "ĉirkaŭ uno horo",
19 hours: "ĉirkaŭ %d horojn",
20 day: "ĉirkaŭ tago",
21 days: "%d tagoj",
22 month: "ĉirkaŭ unu monato",
23 months: "%d monatoj",
24 year: "ĉirkaŭ unu jaro",
25 years: "%d jaroj",
26 wordSeparator: " ",
27 numbers: []
28 };
29 }));
66 factory(jQuery);
77 }
88 }(function (jQuery) {
9 // persion shortened
9 // persian shortened
1010 jQuery.timeago.settings.strings = {
1111 prefixAgo: null,
1212 prefixFromNow: null,
0 (function (factory) {
1 if (typeof define === 'function' && define.amd) {
2 define(['jquery'], factory);
3 } else if (typeof module === 'object' && typeof module.exports === 'object') {
4 factory(require('jquery'));
5 } else {
6 factory(jQuery);
7 }
8 }(function (jQuery) {
9 // English (Template)
10 jQuery.timeago.settings.strings = {
11 prefixAgo: null,
12 prefixFromNow: null,
13 suffixAgo: "ის წინ",
14 suffixFromNow: null,
15 seconds: "რამდენიმე წამ",
16 minute: "1 წუთ",
17 minutes: "%d წუთ",
18 hour: "1 საათ",
19 hours: "%d საათ",
20 day: "1 დღ",
21 days: "%d დღ",
22 month: "1 თვ",
23 months: "%d თვ",
24 year: "1 წლ",
25 years: "%d წლ",
26 wordSeparator: "",
27 };
28 })
29 );
99 // Romanian
1010 jQuery.timeago.settings.strings = {
1111 prefixAgo: "acum",
12 prefixFromNow: "in timp de",
12 prefixFromNow: "peste",
1313 suffixAgo: "",
1414 suffixFromNow: "",
15 seconds: "mai putin de un minut",
15 seconds: "mai puțin de un minut",
1616 minute: "un minut",
1717 minutes: "%d minute",
18 hour: "o ora",
18 hour: "o oră",
1919 hours: "%d ore",
2020 day: "o zi",
2121 days: "%d zile",
22 month: "o luna",
22 month: "o lună",
2323 months: "%d luni",
2424 year: "un an",
2525 years: "%d ani"
160160 <li><abbr id="testLatinSettings20" class="tolatin" title="31622400"></abbr> [366 days]</li>
161161 <li><abbr id="testLatinSettings21" class="tolatin" title="94608000"></abbr> [1095 days]</li>
162162
163 <li><abbr id="testPolishSettings1" class="topolish" title="-7200"></abbr> [-120 min]</li>
164 <li><abbr id="testPolishSettings2" class="topolish" title="-60"></abbr> [-60 sec]</li>
165 <li><abbr id="testPolishSettings3" class="topolish" title="-30"></abbr> [-30 sec]</li>
166 <li><abbr id="testPolishSettings4" class="topolish" title="-1"></abbr> [-1 sec]</li>
167 <li><abbr id="testPolishSettings5" class="topolish" title="0"></abbr> [0 sec]</li>
168 <li><abbr id="testPolishSettings6" class="topolish" title="30"></abbr> [30 sec]</li>
169 <li><abbr id="testPolishSettings7" class="topolish" title="45"></abbr> [45 sec]</li>
170 <li><abbr id="testPolishSettings8" class="topolish" title="90"></abbr> [90 sec]</li>
171 <li><abbr id="testPolishSettings9" class="topolish" title="120"></abbr> [120 sec]</li>
172 <li><abbr id="testPolishSettings10" class="topolish" title="2700"></abbr> [45 min]</li>
173 <li><abbr id="testPolishSettings11" class="topolish" title="5340"></abbr> [89 min]</li>
174 <li><abbr id="testPolishSettings12" class="topolish" title="5400"></abbr> [90 min]</li>
175 <li><abbr id="testPolishSettings13" class="topolish" title="7200"></abbr> [120 min]</li>
176 <li><abbr id="testPolishSettings14" class="topolish" title="82800"></abbr> [1380 min]</li>
177 <li><abbr id="testPolishSettings15" class="topolish" title="90000"></abbr> [25 hours]</li>
178 <li><abbr id="testLatinSettings16" class="topolish" title="172800"></abbr> [48 hours]</li>
179 <li><abbr id="testPolishSettings17" class="topolish" title="2505600"></abbr> [696 hours]</li>
180 <li><abbr id="testPolishSettings18" class="topolish" title="2592000"></abbr> [30 days]</li>
181 <li><abbr id="testPolishSettings19" class="topolish" title="16416000"></abbr> [190 days]</li>
182 <li><abbr id="testPolishSettings20" class="topolish" title="31622400"></abbr> [366 days]</li>
183 <li><abbr id="testPolishSettings21" class="topolish" title="94608000"></abbr> [1095 days]</li>
184
163185 <li><abbr id="testRussianSettings1" class="torussian" title="-7200"></abbr> [-120 min]</li>
164186 <li><abbr id="testRussianSettings2" class="torussian" title="-60"></abbr> [-60 sec]</li>
165187 <li><abbr id="testRussianSettings3" class="torussian" title="-30"></abbr> [-30 sec]</li>
315337 loadBelarusian();
316338 $("abbr.tobelarusian").each(toWords);
317339
340 loadPolish();
341 $("abbr.topolish").each(toWords);
342
318343 module("Valid date");
319344
320345 test("Text in abbr tag should be replaced", function () {
585610 ok($("#testRussianSettings5").html().match(/назад$/), "Settings correctly applied");
586611 ok($("#testBelarusianSettings5").html().match(/таму$/), "Settings correctly applied");
587612 ok($("#testMillisSettings5").html().match(/ago/), "Settings correctly applied");
613 ok($("#testPolishSettings5").html().match(/temu/), "Settings correctly applied");
588614 });
589615
590616 test("prefixFromNow", function () {
591617 ok($("#testRussianSettings2").html().match(/^через/), "Settings correctly applied");
592618 ok($("#testBelarusianSettings2").html().match(/^праз/), "Settings correctly applied");
619 ok($("#testPolishSettings2").html().match(/za/), "Settings correctly applied");
593620 });
594621
595622 test("seconds", function () {
5050 year: "about-hay a-hay ear-yay",
5151 years: "%d years-yay"
5252 };
53 }
54
55 function loadPolish() {
56 (function () {
57 // Polish
58 function numpf(n, s, t) {
59 // s - 2-4, 22-24, 32-34 ...
60 // t - 5-21, 25-31, ...
61 var n10 = n % 10;
62 if ( (n10 > 1) && (n10 < 5) && ( (n > 20) || (n < 10) ) ) {
63 return s;
64 } else {
65 return t;
66 }
67 }
68
69 jQuery.timeago.settings.strings = {
70 prefixAgo: null,
71 prefixFromNow: "za",
72 suffixAgo: "temu",
73 suffixFromNow: null,
74 seconds: "mniej niż minutę",
75 minute: "minutę",
76 minutes: function(value) { return numpf(value, "%d minuty", "%d minut"); },
77 hour: "godzinę",
78 hours: function(value) { return numpf(value, "%d godziny", "%d godzin"); },
79 day: "dzień",
80 days: "%d dni",
81 month: "miesiąc",
82 months: function(value) { return numpf(value, "%d miesiące", "%d miesięcy"); },
83 year: "rok",
84 years: function(value) { return numpf(value, "%d lata", "%d lat"); }
85 };
86 })();
5387 }
5488
5589 function loadRussian() {