X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fresources%2Fstatic%2Fjavascript%2Fsone.js;h=e4527af94102daed490928849eedf8a3f7365f88;hb=fc7f06fc5b3e497bd9a576f212cc368e7fc2d701;hp=a7bfe08fe40a99b35e696fb58c0421389e42b110;hpb=845b4d3af981ae2974528273769ff3d8b1f90ccf;p=Sone.git diff --git a/src/main/resources/static/javascript/sone.js b/src/main/resources/static/javascript/sone.js index a7bfe08..e4527af 100644 --- a/src/main/resources/static/javascript/sone.js +++ b/src/main/resources/static/javascript/sone.js @@ -130,7 +130,7 @@ function getTranslation(key, callback) { function getSoneStatus(soneId, local) { $.getJSON("ajax/getSoneStatus.ajax", {"sone": soneId}, function(data, textStatus) { if ((data != null) && data.success) { - updateSoneStatus(soneId, data.name, data.status, data.modified, data.lastUpdated); + updateSoneStatus(soneId, data.name, data.status, data.modified, data.locked, data.lastUpdated); } /* seconds! */ updateInterval = 60; @@ -166,16 +166,20 @@ function filterSoneId(soneId) { * “downloading”) * @param modified * Whether the Sone is modified + * @param locked + * Whether the Sone is locked * @param lastUpdated * The date and time of the last update (formatted for display) */ -function updateSoneStatus(soneId, name, status, modified, lastUpdated) { +function updateSoneStatus(soneId, name, status, modified, locked, lastUpdated) { $("#sone .sone." + filterSoneId(soneId)). toggleClass("unknown", status == "unknown"). toggleClass("idle", status == "idle"). toggleClass("inserting", status == "inserting"). toggleClass("downloading", status == "downloading"). 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); $("#sone .sone." + filterSoneId(soneId) + " .profile-link a").text(name); } @@ -508,12 +512,11 @@ function getNotifications() { oldNotification = $("#sone #notification-area .notification#" + value.id); notification = ajaxifyNotification(createNotification(value.id, value.text, value.dismissable)).hide(); if (oldNotification.length != 0) { - oldNotification.slideUp(); - notification.insertBefore(oldNotification); + oldNotification.replaceWith(notification.show()); } else { $("#sone #notification-area").append(notification); + notification.slideDown(); } - notification.slideDown(); }); $.each(data.removedNotifications, function(index, value) { $("#sone #notification-area .notification#" + value.id).slideUp();