Index: trunk/phase3/resources/mediawiki/mediawiki.log.js |
— | — | @@ -2,61 +2,56 @@ |
3 | 3 | * Debug output logging |
4 | 4 | */ |
5 | 5 | |
6 | | -( function( $, mw ) { |
| 6 | +( function( $ ) { |
7 | 7 | |
8 | 8 | /* Extension */ |
9 | 9 | |
10 | | -$.extend( mw, { |
11 | | - |
12 | | - /* Functions */ |
13 | | - |
14 | | - /** |
15 | | - * Log output to the console |
16 | | - * |
17 | | - * In the case that the browser does not have a console available, one is created by appending a <div> element to |
18 | | - * the bottom of the body and then appending a <div> element to that for each message. |
19 | | - * |
20 | | - * @author Michael Dale <mdale@wikimedia.org>, Trevor Parscal <tparscal@wikimedia.org> |
21 | | - * @param {string} string message to output to console |
22 | | - */ |
23 | | - 'log': function( string ) { |
24 | | - // Allow log messages to use a configured prefix |
25 | | - if ( mw.config.exists( 'mw.log.prefix' ) ) { |
26 | | - string = mw.config.get( 'mw.log.prefix' ) + string; |
| 10 | +/** |
| 11 | + * Log output to the console |
| 12 | + * |
| 13 | + * In the case that the browser does not have a console available, one is created by appending a <div> element to |
| 14 | + * the bottom of the body and then appending a <div> element to that for each message. |
| 15 | + * |
| 16 | + * @author Michael Dale <mdale@wikimedia.org>, Trevor Parscal <tparscal@wikimedia.org> |
| 17 | + * @param {string} string message to output to console |
| 18 | + */ |
| 19 | +mediaWiki.log = function( string ) { |
| 20 | + // Allow log messages to use a configured prefix |
| 21 | + if ( mw.config.exists( 'mw.log.prefix' ) ) { |
| 22 | + string = mw.config.get( 'mw.log.prefix' ) + string; |
| 23 | + } |
| 24 | + // Try to use an existing console |
| 25 | + if ( typeof window.console !== 'undefined' && typeof window.console.log == 'function' ) { |
| 26 | + window.console.log( string ); |
| 27 | + } else { |
| 28 | + // Show a log box for console-less browsers |
| 29 | + var $log = $( '#mw_log_console' ); |
| 30 | + if ( !$log.length ) { |
| 31 | + $log = $( '<div id="mw_log_console"></div>' ) |
| 32 | + .css( { |
| 33 | + 'position': 'absolute', |
| 34 | + 'overflow': 'auto', |
| 35 | + 'z-index': 500, |
| 36 | + 'bottom': '0px', |
| 37 | + 'left': '0px', |
| 38 | + 'right': '0px', |
| 39 | + 'height': '150px', |
| 40 | + 'background-color': 'white', |
| 41 | + 'border-top': 'solid 1px #DDDDDD' |
| 42 | + } ) |
| 43 | + .appendTo( $( 'body' ) ); |
27 | 44 | } |
28 | | - // Try to use an existing console |
29 | | - if ( typeof window.console !== 'undefined' && typeof window.console.log == 'function' ) { |
30 | | - window.console.log( string ); |
31 | | - } else { |
32 | | - // Show a log box for console-less browsers |
33 | | - var $log = $( '#mw_log_console' ); |
34 | | - if ( !$log.length ) { |
35 | | - $log = $( '<div id="mw_log_console"></div>' ) |
36 | | - .css( { |
37 | | - 'position': 'absolute', |
38 | | - 'overflow': 'auto', |
39 | | - 'z-index': 500, |
40 | | - 'bottom': '0px', |
41 | | - 'left': '0px', |
42 | | - 'right': '0px', |
43 | | - 'height': '150px', |
44 | | - 'background-color': 'white', |
45 | | - 'border-top': 'solid 1px #DDDDDD' |
46 | | - } ) |
47 | | - .appendTo( $( 'body' ) ); |
48 | | - } |
49 | | - $log.append( |
50 | | - $( '<div></div>' ) |
51 | | - .text( string ) |
52 | | - .css( { |
53 | | - 'border-bottom': 'solid 1px #DDDDDD', |
54 | | - 'font-size': 'small', |
55 | | - 'font-family': 'monospace', |
56 | | - 'padding': '0.125em 0.25em' |
57 | | - } ) |
58 | | - ); |
59 | | - } |
| 45 | + $log.append( |
| 46 | + $( '<div></div>' ) |
| 47 | + .text( string ) |
| 48 | + .css( { |
| 49 | + 'border-bottom': 'solid 1px #DDDDDD', |
| 50 | + 'font-size': 'small', |
| 51 | + 'font-family': 'monospace', |
| 52 | + 'padding': '0.125em 0.25em' |
| 53 | + } ) |
| 54 | + ); |
60 | 55 | } |
61 | | -} ); |
| 56 | +}; |
62 | 57 | |
63 | | -} )( jQuery, mediaWiki ); |
\ No newline at end of file |
| 58 | +} )( jQuery ); |
\ No newline at end of file |