successCallback(data, textStatus);
}
}, "error": function(xmlHttpRequest, textStatus, errorThrown) {
+ if (xmlHttpRequest.status == 403) {
+ notLoggedIn = true;
+ }
if (typeof errorCallback != "undefined") {
errorCallback();
} else {
$.each(data.sones, function(index, value) {
updateSoneStatus(value.id, value.name, value.status, value.modified, value.locked, value.lastUpdatedUnknown ? null : value.lastUpdated, value.lastUpdatedText);
});
+ notLoggedIn = !data.loggedIn;
+ if (!notLoggedIn) {
+ showOfflineMarker(!online);
+ }
/* search for removed notifications. */
$("#sone #notification-area .notification").each(function() {
notificationId = $(this).attr("id");
if ($(postElement).hasClass("new")) {
(function(postElement) {
$(postElement).removeClass("new");
- $(".click-to-show", postElement).removeClass("new");
if ((typeof skipRequest == "undefined") || !skipRequest) {
ajaxGet("markAsKnown.ajax", {"formPassword": getFormPassword(), "type": "post", "id": getPostId(postElement)});
}
})(postElement);
}
+ $(".click-to-show", postElement).removeClass("new");
});
markReplyAsKnown($(postElements).find(".reply"));
}
*/
function ajaxError() {
online = false;
- toggleOfflineMarker(true);
+ showOfflineMarker(true);
if (!statusRequestQueued) {
setTimeout(getStatus, 5000);
statusRequestQueued = true;
*/
function ajaxSuccess() {
online = true;
- toggleOfflineMarker(false);
+ showOfflineMarker(!online || (initiallyLoggedIn && notLoggedIn));
}
/**
* {@code true} to display the offline marker, {@code false} to hide
* it
*/
-function toggleOfflineMarker(visible) {
+function showOfflineMarker(visible) {
/* jQuery documentation says toggle() works the other way around?! */
$("#sone #offline-marker").toggle(visible);
if (visible) {
var focus = true;
var online = true;
+var initiallyLoggedIn = $("#sone #loggedIn").text() == "true";
+var notLoggedIn = !initiallyLoggedIn;
$(document).ready(function() {
allReplies = $(this).find(".reply");
if (allReplies.length > 2) {
newHidden = false;
- for (replyIndex = 0; replyIndex < (allReplies.length - 2); ++replyIndex) {
+ for (replyIndex = 0; !newHidden && (replyIndex < (allReplies.length - 2)); ++replyIndex) {
$(allReplies[replyIndex]).addClass("hidden");
newHidden |= $(allReplies[replyIndex]).hasClass("new");
}