Index: trunk/extensions/LiquidThreads/lqt.js |
— | — | @@ -1152,48 +1152,25 @@ |
1153 | 1153 | .data( 'sortkey', sortKey ) |
1154 | 1154 | .data( 'parent', parent ); |
1155 | 1155 | }; |
1156 | | - if( isThreadReply ) { |
1157 | | - // FIXME - duplicate drop zones appear often on more complex threads. |
1158 | | - // FIXME - not all drop zones appear to work correctly. Ensure you're setting the sortkey and parent correctly |
1159 | | - $j( '.lqt_thread' ).not( '.lqt-thread-topmost' ).each( function() { |
1160 | | - var $curThread = $j( this ); |
1161 | | - if( $curThread.prev().size() == 0 && $curThread[0] != $thread[0] ) { |
1162 | | - // if this is a top thread, and not the drag thread, add a dropzon before it |
1163 | | - $curThread.before( createDropZone( 'now', $curThread.parents( '.lqt_thread:first' ).data( 'thread-id' ) ) ); |
1164 | | - } |
1165 | | - if ( $curThread[0] != $thread[0] ) { |
1166 | | - // if this isn't the drag thread, add some drop zones |
1167 | | - if ( $curThread[0] != $thread.parents( '.lqt_thread:first' )[0] ) { |
1168 | | - // if this isn't the parent of the drag thread, add a drop zone inside it |
1169 | | - liquidThreads.getRepliesElement( $curThread ) |
1170 | | - .contents().filter('.lqt-replies-finish') |
1171 | | - .before( createDropZone( 'now', $curThread.data( 'thread-id' ) ) ); |
1172 | | - } |
1173 | | - if ( $curThread.next()[0] != $thread[0] ) { |
1174 | | - // if this isn't right above the drag thread, add a drop zone beneath it |
1175 | | - $curThread.append( createDropZone( 'now', $curThread.parents('.lqt_thread').data( 'thread-id' ) ) ); |
1176 | | - } |
1177 | | - } |
1178 | | - } ); |
1179 | | - } else { |
1180 | | - // Rearrange threads |
1181 | | - // FIXME: Should collapse all replys to make reordering quick and easy |
1182 | | - // add a drop zone at the top if the drag thread is not first |
1183 | | - if( $thread.prev().size() != 0 ) { |
1184 | | - var $curThread = $j( '.lqt-thread-topmost:first' ); |
1185 | | - var sortkey = parseInt( $curThread.contents().filter( 'input[name=lqt-thread-sortkey]' ).val() ); |
1186 | | - $curThread.before( createDropZone( sortkey - 1, 'top') ); |
1187 | | - } |
1188 | | - $j( '.lqt-thread-topmost' ).each( function() { |
1189 | | - var $curThread = $j( this ); |
1190 | | - if( $curThread[0] != $thread[0] && $curThread.next()[0] != $thread[0] ) { |
1191 | | - // add a drop zone below our current thread if it's not the drag thread OR followed by the drag thread |
1192 | | - var sortkey = parseInt( $curThread.contents().filter( 'input[name=lqt-thread-sortkey]' ).val() ); |
1193 | | - $curThread.after( createDropZone( sortkey - 1, 'top') ); |
1194 | | - } |
1195 | | - }); |
1196 | | - } |
| 1156 | + |
| 1157 | + // Add a drop zone at the very top unless the drag thread is the very first thread |
| 1158 | + $j( '.lqt-thread-topmost:first' ) |
| 1159 | + .not( $thread ) |
| 1160 | + .before( createDropZone( 'now', 'top' ) ); |
| 1161 | + |
| 1162 | + // Now one after every thread except the drag thread |
| 1163 | + $j( '.lqt-thread-topmost' ).not( $thread ).each( function() { |
| 1164 | + var sortkey = parseInt( $j( this ).contents().filter( 'input[name=lqt-thread-sortkey]' ).val() ); |
| 1165 | + $j( this ).after( createDropZone( sortkey - 1, 'top' ) ); |
| 1166 | + } ); |
1197 | 1167 | |
| 1168 | + // Now one underneath every thread except the drag thread |
| 1169 | + $j('.lqt_thread').not( $thread ).each( function() { |
| 1170 | + var $curThread = $j( this ); |
| 1171 | + var repliesElement = liquidThreads.getRepliesElement( $curThread ); |
| 1172 | + repliesElement.contents().filter('.lqt-replies-finish').before( createDropZone( 'now', $curThread.data( 'thread-id' ) ) ); |
| 1173 | + } ); |
| 1174 | + |
1198 | 1175 | var droppableOptions = { |
1199 | 1176 | 'activeClass' : 'lqt-drop-zone-active', |
1200 | 1177 | 'hoverClass' : 'lqt-drop-zone-hover', |
— | — | @@ -1206,7 +1183,7 @@ |
1207 | 1184 | scrollOffset = scrollOffset + $thread.offset().top; |
1208 | 1185 | |
1209 | 1186 | // Reset scroll position |
1210 | | - $j('html,body').attr( 'scrollTop', scrollOffset ); |
| 1187 | + $j( 'html,body' ).attr( 'scrollTop', scrollOffset ); |
1211 | 1188 | }, |
1212 | 1189 | |
1213 | 1190 | 'completeDragDrop' : function( e, ui ) { |