X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fresources%2Fstatic%2Fjavascript%2Fsone.js;h=9d00c5aeb6754e23892dea9b8df102db685ec358;hb=d7b6e638e17b74e3f0a074ba4f36bab1774e3701;hp=80d039c95546e522b9824b9015443af90faeaec1;hpb=f4ea1e1b3526175e255831c975d6eea813589f25;p=Sone.git diff --git a/src/main/resources/static/javascript/sone.js b/src/main/resources/static/javascript/sone.js index 80d039c..9d00c5a 100644 --- a/src/main/resources/static/javascript/sone.js +++ b/src/main/resources/static/javascript/sone.js @@ -47,6 +47,7 @@ function registerInputTextareaSwap(inputElement, defaultText, inputFieldName, op textarea.show(); } $(inputField.get(0).form).submit(function() { + inputField.attr("disabled", "disabled"); if (!optional && (textarea.val() == "")) { return false; } @@ -64,7 +65,7 @@ function registerInputTextareaSwap(inputElement, defaultText, inputFieldName, op * The element to add a “comment” link to */ function addCommentLink(postId, element, insertAfterThisElement) { - if ($(element).find(".show-reply-form").length > 0) { + if (($(element).find(".show-reply-form").length > 0) || (getPostElement(element).find(".create-reply").length == 0)) { return; } commentElement = (function(postId) { @@ -152,7 +153,13 @@ function updateSoneStatus(soneId, name, status, modified, locked, lastUpdated) { toggleClass("modified", modified); $("#sone .sone." + filterSoneId(soneId) + " .lock").toggleClass("hidden", locked); $("#sone .sone." + filterSoneId(soneId) + " .unlock").toggleClass("hidden", !locked); - $("#sone .sone." + filterSoneId(soneId) + " .last-update span.time").text(lastUpdated); + if (lastUpdated != null) { + $("#sone .sone." + filterSoneId(soneId) + " .last-update span.time").text(lastUpdated); + } else { + getTranslation("View.Sone.Text.UnknownDate", function(unknown) { + $("#sone .sone." + filterSoneId(soneId) + " .last-update span.time").text(unknown); + }); + } $("#sone .sone." + filterSoneId(soneId) + " .profile-link a").text(name); } @@ -456,14 +463,14 @@ function updateTrustControls(soneId, trustValue) { $("#sone .post").each(function() { if (getPostAuthor(this) == soneId) { getPostElement(this).find(".post-trust").toggleClass("hidden", trustValue != null); - getPostElement(this).find(".post-distrust").toggleClass("hidden", (trustValue != null) && (trustValue < 0)); + getPostElement(this).find(".post-distrust").toggleClass("hidden", trustValue != null); getPostElement(this).find(".post-untrust").toggleClass("hidden", trustValue == null); } }); $("#sone .reply").each(function() { if (getReplyAuthor(this) == soneId) { getReplyElement(this).find(".reply-trust").toggleClass("hidden", trustValue != null); - getReplyElement(this).find(".reply-distrust").toggleClass("hidden", (trustValue != null) && (trustValue < 0)); + getReplyElement(this).find(".reply-distrust").toggleClass("hidden", trustValue != null); getReplyElement(this).find(".reply-untrust").toggleClass("hidden", trustValue == null); } }); @@ -689,7 +696,7 @@ function getStatus() { if ((data != null) && data.success) { /* process Sone information. */ $.each(data.sones, function(index, value) { - updateSoneStatus(value.id, value.name, value.status, value.modified, value.locked, value.lastUpdated); + updateSoneStatus(value.id, value.name, value.status, value.modified, value.locked, value.lastUpdatedUnknown ? null : value.lastUpdated); }); /* process notifications. */ $.each(data.notifications, function(index, value) {