Index: trunk/extensions/OnlineStatusBar/ext.onlinestatusbar.js |
— | — | @@ -3,14 +3,15 @@ |
4 | 4 | $(function() { |
5 | 5 | |
6 | 6 | $statusbar = $('#status-top'); |
| 7 | + $iconbar = $('.onlinestatusbaricon'); |
7 | 8 | |
8 | 9 | // Only do the rest if we have the statusbar! |
9 | 10 | if ($statusbar.length > 0) { |
10 | 11 | function updateOnlineStatusBar() { |
11 | 12 | // ... code to fetch and update |
12 | 13 | $.ajax({ |
13 | | - url: mw.config.get('wgScriptUrl') + '/api' + mw.config.get('wgScriptExtension'), |
14 | | - params: { |
| 14 | + url: mw.config.get('wgScriptPath') + '/api' + mw.config.get('wgScriptExtension'), |
| 15 | + data: { |
15 | 16 | action: "query", |
16 | 17 | prop: "onlinestatus", |
17 | 18 | onlinestatususer: mw.config.get('wgTitle'), |
— | — | @@ -18,12 +19,15 @@ |
19 | 20 | }, |
20 | 21 | success: function(data) { |
21 | 22 | // code to update the statusbar based on the returned message |
| 23 | + $icon = $("<img>").attr("src",mw.config.values.wgScriptPath+"/extensions/OnlineStatusBar/status"+({offline:'red',online:'green',away:'orange'})[data.onlinestatus.result]+'.png'); |
| 24 | + $statusbar.html(mw.msg('onlinestatusbar-line', wgTitle,$icon,data.onlinestatus.result)); |
| 25 | + //$statusbar.text(mw.config.values.wgTitle +" is now ").append($("<img>").attr("src",mw.config.values.wgScriptPath+"/extensions/OnlineStatusBar/status"+({offline:'red',online:'green',away:'orange'})[data.onlinestatus.result]+'.png')).append(data) |
22 | 26 | } |
23 | 27 | }); |
24 | 28 | } |
25 | 29 | |
26 | 30 | // Update the status every couple minutes if we leave the page open |
27 | | - window.setInterval(updateOnlineStatusBar(), 120 * 1000); |
| 31 | + window.setInterval(updateOnlineStatusBar, 120 * 1000); |
28 | 32 | updateOnlineStatusBar(); |
29 | 33 | } |
30 | 34 | |
Index: trunk/extensions/OnlineStatusBar/OnlineStatusBar.php |
— | — | @@ -41,6 +41,7 @@ |
42 | 42 | 'scripts' => 'ext.onlinestatusbar.js', |
43 | 43 | 'localBasePath' => dirname ( __FILE__ ), |
44 | 44 | 'remoteExtPath' => 'OnlineStatusBar', |
| 45 | + 'messages' => array ( 'onlinestatusbar-status-offline', 'onlinestatusbar-status-online', 'onlinestatusbar-status-busy', 'onlinestatusbar-status-away', 'onlinestatusbar-line' ), |
45 | 46 | ); |
46 | 47 | |
47 | 48 | // Load other files of extension |