Show More
@@ -192,7 +192,7 b' p, .br {' | |||||
192 | margin-bottom: 0.5ex; |
|
192 | margin-bottom: 0.5ex; | |
193 | } |
|
193 | } | |
194 |
|
194 | |||
195 | input[type="submit"] { |
|
195 | input[type="submit"], button { | |
196 | background: #222; |
|
196 | background: #222; | |
197 | border: solid 2px #fff; |
|
197 | border: solid 2px #fff; | |
198 | color: #fff; |
|
198 | color: #fff; | |
@@ -203,6 +203,10 b' input[type="submit"]:hover {' | |||||
203 | background: #060; |
|
203 | background: #060; | |
204 | } |
|
204 | } | |
205 |
|
205 | |||
|
206 | button:hover { | |||
|
207 | background: #006; | |||
|
208 | } | |||
|
209 | ||||
206 | blockquote { |
|
210 | blockquote { | |
207 | border-left: solid 2px; |
|
211 | border-left: solid 2px; | |
208 | padding-left: 5px; |
|
212 | padding-left: 5px; | |
@@ -535,12 +539,6 b' ul {' | |||||
535 | padding: 1ex; |
|
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 | .image-metadata { |
|
542 | .image-metadata { | |
545 | font-style: italic; |
|
543 | font-style: italic; | |
546 | font-size: 0.9em; |
|
544 | font-size: 0.9em; |
@@ -165,7 +165,7 b' function updatePost(postHtml) {' | |||||
165 | var type; |
|
165 | var type; | |
166 |
|
166 | |||
167 | if (existingPosts.size() > 0) { |
|
167 | if (existingPosts.size() > 0) { | |
168 |
existingPosts. |
|
168 | replacePartial(existingPosts.first(), post); | |
169 |
|
169 | |||
170 | type = POST_UPDATED; |
|
170 | type = POST_UPDATED; | |
171 | } else { |
|
171 | } else { | |
@@ -362,6 +362,28 b' function processNewPost(post) {' | |||||
362 | blink(post); |
|
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 | $(document).ready(function(){ |
|
387 | $(document).ready(function(){ | |
366 | if (initAutoupdate()) { |
|
388 | if (initAutoupdate()) { | |
367 | // Post form data over AJAX |
|
389 | // Post form data over AJAX |
@@ -136,13 +136,13 b'' | |||||
136 | {{ form.as_div }} |
|
136 | {{ form.as_div }} | |
137 | <div class="form-submit"> |
|
137 | <div class="form-submit"> | |
138 | <input type="submit" value="{% trans "Post" %}"/> |
|
138 | <input type="submit" value="{% trans "Post" %}"/> | |
|
139 | <button id="preview-button" onclick="return false;">{% trans 'Preview' %}</button> | |||
139 | </div> |
|
140 | </div> | |
140 | </form> |
|
141 | </form> | |
141 | </div> |
|
142 | </div> | |
142 | <div> |
|
143 | <div> | |
143 | {% trans 'Tags must be delimited by spaces. Text or image is required.' %} |
|
144 | {% trans 'Tags must be delimited by spaces. Text or image is required.' %} | |
144 | </div> |
|
145 | </div> | |
145 | <div><button id="preview-button">{% trans 'Preview' %}</button></div> |
|
|||
146 | <div id="preview-text"></div> |
|
146 | <div id="preview-text"></div> | |
147 | <div><a href="{% url "staticpage" name="help" %}">{% trans 'Text syntax' %}</a></div> |
|
147 | <div><a href="{% url "staticpage" name="help" %}">{% trans 'Text syntax' %}</a></div> | |
148 | <div><a href="{% url "tags" "required" %}">{% trans 'Tags' %}</a></div> |
|
148 | <div><a href="{% url "tags" "required" %}">{% trans 'Tags' %}</a></div> |
@@ -36,10 +36,10 b'' | |||||
36 | {{ form.as_div }} |
|
36 | {{ form.as_div }} | |
37 | <div class="form-submit"> |
|
37 | <div class="form-submit"> | |
38 | <input type="submit" value="{% trans "Post" %}"/> |
|
38 | <input type="submit" value="{% trans "Post" %}"/> | |
|
39 | <button id="preview-button" onclick="return false;">{% trans 'Preview' %}</button> | |||
39 | </div> |
|
40 | </div> | |
40 | </form> |
|
41 | </form> | |
41 | </div> |
|
42 | </div> | |
42 | <div><button id="preview-button">{% trans 'Preview' %}</button></div> |
|
|||
43 | <div id="preview-text"></div> |
|
43 | <div id="preview-text"></div> | |
44 | <div><a href="{% url "staticpage" name="help" %}"> |
|
44 | <div><a href="{% url "staticpage" name="help" %}"> | |
45 | {% trans 'Text syntax' %}</a></div> |
|
45 | {% trans 'Text syntax' %}</a></div> |
General Comments 0
You need to be logged in to leave comments.
Login now