r58145 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r58144‎ | r58145 | r58146 >
Date:16:32, 26 October 2009
Author:werdna
Status:deferred
Tags:
Comment:
LiquidThreads: Adjust newmessages.js to fix JS errors on using "Mark all as read"
Modified paths:
  • /trunk/extensions/LiquidThreads/newmessages.js (modified) (history)

Diff [purge]

Index: trunk/extensions/LiquidThreads/newmessages.js
@@ -4,9 +4,16 @@
55 e.preventDefault();
66
77 var button = $j(this);
 8+ var type = 'one';
89
910 // Find the operand.
1011 var form = button.closest('form.lqt_newmessages_read_button');
 12+
 13+ if (!form.length) {
 14+ form = button.closest( 'form.lqt_newmessages_read_all_button' );
 15+ type = 'all';
 16+ }
 17+
1118 var operand = form.find('input[name=lqt_operand]').val();
1219 var threads = operand.replace( /\,/g, '|' );
1320
@@ -22,6 +29,21 @@
2330 var spinner = $j('<div class="mw-ajax-loader"/>');
2431 $j(button).before( spinner );
2532
 33+ var doneCallback =
 34+ function(reply) {
 35+ if ( type == 'one' ) {
 36+ var row = button.closest('tr');
 37+ row.fadeOut( 'slow',
 38+ function() { row.remove(); } );
 39+ } else {
 40+ var tables = $j('table.lqt-new-messages');
 41+ tables.fadeOut( 'slow',
 42+ function() { tables.remove(); } );
 43+ }
 44+
 45+ spinner.remove();
 46+ }
 47+
2648 $j.get( wgScriptPath+'/api'+wgScriptExtension, getTokenParams,
2749 function( data ) {
2850 var token = data.query.pages[-1].edittoken;
@@ -37,12 +59,7 @@
3860
3961 $j.post( wgScriptPath+'/api'+wgScriptExtension,
4062 markReadParameters,
41 - function(reply) {
42 - var row = button.closest('tr');
43 - row.fadeOut( 'slow',
44 - function() { row.remove(); } );
45 - spinner.remove();
46 - }, 'json' );
 63+ doneCallback, 'json' );
4764 }, 'json' );
4865 }
4966

Status & tagging log