Index: trunk/extensions/UploadWizard/resources/combined.js |
— | — | @@ -5228,7 +5228,7 @@ |
5229 | 5229 | * @param {String} string String to output to console |
5230 | 5230 | */ |
5231 | 5231 | mw.log = function( s, level ) { |
5232 | | - |
| 5232 | + |
5233 | 5233 | if ( typeof level === 'undefined' ) { |
5234 | 5234 | level = 30; |
5235 | 5235 | } |
— | — | @@ -5242,63 +5242,59 @@ |
5243 | 5243 | s = mw.log.preAppendLog + s; |
5244 | 5244 | } |
5245 | 5245 | |
5246 | | - if ( window.console ) { |
| 5246 | + if ( typeof window.console !== 'undefined' && typeof window.console.log === 'function' ) { |
5247 | 5247 | window.console.log( s ); |
5248 | 5248 | } else { |
5249 | | - |
5250 | | - /** |
5251 | | - * Old IE and non-Firebug debug |
5252 | | - */ |
5253 | | - var log_elm = document.getElementById('mv_js_log'); |
5254 | | - |
5255 | | - if ( ! log_elm ) { |
5256 | | - var body = document.getElementsByTagName("body")[0]; |
5257 | | - if (body) { |
5258 | | - body.innerHTML = document.getElementsByTagName("body")[0].innerHTML + |
5259 | | - '<div style="position:absolute;z-index:500;bottom:0px;left:0px;right:0px;height:100px;">'+ |
5260 | | - '<textarea id="mv_js_log" cols="120" rows="4"></textarea>'+ |
5261 | | - '</div>'; |
5262 | | - log_elm = document.getElementById('mv_js_log'); |
5263 | | - } else { |
5264 | | - mw.logBuffered += s + "\n"; |
5265 | | - } |
| 5249 | + // Show a log box for console-less browsers |
| 5250 | + var $log = $( '#mw-log-console' ); |
| 5251 | + if ( !$log.length ) { |
| 5252 | + $log = $( '<div id="mw-log-console"></div>' ) |
| 5253 | + .css( { |
| 5254 | + 'position': 'absolute', |
| 5255 | + 'overflow': 'auto', |
| 5256 | + 'z-index': 500, |
| 5257 | + 'bottom': '0px', |
| 5258 | + 'left': '0px', |
| 5259 | + 'right': '0px', |
| 5260 | + 'height': '100px', |
| 5261 | + 'width': '100%', |
| 5262 | + 'background-color': 'white', |
| 5263 | + 'border-top': 'solid 2px #ADADAD' |
| 5264 | + } ) |
| 5265 | + .appendTo( 'body' ); |
5266 | 5266 | } |
5267 | | - |
5268 | | - if ( log_elm ) { |
5269 | | - if (mw.logBuffered.length) { |
5270 | | - log_elm.value += mw.logBuffered; |
5271 | | - mw.logBuffered = ""; |
5272 | | - } |
5273 | | - log_elm.value += s + "\n"; |
5274 | | - } |
5275 | | - |
| 5267 | + $log.append( |
| 5268 | + $( '<div></div>' ) |
| 5269 | + .css( { |
| 5270 | + 'border-bottom': 'solid 1px #DDDDDD', |
| 5271 | + 'font-size': 'small', |
| 5272 | + 'font-family': 'monospace', |
| 5273 | + 'padding': '0.125em 0.25em' |
| 5274 | + } ) |
| 5275 | + .text( s ) |
| 5276 | + ); |
5276 | 5277 | } |
5277 | 5278 | }; |
5278 | | - |
| 5279 | + |
5279 | 5280 | mw.log.level = mw.log.NONE = 0; |
5280 | 5281 | mw.log.FATAL = 10; |
5281 | 5282 | mw.log.WARN = 20; |
5282 | 5283 | mw.log.INFO = 30; |
5283 | 5284 | mw.log.ALL = 100; |
5284 | | - |
| 5285 | + |
5285 | 5286 | mw.log.fatal = function( s ) { |
5286 | 5287 | mw.log( s, mw.log.FATAL ); |
5287 | 5288 | }; |
5288 | | - |
5289 | 5289 | mw.log.warn = function( s ) { |
5290 | 5290 | mw.log( s, mw.log.WARN ); |
5291 | 5291 | }; |
5292 | | - |
5293 | 5292 | mw.log.info = function( s ) { |
5294 | 5293 | mw.log( s, mw.log.INFO ); |
5295 | 5294 | }; |
5296 | | - |
5297 | 5295 | mw.log.level = mw.log.ALL; |
5298 | 5296 | |
5299 | | - mw.logBuffered = ""; |
| 5297 | +} )( window.mediaWiki, jQuery ); |
5300 | 5298 | |
5301 | | -} )( window.mw ); |
5302 | | - |
5303 | 5299 | // dependencies: mw |
5304 | 5300 | |
5305 | 5301 | ( function( mw ) { |
Index: trunk/extensions/UploadWizard/resources/combined.min.js |
— | — | @@ -5242,37 +5242,38 @@ |
5243 | 5243 | s=mw.log.preAppendLog+s; |
5244 | 5244 | } |
5245 | 5245 | |
5246 | | -if(window.console){ |
| 5246 | +if(typeof window.console!=='undefined'&&typeof window.console.log==='function'){ |
5247 | 5247 | window.console.log(s); |
5248 | 5248 | }else{ |
5249 | 5249 | |
5250 | | - |
5251 | | - |
5252 | | - |
5253 | | -var log_elm=document.getElementById('mv_js_log'); |
5254 | | - |
5255 | | -if(!log_elm){ |
5256 | | -var body=document.getElementsByTagName("body")[0]; |
5257 | | -if(body){ |
5258 | | -body.innerHTML=document.getElementsByTagName("body")[0].innerHTML+ |
5259 | | -'<div style="position:absolute;z-index:500;bottom:0px;left:0px;right:0px;height:100px;">'+ |
5260 | | -'<textarea id="mv_js_log" cols="120" rows="4"></textarea>'+ |
5261 | | -'</div>'; |
5262 | | -log_elm=document.getElementById('mv_js_log'); |
5263 | | -}else{ |
5264 | | -mw.logBuffered+=s+"\n"; |
| 5250 | +var $log=$('#mw-log-console'); |
| 5251 | +if(!$log.length){ |
| 5252 | +$log=$('<div id="mw-log-console"></div>') |
| 5253 | +.css({ |
| 5254 | +'position':'absolute', |
| 5255 | +'overflow':'auto', |
| 5256 | +'z-index':500, |
| 5257 | +'bottom':'0px', |
| 5258 | +'left':'0px', |
| 5259 | +'right':'0px', |
| 5260 | +'height':'100px', |
| 5261 | +'width':'100%', |
| 5262 | +'background-color':'white', |
| 5263 | +'border-top':'solid 2px #ADADAD' |
| 5264 | +}) |
| 5265 | +.appendTo('body'); |
5265 | 5266 | } |
| 5267 | +$log.append( |
| 5268 | +$('<div></div>') |
| 5269 | +.css({ |
| 5270 | +'border-bottom':'solid 1px #DDDDDD', |
| 5271 | +'font-size':'small', |
| 5272 | +'font-family':'monospace', |
| 5273 | +'padding':'0.125em 0.25em' |
| 5274 | +}) |
| 5275 | +.text(s) |
| 5276 | +); |
5266 | 5277 | } |
5267 | | - |
5268 | | -if(log_elm){ |
5269 | | -if(mw.logBuffered.length){ |
5270 | | -log_elm.value+=mw.logBuffered; |
5271 | | -mw.logBuffered=""; |
5272 | | -} |
5273 | | -log_elm.value+=s+"\n"; |
5274 | | -} |
5275 | | - |
5276 | | -} |
5277 | 5278 | }; |
5278 | 5279 | |
5279 | 5280 | mw.log.level=mw.log.NONE=0; |
— | — | @@ -5284,23 +5285,18 @@ |
5285 | 5286 | mw.log.fatal=function(s){ |
5286 | 5287 | mw.log(s,mw.log.FATAL); |
5287 | 5288 | }; |
5288 | | - |
5289 | 5289 | mw.log.warn=function(s){ |
5290 | 5290 | mw.log(s,mw.log.WARN); |
5291 | 5291 | }; |
5292 | | - |
5293 | 5292 | mw.log.info=function(s){ |
5294 | 5293 | mw.log(s,mw.log.INFO); |
5295 | 5294 | }; |
5296 | | - |
5297 | 5295 | mw.log.level=mw.log.ALL; |
5298 | 5296 | |
5299 | | -mw.logBuffered=""; |
| 5297 | +})(window.mediaWiki,jQuery); |
5300 | 5298 | |
5301 | | -})(window.mw); |
5302 | 5299 | |
5303 | 5300 | |
5304 | | - |
5305 | 5301 | (function(mw){ |
5306 | 5302 | |
5307 | 5303 | |