Show More
@@ -192,7 +192,7 b' p, .br {' | |||
|
192 | 192 | margin-bottom: 0.5ex; |
|
193 | 193 | } |
|
194 | 194 | |
|
195 | input[type="submit"] { | |
|
195 | input[type="submit"], button { | |
|
196 | 196 | background: #222; |
|
197 | 197 | border: solid 2px #fff; |
|
198 | 198 | color: #fff; |
@@ -203,6 +203,10 b' input[type="submit"]:hover {' | |||
|
203 | 203 | background: #060; |
|
204 | 204 | } |
|
205 | 205 | |
|
206 | button:hover { | |
|
207 | background: #006; | |
|
208 | } | |
|
209 | ||
|
206 | 210 | blockquote { |
|
207 | 211 | border-left: solid 2px; |
|
208 | 212 | padding-left: 5px; |
@@ -535,12 +539,6 b' ul {' | |||
|
535 | 539 | padding: 1ex; |
|
536 | 540 | } |
|
537 | 541 | |
|
538 | button { | |
|
539 | border: 1px solid white; | |
|
540 | margin-bottom: .5ex; | |
|
541 | margin-top: .5ex; | |
|
542 | } | |
|
543 | ||
|
544 | 542 | .image-metadata { |
|
545 | 543 | font-style: italic; |
|
546 | 544 | font-size: 0.9em; |
@@ -165,7 +165,7 b' function updatePost(postHtml) {' | |||
|
165 | 165 | var type; |
|
166 | 166 | |
|
167 | 167 | if (existingPosts.size() > 0) { |
|
168 |
existingPosts. |
|
|
168 | replacePartial(existingPosts.first(), post); | |
|
169 | 169 | |
|
170 | 170 | type = POST_UPDATED; |
|
171 | 171 | } else { |
@@ -362,6 +362,28 b' function processNewPost(post) {' | |||
|
362 | 362 | blink(post); |
|
363 | 363 | } |
|
364 | 364 | |
|
365 | function replacePartial(oldNode, newNode) { | |
|
366 | var oldContent = oldNode[0].outerHTML; | |
|
367 | var newContent = newNode[0].outerHTML; | |
|
368 | ||
|
369 | // TODO Handle different children sizes | |
|
370 | ||
|
371 | if (oldContent != newContent) { | |
|
372 | var children = oldNode.children(); | |
|
373 | if (children.length == 0) { | |
|
374 | console.log(oldContent); | |
|
375 | console.log(newContent) | |
|
376 | ||
|
377 | oldNode.replaceWith(newNode); | |
|
378 | } else { | |
|
379 | var newChildren = newNode.children(); | |
|
380 | children.each(function(i) { | |
|
381 | replacePartial(children.eq(i), newChildren.eq(i)); | |
|
382 | }); | |
|
383 | } | |
|
384 | } | |
|
385 | } | |
|
386 | ||
|
365 | 387 | $(document).ready(function(){ |
|
366 | 388 | if (initAutoupdate()) { |
|
367 | 389 | // Post form data over AJAX |
@@ -136,13 +136,13 b'' | |||
|
136 | 136 | {{ form.as_div }} |
|
137 | 137 | <div class="form-submit"> |
|
138 | 138 | <input type="submit" value="{% trans "Post" %}"/> |
|
139 | <button id="preview-button" onclick="return false;">{% trans 'Preview' %}</button> | |
|
139 | 140 | </div> |
|
140 | 141 | </form> |
|
141 | 142 | </div> |
|
142 | 143 | <div> |
|
143 | 144 | {% trans 'Tags must be delimited by spaces. Text or image is required.' %} |
|
144 | 145 | </div> |
|
145 | <div><button id="preview-button">{% trans 'Preview' %}</button></div> | |
|
146 | 146 | <div id="preview-text"></div> |
|
147 | 147 | <div><a href="{% url "staticpage" name="help" %}">{% trans 'Text syntax' %}</a></div> |
|
148 | 148 | <div><a href="{% url "tags" "required" %}">{% trans 'Tags' %}</a></div> |
@@ -36,10 +36,10 b'' | |||
|
36 | 36 | {{ form.as_div }} |
|
37 | 37 | <div class="form-submit"> |
|
38 | 38 | <input type="submit" value="{% trans "Post" %}"/> |
|
39 | <button id="preview-button" onclick="return false;">{% trans 'Preview' %}</button> | |
|
39 | 40 | </div> |
|
40 | 41 | </form> |
|
41 | 42 | </div> |
|
42 | <div><button id="preview-button">{% trans 'Preview' %}</button></div> | |
|
43 | 43 | <div id="preview-text"></div> |
|
44 | 44 | <div><a href="{% url "staticpage" name="help" %}"> |
|
45 | 45 | {% trans 'Text syntax' %}</a></div> |
General Comments 0
You need to be logged in to leave comments.
Login now