Duplicate IDs are not allowed in HTML and do make problems. Use classes.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Thu, 21 Oct 2010 13:22:07 +0000 (15:22 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Thu, 21 Oct 2010 13:22:07 +0000 (15:22 +0200)
src/main/resources/static/css/sone.css
src/main/resources/static/javascript/sone.js
src/main/resources/templates/include/head.html
src/main/resources/templates/include/viewSone.html

index 1d426ed..da01622 100644 (file)
@@ -239,6 +239,10 @@ textarea {
        padding: 0.5ex;
 }
 
+#sone .sone .id {
+       display: none;
+}
+
 #sone .sone .profile-link {
        display: block;
 }
index 6420e5b..9c99bb2 100644 (file)
@@ -93,13 +93,13 @@ function getSoneStatus(soneId) {
  *            The date and time of the last update (formatted for display)
  */
 function updateSoneStatus(soneId, status, modified, lastUpdated) {
-       $("#sone .sone#" + soneId).
+       $("#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);
+       $("#sone .sone." + soneId + " .last-update span.time").text(lastUpdated);
 }
 
 var watchedSones = {};
index 7798af4..50cf77e 100644 (file)
@@ -14,7 +14,7 @@
                /* these functions are necessary for updating Sone statuses. */
                $(document).ready(function() {
                        $("#sone .sone").each(function() {
-                               watchSone($(this).attr("id"));
+                               watchSone($(this).find(".id").text());
                        });
                });
        </script>
index e7599bd..b12de4a 100644 (file)
@@ -1,4 +1,5 @@
-<div id="<% sone.id|html>" class="sone <% sone.status|html><%if sone.modified> modified<%/if>">
+<div class="sone <% sone.status|html><%if sone.modified> modified<%/if> <% sone.id|html>">
+       <div class="id"><% sone.id|html></div>
        <div class="unknown-marker" title="<%= View.Sone.Status.Unknown|l10n|html>">?</div>
        <div class="modified-marker" title="<%= View.Sone.Status.Modified|l10n|html>">!</div>
        <div class="download-marker" title="<%= View.Sone.Status.Downloading|l10n|html>">⬊</div>