Merge "Made SSL validation in Curl HTTP requests the default."
[lhc/web/wiklou.git] / resources / mediawiki / mediawiki.log.js
index 9c3d890..4ea1a88 100644 (file)
@@ -6,7 +6,7 @@
  * @author Trevor Parscal <tparscal@wikimedia.org>
  */
 
-(function( $ ) {
+( function ( mw, $ ) {
 
        /**
         * Logs a message to the console.
         * a <div id="mw-log-console"> element to the bottom of the body and then appending this and future
         * messages to that, instead of the console.
         *
-        * @param logmsg {String} Messages to output to the console.
+        * @param {String} First in list of variadic messages to output to console.
         */
-       mw.log = function( logmsg ) {
-               // Allow log messages to use a configured prefix to identify the source window (ie. frame)
-               if ( mw.config.exists( 'mw.log.prefix' ) ) {
-                       logmsg = mw.config.get( 'mw.log.prefix' ) + '> ' + logmsg;
-               }
+       mw.log = function ( /* logmsg, logmsg, */ ) {
+               // Turn arguments into an array
+               var     args = Array.prototype.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 ) ) {
-                       window.console.log( logmsg );
+                       args.unshift( prefix );
+                       window.console.log.apply( window.console, args );
                        return;
                }
 
                // If there is no console, use our own log box
+               mw.loader.using( 'jquery.footHovzer', function () {
 
-                       var     d = new Date(),
+                       var     hovzer,
+                               d = new Date(),
                                // Create HH:MM:SS.MIL timestamp
                                time = ( d.getHours() < 10 ? '0' + d.getHours() : d.getHours() ) +
                                 ':' + ( d.getMinutes() < 10 ? '0' + d.getMinutes() : d.getMinutes() ) +
        
                        if ( !$log.length ) {
                                $log = $( '<div id="mw-log-console"></div>' ).css( {
-                                               position: 'fixed',
                                                overflow: 'auto',
-                                               zIndex: 500,
-                                               bottom: '0px',
-                                               left: '0px',
-                                               right: '0px',
                                                height: '150px',
                                                backgroundColor: 'white',
                                                borderTop: 'solid 2px #ADADAD'
                                        } );
-                               $( 'body' )
-                                       // Since the position is fixed, make sure we don't hide any actual content.
-                                       // Increase padding to account for #mw-log-console.
-                                       .css( 'paddingBottom', '+=150px' )
-                                       .append( $log );
+                               hovzer = $.getFootHovzer();
+                               hovzer.$.append( $log );
+                               hovzer.update();
                        }
                        $log.append(
                                $( '<div></div>' )
                                                whiteSpace: 'pre-wrap',
                                                padding: '0.125em 0.25em'
                                        } )
-                                       .text( logmsg )
+                                       .text( prefix + args.join( ', ' ) )
                                        .prepend( '<span style="float: right;">[' + time + ']</span>' )
-               );
+                       );
+               } );
        };
 
-})( jQuery );
+}( mediaWiki, jQuery ) );