jabe 0.5.9 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (149) hide show
  1. data/{LICENSE.txt → MIT-LICENSE} +1 -1
  2. data/README.textile +46 -31
  3. data/Rakefile +30 -47
  4. data/app/assets/images/jabe/delete.png +0 -0
  5. data/{public/images → app/assets/images/jabe}/delete_page.png +0 -0
  6. data/{public/images → app/assets/images/jabe}/full_page.png +0 -0
  7. data/{public/images → app/assets/images/jabe}/gravatar.gif +0 -0
  8. data/{public/javascripts → app/assets/javascripts/jabe}/application.js +15 -0
  9. data/{public/javascripts → app/assets/javascripts/jabe}/libs/dd_belatedpng.js +0 -0
  10. data/{public/javascripts → app/assets/javascripts/jabe}/libs/modernizr-1.6.min.js +0 -0
  11. data/{public/javascripts → app/assets/javascripts/jabe}/plugins.js +0 -0
  12. data/app/assets/stylesheets/jabe/application.css +3 -0
  13. data/app/{stylesheets → assets/stylesheets/jabe}/boilerplate.scss +0 -0
  14. data/app/{stylesheets → assets/stylesheets/jabe}/jabe.scss +47 -8
  15. data/app/controllers/jabe/admin/base_controller.rb +7 -0
  16. data/app/controllers/jabe/admin/entries_controller.rb +49 -0
  17. data/app/controllers/jabe/admin/settings_controller.rb +13 -0
  18. data/app/controllers/jabe/application_controller.rb +5 -0
  19. data/app/controllers/jabe/comments_controller.rb +34 -0
  20. data/app/controllers/jabe/entries_controller.rb +30 -0
  21. data/app/controllers/jabe/feed_controller.rb +8 -0
  22. data/app/controllers/jabe/sessions_controller.rb +4 -0
  23. data/app/helpers/jabe/application_helper.rb +25 -0
  24. data/app/mailers/jabe/comment_mailer.rb +12 -0
  25. data/app/models/jabe/admin.rb +11 -0
  26. data/app/models/jabe/comment.rb +35 -0
  27. data/app/models/jabe/entry.rb +22 -0
  28. data/app/models/jabe/settings.rb +14 -0
  29. data/app/views/{admin → jabe/admin}/entries/_form.html.haml +1 -1
  30. data/app/views/{admin → jabe/admin}/entries/edit.html.haml +0 -0
  31. data/app/views/{admin → jabe/admin}/entries/index.html.haml +9 -7
  32. data/app/views/{admin → jabe/admin}/entries/new.html.haml +0 -0
  33. data/app/views/{admin → jabe/admin}/settings/edit.html.haml +2 -1
  34. data/app/views/jabe/comment_mailer/notification.html.erb +19 -0
  35. data/app/views/jabe/confirmations/new.html.erb +15 -0
  36. data/app/views/{entries → jabe/entries}/index.html.haml +4 -3
  37. data/app/views/jabe/entries/show.html.haml +49 -0
  38. data/app/views/{feed → jabe/feed}/index.xml.builder +3 -3
  39. data/app/views/jabe/mailer/confirmation_instructions.html.erb +5 -0
  40. data/app/views/jabe/mailer/reset_password_instructions.html.erb +8 -0
  41. data/app/views/jabe/mailer/unlock_instructions.html.erb +7 -0
  42. data/app/views/jabe/passwords/edit.html.erb +19 -0
  43. data/app/views/jabe/passwords/new.html.erb +15 -0
  44. data/app/views/jabe/registrations/edit.html.erb +22 -0
  45. data/app/views/jabe/registrations/new.html.erb +17 -0
  46. data/app/views/jabe/sessions/new.html.erb +15 -0
  47. data/app/views/jabe/shared/_links.erb +25 -0
  48. data/app/views/jabe/unlocks/new.html.erb +15 -0
  49. data/app/views/layouts/jabe/_flashes.html.haml +3 -0
  50. data/app/views/layouts/{_footer.html.haml → jabe/_footer.html.haml} +0 -0
  51. data/app/views/layouts/jabe/_header.html.haml +4 -0
  52. data/app/views/layouts/jabe/_sidebar.html.haml +21 -0
  53. data/app/views/layouts/jabe/application.html.haml +63 -0
  54. data/{test/dummy/vendor/plugins/acts_as_textiled/init.rb → config/initializers/acts_as_textiled.rb} +2 -1
  55. data/config/initializers/devise.rb +3 -0
  56. data/config/initializers/settings.rb +5 -5
  57. data/config/initializers/simple_form.rb +93 -0
  58. data/config/initializers/time_formats.rb +1 -2
  59. data/config/locales/simple_form.en.yml +24 -0
  60. data/config/routes.rb +10 -5
  61. data/{test/dummy/db/migrate/20101229224027_create_settings.rb → db/migrate/20101230010434_create_settings.rb} +7 -2
  62. data/{lib/generators/jabe/templates/migrations/devise_create_admins.rb → db/migrate/20101230010436_devise_create_admins.rb} +6 -6
  63. data/{test/dummy/db/migrate/20101229224030_create_entries.rb → db/migrate/20101230010437_create_entries.rb} +2 -2
  64. data/{test/dummy/db/migrate/20101229224031_create_comments.rb → db/migrate/20101230010438_create_comments.rb} +3 -4
  65. data/{test/dummy/vendor/plugins/acts_as_textiled/lib/acts_as_textiled.rb → lib/acts_as_textiled/base.rb} +0 -0
  66. data/lib/jabe.rb +7 -15
  67. data/lib/jabe/engine.rb +5 -0
  68. data/lib/jabe/version.rb +3 -0
  69. data/lib/tasks/jabe_tasks.rake +4 -0
  70. metadata +187 -601
  71. data/Gemfile +0 -35
  72. data/Gemfile.lock +0 -214
  73. data/VERSION +0 -1
  74. data/app/controllers/admin/base_controller.rb +0 -3
  75. data/app/controllers/admin/entries_controller.rb +0 -42
  76. data/app/controllers/admin/settings_controller.rb +0 -11
  77. data/app/controllers/comments_controller.rb +0 -25
  78. data/app/controllers/entries_controller.rb +0 -26
  79. data/app/controllers/feed_controller.rb +0 -8
  80. data/app/helpers/jabe_helper.rb +0 -13
  81. data/app/models/admin.rb +0 -9
  82. data/app/models/comment.rb +0 -22
  83. data/app/models/entry.rb +0 -17
  84. data/app/models/settings.rb +0 -7
  85. data/app/stylesheets/_will_paginate.scss +0 -102
  86. data/app/stylesheets/handheld.scss +0 -7
  87. data/app/views/entries/_comment_form.html.haml +0 -3
  88. data/app/views/entries/show.html.haml +0 -38
  89. data/app/views/layouts/_header.html.haml +0 -4
  90. data/app/views/layouts/_sidebar.html.haml +0 -21
  91. data/app/views/layouts/application.html.haml +0 -59
  92. data/config/initializers/sass.rb +0 -5
  93. data/lib/generators/jabe/migrations/migrations_generator.rb +0 -38
  94. data/lib/generators/jabe/stylesheets/stylesheets_generator.rb +0 -9
  95. data/lib/generators/jabe/templates/migrations/add_new_settings.rb +0 -17
  96. data/lib/generators/jabe/templates/migrations/create_comments.rb +0 -20
  97. data/lib/generators/jabe/templates/migrations/create_entries.rb +0 -16
  98. data/lib/generators/jabe/templates/migrations/create_settings.rb +0 -21
  99. data/lib/generators/jabe/templates/migrations/create_slugs.rb +0 -18
  100. data/public/.htaccess +0 -220
  101. data/public/apple-touch-icon.png +0 -0
  102. data/public/blackbird/blackbird.css +0 -80
  103. data/public/blackbird/blackbird.js +0 -365
  104. data/public/blackbird/blackbird.png +0 -0
  105. data/public/crossdomain.xml +0 -25
  106. data/public/javascripts/jquery-ui.js +0 -11511
  107. data/public/javascripts/jquery-ui.min.js +0 -404
  108. data/public/javascripts/jquery.js +0 -7179
  109. data/public/javascripts/jquery.min.js +0 -167
  110. data/public/javascripts/libs/profiling/charts.swf +0 -0
  111. data/public/javascripts/libs/profiling/config.js +0 -59
  112. data/public/javascripts/libs/profiling/yahoo-profiling.css +0 -7
  113. data/public/javascripts/libs/profiling/yahoo-profiling.min.js +0 -39
  114. data/public/javascripts/rails.js +0 -154
  115. data/public/nginx.conf +0 -108
  116. data/public/robots.txt +0 -5
  117. data/test/dummy/app/controllers/application_controller.rb +0 -3
  118. data/test/dummy/app/helpers/application_helper.rb +0 -2
  119. data/test/dummy/config/application.rb +0 -52
  120. data/test/dummy/config/boot.rb +0 -10
  121. data/test/dummy/config/environment.rb +0 -5
  122. data/test/dummy/config/environments/development.rb +0 -26
  123. data/test/dummy/config/environments/production.rb +0 -49
  124. data/test/dummy/config/environments/test.rb +0 -35
  125. data/test/dummy/config/initializers/backtrace_silencers.rb +0 -7
  126. data/test/dummy/config/initializers/devise.rb +0 -142
  127. data/test/dummy/config/initializers/inflections.rb +0 -10
  128. data/test/dummy/config/initializers/mime_types.rb +0 -5
  129. data/test/dummy/config/initializers/secret_token.rb +0 -7
  130. data/test/dummy/config/initializers/session_store.rb +0 -8
  131. data/test/dummy/config/routes.rb +0 -58
  132. data/test/dummy/db/migrate/20101229224028_create_slugs.rb +0 -18
  133. data/test/dummy/db/migrate/20101229224029_devise_create_admins.rb +0 -26
  134. data/test/dummy/db/migrate/20110104004400_add_new_settings.rb +0 -17
  135. data/test/dummy/db/schema.rb +0 -110
  136. data/test/dummy/features/step_definitions/admin_steps.rb +0 -14
  137. data/test/dummy/features/step_definitions/email_steps.rb +0 -194
  138. data/test/dummy/features/step_definitions/entry_steps.rb +0 -54
  139. data/test/dummy/features/step_definitions/support_steps.rb +0 -3
  140. data/test/dummy/features/step_definitions/web_steps.rb +0 -219
  141. data/test/dummy/features/support/blueprints.rb +0 -37
  142. data/test/dummy/features/support/env.rb +0 -59
  143. data/test/dummy/features/support/paths.rb +0 -39
  144. data/test/dummy/spec/spec_helper.rb +0 -0
  145. data/test/dummy/spec/support/blueprints.rb +0 -9
  146. data/test/dummy/vendor/plugins/acts_as_textiled/test/fixtures/author.rb +0 -4
  147. data/test/dummy/vendor/plugins/acts_as_textiled/test/fixtures/story.rb +0 -4
  148. data/test/dummy/vendor/plugins/acts_as_textiled/test/helper.rb +0 -87
  149. data/test/dummy/vendor/plugins/acts_as_textiled/test/textiled_test.rb +0 -145
Binary file
@@ -1,80 +0,0 @@
1
- /*
2
- Blackbird - Open Source JavaScript Logging Utility
3
- Author: G Scott Olson
4
- Web: http://blackbirdjs.googlecode.com/
5
- http://www.gscottolson.com/blackbirdjs/
6
- Version: 1.0
7
-
8
- The MIT License - Copyright (c) 2008 Blackbird Project
9
- */
10
- #blackbird { margin:0; padding:0; position:fixed; _position:absolute; font:11px/1.3 Consolas, 'Lucida Console', Monaco, monospace; _border:2px solid #BBB; }
11
- #blackbird.bb-top-left { top:0; left:0; _top:expression(eval(document.documentElement.scrollTop+8)); _left:expression(eval(document.documentElement.scrollLeft+8)); }
12
- #blackbird.bb-top-right { top:0; right:0; }
13
- * html .bb-top-right { right:auto; top:expression(eval(document.documentElement.scrollTop+8)); left:expression(eval(document.documentElement.scrollLeft+document.documentElement.clientWidth-document.getElementById('blackbird').offsetWidth-8)); }
14
- #blackbird.bb-bottom-left { bottom:0; left:0; }
15
- * html .bb-bottom-left { bottom:auto; top:expression(eval(document.documentElement.scrollTop+document.documentElement.clientHeight-document.getElementById('blackbird').offsetHeight-8)); left:expression(eval(document.documentElement.scrollLeft+8)); }
16
- #blackbird.bb-bottom-right { bottom:0; right:0; }
17
- * html .bb-bottom-right { bottom:auto; right:auto; top:expression(eval(document.documentElement.scrollTop+document.documentElement.clientHeight-document.getElementById('blackbird').offsetHeight-8)); left:expression(eval(document.documentElement.scrollLeft+document.documentElement.clientWidth-document.getElementById('blackbird').offsetWidth-8)); }
18
-
19
- #blackbird.bb-small { width:300px; _width:272px; }
20
- #blackbird.bb-small .bb-header { _width:272px; }
21
- #blackbird.bb-small .bb-header div.bb-left, #blackbird.bb-small .bb-footer div.bb-left { width:150px; }
22
- #blackbird.bb-small .bb-main { _width:272px; }
23
- #blackbird.bb-small .bb-main div { height:200px; }
24
- #blackbird.bb-small .bb-main div.bb-mainBody { width:272px; }
25
- #blackbird.bb-small .bb-footer { _width:272px; }
26
-
27
- #blackbird.bb-large { width:500px; _width:472px; }
28
- #blackbird.bb-large .bb-header { _width:472px; }
29
- #blackbird.bb-large .bb-header div.bb-left, #blackbird.bb-large .bb-footer div.bb-left { width:350px; }
30
- #blackbird.bb-large .bb-main { _width:472px; }
31
- #blackbird.bb-large .bb-main div { height:500px; }
32
- #blackbird.bb-large .bb-main div.bb-mainBody { width:472px; }
33
- #blackbird.bb-large .bb-footer { _width:472px; }
34
-
35
- #blackbird .bb-header span { cursor: pointer; position:relative; width:16px; height:16px; margin:0 4px; float:left; background-image:url(blackbird.png); background-repeat:no-repeat; }
36
- #blackbird .bb-header span.bb-error { background-position:100% -84px; }
37
- #blackbird .bb-header span.bb-warn { background-position:100% -100px; }
38
- #blackbird .bb-header span.bb-info { background-position:100% -116px; }
39
- #blackbird .bb-header span.bb-debug { background-position:100% -132px; }
40
- #blackbird .bb-header span.bb-profile { background-position:100% -148px; }
41
- #blackbird .bb-header span.bb-close { background-position:100% -68px; }
42
- #blackbird .bb-header span.bb-clear { background-position:100% -52px; }
43
- #blackbird .bb-header span.bb-contract { background-position:100% -20px; }
44
- #blackbird .bb-header span.bb-expand { background-position:100% -36px; }
45
- #blackbird .bb-header span.bb-disabled { opacity: 0.4; *filter:alpha(opacity=40); }
46
-
47
- #blackbird .bb-header > div, #blackbird .bb-main > div, #blackbird .bb-footer > div { background-image:url(blackbird.png); background-repeat:no-repeat; }
48
-
49
- #blackbird .bb-header div { float:left; _background-color:#000; }
50
- #blackbird .bb-header div.bb-left { background-position:0 0; height:40px; _height:16px; }
51
- #blackbird #bbFilters { margin-left: -4px; padding:16px 0 0 19px; float:left; _padding:6px 8px; }
52
- #blackbird .bb-header div.bb-right { background-position:-350px 0; height:40px; width:150px; _width:122px; _height:16px; }
53
- #blackbird #bbControls { padding:16px 24px 0 0; float:right; _padding:6px 8px; }
54
- #blackbird #bbControls span { margin:0 2px; }
55
- #blackbird #bbControls span.bb-clear { margin-right:8px; }
56
-
57
- #blackbird .bb-main div { float:left; }
58
- #blackbird .bb-main div.bb-left { background-position:0 -30px; width:11px; _width:0; }
59
- #blackbird .bb-main div.bb-mainBody { background-position:-11px -40px; _background-color:#000; _filter:alpha(opacity='90'); }
60
- #blackbird .bb-main .bb-mainBody ol { line-height: 1.45; height:100%; overflow:auto; width:100%; list-style-type:none; margin:0; padding:0; }
61
- #blackbird .bb-main .bb-mainBody ol li { padding:1px 4px 1px 24px; border-bottom: 1px solid #333; color:#CCC; margin: 2px 2px; _text-indent: -2px; }
62
- #blackbird .bb-main .bb-mainBody ol li span { display:block; _display:inline-block; _font-size:6px; _line-height:0; height: 8px; width: 8px; background: url(blackbird.png) no-repeat 0 0; margin: 3px 0 1px -16px; }
63
-
64
- #blackbird .bb-main .bb-mainBody ol li.bb-error span { background-position:100% -164px; }
65
- #blackbird .bb-main .bb-mainBody ol li.bb-warn span { background-position:100% -172px; }
66
- #blackbird .bb-main .bb-mainBody ol li.bb-info span { background-position:100% -180px; }
67
- #blackbird .bb-main .bb-mainBody ol li.bb-debug span { background-position:100% -188px; }
68
- #blackbird .bb-main .bb-mainBody ol li.bb-profile span { background-position:100% -196px; }
69
-
70
- #blackbird .bb-main .bb-mainBody ol li.bb-profile { color:#DDD; font-style:italic; }
71
-
72
- #blackbird .bb-error-hidden li.bb-error, #blackbird .bb-warn-hidden li.bb-warn, #blackbird .bb-info-hidden li.bb-info, #blackbird .bb-debug-hidden li.bb-debug, #blackbird .bb-profile-hidden li.bb-profile { display:none; }
73
-
74
- #blackbird .bb-main div.bb-right { background-position:-483px -30px; width:17px; _width:0; }
75
-
76
- #blackbird .bb-footer div { height:50px; float:left; _background-color:#000; _height:auto; _filter:alpha(opacity='90'); }
77
- #blackbird .bb-footer div.bb-left { cursor: pointer; background-position:bottom left; _width:100% !important; font-family:Arial,sans-serif; color:#BBB; padding-top: 10px; height: 40px; _height:auto; _padding:4px 0 6px; }
78
- #blackbird .bb-footer div.bb-left span { cursor: pointer; display:block; float:left; _float:none; _display:inline-block; _font-size:6px; _line-height:0; background:transparent url(blackbird.png) no-repeat -506px -10px; height:10px; width:10px; margin:2px 4px 0 20px; position:relative; _margin:4px 4px 0 8px; }
79
- #blackbird .bb-footer div.bb-left span.checked { background-position: -506px 0; }
80
- #blackbird .bb-footer div.bb-right { background-position:-350px -550px; width:150px; _width:0; }
@@ -1,365 +0,0 @@
1
- /*
2
- Blackbird - Open Source JavaScript Logging Utility
3
- Author: G Scott Olson
4
- Web: http://blackbirdjs.googlecode.com/
5
- http://www.gscottolson.com/blackbirdjs/
6
- Version: 1.0
7
-
8
- The MIT License - Copyright (c) 2008 Blackbird Project
9
- */
10
- ( function() {
11
- var NAMESPACE = 'log';
12
- var IE6_POSITION_FIXED = true; // enable IE6 {position:fixed}
13
-
14
- var bbird;
15
- var outputList;
16
- var cache = [];
17
-
18
- var state = getState();
19
- var classes = {};
20
- var profiler = {};
21
- var IDs = {
22
- blackbird: 'blackbird',
23
- checkbox: 'bbVis',
24
- filters: 'bbFilters',
25
- controls: 'bbControls',
26
- size: 'bbSize'
27
- }
28
- var messageTypes = { //order of these properties imply render order of filter controls
29
- debug: true,
30
- info: true,
31
- warn: true,
32
- error: true,
33
- profile: true
34
- };
35
-
36
- function generateMarkup() { //build markup
37
- var spans = [];
38
- for ( type in messageTypes ) {
39
- spans.push( [ '<span class="bb-', type, '" type="', type, '"></span>'].join( '' ) );
40
- }
41
-
42
- var newNode = document.createElement( 'DIV' );
43
- newNode.id = IDs.blackbird;
44
- newNode.style.display = 'none';
45
- newNode.innerHTML = [
46
- '<div class="bb-header">',
47
- '<div class="bb-left">',
48
- '<div id="', IDs.filters, '" title="click to filter by message type">', spans.join( '' ), '</div>',
49
- '</div>',
50
- '<div class="bb-right">',
51
- '<div id="', IDs.controls, '">',
52
- '<span id="', IDs.size ,'" op="resize"></span>',
53
- '<span class="bb-clear" title="clear" op="clear"></span>',
54
- '<span class="bb-close" title="close" op="close"></span>',
55
- '</div>',
56
- '</div>',
57
- '</div>',
58
- '<div class="bb-main">',
59
- '<div class="bb-left"></div><div class="bb-mainBody">',
60
- '<ol>', cache.join( '' ), '</ol>',
61
- '</div><div class="bb-right"></div>',
62
- '</div>',
63
- '<div class="bb-footer">',
64
- '<div class="bb-left" id="', IDs.checkbox, '"><span></span>Visible on page load</div>',
65
- '<div class="bb-right"></div>',
66
- '</div>'
67
- ].join( '' );
68
- return newNode;
69
- }
70
-
71
- function backgroundImage() { //(IE6 only) change <BODY> tag's background to resolve {position:fixed} support
72
- var bodyTag = document.getElementsByTagName( 'BODY' )[ 0 ];
73
-
74
- if ( bodyTag.currentStyle && IE6_POSITION_FIXED ) {
75
- if (bodyTag.currentStyle.backgroundImage == 'none' ) {
76
- bodyTag.style.backgroundImage = 'url(about:blank)';
77
- }
78
- if (bodyTag.currentStyle.backgroundAttachment == 'scroll' ) {
79
- bodyTag.style.backgroundAttachment = 'fixed';
80
- }
81
- }
82
- }
83
-
84
- function addMessage( type, content ) { //adds a message to the output list
85
- content = ( content.constructor == Array ) ? content.join( '' ) : content;
86
- if ( outputList ) {
87
- var newMsg = document.createElement( 'LI' );
88
- newMsg.className = 'bb-' + type;
89
- newMsg.title = type;
90
- newMsg.innerHTML = [ '<span class="bb-icon"></span>', content ].join( '' );
91
- outputList.appendChild( newMsg );
92
- scrollToBottom();
93
- } else {
94
- cache.push( [ '<li class="bb-', type, '" title="', type ,' message"><span class="bb-icon"></span>', content, '</li>' ].join( '' ) );
95
- }
96
- }
97
-
98
- function clear() { //clear list output
99
- outputList.innerHTML = '';
100
- }
101
-
102
- function clickControl( evt ) {
103
- if ( !evt ) evt = window.event;
104
- var el = ( evt.target ) ? evt.target : evt.srcElement;
105
-
106
- if ( el.tagName == 'SPAN' ) {
107
- switch ( el.getAttributeNode( 'op' ).nodeValue ) {
108
- case 'resize': resize(); break;
109
- case 'clear': clear(); break;
110
- case 'close': hide(); break;
111
- }
112
- }
113
- }
114
-
115
- function clickFilter( evt ) { //show/hide a specific message type
116
- if ( !evt ) evt = window.event;
117
- var span = ( evt.target ) ? evt.target : evt.srcElement;
118
-
119
- if ( span && span.tagName == 'SPAN' ) {
120
-
121
- var type = span.getAttributeNode( 'type' ).nodeValue;
122
-
123
- if ( evt.altKey ) {
124
- var filters = document.getElementById( IDs.filters ).getElementsByTagName( 'SPAN' );
125
-
126
- var active = 0;
127
- for ( entry in messageTypes ) {
128
- if ( messageTypes[ entry ] ) active++;
129
- }
130
- var oneActiveFilter = ( active == 1 && messageTypes[ type ] );
131
-
132
- for ( var i = 0; filters[ i ]; i++ ) {
133
- var spanType = filters[ i ].getAttributeNode( 'type' ).nodeValue;
134
-
135
- filters[ i ].className = ( oneActiveFilter || ( spanType == type ) ) ? 'bb-' + spanType : 'bb-' + spanType + ' bb-disabled';
136
- messageTypes[ spanType ] = oneActiveFilter || ( spanType == type );
137
- }
138
- }
139
- else {
140
- messageTypes[ type ] = ! messageTypes[ type ];
141
- span.className = ( messageTypes[ type ] ) ? 'bb-' + type : 'bb-' + type + ' bb-disabled';
142
- }
143
-
144
- //build outputList's class from messageTypes object
145
- var disabledTypes = [];
146
- for ( type in messageTypes ) {
147
- if ( ! messageTypes[ type ] ) disabledTypes.push( 'bb-' + type );
148
- }
149
- disabledTypes.push( '' );
150
- outputList.className = disabledTypes.join( '-hidden ' );
151
-
152
- scrollToBottom();
153
- }
154
- }
155
-
156
- function clickVis( evt ) {
157
- if ( !evt ) evt = window.event;
158
- var el = ( evt.target ) ? evt.target : evt.srcElement;
159
-
160
- var checkbox = ( el.tagName == 'SPAN' ) ? el : el.getElementsByTagName( 'SPAN' )[ 0 ];
161
- checkbox.className = ( checkbox.className == '' ) ? 'checked' : '';
162
- state.load = ( checkbox.className == 'checked' ) ? true : false;
163
- setState();
164
- }
165
-
166
-
167
- function scrollToBottom() { //scroll list output to the bottom
168
- outputList.scrollTop = outputList.scrollHeight;
169
- }
170
-
171
- function isVisible() { //determine the visibility
172
- return ( bbird.style.display == 'block' );
173
- }
174
-
175
- function hide() {
176
- bbird.style.display = 'none';
177
- }
178
-
179
- function show() {
180
- var body = document.getElementsByTagName( 'BODY' )[ 0 ];
181
- body.removeChild( bbird );
182
- body.appendChild( bbird );
183
- bbird.style.display = 'block';
184
- }
185
-
186
- //sets the position
187
- function reposition( position ) {
188
- if ( position === undefined || position == null ) {
189
- position = ( state && state.pos === null ) ? 1 : ( state.pos + 1 ) % 4; //set to initial position ('topRight') or move to next position
190
- }
191
-
192
- switch ( position ) {
193
- case 0: classes[ 0 ] = 'bb-top-left'; break;
194
- case 1: classes[ 0 ] = 'bb-top-right'; break;
195
- case 2: classes[ 0 ] = 'bb-bottom-left'; break;
196
- case 3: classes[ 0 ] = 'bb-bottom-right'; break;
197
- }
198
- state.pos = position;
199
- setState();
200
- }
201
-
202
- function resize( size ) {
203
- if ( size === undefined || size === null ) {
204
- size = ( state && state.size == null ) ? 0 : ( state.size + 1 ) % 2;
205
- }
206
-
207
- classes[ 1 ] = ( size === 0 ) ? 'bb-small' : 'bb-large'
208
-
209
- var span = document.getElementById( IDs.size );
210
- span.title = ( size === 1 ) ? 'small' : 'large';
211
- span.className = ( size === 1) ? 'bb-contract' : 'bb-expand';
212
-
213
- state.size = size;
214
- setState();
215
- scrollToBottom();
216
- }
217
-
218
- function setState() {
219
- var props = [];
220
- for ( entry in state ) {
221
- var value = ( state[ entry ] && state[ entry ].constructor === String ) ? '"' + state[ entry ] + '"' : state[ entry ];
222
- props.push( entry + ':' + value );
223
- }
224
- props = props.join( ',' );
225
-
226
- var expiration = new Date();
227
- expiration.setDate( expiration.getDate() + 14 );
228
- document.cookie = [ 'blackbird={', props, '}; expires=', expiration.toUTCString() ,';' ].join( '' );
229
-
230
- var newClass = [];
231
- for ( word in classes ) {
232
- newClass.push( classes[ word ] );
233
- }
234
- bbird.className = newClass.join( ' ' );
235
- }
236
-
237
- function getState() {
238
- var re = new RegExp( /blackbird=({[^;]+})(;|\b|$)/ );
239
- var match = re.exec( document.cookie );
240
- return ( match && match[ 1 ] ) ? eval( '(' + match[ 1 ] + ')' ) : { pos:null, size:null, load:null };
241
- }
242
-
243
- //event handler for 'keyup' event for window
244
- function readKey( evt ) {
245
- if ( !evt ) evt = window.event;
246
- var code = 113; //F2 key
247
-
248
- if ( evt && evt.keyCode == code ) {
249
-
250
- var visible = isVisible();
251
-
252
- if ( visible && evt.shiftKey && evt.altKey ) clear();
253
- else if (visible && evt.shiftKey ) reposition();
254
- else if ( !evt.shiftKey && !evt.altKey ) {
255
- ( visible ) ? hide() : show();
256
- }
257
- }
258
- }
259
-
260
- //event management ( thanks John Resig )
261
- function addEvent( obj, type, fn ) {
262
- var obj = ( obj.constructor === String ) ? document.getElementById( obj ) : obj;
263
- if ( obj.attachEvent ) {
264
- obj[ 'e' + type + fn ] = fn;
265
- obj[ type + fn ] = function(){ obj[ 'e' + type + fn ]( window.event ) };
266
- obj.attachEvent( 'on' + type, obj[ type + fn ] );
267
- } else obj.addEventListener( type, fn, false );
268
- }
269
- function removeEvent( obj, type, fn ) {
270
- var obj = ( obj.constructor === String ) ? document.getElementById( obj ) : obj;
271
- if ( obj.detachEvent ) {
272
- obj.detachEvent( 'on' + type, obj[ type + fn ] );
273
- obj[ type + fn ] = null;
274
- } else obj.removeEventListener( type, fn, false );
275
- }
276
-
277
-
278
- window[ NAMESPACE ] = {
279
- toggle:
280
- function( visible ) {
281
- if ( visible === true || visible === false ) {
282
- ( visible ) ? show() : hide()
283
- } else if ( isVisible() ) {
284
- hide();
285
- } else {
286
- show();
287
- }
288
- },
289
- resize:
290
- function() { resize(); },
291
- clear:
292
- function() { clear(); },
293
- move:
294
- function() { reposition(); },
295
- debug:
296
- function( msg ) { addMessage( 'debug', msg ); },
297
- warn:
298
- function( msg ) { addMessage( 'warn', msg ); },
299
- info:
300
- function( msg ) { addMessage( 'info', msg ); },
301
- error:
302
- function( msg ) { addMessage( 'error', msg ); },
303
- profile:
304
- function( label ) {
305
- var currentTime = new Date(); //record the current time when profile() is executed
306
-
307
- if ( label == undefined || label == '' ) {
308
- addMessage( 'error', '<b>ERROR:</b> Please specify a label for your profile statement' );
309
- }
310
- else if ( profiler[ label ] ) {
311
- addMessage( 'profile', [ label, ': ', currentTime - profiler[ label ], 'ms' ].join( '' ) );
312
- delete profiler[ label ];
313
- }
314
- else {
315
- profiler[ label ] = currentTime;
316
- addMessage( 'profile', label );
317
- }
318
- return currentTime;
319
- }
320
- }
321
-
322
- addEvent( window, 'load', function() { /* initialize Blackbird when the page loads */
323
- var body = document.getElementsByTagName( 'BODY' )[ 0 ];
324
- bbird = body.appendChild( generateMarkup() );
325
- outputList = bbird.getElementsByTagName( 'OL' )[ 0 ];
326
-
327
- backgroundImage();
328
-
329
- //add events
330
- addEvent( IDs.checkbox, 'click', clickVis );
331
- addEvent( IDs.filters, 'click', clickFilter );
332
- addEvent( IDs.controls, 'click', clickControl );
333
- addEvent( document, 'keyup', readKey);
334
-
335
- resize( state.size );
336
- reposition( state.pos );
337
- if ( state.load ) {
338
- show();
339
- document.getElementById( IDs.checkbox ).getElementsByTagName( 'SPAN')[ 0 ].className = 'checked';
340
- }
341
-
342
- scrollToBottom();
343
-
344
- addEvent( window, 'unload', function() {
345
- removeEvent( IDs.checkbox, 'click', clickVis );
346
- removeEvent( IDs.filters, 'click', clickFilter );
347
- removeEvent( IDs.controls, 'click', clickControl );
348
- removeEvent( document, 'keyup', readKey );
349
- });
350
- });
351
-
352
- window.blackbird = {
353
- namespace:
354
- function( newNS ) {
355
- if ( newNS && newNS.constructor === String ) {
356
- window[ newNS ] = {};
357
- for ( method in window[ NAMESPACE ] ) {
358
- window[ newNS ][ method ] = window[ NAMESPACE ][ method ];
359
- }
360
- delete window[ NAMESPACE ];
361
- NAMESPACE = newNS;
362
- }
363
- }
364
- }
365
- })();
Binary file