Index: branches/wmf-deployment/extensions/LiquidThreads_alpha/lqt.js |
— | — | @@ -70,13 +70,17 @@ |
71 | 71 | return repliesElement; |
72 | 72 | }, |
73 | 73 | |
74 | | - 'checkEmptyReplies' : function( element ) { |
| 74 | + 'checkEmptyReplies' : function( element, action ) { |
75 | 75 | var contents = element.contents(); |
76 | 76 | |
77 | 77 | contents = contents.not('.lqt-replies-finish,.lqt-post-sep,.lqt-edit-form'); |
78 | 78 | |
79 | 79 | if ( !contents.length ) { |
80 | | - element.remove(); |
| 80 | + if ( typeof action == 'undefined' || action == 'remove' ) { |
| 81 | + element.remove(); |
| 82 | + } else { |
| 83 | + element.hide(); |
| 84 | + } |
81 | 85 | } |
82 | 86 | }, |
83 | 87 | |
— | — | @@ -1234,18 +1238,23 @@ |
1235 | 1239 | |
1236 | 1240 | setTimeout( function() { thread.draggable('destroy'); }, 1 ); |
1237 | 1241 | |
1238 | | - // Now, let's do our updates |
1239 | | - liquidThreads.confirmDragDrop( thread, params ); |
1240 | | - |
| 1242 | + // Remove drop points and schedule removal of empty replies elements. |
| 1243 | + var emptyChecks = []; |
1241 | 1244 | $j('.lqt-drop-zone').each( function() { |
1242 | 1245 | var repliesHolder = $j(this).closest('.lqt-thread-replies'); |
1243 | 1246 | |
1244 | 1247 | $j(this).remove(); |
1245 | 1248 | |
1246 | 1249 | if (repliesHolder.length) { |
1247 | | - liquidThreads.checkEmptyReplies(repliesHolder); |
| 1250 | + liquidThreads.checkEmptyReplies( repliesHolder, 'hide' ); |
| 1251 | + emptyChecks = $j.merge( emptyChecks, repliesHolder ); |
1248 | 1252 | } |
1249 | 1253 | } ); |
| 1254 | + |
| 1255 | + params.emptyChecks = emptyChecks; |
| 1256 | + |
| 1257 | + // Now, let's do our updates |
| 1258 | + liquidThreads.confirmDragDrop( thread, params ); |
1250 | 1259 | }, |
1251 | 1260 | |
1252 | 1261 | 'confirmDragDrop' : function( thread, params ) { |
— | — | @@ -1352,6 +1361,12 @@ |
1353 | 1362 | var topLevel = (newParent == 'top'); |
1354 | 1363 | var wasTopLevel = thread.hasClass( 'lqt-thread-topmost' ); |
1355 | 1364 | |
| 1365 | + var doEmptyChecks = function() { |
| 1366 | + $j.each( params.emptyChecks, function( k, element ) { |
| 1367 | + liquidThreads.checkEmptyReplies( $j(element) ); |
| 1368 | + } ); |
| 1369 | + }; |
| 1370 | + |
1356 | 1371 | var doneCallback = |
1357 | 1372 | function(data) { |
1358 | 1373 | // TODO error handling |
— | — | @@ -1369,6 +1384,7 @@ |
1370 | 1385 | |
1371 | 1386 | if (result != 'success') { |
1372 | 1387 | alert( "Error: "+result ); |
| 1388 | + doEmptyChecks(); |
1373 | 1389 | return; |
1374 | 1390 | } |
1375 | 1391 | |
— | — | @@ -1393,7 +1409,6 @@ |
1394 | 1410 | var heading = $j('#lqt-header-'+threadId); |
1395 | 1411 | } |
1396 | 1412 | |
1397 | | - |
1398 | 1413 | // Assorted ways of returning a thread to its proper place. |
1399 | 1414 | if ( typeof params.insertAfter != 'undefined' ) { |
1400 | 1415 | // Move the heading |
— | — | @@ -1463,6 +1478,8 @@ |
1464 | 1479 | if ( typeof callback == 'function' ) { |
1465 | 1480 | callback(); |
1466 | 1481 | } |
| 1482 | + |
| 1483 | + doEmptyChecks(); |
1467 | 1484 | } |
1468 | 1485 | |
1469 | 1486 | if ( !topLevel || !wasTopLevel ) { |
Property changes on: branches/wmf-deployment/extensions/LiquidThreads_alpha/lqt.js |
___________________________________________________________________ |
Name: svn:mergeinfo |
1470 | 1487 | + /trunk/extensions/LiquidThreads/lqt.js:57390,58990-62113,62158 |