"Nikerabbit" changed the status of MediaWiki.r115438 to "ok"
URL: http://www.mediawiki.org/wiki/Special:Code/MediaWiki/115438
Old status: new
New status: ok
Commit summary for MediaWiki.r115438:
Follow-up r115430
* Escape messages before inserting into the document with .html(). Not
just for security reasons but also for good function in general. As
otherwise special characters can cause the interface to break
unexpectedly. For example:
$("<div>").html( mw.msg('blabla') )
Will unexpectedly be interpreted as HTML and create a <blabla>
element in the DOM. Causing a blank spot in the interface instead of
text "<blabla>" (which is better than nothing at all). Usually the
best fix is to simply use .text() instead of .html(), but since one of
the msg parameters here is an <img>, instead escaping the other
parameters.
* Fix typo in .i18n.php: 'uknown' -> 'unknown'.
This caused the following in the front-end:
"<onlinestatusbar-status-unknown>",
because the module and js code didn't have the typo.
* Fix using global variables mw and $ (aliasing from mediaWiki and
jQuery instead). r115430 changed $() to jQuery(), but left inner code
still referring to the
$ global. Could be fixed by using jQuery(function ($) {}); (so that
no additional closure is needed). But since mediaWiki>mw should be
aliases as well, created a closure instead.
* Using .done() on the jqXHR (which inherits from $.Deferred) in
$.ajax.
The success/error/complete properties have been deprecated in favor
of Deferred methods done(), fail() and always(). (the old AJAX
properties are now aliases to these as of jQuery 1.7).
* Server can give status "online", "offline", "busy", "away"
and "unknown". However front-end had no handling for "unknown".
This caused a 404 error:
GET /mw/extensions/OnlineStatusBar/resources/images/undefined 404
Added a statusgrey.png for it.
Also added basic future proof check, never insert a 404 error.
* Moved addModules() call to where the html is added. No need to load
this module on all pages unconditionally.
* Don't use setInterval for asynchronous and/or potentially
long-running functions.
Instead call it once and schedule again from a callback. Otherwise
internet problems or slow connections can cause a long list of pending
requests to build up. Done by using the always() callback (which fires
both if the deferred is done or failed), and calling setTimeout
(instead of setInterval) from there.
* Fix indention level of javascript code.
* Using Title case in ExtensionCredits name (like the rest of the code
and documentation)
* Removed unused $wgOnlineStatusBarIcon configuration variable
* Removed unused $iconbar variable in JS.
* The HTML template inserted from PHP contained the (invisible)
<div class="onlinestatusbaricon"></div>
structure. I removed this since by default (no javascript) it is
invisible, and the javascript replaces the html of the parent of this
(thereby removing the element). So it wasn't used for anything at all.
Removed then unused css as well.
* Skin style fixes:
- standard: Using em instead of px, to match skin margin (it was slightly
hangout
outside the border in Chrome)
- monobook: Remove negative top margin. overlapped sitenotice if there is
a sitenotice. add 1em margin right. To match #content padding
- simple: Set 1em margin right. To match #content padding
- vector: Remove negative top margin. overlapped sitenotice if there is
a sitenotice.
* I'm not sure what the class "metadata" is for, but left it as it is. Although
it appears to be unused in the extension. Not used in core mediawiki either.
_______________________________________________
MediaWiki-CodeReview mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-codereview