diff --git a/boards/static/css/md/base_page.css b/boards/static/css/md/base_page.css --- a/boards/static/css/md/base_page.css +++ b/boards/static/css/md/base_page.css @@ -192,7 +192,7 @@ p, .br { margin-bottom: 0.5ex; } -input[type="submit"] { +input[type="submit"], button { background: #222; border: solid 2px #fff; color: #fff; @@ -203,6 +203,10 @@ input[type="submit"]:hover { background: #060; } +button:hover { + background: #006; +} + blockquote { border-left: solid 2px; padding-left: 5px; @@ -535,12 +539,6 @@ ul { padding: 1ex; } -button { - border: 1px solid white; - margin-bottom: .5ex; - margin-top: .5ex; -} - .image-metadata { font-style: italic; font-size: 0.9em; diff --git a/boards/static/js/thread_update.js b/boards/static/js/thread_update.js --- a/boards/static/js/thread_update.js +++ b/boards/static/js/thread_update.js @@ -165,7 +165,7 @@ function updatePost(postHtml) { var type; if (existingPosts.size() > 0) { - existingPosts.replaceWith(post); + replacePartial(existingPosts.first(), post); type = POST_UPDATED; } else { @@ -362,6 +362,28 @@ function processNewPost(post) { blink(post); } +function replacePartial(oldNode, newNode) { + var oldContent = oldNode[0].outerHTML; + var newContent = newNode[0].outerHTML; + + // TODO Handle different children sizes + + if (oldContent != newContent) { + var children = oldNode.children(); + if (children.length == 0) { + console.log(oldContent); + console.log(newContent) + + oldNode.replaceWith(newNode); + } else { + var newChildren = newNode.children(); + children.each(function(i) { + replacePartial(children.eq(i), newChildren.eq(i)); + }); + } + } +} + $(document).ready(function(){ if (initAutoupdate()) { // Post form data over AJAX diff --git a/boards/templates/boards/all_threads.html b/boards/templates/boards/all_threads.html --- a/boards/templates/boards/all_threads.html +++ b/boards/templates/boards/all_threads.html @@ -136,13 +136,13 @@ {{ form.as_div }}