X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=resources%2Fmediawiki%2Fmediawiki.log.js;h=dd22e354faa804bb2ded668e3daecea4dd338625;hb=bccd14346568a39fead764b0685dc679173db877;hp=e94f37ce4a6d2b0abcb5d33d8ceed719ee12ad3e;hpb=76072add9847ec297cd31a23aea9d63fb488d533;p=lhc%2Fweb%2Fwiklou.git diff --git a/resources/mediawiki/mediawiki.log.js b/resources/mediawiki/mediawiki.log.js index e94f37ce4a..dd22e354fa 100644 --- a/resources/mediawiki/mediawiki.log.js +++ b/resources/mediawiki/mediawiki.log.js @@ -8,27 +8,32 @@ ( function ( mw, $ ) { - /** - * @class mw.plugin.log - */ + // Reference to dummy + // We don't need the dummy, but it has other methods on it + // that we need to restore afterwards. + var original = mw.log, + slice = Array.prototype.slice; /** - * Logs a message to the console. + * Logs a message to the console in debug mode. * * In the case the browser does not have a console API, a console is created on-the-fly by appending * a `
` element to the bottom of the body and then appending this and future * messages to that, instead of the console. * + * @member mw.log * @param {string...} msg Messages to output to console. */ mw.log = function () { // Turn arguments into an array - var args = Array.prototype.slice.call( arguments ), + var args = slice.call( arguments ), // Allow log messages to use a configured prefix to identify the source window (ie. frame) prefix = mw.config.exists( 'mw.log.prefix' ) ? mw.config.get( 'mw.log.prefix' ) + '> ' : ''; // Try to use an existing console - if ( window.console !== undefined && $.isFunction( window.console.log ) ) { + // Generally we can cache this, but in this case we want to re-evaluate this as a + // global property live so that things like Firebug Lite can take precedence. + if ( window.console && window.console.log ) { args.unshift( prefix ); window.console.log.apply( window.console, args ); return; @@ -58,7 +63,7 @@ hovzer.update(); } $log.append( - $( '
' ) + $( '
' ) .css( { borderBottom: 'solid 1px #DDDDDD', fontSize: 'small', @@ -72,9 +77,8 @@ } ); }; - /** - * @class mw - * @mixins mw.plugin.log - */ + // Restore original methods + mw.log.warn = original.warn; + mw.log.deprecate = original.deprecate; }( mediaWiki, jQuery ) );