/[jquery]/jquery/jquery-log.js
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /jquery/jquery-log.js

Parent Directory Parent Directory | Revision Log Revision Log


Revision 34 - (show annotations)
Fri Aug 18 13:20:53 2006 UTC (17 years, 8 months ago) by dpavlin
Original Path: no_pager/jquery-log.js
File MIME type: application/javascript
File size: 1652 byte(s)
extract CSS to separate file, all classes and ids now begin with jql
1 /*
2 jquery logging plugin
3
4 2006-08-18 Dobrica Pavlinusic <dpavlin@rot13.org>
5 */
6
7 var _log_count;
8
9 $.log = {
10
11 /* semi-private functions */
12
13 join: function(a) {
14 var m = '';
15 for (var i=0; i<a.length; i++)
16 m += a[i] + '<br/>';
17 return m;
18 },
19
20 counter: function() {
21 $('#jql-counter').html(
22 '<span class="jql-info">'+_log_count.info+'</span> ' +
23 '<span class="jql-debug">'+_log_count.debug+'</span> ' +
24 '<span class="jql-error">'+_log_count.error+'</span>'
25 );
26 },
27
28 toggle: function() {
29 $('#jql').toggle();
30 $('#jql-show').toggle();
31 return false;
32 },
33
34 /* public functions */
35
36 create: function() {
37
38 $('body').append(
39 '<div id="jql" class="jql">' +
40 '<a class="hide" href="#" onclick="javascript:return $.log.toggle();">X</a>' +
41 '</div>' +
42 '<div id="jql-show" class="jql">' +
43 '<a class="hide" href="#" onclick="javascript:return $.log.toggle();"><span id="jql-counter">?</span></a>' +
44 '</div>'
45 );
46
47 _log_count = {
48 info: 0,
49 debug: 0,
50 error: 0
51 };
52
53 this.debug('created logger');
54 },
55
56 info: function() {
57 if (arguments) {
58 if (! _log_count) this.create();
59 _log_count.info++;
60 $('#jql').append( '<div class="jql-info">'+this.join(arguments)+'</div>' );
61 this.counter();
62 }
63 },
64 debug: function() {
65 if (arguments) {
66 if (! _log_count) this.create();
67 _log_count.debug++;
68 $('#jql').append( '<div class="jql-debug">'+this.join(arguments)+'</div>' );
69 this.counter();
70 }
71 },
72 error: function() {
73 if (arguments) {
74 if (! _log_count) this.create();
75 _log_count.error++;
76 $('#jql').append( '<div class="jql-error">'+this.join(arguments)+'</div>' );
77 this.counter();
78 }
79 }
80 };
81

  ViewVC Help
Powered by ViewVC 1.1.26