r70083 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r70082‎ | r70083 | r70084 >
Date:12:14, 28 July 2010
Author:werdna
Status:deferred
Tags:
Comment:
LiquidThreads: Fix several bugs in drag-and-drop, drop large containing box in favour of moving header and anchor within the existing one.
Modified paths:
  • /trunk/extensions/LiquidThreads/classes/View.php (modified) (history)
  • /trunk/extensions/LiquidThreads/lqt.js (modified) (history)

Diff [purge]

Index: trunk/extensions/LiquidThreads/classes/View.php
@@ -1893,11 +1893,6 @@
18941894
18951895 $html = '';
18961896
1897 - $html .= Xml::openElement( 'div', array( 'class' => 'lqt-thread-wrapper' ) );
1898 -
1899 - $html .= Xml::element( 'a', array( 'name' => $this->anchorName( $thread ) ), ' ' );
1900 - $html .= $this->showThreadHeading( $thread );
1901 -
19021897 $class = $this->threadDivClass( $thread );
19031898 if ( $levelNum == 1 ) {
19041899 $class .= ' lqt-thread-first';
@@ -1910,6 +1905,8 @@
19111906 } else {
19121907 $class .= ' lqt-thread-no-subthreads';
19131908 }
 1909+
 1910+ $class .= ' lqt-thread-wrapper';
19141911
19151912 $html .= Xml::openElement(
19161913 'div',
@@ -1918,6 +1915,9 @@
19191916 'id' => 'lqt_thread_id_' . $thread->id()
19201917 )
19211918 );
 1919+
 1920+ $html .= Xml::element( 'a', array( 'name' => $this->anchorName( $thread ) ), ' ' );
 1921+ $html .= $this->showThreadHeading( $thread );
19221922
19231923 // Metadata stuck in the top of the lqt_thread div.
19241924 // Modified time for topmost threads...
@@ -2039,7 +2039,7 @@
20402040 // }
20412041 // }
20422042
2043 - $this->output->addHTML( Xml::closeElement( 'div' ) . Xml::closeElement( 'div' ) );
 2043+ $this->output->addHTML( Xml::closeElement( 'div' ) );
20442044
20452045 $this->threadNestingLevel--;
20462046 }
Index: trunk/extensions/LiquidThreads/lqt.js
@@ -567,15 +567,15 @@
568568 thread.append( newThreadContent );
569569 thread.attr( 'class', newThread.attr('class') );
570570
571 - // Replace header content
572 - var newHeader = newContent.filter('#lqt-header-'+threadId);
573 - if ( header.length ) {
574 - var newHeaderContent = $j(newHeader).contents();
575 - header.append( newHeaderContent );
576 - } else {
577 - // No existing header, add one before the thread
578 - thread.before(newHeader);
579 - }
 571+// Replace header content
 572+// var newHeader = newContent.filter('#lqt-header-'+threadId);
 573+// if ( header.length ) {
 574+// var newHeaderContent = $j(newHeader).contents();
 575+// header.append( newHeaderContent );
 576+// } else {
 577+// // No existing header, add one before the thread
 578+// thread.before(newHeader);
 579+// }
580580
581581 // Set up thread.
582582 thread.find('.lqt-post-wrapper').each( function() {
@@ -872,7 +872,7 @@
873873 var replyCallback = function( data ) {
874874 $parent = $j( '#lqt_thread_id_' + data.threadaction.thread['parent-id'] );
875875 $html = $j( data.threadaction.thread['html'] );
876 - $newThread = $html.find( '#lqt_thread_id_' + data.threadaction.thread['thread-id'] ).parent();
 876+ $newThread = $html.find( '#lqt_thread_id_' + data.threadaction.thread['thread-id'] );
877877 $parent.find( '.lqt-thread-replies:first' ).append( $newThread );
878878 liquidThreads.setupThread( $newThread.find( '.lqt-post-wrapper' ) );
879879 $j( 'html,body' ).animate({scrollTop: $newThread.offset().top}, 'slow');
@@ -1153,10 +1153,8 @@
11541154 var firstDropZone = createDropZone();
11551155 firstDropZone.data( 'sortkey', 'now' );
11561156 firstDropZone.data( 'parent', 'top' );
1157 - var firstThread = $j('.lqt-thread-topmost.lqt-thread-first');
1158 - var firstThreadID = firstThread.find('.lqt-post-wrapper').data('thread-id');
1159 - var firstHeading = $j('#lqt-header-'+firstThreadID);
1160 - firstHeading.before(firstDropZone);
 1157+ var firstThread = $j('.lqt-thread-topmost:first');
 1158+ firstThread.before(firstDropZone);
11611159
11621160 // Now one after every thread
11631161 $j('.lqt-thread-topmost').each( function() {
@@ -1171,7 +1169,7 @@
11721170 } );
11731171
11741172 // Now one underneath every thread
1175 - $j('.lqt_thread').each( function() {
 1173+ $j('.lqt_thread').not(thread).each( function() {
11761174 var thread = $j(this);
11771175 var repliesElement = liquidThreads.getRepliesElement( thread );
11781176 var dropZone = createDropZone();
@@ -1392,44 +1390,17 @@
13931391 // Do the actual physical movement
13941392 var threadId = thread.find('.lqt-post-wrapper')
13951393 .data('thread-id');
1396 - var topmost = thread.hasClass('lqt-thread-topmost');
13971394
1398 - if ( topmost ) {
1399 - var heading = $j('#lqt-header-'+threadId);
1400 - }
1401 -
14021395 // Assorted ways of returning a thread to its proper place.
14031396 if ( typeof params.insertAfter != 'undefined' ) {
1404 - // Move the heading
1405 - if ( topmost ) {
1406 - heading.remove();
1407 - params.insertAfter.after(heading);
1408 - thread.remove();
1409 - heading.after( thread );
1410 - } else {
1411 - thread.remove();
1412 - params.insertAfter.after(thread);
1413 - }
 1397+ thread.remove();
 1398+ params.insertAfter.after(thread);
14141399 } else if ( typeof params.insertBefore != 'undefined' ) {
1415 - if ( topmost ) {
1416 - heading.remove();
1417 - params.insertBefore.before(heading);
1418 - thread.remove();
1419 - heading.after( thread );
1420 - } else {
1421 - thread.remove();
1422 - params.insertBefore.before( thread );
1423 - }
 1400+ thread.remove();
 1401+ params.insertBefore.before( thread );
14241402 } else if ( typeof params.insertUnder != 'undefined' ) {
1425 - if ( topmost ) {
1426 - heading.remove();
1427 - params.insertUnder.prepend(heading);
1428 - thread.remove();
1429 - heading.after(thread);
1430 - } else {
1431 - thread.remove();
1432 - params.insertUnder.prepend(thread);
1433 - }
 1403+ thread.remove();
 1404+ params.insertUnder.prepend(thread);
14341405 }
14351406
14361407 thread.data('thread-id', threadId);
@@ -1455,8 +1426,8 @@
14561427 }
14571428
14581429 // Kill the heading, if there isn't one.
1459 - if ( !topLevel && wasTopLevel && heading.length ) {
1460 - heading.remove();
 1430+ if ( !topLevel && wasTopLevel ) {
 1431+ thread.find('h2.lqt_header').remove();
14611432 }
14621433
14631434 if ( !wasTopLevel && typeof oldParent != 'undefined' ) {

Status & tagging log