mirror of
https://github.com/scratchfoundation/jquery-timeago.git
synced 2024-11-23 15:57:54 -05:00
Making all if statements have the curly braces.
This commit is contained in:
parent
49e782a9eb
commit
3751418fa2
1 changed files with 10 additions and 4 deletions
|
@ -15,9 +15,13 @@
|
||||||
*/
|
*/
|
||||||
(function($) {
|
(function($) {
|
||||||
$.timeago = function(timestamp) {
|
$.timeago = function(timestamp) {
|
||||||
if (timestamp instanceof Date) return inWords(timestamp);
|
if (timestamp instanceof Date) {
|
||||||
else if (typeof timestamp === "string") return inWords($.timeago.parse(timestamp));
|
return inWords(timestamp);
|
||||||
else return inWords($.timeago.datetime(timestamp));
|
} else if (typeof timestamp === "string") {
|
||||||
|
return inWords($.timeago.parse(timestamp));
|
||||||
|
} else {
|
||||||
|
return inWords($.timeago.datetime(timestamp));
|
||||||
|
}
|
||||||
};
|
};
|
||||||
var $t = $.timeago;
|
var $t = $.timeago;
|
||||||
|
|
||||||
|
@ -122,7 +126,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) element.attr("title", text);
|
if (text.length > 0) {
|
||||||
|
element.attr("title", text);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return element.data("timeago");
|
return element.data("timeago");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue