r105405 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r105404‎ | r105405 | r105406 >
Date:01:33, 7 December 2011
Author:brion
Status:deferred
Tags:
Comment:
whitespace, local variable fixes
Modified paths:
  • /trunk/extensions/OnlineStatusBar/ext.onlinestatusbar.js (modified) (history)

Diff [purge]

Index: trunk/extensions/OnlineStatusBar/ext.onlinestatusbar.js
@@ -2,32 +2,32 @@
33
44 $(function() {
55
6 - $statusbar = $('#status-top');
 6+var $statusbar = $('#status-top'),
77 $iconbar = $('.onlinestatusbaricon');
88
9 - // Only do the rest if we have the statusbar!
10 - if ($statusbar.length > 0) {
11 - function updateOnlineStatusBar() {
12 - // ... code to fetch and update
13 - $.ajax({
 9+// Only do the rest if we have the statusbar!
 10+if ($statusbar.length > 0) {
 11+ function updateOnlineStatusBar() {
 12+ // ... code to fetch and update
 13+ $.ajax({
1414 url: mw.config.get('wgScriptPath') + '/api' + mw.config.get('wgScriptExtension'),
1515 data: {
16 - action: "query",
17 - prop: "onlinestatus",
18 - onlinestatususer: mw.config.get('wgTitle'),
19 - format: 'json'
20 - },
21 - success: function(data) {
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)
26 - }
27 -});
28 - }
 16+ action: "query",
 17+ prop: "onlinestatus",
 18+ onlinestatususer: mw.config.get('wgTitle'),
 19+ format: 'json'
 20+ },
 21+ success: function(data) {
 22+ // code to update the statusbar based on the returned message
 23+ var $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)
 26+ }
 27+ });
 28+ }
2929
30 - // Update the status every couple minutes if we leave the page open
31 - window.setInterval(updateOnlineStatusBar, 120 * 1000);
 30+ // Update the status every couple minutes if we leave the page open
 31+ window.setInterval(updateOnlineStatusBar, 120 * 1000);
3232 updateOnlineStatusBar();
3333 }
3434

Status & tagging log