(function(inputField, textarea) {
inputField.focus(function() {
$(this).hide().attr("disabled", "disabled");
- textarea.show().focus();
+ /* no, show(), “display: block” is not what I need. */
+ textarea.attr("style", "display: inline").focus();
});
if (inputField.val() == "") {
inputField.addClass("default");
$(inputField.get(0).form).submit(function() {
inputField.attr("disabled", "disabled");
if (!optional && (textarea.val() == "")) {
+ inputField.removeAttr("disabled").focus();
return false;
}
});
}
/**
- * Requests information about the reply with the given ID.
- *
- * @param replyId
- * The ID of the reply
- * @param callbackFunction
- * A callback function (parameters soneId, soneName, replyTime,
- * replyDisplayTime, text, html)
- */
-function getReply(replyId, callbackFunction) {
- $.getJSON("getReply.ajax", { "reply" : replyId }, function(data, textStatus) {
- if ((data != null) && data.success) {
- callbackFunction(data.soneId, data.soneName, data.time, data.displayTime, data.text, data.html);
- }
- }, function(xmlHttpRequest, textStatus, error) {
- /* ignore error. */
- });
-}
-
-/**
* Ajaxifies the given Sone by enhancing all eligible elements with AJAX.
*
* @param soneElement
$.each(data.sones, function(index, value) {
updateSoneStatus(value.id, value.name, value.status, value.modified, value.locked, value.lastUpdatedUnknown ? null : value.lastUpdated);
});
+ /* search for removed notifications. */
+ $("#sone #notification-area .notification").each(function() {
+ notificationId = $(this).attr("id");
+ foundNotification = false;
+ $.each(data.notifications, function(index, value) {
+ if (value.id == notificationId) {
+ foundNotification = true;
+ return false;
+ }
+ });
+ if (!foundNotification) {
+ $(this).slideUp("normal", function() {
+ $(this).remove();
+ });
+ }
+ });
/* process notifications. */
$.each(data.notifications, function(index, value) {
oldNotification = $("#sone #notification-area .notification#" + value.id);
} else {
$("#sone #notification-area").append(notification);
notification.slideDown();
+ setActivity();
}
- setActivity();
- });
- $.each(data.removedNotifications, function(index, value) {
- $("#sone #notification-area .notification#" + value.id).slideUp();
});
/* process new posts. */
$.each(data.newPosts, function(index, value) {
iconBlinking = false;
} else {
iconActive = !iconActive;
- console.log("showing icon: " + iconActive);
changeIcon(iconActive ? "images/icon-activity.png" : "images/icon.png");
setTimeout(toggleIcon, 1500);
}