r70204 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r70203‎ | r70204 | r70205 >
Date:20:02, 30 July 2010
Author:adam
Status:deferred
Tags:
Comment:
Followup to r70147. Going back to more of the logic we had before, but cleaning it up a lot
Modified paths:
  • /trunk/extensions/LiquidThreads/lqt.js (modified) (history)

Diff [purge]

Index: trunk/extensions/LiquidThreads/lqt.js
@@ -1152,48 +1152,25 @@
11531153 .data( 'sortkey', sortKey )
11541154 .data( 'parent', parent );
11551155 };
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+ } );
11971167
 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+
11981175 var droppableOptions = {
11991176 'activeClass' : 'lqt-drop-zone-active',
12001177 'hoverClass' : 'lqt-drop-zone-hover',
@@ -1206,7 +1183,7 @@
12071184 scrollOffset = scrollOffset + $thread.offset().top;
12081185
12091186 // Reset scroll position
1210 - $j('html,body').attr( 'scrollTop', scrollOffset );
 1187+ $j( 'html,body' ).attr( 'scrollTop', scrollOffset );
12111188 },
12121189
12131190 'completeDragDrop' : function( e, ui ) {

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r70147Lots of cleanup and rearranging and changes on thread rearranging. Not all of...adam17:57, 29 July 2010

Status & tagging log