Skip to content

Instantly share code, notes, and snippets.

@cyress
Created August 13, 2010 13:24
Show Gist options
  • Save cyress/522869 to your computer and use it in GitHub Desktop.
Save cyress/522869 to your computer and use it in GitHub Desktop.
if (!("console" in window) || !("firebug" in console)){
var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml", "group"
, "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"];
window.console = {};
for (var i = 0; i < names.length; ++i){
window.console[names[i]] = function(input){
if (!document.getElementById('crossConsoleData')){
var ccRedQuad = '<div id="crossConsoleRedQuad" style="position: absolute; bottom: 0; left: 0; width: 20px; height: 20px; margin: 10px; background-color: #d51212; border: 1px solid #000;" onclick="document.getElementById(\'crossConsoleData\').style.display=\'block\'; document.getElementById(\'crossConsoleCloser\').style.display=\'block\';"></div>';
var ccData = '<textarea id="crossConsoleData" style="opacity: 0.9; filter:alpha(opacity=90); display: none; clear: both; position: absolute; left: 0px; bottom: 0px; width: 100%; height: 300px; border: 1px solid #000; background-color: #f3f2f2; z-index: 10000"></textarea>';
var ccClose = '<div id="crossConsoleCloser" style="display: none; position: absolute; bottom: 284px; left: 0; margin: 0 15px 2px 0; font-family: Arial; background: #fff; border: 1px solid #000; width: 12px; height: 12px; text-align: center; padding: 2px; overflow: hidden; line-height: 10px; cursor: pointer; z-index: 10001;" onclick="document.getElementById(\'crossConsoleData\').style.display=\'none\'; this.style.display=\'none\';"><b>x</b></div>';
var crossConsole = document.createElement('div');
crossConsole.setAttribute('id', 'crossConsole');
crossConsole.innerHTML = ccRedQuad+ccData+ccClose;
var theBody = document.getElementsByTagName('body')[0];
theBody.appendChild(crossConsole);
}
var crossConsole = document.getElementById('crossConsoleData');
var crossConsoleData = crossConsole.value;
crossConsole.value = crossConsoleData+"\n--------------------------------\n"+input;
};
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment