-<div class="sone <% sone.status><%if sone.modified> modified<%/if>">
- <div class="profile-link"><a href="viewSone.html?sone=<% sone.id>" title="<% sone.requestUri|html>"><% sone.niceName|html></a></div>
- <div class="last-update">(<%= View.Sone.Label.LastUpdate|l10n|html> <% sone.time|date format="MMM d, yyyy, HH:mm:ss">)</div>
+<script language="javascript">
+
+ function getStatus(soneId) {
+ $.getJSON("ajax/getSoneStatus.ajax", {"sone": soneId}, function(data, textStatus) {
+ updateStatus(soneId, data.status, data.modified, data.lastUpdated);
+ setTimeout(function() {
+ getStatus(soneId);
+ }, 5000);
+ });
+ }
+
+ function updateStatus(soneId, status, modified, lastUpdated) {
+ $("#sone .sone#" + soneId).
+ toggleClass("unknown", status == "unknown").
+ toggleClass("idle", status == "idle").
+ toggleClass("inserting", status == "inserting").
+ toggleClass("downloading", status == "downloading").
+ toggleClass("modified", modified);
+ $("#sone .sone#" + soneId + " .last-update span.time").text(lastUpdated);
+ }
+
+ registeredSones = {};
+
+ $(document).ready(function() {
+ $("#sone .sone").each(function() {
+ soneId = $(this).attr("id");
+ if (registeredSones[soneId]) {
+ return;
+ }
+ registeredSones[soneId] = true;
+ (function(soneId) {
+ setTimeout(function() {
+ getStatus(soneId);
+ }, 5000);
+ })(soneId);
+ });
+ });
+</script>
+
+<div id="<% sone.id|html>" class="sone <% sone.status|html><%if sone.modified> modified<%/if>">