Index: trunk/extensions/InterfaceConcurrency/InterfaceConcurrency.php |
— | — | @@ -62,7 +62,7 @@ |
63 | 63 | 'scripts' => 'jquery.interfaceConcurrency/jquery.interfaceConcurrency.js', |
64 | 64 | 'dependencies' => array( |
65 | 65 | 'mediawiki.util', |
66 | | - 'mediawiki.user', |
| 66 | + 'user.tokens', |
67 | 67 | ), |
68 | 68 | ); |
69 | 69 | |
Index: trunk/extensions/InterfaceConcurrency/modules/jquery.interfaceConcurrency/jquery.interfaceConcurrency.js |
— | — | @@ -9,11 +9,11 @@ |
10 | 10 | ccaction: 'checkout', |
11 | 11 | resourcetype: 'application-specific-string', |
12 | 12 | record: 123 |
13 | | - }, function( result ){ |
14 | | - if( result == 'failure' ) { |
15 | | - //checkout failed because item is already checked out. do something useful here. |
16 | | - } else if (result == 'success') { |
17 | | - //successfully checked out item. do something useful here. |
| 13 | + }, function ( result ) { |
| 14 | + if ( result === 'failure' ) { |
| 15 | + // Checkout failed because item is already checked out. do something useful here. |
| 16 | + } else if ( result === 'success' ) { |
| 17 | + // Successfully checked out item. do something useful here. |
18 | 18 | } |
19 | 19 | } ); |
20 | 20 | */ |
— | — | @@ -29,20 +29,20 @@ |
30 | 30 | callback: (function) handle results |
31 | 31 | } |
32 | 32 | */ |
33 | | - check: function( params, callback ) { |
| 33 | + check: function ( params, callback ) { |
34 | 34 | params = $.extend({ |
35 | 35 | action: 'concurrency', |
36 | 36 | token: mw.user.tokens.get( 'editToken' ), |
37 | 37 | format: 'json' |
38 | | - }, params); |
| 38 | + }, params ); |
39 | 39 | |
40 | 40 | return $.ajax( { |
41 | 41 | type: 'POST', |
42 | 42 | url: mw.util.wikiScript( 'api' ), |
43 | 43 | data: params, |
44 | | - success: function( data ){ |
| 44 | + success: function ( data ) { |
45 | 45 | if ( typeof callback === 'function' ){ |
46 | | - if ( data && data.concurrency.result ) { |
| 46 | + if ( data && data.concurrency && data.concurrency.result ) { |
47 | 47 | callback( data.concurrency.result ); |
48 | 48 | } |
49 | 49 | } |