Index: trunk/extensions/LiquidThreads/lqt.js |
— | — | @@ -1,4 +1,6 @@ |
2 | 2 | var liquidThreads = { |
| 3 | + currentReplyThread : null, |
| 4 | + |
3 | 5 | 'handleReplyLink' : function(e) { |
4 | 6 | if (e.preventDefault) |
5 | 7 | e.preventDefault(); |
— | — | @@ -12,11 +14,18 @@ |
13 | 15 | var prefixLength = "lqt_thread_id_".length; |
14 | 16 | var container = $j(target).closest('.lqt_thread')[0]; |
15 | 17 | var thread_id = container.id.substring( prefixLength ); |
| 18 | + |
| 19 | + if (thread_id == liquidThreads.currentReplyThread) { |
| 20 | + liquidThreads.cancelEdit({}); |
| 21 | + return; |
| 22 | + } |
| 23 | + |
16 | 24 | var query = '&lqt_method=reply&lqt_operand='+thread_id; |
17 | 25 | |
18 | 26 | var replyDiv = $j(container).find('.lqt-reply-form')[0]; |
19 | 27 | |
20 | 28 | liquidThreads.injectEditForm( query, replyDiv, e.preload ); |
| 29 | + liquidThreads.currentReplyThread = thread_id; |
21 | 30 | |
22 | 31 | return false; |
23 | 32 | }, |
— | — | @@ -29,6 +38,7 @@ |
30 | 39 | var container = $j('.lqt-new-thread' ); |
31 | 40 | |
32 | 41 | liquidThreads.injectEditForm( query, container ); |
| 42 | + liquidThreads.currentReplyThread = 0; |
33 | 43 | |
34 | 44 | return false; |
35 | 45 | }, |
— | — | @@ -175,8 +185,9 @@ |
176 | 186 | e.preventDefault(); |
177 | 187 | } |
178 | 188 | |
179 | | - $j('.lqt-reply-form,.lqt-new-thread').not(e).slideUp('slow'); |
180 | | - $j('.lqt-reply-form,.lqt-new-thread').not(e).empty(); |
| 189 | + $j('.lqt-edit-form').not(e).slideUp('slow', function() { $j(this).empty(); } ); |
| 190 | + |
| 191 | + liquidThreads.currentReplyThread = null; |
181 | 192 | } |
182 | 193 | } |
183 | 194 | |