--- no_pager/jquery-log.js 2006/08/18 11:54:32 30 +++ no_pager/jquery-log.js 2006/08/18 13:09:28 32 @@ -4,13 +4,12 @@ 2006-08-18 Dobrica Pavlinusic */ -var _log_count = { - info: 0, - debug: 0, - error: 0 -}; +var _log_count; $.log = { + + /* semi-private functions */ + join: function(a) { var m = ''; for (var i=0; i'+_log_count.info+' ' + @@ -27,8 +25,37 @@ ); }, + toggle: function() { + $('#debug').toggle(); + $('#debug_show').toggle(); + return false; + }, + + /* public functions */ + + create: function() { + + $('body').append( + '
' + + 'X' + + '
' + + '
' + + '?' + + '
' + ); + + _log_count = { + info: 0, + debug: 0, + error: 0 + }; + + this.debug('created logger'); + }, + info: function() { if (arguments) { + if (! _log_count) this.create(); _log_count.info++; $('#debug').append( '
'+this.join(arguments)+'
' ); this.counter(); @@ -36,6 +63,7 @@ }, debug: function() { if (arguments) { + if (! _log_count) this.create(); _log_count.debug++; $('#debug').append( '
'+this.join(arguments)+'
' ); this.counter(); @@ -43,9 +71,11 @@ }, error: function() { if (arguments) { + if (! _log_count) this.create(); _log_count.error++; $('#debug').append( '
'+this.join(arguments)+'
' ); this.counter(); } - }, + } }; +