mirror of
https://github.com/scratchfoundation/jquery-timeago.git
synced 2024-11-23 15:57:54 -05:00
add setting to set the title to Date#toLocaleString
This commit is contained in:
parent
783066c2d9
commit
fb4035864d
1 changed files with 4 additions and 1 deletions
|
@ -40,6 +40,7 @@
|
||||||
settings: {
|
settings: {
|
||||||
refreshMillis: 60000,
|
refreshMillis: 60000,
|
||||||
allowFuture: false,
|
allowFuture: false,
|
||||||
|
localeTitle: false,
|
||||||
strings: {
|
strings: {
|
||||||
prefixAgo: null,
|
prefixAgo: null,
|
||||||
prefixFromNow: null,
|
prefixFromNow: null,
|
||||||
|
@ -160,7 +161,9 @@
|
||||||
if (!element.data("timeago")) {
|
if (!element.data("timeago")) {
|
||||||
element.data("timeago", { datetime: $t.datetime(element) });
|
element.data("timeago", { datetime: $t.datetime(element) });
|
||||||
var text = $.trim(element.text());
|
var text = $.trim(element.text());
|
||||||
if (text.length > 0 && !($t.isTime(element) && element.attr("title"))) {
|
if ($t.settings.localeTitle) {
|
||||||
|
element.attr("title", element.data('timeago').datetime.toLocaleString())
|
||||||
|
} else if (text.length > 0 && !($t.isTime(element) && element.attr("title"))) {
|
||||||
element.attr("title", text);
|
element.attr("title", text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue