Created
April 28, 2010 00:50
-
-
Save textarcana/381576 to your computer and use it in GitHub Desktop.
avoid throwing errors when Firebug is not installed
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Avoid throwing errors when Firebug is not installed. | |
* See http://mattsnider.com/test/debugging-firebug-console-emulator/ | |
* | |
* @todo as written this prevents using the console in WebKit. | |
*/ | |
$.site.mes_getConsole = function() { | |
if (window.console && window.console.firebug) { | |
return window.console; | |
} | |
else { | |
return { | |
error: function() {}, | |
debug: function() {}, | |
info: function() {}, | |
log: function() {}, | |
warn: function() {} | |
}; | |
} | |
}; | |
$(function () { | |
if (! window.console) | |
window.console = $.site.mes_getConsole(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment