Index: trunk/extensions/LiquidThreads/lqt.js |
— | — | @@ -177,6 +177,8 @@ |
178 | 178 | } |
179 | 179 | // Add wikiEditor toolbar |
180 | 180 | $j( '#wpTextbox1' ).wikiEditor( 'addModule', { 'toolbar': liquidThreads.toolbar.config, 'dialogs': liquidThreads.toolbar.dialogs } ); |
| 181 | + // cleanup unnecessary things from the old toolbar |
| 182 | + $j( '#editpage-specialchars' ).remove(); |
181 | 183 | } else { |
182 | 184 | // Add old toolbar |
183 | 185 | mwSetupToolbar() |
— | — | @@ -591,7 +593,14 @@ |
592 | 594 | |
593 | 595 | 'setupThread' : function(threadContainer) { |
594 | 596 | var prefixLength = "lqt_thread_id_".length; |
595 | | - |
| 597 | + // add the interruption class if it needs it |
| 598 | + $parentWrapper = $j( threadContainer ) |
| 599 | + .closest( '.lqt-thread-wrapper' ).parent().closest( '.lqt-thread-wrapper' ); |
| 600 | + if( $parentWrapper.next( '.lqt-thread-wrapper' ).length > 0 ) { |
| 601 | + $parentWrapper |
| 602 | + .find( '.lqt-thread-replies' ) |
| 603 | + .addClass( 'lqt-thread-replies-interruption' ); |
| 604 | + } |
596 | 605 | // Update reply links |
597 | 606 | var threadWrapper = $j(threadContainer).closest('.lqt_thread')[0] |
598 | 607 | var threadId = threadWrapper.id.substring( prefixLength ); |
— | — | @@ -860,35 +869,12 @@ |
861 | 870 | editform.prepend(spinner); |
862 | 871 | |
863 | 872 | var replyCallback = function( data ) { |
864 | | - // Grab topmost thread, reload it. |
865 | | - var topmostThread = editform.closest('.lqt-thread-topmost'); |
866 | | - var post = topmostThread.find('.lqt-post-wrapper'); |
867 | | -// var threadID = post.data('thread-id'); Unused, but useful |
868 | | - var newPostID = data.threadaction.thread['thread-id']; |
869 | | - |
870 | | - // Load data from JSON |
871 | | - var html = data.threadaction.thread['html'] |
872 | | - var newContent = $j(html); |
873 | | - |
874 | | - // Clear old post. |
875 | | - topmostThread.empty(); |
876 | | - |
877 | | - // Replace post content |
878 | | - var newThread = newContent.filter('div.lqt_thread')[0]; |
879 | | - var newThreadContent = $j(newThread).contents(); |
880 | | - topmostThread.append( newThreadContent ); |
881 | | - topmostThread.removeClass( 'lqt-thread-no-subthreads' ); |
882 | | - topmostThread.addClass( 'lqt-thread-with-subthreads' ); |
883 | | - |
884 | | - // Set up thread. |
885 | | - topmostThread.find('.lqt-post-wrapper').each( function() { |
886 | | - liquidThreads.setupThread( $j(this) ); |
887 | | - } ); |
888 | | - |
889 | | - // Scroll to the new post. |
890 | | - var newPost = $j('#lqt_thread_id_'+newPostID); |
891 | | - var targetOffset = $j(newPost).offset().top; |
892 | | - $j('html,body').animate({scrollTop: targetOffset}, 'slow'); |
| 873 | + $parent = $j( '#lqt_thread_id_' + data.threadaction.thread['parent-id'] ); |
| 874 | + $html = $j( data.threadaction.thread['html'] ); |
| 875 | + $newThread = $html.find( '#lqt_thread_id_' + data.threadaction.thread['thread-id'] ).parent(); |
| 876 | + $parent.find( '.lqt-thread-replies:first' ).append( $newThread ); |
| 877 | + liquidThreads.setupThread( $newThread.find( '.lqt-post-wrapper' ) ); |
| 878 | + $j( 'html,body' ).animate({scrollTop: $newThread.offset().top}, 'slow'); |
893 | 879 | }; |
894 | 880 | |
895 | 881 | var newCallback = function( data ) { |