/* * Simple jQuery logger / debugger. * Based on: http://jquery.com/plugins/Authoring/ */ // global debug switch var DEBUG = true; // shamelessly ripped off from http://getfirebug.com/ 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"]; // create the logging div jQuery(document).ready( function(){ /*$(document.body).append('
');*/ } ); window.console = {}; for (var i = 0; i < names.length; ++i){ window.console[names[i]] = function(msg){ $('#DEBUG ul').append( '
  • ' + msg + '
  • ' ); } } } $.fn.debug = function() { return this.each(function(){ $.log(this); }); }; $.log = function(message){ // only do this if debugging is on if( window.DEBUG ){ console.debug(message); } };