Index: trunk/extensions/LiquidThreads/newmessages.js |
— | — | @@ -4,9 +4,16 @@ |
5 | 5 | e.preventDefault(); |
6 | 6 | |
7 | 7 | var button = $j(this); |
| 8 | + var type = 'one'; |
8 | 9 | |
9 | 10 | // Find the operand. |
10 | 11 | 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 | + |
11 | 18 | var operand = form.find('input[name=lqt_operand]').val(); |
12 | 19 | var threads = operand.replace( /\,/g, '|' ); |
13 | 20 | |
— | — | @@ -22,6 +29,21 @@ |
23 | 30 | var spinner = $j('<div class="mw-ajax-loader"/>'); |
24 | 31 | $j(button).before( spinner ); |
25 | 32 | |
| 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 | + |
26 | 48 | $j.get( wgScriptPath+'/api'+wgScriptExtension, getTokenParams, |
27 | 49 | function( data ) { |
28 | 50 | var token = data.query.pages[-1].edittoken; |
— | — | @@ -37,12 +59,7 @@ |
38 | 60 | |
39 | 61 | $j.post( wgScriptPath+'/api'+wgScriptExtension, |
40 | 62 | 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' ); |
47 | 64 | }, 'json' ); |
48 | 65 | } |
49 | 66 | |