Making all if statements have the curly braces.

This commit is contained in:
Randy Merrill 2011-01-21 09:36:21 -08:00
parent 49e782a9eb
commit 3751418fa2

View file

@ -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");
} }