r105404 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r105403‎ | r105404 | r105405 >
Date:01:30, 7 December 2011
Author:petrb
Status:resolved (Comments)
Tags:
Comment:
commited for brion for review
Modified paths:
  • /trunk/extensions/OnlineStatusBar/OnlineStatusBar.php (modified) (history)
  • /trunk/extensions/OnlineStatusBar/ext.onlinestatusbar.js (modified) (history)

Diff [purge]

Index: trunk/extensions/OnlineStatusBar/ext.onlinestatusbar.js
@@ -3,14 +3,15 @@
44 $(function() {
55
66 $statusbar = $('#status-top');
 7+ $iconbar = $('.onlinestatusbaricon');
78
89 // Only do the rest if we have the statusbar!
910 if ($statusbar.length > 0) {
1011 function updateOnlineStatusBar() {
1112 // ... code to fetch and update
1213 $.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: {
1516 action: "query",
1617 prop: "onlinestatus",
1718 onlinestatususer: mw.config.get('wgTitle'),
@@ -18,12 +19,15 @@
1920 },
2021 success: function(data) {
2122 // 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)
2226 }
2327 });
2428 }
2529
2630 // Update the status every couple minutes if we leave the page open
27 - window.setInterval(updateOnlineStatusBar(), 120 * 1000);
 31+ window.setInterval(updateOnlineStatusBar, 120 * 1000);
2832 updateOnlineStatusBar();
2933 }
3034
Index: trunk/extensions/OnlineStatusBar/OnlineStatusBar.php
@@ -41,6 +41,7 @@
4242 'scripts' => 'ext.onlinestatusbar.js',
4343 'localBasePath' => dirname ( __FILE__ ),
4444 'remoteExtPath' => 'OnlineStatusBar',
 45+ 'messages' => array ( 'onlinestatusbar-status-offline', 'onlinestatusbar-status-online', 'onlinestatusbar-status-busy', 'onlinestatusbar-status-away', 'onlinestatusbar-line' ),
4546 );
4647
4748 // Load other files of extension

Follow-up revisions

RevisionCommit summaryAuthorDate
r106506r105404 fixed wgTitle in scriptpetrb14:57, 17 December 2011

Comments

#Comment by Yair rand (talk | contribs)   03:21, 7 December 2011

Using .html should really be avoided here if possible, I think...

#Comment by Nikerabbit (talk | contribs)   14:05, 7 December 2011

have a look at mw.util.wikiScript too

#Comment by Petrb (talk | contribs)   14:09, 7 December 2011

Thanks for replies, please note that Brion already updated that, I will try to look it up and add as follow up.

#Comment by Nikerabbit (talk | contribs)   12:37, 14 December 2011

Don't use wgTitle directly, use mw.config.get( 'wgTitle' ).

#Comment by Petrb (talk | contribs)   09:42, 23 December 2011

resolved ;)

Status & tagging log