rails 1.0.0 → 7.0.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of rails might be problematic. Click here for more details.

Files changed (156) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +103 -0
  3. metadata +228 -294
  4. data/CHANGELOG +0 -865
  5. data/MIT-LICENSE +0 -20
  6. data/README +0 -153
  7. data/Rakefile +0 -422
  8. data/bin/about +0 -3
  9. data/bin/breakpointer +0 -3
  10. data/bin/console +0 -3
  11. data/bin/destroy +0 -3
  12. data/bin/generate +0 -3
  13. data/bin/performance/benchmarker +0 -3
  14. data/bin/performance/profiler +0 -3
  15. data/bin/plugin +0 -3
  16. data/bin/process/reaper +0 -3
  17. data/bin/process/spawner +0 -3
  18. data/bin/process/spinner +0 -3
  19. data/bin/rails +0 -21
  20. data/bin/runner +0 -3
  21. data/bin/server +0 -3
  22. data/builtin/controllers/rails_info_controller.rb +0 -11
  23. data/configs/apache.conf +0 -40
  24. data/configs/database.yml +0 -85
  25. data/configs/empty.log +0 -0
  26. data/configs/lighttpd.conf +0 -40
  27. data/configs/routes.rb +0 -19
  28. data/dispatches/dispatch.fcgi +0 -24
  29. data/dispatches/dispatch.rb +0 -10
  30. data/dispatches/gateway.cgi +0 -97
  31. data/doc/README_FOR_APP +0 -2
  32. data/environments/boot.rb +0 -19
  33. data/environments/development.rb +0 -19
  34. data/environments/environment.rb +0 -53
  35. data/environments/production.rb +0 -19
  36. data/environments/test.rb +0 -19
  37. data/fresh_rakefile +0 -10
  38. data/helpers/application.rb +0 -4
  39. data/helpers/application_helper.rb +0 -3
  40. data/helpers/test_helper.rb +0 -28
  41. data/html/404.html +0 -8
  42. data/html/500.html +0 -8
  43. data/html/favicon.ico +0 -0
  44. data/html/images/rails.png +0 -0
  45. data/html/index.html +0 -277
  46. data/html/javascripts/controls.js +0 -750
  47. data/html/javascripts/dragdrop.js +0 -584
  48. data/html/javascripts/effects.js +0 -854
  49. data/html/javascripts/prototype.js +0 -1785
  50. data/html/robots.txt +0 -1
  51. data/lib/binding_of_caller.rb +0 -85
  52. data/lib/breakpoint.rb +0 -523
  53. data/lib/breakpoint_client.rb +0 -196
  54. data/lib/code_statistics.rb +0 -107
  55. data/lib/commands/about.rb +0 -2
  56. data/lib/commands/breakpointer.rb +0 -1
  57. data/lib/commands/console.rb +0 -23
  58. data/lib/commands/destroy.rb +0 -6
  59. data/lib/commands/generate.rb +0 -6
  60. data/lib/commands/ncgi/listener +0 -86
  61. data/lib/commands/ncgi/tracker +0 -69
  62. data/lib/commands/performance/benchmarker.rb +0 -24
  63. data/lib/commands/performance/profiler.rb +0 -34
  64. data/lib/commands/plugin.rb +0 -823
  65. data/lib/commands/process/reaper.rb +0 -130
  66. data/lib/commands/process/spawner.rb +0 -52
  67. data/lib/commands/process/spinner.rb +0 -57
  68. data/lib/commands/runner.rb +0 -27
  69. data/lib/commands/server.rb +0 -28
  70. data/lib/commands/servers/lighttpd.rb +0 -60
  71. data/lib/commands/servers/webrick.rb +0 -59
  72. data/lib/commands/update.rb +0 -4
  73. data/lib/commands.rb +0 -17
  74. data/lib/console_sandbox.rb +0 -6
  75. data/lib/dispatcher.rb +0 -99
  76. data/lib/fcgi_handler.rb +0 -189
  77. data/lib/initializer.rb +0 -553
  78. data/lib/rails_generator/base.rb +0 -203
  79. data/lib/rails_generator/commands.rb +0 -509
  80. data/lib/rails_generator/generators/applications/app/USAGE +0 -16
  81. data/lib/rails_generator/generators/applications/app/app_generator.rb +0 -140
  82. data/lib/rails_generator/generators/components/controller/USAGE +0 -30
  83. data/lib/rails_generator/generators/components/controller/controller_generator.rb +0 -38
  84. data/lib/rails_generator/generators/components/controller/templates/controller.rb +0 -10
  85. data/lib/rails_generator/generators/components/controller/templates/functional_test.rb +0 -18
  86. data/lib/rails_generator/generators/components/controller/templates/helper.rb +0 -2
  87. data/lib/rails_generator/generators/components/controller/templates/view.rhtml +0 -2
  88. data/lib/rails_generator/generators/components/mailer/USAGE +0 -18
  89. data/lib/rails_generator/generators/components/mailer/mailer_generator.rb +0 -32
  90. data/lib/rails_generator/generators/components/mailer/templates/fixture.rhtml +0 -3
  91. data/lib/rails_generator/generators/components/mailer/templates/mailer.rb +0 -13
  92. data/lib/rails_generator/generators/components/mailer/templates/unit_test.rb +0 -37
  93. data/lib/rails_generator/generators/components/mailer/templates/view.rhtml +0 -3
  94. data/lib/rails_generator/generators/components/migration/USAGE +0 -14
  95. data/lib/rails_generator/generators/components/migration/migration_generator.rb +0 -7
  96. data/lib/rails_generator/generators/components/migration/templates/migration.rb +0 -7
  97. data/lib/rails_generator/generators/components/model/USAGE +0 -17
  98. data/lib/rails_generator/generators/components/model/model_generator.rb +0 -18
  99. data/lib/rails_generator/generators/components/model/templates/fixtures.yml +0 -5
  100. data/lib/rails_generator/generators/components/model/templates/model.rb +0 -2
  101. data/lib/rails_generator/generators/components/model/templates/unit_test.rb +0 -10
  102. data/lib/rails_generator/generators/components/plugin/USAGE +0 -33
  103. data/lib/rails_generator/generators/components/plugin/plugin_generator.rb +0 -33
  104. data/lib/rails_generator/generators/components/plugin/templates/README +0 -4
  105. data/lib/rails_generator/generators/components/plugin/templates/Rakefile +0 -22
  106. data/lib/rails_generator/generators/components/plugin/templates/USAGE +0 -8
  107. data/lib/rails_generator/generators/components/plugin/templates/generator.rb +0 -8
  108. data/lib/rails_generator/generators/components/plugin/templates/init.rb +0 -1
  109. data/lib/rails_generator/generators/components/plugin/templates/plugin.rb +0 -1
  110. data/lib/rails_generator/generators/components/plugin/templates/tasks.rake +0 -4
  111. data/lib/rails_generator/generators/components/plugin/templates/unit_test.rb +0 -8
  112. data/lib/rails_generator/generators/components/scaffold/USAGE +0 -32
  113. data/lib/rails_generator/generators/components/scaffold/scaffold_generator.rb +0 -184
  114. data/lib/rails_generator/generators/components/scaffold/templates/controller.rb +0 -54
  115. data/lib/rails_generator/generators/components/scaffold/templates/form.rhtml +0 -3
  116. data/lib/rails_generator/generators/components/scaffold/templates/form_scaffolding.rhtml +0 -1
  117. data/lib/rails_generator/generators/components/scaffold/templates/functional_test.rb +0 -98
  118. data/lib/rails_generator/generators/components/scaffold/templates/helper.rb +0 -2
  119. data/lib/rails_generator/generators/components/scaffold/templates/layout.rhtml +0 -13
  120. data/lib/rails_generator/generators/components/scaffold/templates/style.css +0 -74
  121. data/lib/rails_generator/generators/components/scaffold/templates/view_edit.rhtml +0 -9
  122. data/lib/rails_generator/generators/components/scaffold/templates/view_list.rhtml +0 -27
  123. data/lib/rails_generator/generators/components/scaffold/templates/view_new.rhtml +0 -8
  124. data/lib/rails_generator/generators/components/scaffold/templates/view_show.rhtml +0 -8
  125. data/lib/rails_generator/generators/components/session_migration/USAGE +0 -15
  126. data/lib/rails_generator/generators/components/session_migration/session_migration_generator.rb +0 -12
  127. data/lib/rails_generator/generators/components/session_migration/templates/migration.rb +0 -15
  128. data/lib/rails_generator/generators/components/web_service/USAGE +0 -28
  129. data/lib/rails_generator/generators/components/web_service/templates/api_definition.rb +0 -5
  130. data/lib/rails_generator/generators/components/web_service/templates/controller.rb +0 -8
  131. data/lib/rails_generator/generators/components/web_service/templates/functional_test.rb +0 -19
  132. data/lib/rails_generator/generators/components/web_service/web_service_generator.rb +0 -29
  133. data/lib/rails_generator/lookup.rb +0 -210
  134. data/lib/rails_generator/manifest.rb +0 -53
  135. data/lib/rails_generator/options.rb +0 -140
  136. data/lib/rails_generator/scripts/destroy.rb +0 -7
  137. data/lib/rails_generator/scripts/generate.rb +0 -7
  138. data/lib/rails_generator/scripts/update.rb +0 -12
  139. data/lib/rails_generator/scripts.rb +0 -83
  140. data/lib/rails_generator/simple_logger.rb +0 -46
  141. data/lib/rails_generator/spec.rb +0 -44
  142. data/lib/rails_generator.rb +0 -43
  143. data/lib/rails_info.rb +0 -104
  144. data/lib/rails_version.rb +0 -9
  145. data/lib/railties_path.rb +0 -1
  146. data/lib/rubyprof_ext.rb +0 -35
  147. data/lib/tasks/databases.rake +0 -158
  148. data/lib/tasks/documentation.rake +0 -76
  149. data/lib/tasks/framework.rake +0 -71
  150. data/lib/tasks/javascripts.rake +0 -6
  151. data/lib/tasks/misc.rake +0 -19
  152. data/lib/tasks/rails.rb +0 -8
  153. data/lib/tasks/statistics.rake +0 -16
  154. data/lib/tasks/testing.rake +0 -50
  155. data/lib/test_help.rb +0 -17
  156. data/lib/webrick_server.rb +0 -170
@@ -1,854 +0,0 @@
1
- // Copyright (c) 2005 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
2
- // Contributors:
3
- // Justin Palmer (http://encytemedia.com/)
4
- // Mark Pilgrim (http://diveintomark.org/)
5
- // Martin Bialasinki
6
- //
7
- // See scriptaculous.js for full license.
8
-
9
- /* ------------- element ext -------------- */
10
-
11
- // converts rgb() and #xxx to #xxxxxx format,
12
- // returns self (or first argument) if not convertable
13
- String.prototype.parseColor = function() {
14
- var color = '#';
15
- if(this.slice(0,4) == 'rgb(') {
16
- var cols = this.slice(4,this.length-1).split(',');
17
- var i=0; do { color += parseInt(cols[i]).toColorPart() } while (++i<3);
18
- } else {
19
- if(this.slice(0,1) == '#') {
20
- if(this.length==4) for(var i=1;i<4;i++) color += (this.charAt(i) + this.charAt(i)).toLowerCase();
21
- if(this.length==7) color = this.toLowerCase();
22
- }
23
- }
24
- return(color.length==7 ? color : (arguments[0] || this));
25
- }
26
-
27
- Element.collectTextNodesIgnoreClass = function(element, ignoreclass) {
28
- var children = $(element).childNodes;
29
- var text = '';
30
- var classtest = new RegExp('^([^ ]+ )*' + ignoreclass+ '( [^ ]+)*$','i');
31
-
32
- for (var i = 0; i < children.length; i++) {
33
- if(children[i].nodeType==3) {
34
- text+=children[i].nodeValue;
35
- } else {
36
- if((!children[i].className.match(classtest)) && children[i].hasChildNodes())
37
- text += Element.collectTextNodesIgnoreClass(children[i], ignoreclass);
38
- }
39
- }
40
-
41
- return text;
42
- }
43
-
44
- Element.setStyle = function(element, style) {
45
- element = $(element);
46
- for(k in style) element.style[k.camelize()] = style[k];
47
- }
48
-
49
- Element.setContentZoom = function(element, percent) {
50
- Element.setStyle(element, {fontSize: (percent/100) + 'em'});
51
- if(navigator.appVersion.indexOf('AppleWebKit')>0) window.scrollBy(0,0);
52
- }
53
-
54
- Element.getOpacity = function(element){
55
- var opacity;
56
- if (opacity = Element.getStyle(element, 'opacity'))
57
- return parseFloat(opacity);
58
- if (opacity = (Element.getStyle(element, 'filter') || '').match(/alpha\(opacity=(.*)\)/))
59
- if(opacity[1]) return parseFloat(opacity[1]) / 100;
60
- return 1.0;
61
- }
62
-
63
- Element.setOpacity = function(element, value){
64
- element= $(element);
65
- if (value == 1){
66
- Element.setStyle(element, { opacity:
67
- (/Gecko/.test(navigator.userAgent) && !/Konqueror|Safari|KHTML/.test(navigator.userAgent)) ?
68
- 0.999999 : null });
69
- if(/MSIE/.test(navigator.userAgent))
70
- Element.setStyle(element, {filter: Element.getStyle(element,'filter').replace(/alpha\([^\)]*\)/gi,'')});
71
- } else {
72
- if(value < 0.00001) value = 0;
73
- Element.setStyle(element, {opacity: value});
74
- if(/MSIE/.test(navigator.userAgent))
75
- Element.setStyle(element,
76
- { filter: Element.getStyle(element,'filter').replace(/alpha\([^\)]*\)/gi,'') +
77
- 'alpha(opacity='+value*100+')' });
78
- }
79
- }
80
-
81
- Element.getInlineOpacity = function(element){
82
- return $(element).style.opacity || '';
83
- }
84
-
85
- Element.childrenWithClassName = function(element, className) {
86
- return $A($(element).getElementsByTagName('*')).select(
87
- function(c) { return Element.hasClassName(c, className) });
88
- }
89
-
90
- Array.prototype.call = function() {
91
- var args = arguments;
92
- this.each(function(f){ f.apply(this, args) });
93
- }
94
-
95
- /*--------------------------------------------------------------------------*/
96
-
97
- var Effect = {
98
- tagifyText: function(element) {
99
- var tagifyStyle = 'position:relative';
100
- if(/MSIE/.test(navigator.userAgent)) tagifyStyle += ';zoom:1';
101
- element = $(element);
102
- $A(element.childNodes).each( function(child) {
103
- if(child.nodeType==3) {
104
- child.nodeValue.toArray().each( function(character) {
105
- element.insertBefore(
106
- Builder.node('span',{style: tagifyStyle},
107
- character == ' ' ? String.fromCharCode(160) : character),
108
- child);
109
- });
110
- Element.remove(child);
111
- }
112
- });
113
- },
114
- multiple: function(element, effect) {
115
- var elements;
116
- if(((typeof element == 'object') ||
117
- (typeof element == 'function')) &&
118
- (element.length))
119
- elements = element;
120
- else
121
- elements = $(element).childNodes;
122
-
123
- var options = Object.extend({
124
- speed: 0.1,
125
- delay: 0.0
126
- }, arguments[2] || {});
127
- var masterDelay = options.delay;
128
-
129
- $A(elements).each( function(element, index) {
130
- new effect(element, Object.extend(options, { delay: index * options.speed + masterDelay }));
131
- });
132
- }
133
- };
134
-
135
- var Effect2 = Effect; // deprecated
136
-
137
- /* ------------- transitions ------------- */
138
-
139
- Effect.Transitions = {}
140
-
141
- Effect.Transitions.linear = function(pos) {
142
- return pos;
143
- }
144
- Effect.Transitions.sinoidal = function(pos) {
145
- return (-Math.cos(pos*Math.PI)/2) + 0.5;
146
- }
147
- Effect.Transitions.reverse = function(pos) {
148
- return 1-pos;
149
- }
150
- Effect.Transitions.flicker = function(pos) {
151
- return ((-Math.cos(pos*Math.PI)/4) + 0.75) + Math.random()/4;
152
- }
153
- Effect.Transitions.wobble = function(pos) {
154
- return (-Math.cos(pos*Math.PI*(9*pos))/2) + 0.5;
155
- }
156
- Effect.Transitions.pulse = function(pos) {
157
- return (Math.floor(pos*10) % 2 == 0 ?
158
- (pos*10-Math.floor(pos*10)) : 1-(pos*10-Math.floor(pos*10)));
159
- }
160
- Effect.Transitions.none = function(pos) {
161
- return 0;
162
- }
163
- Effect.Transitions.full = function(pos) {
164
- return 1;
165
- }
166
-
167
- /* ------------- core effects ------------- */
168
-
169
- Effect.Queue = {
170
- effects: [],
171
- _each: function(iterator) {
172
- this.effects._each(iterator);
173
- },
174
- interval: null,
175
- add: function(effect) {
176
- var timestamp = new Date().getTime();
177
-
178
- switch(effect.options.queue) {
179
- case 'front':
180
- // move unstarted effects after this effect
181
- this.effects.findAll(function(e){ return e.state=='idle' }).each( function(e) {
182
- e.startOn += effect.finishOn;
183
- e.finishOn += effect.finishOn;
184
- });
185
- break;
186
- case 'end':
187
- // start effect after last queued effect has finished
188
- timestamp = this.effects.pluck('finishOn').max() || timestamp;
189
- break;
190
- }
191
-
192
- effect.startOn += timestamp;
193
- effect.finishOn += timestamp;
194
- this.effects.push(effect);
195
- if(!this.interval)
196
- this.interval = setInterval(this.loop.bind(this), 40);
197
- },
198
- remove: function(effect) {
199
- this.effects = this.effects.reject(function(e) { return e==effect });
200
- if(this.effects.length == 0) {
201
- clearInterval(this.interval);
202
- this.interval = null;
203
- }
204
- },
205
- loop: function() {
206
- var timePos = new Date().getTime();
207
- this.effects.invoke('loop', timePos);
208
- }
209
- }
210
- Object.extend(Effect.Queue, Enumerable);
211
-
212
- Effect.Base = function() {};
213
- Effect.Base.prototype = {
214
- position: null,
215
- setOptions: function(options) {
216
- this.options = Object.extend({
217
- transition: Effect.Transitions.sinoidal,
218
- duration: 1.0, // seconds
219
- fps: 25.0, // max. 25fps due to Effect.Queue implementation
220
- sync: false, // true for combining
221
- from: 0.0,
222
- to: 1.0,
223
- delay: 0.0,
224
- queue: 'parallel'
225
- }, options || {});
226
- },
227
- start: function(options) {
228
- this.setOptions(options || {});
229
- this.currentFrame = 0;
230
- this.state = 'idle';
231
- this.startOn = this.options.delay*1000;
232
- this.finishOn = this.startOn + (this.options.duration*1000);
233
- this.event('beforeStart');
234
- if(!this.options.sync) Effect.Queue.add(this);
235
- },
236
- loop: function(timePos) {
237
- if(timePos >= this.startOn) {
238
- if(timePos >= this.finishOn) {
239
- this.render(1.0);
240
- this.cancel();
241
- this.event('beforeFinish');
242
- if(this.finish) this.finish();
243
- this.event('afterFinish');
244
- return;
245
- }
246
- var pos = (timePos - this.startOn) / (this.finishOn - this.startOn);
247
- var frame = Math.round(pos * this.options.fps * this.options.duration);
248
- if(frame > this.currentFrame) {
249
- this.render(pos);
250
- this.currentFrame = frame;
251
- }
252
- }
253
- },
254
- render: function(pos) {
255
- if(this.state == 'idle') {
256
- this.state = 'running';
257
- this.event('beforeSetup');
258
- if(this.setup) this.setup();
259
- this.event('afterSetup');
260
- }
261
- if(this.state == 'running') {
262
- if(this.options.transition) pos = this.options.transition(pos);
263
- pos *= (this.options.to-this.options.from);
264
- pos += this.options.from;
265
- this.position = pos;
266
- this.event('beforeUpdate');
267
- if(this.update) this.update(pos);
268
- this.event('afterUpdate');
269
- }
270
- },
271
- cancel: function() {
272
- if(!this.options.sync) Effect.Queue.remove(this);
273
- this.state = 'finished';
274
- },
275
- event: function(eventName) {
276
- if(this.options[eventName + 'Internal']) this.options[eventName + 'Internal'](this);
277
- if(this.options[eventName]) this.options[eventName](this);
278
- },
279
- inspect: function() {
280
- return '#<Effect:' + $H(this).inspect() + ',options:' + $H(this.options).inspect() + '>';
281
- }
282
- }
283
-
284
- Effect.Parallel = Class.create();
285
- Object.extend(Object.extend(Effect.Parallel.prototype, Effect.Base.prototype), {
286
- initialize: function(effects) {
287
- this.effects = effects || [];
288
- this.start(arguments[1]);
289
- },
290
- update: function(position) {
291
- this.effects.invoke('render', position);
292
- },
293
- finish: function(position) {
294
- this.effects.each( function(effect) {
295
- effect.render(1.0);
296
- effect.cancel();
297
- effect.event('beforeFinish');
298
- if(effect.finish) effect.finish(position);
299
- effect.event('afterFinish');
300
- });
301
- }
302
- });
303
-
304
- Effect.Opacity = Class.create();
305
- Object.extend(Object.extend(Effect.Opacity.prototype, Effect.Base.prototype), {
306
- initialize: function(element) {
307
- this.element = $(element);
308
- // make this work on IE on elements without 'layout'
309
- if(/MSIE/.test(navigator.userAgent) && (!this.element.hasLayout))
310
- Element.setStyle(this.element, {zoom: 1});
311
- var options = Object.extend({
312
- from: Element.getOpacity(this.element) || 0.0,
313
- to: 1.0
314
- }, arguments[1] || {});
315
- this.start(options);
316
- },
317
- update: function(position) {
318
- Element.setOpacity(this.element, position);
319
- }
320
- });
321
-
322
- Effect.MoveBy = Class.create();
323
- Object.extend(Object.extend(Effect.MoveBy.prototype, Effect.Base.prototype), {
324
- initialize: function(element, toTop, toLeft) {
325
- this.element = $(element);
326
- this.toTop = toTop;
327
- this.toLeft = toLeft;
328
- this.start(arguments[3]);
329
- },
330
- setup: function() {
331
- // Bug in Opera: Opera returns the "real" position of a static element or
332
- // relative element that does not have top/left explicitly set.
333
- // ==> Always set top and left for position relative elements in your stylesheets
334
- // (to 0 if you do not need them)
335
- Element.makePositioned(this.element);
336
- this.originalTop = parseFloat(Element.getStyle(this.element,'top') || '0');
337
- this.originalLeft = parseFloat(Element.getStyle(this.element,'left') || '0');
338
- },
339
- update: function(position) {
340
- Element.setStyle(this.element, {
341
- top: this.toTop * position + this.originalTop + 'px',
342
- left: this.toLeft * position + this.originalLeft + 'px'
343
- });
344
- }
345
- });
346
-
347
- Effect.Scale = Class.create();
348
- Object.extend(Object.extend(Effect.Scale.prototype, Effect.Base.prototype), {
349
- initialize: function(element, percent) {
350
- this.element = $(element)
351
- var options = Object.extend({
352
- scaleX: true,
353
- scaleY: true,
354
- scaleContent: true,
355
- scaleFromCenter: false,
356
- scaleMode: 'box', // 'box' or 'contents' or {} with provided values
357
- scaleFrom: 100.0,
358
- scaleTo: percent
359
- }, arguments[2] || {});
360
- this.start(options);
361
- },
362
- setup: function() {
363
- this.restoreAfterFinish = this.options.restoreAfterFinish || false;
364
- this.elementPositioning = Element.getStyle(this.element,'position');
365
-
366
- this.originalStyle = {};
367
- ['top','left','width','height','fontSize'].each( function(k) {
368
- this.originalStyle[k] = this.element.style[k];
369
- }.bind(this));
370
-
371
- this.originalTop = this.element.offsetTop;
372
- this.originalLeft = this.element.offsetLeft;
373
-
374
- var fontSize = Element.getStyle(this.element,'font-size') || '100%';
375
- ['em','px','%'].each( function(fontSizeType) {
376
- if(fontSize.indexOf(fontSizeType)>0) {
377
- this.fontSize = parseFloat(fontSize);
378
- this.fontSizeType = fontSizeType;
379
- }
380
- }.bind(this));
381
-
382
- this.factor = (this.options.scaleTo - this.options.scaleFrom)/100;
383
-
384
- this.dims = null;
385
- if(this.options.scaleMode=='box')
386
- this.dims = [this.element.offsetHeight, this.element.offsetWidth];
387
- if(/^content/.test(this.options.scaleMode))
388
- this.dims = [this.element.scrollHeight, this.element.scrollWidth];
389
- if(!this.dims)
390
- this.dims = [this.options.scaleMode.originalHeight,
391
- this.options.scaleMode.originalWidth];
392
- },
393
- update: function(position) {
394
- var currentScale = (this.options.scaleFrom/100.0) + (this.factor * position);
395
- if(this.options.scaleContent && this.fontSize)
396
- Element.setStyle(this.element, {fontSize: this.fontSize * currentScale + this.fontSizeType });
397
- this.setDimensions(this.dims[0] * currentScale, this.dims[1] * currentScale);
398
- },
399
- finish: function(position) {
400
- if (this.restoreAfterFinish) Element.setStyle(this.element, this.originalStyle);
401
- },
402
- setDimensions: function(height, width) {
403
- var d = {};
404
- if(this.options.scaleX) d.width = width + 'px';
405
- if(this.options.scaleY) d.height = height + 'px';
406
- if(this.options.scaleFromCenter) {
407
- var topd = (height - this.dims[0])/2;
408
- var leftd = (width - this.dims[1])/2;
409
- if(this.elementPositioning == 'absolute') {
410
- if(this.options.scaleY) d.top = this.originalTop-topd + 'px';
411
- if(this.options.scaleX) d.left = this.originalLeft-leftd + 'px';
412
- } else {
413
- if(this.options.scaleY) d.top = -topd + 'px';
414
- if(this.options.scaleX) d.left = -leftd + 'px';
415
- }
416
- }
417
- Element.setStyle(this.element, d);
418
- }
419
- });
420
-
421
- Effect.Highlight = Class.create();
422
- Object.extend(Object.extend(Effect.Highlight.prototype, Effect.Base.prototype), {
423
- initialize: function(element) {
424
- this.element = $(element);
425
- var options = Object.extend({ startcolor: '#ffff99' }, arguments[1] || {});
426
- this.start(options);
427
- },
428
- setup: function() {
429
- // Prevent executing on elements not in the layout flow
430
- if(Element.getStyle(this.element, 'display')=='none') { this.cancel(); return; }
431
- // Disable background image during the effect
432
- this.oldStyle = {
433
- backgroundImage: Element.getStyle(this.element, 'background-image') };
434
- Element.setStyle(this.element, {backgroundImage: 'none'});
435
- if(!this.options.endcolor)
436
- this.options.endcolor = Element.getStyle(this.element, 'background-color').parseColor('#ffffff');
437
- if(!this.options.restorecolor)
438
- this.options.restorecolor = Element.getStyle(this.element, 'background-color');
439
- // init color calculations
440
- this._base = $R(0,2).map(function(i){ return parseInt(this.options.startcolor.slice(i*2+1,i*2+3),16) }.bind(this));
441
- this._delta = $R(0,2).map(function(i){ return parseInt(this.options.endcolor.slice(i*2+1,i*2+3),16)-this._base[i] }.bind(this));
442
- },
443
- update: function(position) {
444
- Element.setStyle(this.element,{backgroundColor: $R(0,2).inject('#',function(m,v,i){
445
- return m+(Math.round(this._base[i]+(this._delta[i]*position)).toColorPart()); }.bind(this)) });
446
- },
447
- finish: function() {
448
- Element.setStyle(this.element, Object.extend(this.oldStyle, {
449
- backgroundColor: this.options.restorecolor
450
- }));
451
- }
452
- });
453
-
454
- Effect.ScrollTo = Class.create();
455
- Object.extend(Object.extend(Effect.ScrollTo.prototype, Effect.Base.prototype), {
456
- initialize: function(element) {
457
- this.element = $(element);
458
- this.start(arguments[1] || {});
459
- },
460
- setup: function() {
461
- Position.prepare();
462
- var offsets = Position.cumulativeOffset(this.element);
463
- if(this.options.offset) offsets[1] += this.options.offset;
464
- var max = window.innerHeight ?
465
- window.height - window.innerHeight :
466
- document.body.scrollHeight -
467
- (document.documentElement.clientHeight ?
468
- document.documentElement.clientHeight : document.body.clientHeight);
469
- this.scrollStart = Position.deltaY;
470
- this.delta = (offsets[1] > max ? max : offsets[1]) - this.scrollStart;
471
- },
472
- update: function(position) {
473
- Position.prepare();
474
- window.scrollTo(Position.deltaX,
475
- this.scrollStart + (position*this.delta));
476
- }
477
- });
478
-
479
- /* ------------- combination effects ------------- */
480
-
481
- Effect.Fade = function(element) {
482
- var oldOpacity = Element.getInlineOpacity(element);
483
- var options = Object.extend({
484
- from: Element.getOpacity(element) || 1.0,
485
- to: 0.0,
486
- afterFinishInternal: function(effect) { with(Element) {
487
- if(effect.options.to!=0) return;
488
- hide(effect.element);
489
- setStyle(effect.element, {opacity: oldOpacity}); }}
490
- }, arguments[1] || {});
491
- return new Effect.Opacity(element,options);
492
- }
493
-
494
- Effect.Appear = function(element) {
495
- var options = Object.extend({
496
- from: (Element.getStyle(element, 'display') == 'none' ? 0.0 : Element.getOpacity(element) || 0.0),
497
- to: 1.0,
498
- beforeSetup: function(effect) { with(Element) {
499
- setOpacity(effect.element, effect.options.from);
500
- show(effect.element); }}
501
- }, arguments[1] || {});
502
- return new Effect.Opacity(element,options);
503
- }
504
-
505
- Effect.Puff = function(element) {
506
- element = $(element);
507
- var oldStyle = { opacity: Element.getInlineOpacity(element), position: Element.getStyle(element, 'position') };
508
- return new Effect.Parallel(
509
- [ new Effect.Scale(element, 200,
510
- { sync: true, scaleFromCenter: true, scaleContent: true, restoreAfterFinish: true }),
511
- new Effect.Opacity(element, { sync: true, to: 0.0 } ) ],
512
- Object.extend({ duration: 1.0,
513
- beforeSetupInternal: function(effect) { with(Element) {
514
- setStyle(effect.effects[0].element, {position: 'absolute'}); }},
515
- afterFinishInternal: function(effect) { with(Element) {
516
- hide(effect.effects[0].element);
517
- setStyle(effect.effects[0].element, oldStyle); }}
518
- }, arguments[1] || {})
519
- );
520
- }
521
-
522
- Effect.BlindUp = function(element) {
523
- element = $(element);
524
- Element.makeClipping(element);
525
- return new Effect.Scale(element, 0,
526
- Object.extend({ scaleContent: false,
527
- scaleX: false,
528
- restoreAfterFinish: true,
529
- afterFinishInternal: function(effect) { with(Element) {
530
- [hide, undoClipping].call(effect.element); }}
531
- }, arguments[1] || {})
532
- );
533
- }
534
-
535
- Effect.BlindDown = function(element) {
536
- element = $(element);
537
- var oldHeight = Element.getStyle(element, 'height');
538
- var elementDimensions = Element.getDimensions(element);
539
- return new Effect.Scale(element, 100,
540
- Object.extend({ scaleContent: false,
541
- scaleX: false,
542
- scaleFrom: 0,
543
- scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width},
544
- restoreAfterFinish: true,
545
- afterSetup: function(effect) { with(Element) {
546
- makeClipping(effect.element);
547
- setStyle(effect.element, {height: '0px'});
548
- show(effect.element);
549
- }},
550
- afterFinishInternal: function(effect) { with(Element) {
551
- undoClipping(effect.element);
552
- setStyle(effect.element, {height: oldHeight});
553
- }}
554
- }, arguments[1] || {})
555
- );
556
- }
557
-
558
- Effect.SwitchOff = function(element) {
559
- element = $(element);
560
- var oldOpacity = Element.getInlineOpacity(element);
561
- return new Effect.Appear(element, {
562
- duration: 0.4,
563
- from: 0,
564
- transition: Effect.Transitions.flicker,
565
- afterFinishInternal: function(effect) {
566
- new Effect.Scale(effect.element, 1, {
567
- duration: 0.3, scaleFromCenter: true,
568
- scaleX: false, scaleContent: false, restoreAfterFinish: true,
569
- beforeSetup: function(effect) { with(Element) {
570
- [makePositioned,makeClipping].call(effect.element);
571
- }},
572
- afterFinishInternal: function(effect) { with(Element) {
573
- [hide,undoClipping,undoPositioned].call(effect.element);
574
- setStyle(effect.element, {opacity: oldOpacity});
575
- }}
576
- })
577
- }
578
- });
579
- }
580
-
581
- Effect.DropOut = function(element) {
582
- element = $(element);
583
- var oldStyle = {
584
- top: Element.getStyle(element, 'top'),
585
- left: Element.getStyle(element, 'left'),
586
- opacity: Element.getInlineOpacity(element) };
587
- return new Effect.Parallel(
588
- [ new Effect.MoveBy(element, 100, 0, { sync: true }),
589
- new Effect.Opacity(element, { sync: true, to: 0.0 }) ],
590
- Object.extend(
591
- { duration: 0.5,
592
- beforeSetup: function(effect) { with(Element) {
593
- makePositioned(effect.effects[0].element); }},
594
- afterFinishInternal: function(effect) { with(Element) {
595
- [hide, undoPositioned].call(effect.effects[0].element);
596
- setStyle(effect.effects[0].element, oldStyle); }}
597
- }, arguments[1] || {}));
598
- }
599
-
600
- Effect.Shake = function(element) {
601
- element = $(element);
602
- var oldStyle = {
603
- top: Element.getStyle(element, 'top'),
604
- left: Element.getStyle(element, 'left') };
605
- return new Effect.MoveBy(element, 0, 20,
606
- { duration: 0.05, afterFinishInternal: function(effect) {
607
- new Effect.MoveBy(effect.element, 0, -40,
608
- { duration: 0.1, afterFinishInternal: function(effect) {
609
- new Effect.MoveBy(effect.element, 0, 40,
610
- { duration: 0.1, afterFinishInternal: function(effect) {
611
- new Effect.MoveBy(effect.element, 0, -40,
612
- { duration: 0.1, afterFinishInternal: function(effect) {
613
- new Effect.MoveBy(effect.element, 0, 40,
614
- { duration: 0.1, afterFinishInternal: function(effect) {
615
- new Effect.MoveBy(effect.element, 0, -20,
616
- { duration: 0.05, afterFinishInternal: function(effect) { with(Element) {
617
- undoPositioned(effect.element);
618
- setStyle(effect.element, oldStyle);
619
- }}}) }}) }}) }}) }}) }});
620
- }
621
-
622
- Effect.SlideDown = function(element) {
623
- element = $(element);
624
- Element.cleanWhitespace(element);
625
- // SlideDown need to have the content of the element wrapped in a container element with fixed height!
626
- var oldInnerBottom = Element.getStyle(element.firstChild, 'bottom');
627
- var elementDimensions = Element.getDimensions(element);
628
- return new Effect.Scale(element, 100, Object.extend({
629
- scaleContent: false,
630
- scaleX: false,
631
- scaleFrom: 0,
632
- scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width},
633
- restoreAfterFinish: true,
634
- afterSetup: function(effect) { with(Element) {
635
- makePositioned(effect.element);
636
- makePositioned(effect.element.firstChild);
637
- if(window.opera) setStyle(effect.element, {top: ''});
638
- makeClipping(effect.element);
639
- setStyle(effect.element, {height: '0px'});
640
- show(element); }},
641
- afterUpdateInternal: function(effect) { with(Element) {
642
- setStyle(effect.element.firstChild, {bottom:
643
- (effect.dims[0] - effect.element.clientHeight) + 'px' }); }},
644
- afterFinishInternal: function(effect) { with(Element) {
645
- undoClipping(effect.element);
646
- undoPositioned(effect.element.firstChild);
647
- undoPositioned(effect.element);
648
- setStyle(effect.element.firstChild, {bottom: oldInnerBottom}); }}
649
- }, arguments[1] || {})
650
- );
651
- }
652
-
653
- Effect.SlideUp = function(element) {
654
- element = $(element);
655
- Element.cleanWhitespace(element);
656
- var oldInnerBottom = Element.getStyle(element.firstChild, 'bottom');
657
- return new Effect.Scale(element, 0,
658
- Object.extend({ scaleContent: false,
659
- scaleX: false,
660
- scaleMode: 'box',
661
- scaleFrom: 100,
662
- restoreAfterFinish: true,
663
- beforeStartInternal: function(effect) { with(Element) {
664
- makePositioned(effect.element);
665
- makePositioned(effect.element.firstChild);
666
- if(window.opera) setStyle(effect.element, {top: ''});
667
- makeClipping(effect.element);
668
- show(element); }},
669
- afterUpdateInternal: function(effect) { with(Element) {
670
- setStyle(effect.element.firstChild, {bottom:
671
- (effect.dims[0] - effect.element.clientHeight) + 'px' }); }},
672
- afterFinishInternal: function(effect) { with(Element) {
673
- [hide, undoClipping].call(effect.element);
674
- undoPositioned(effect.element.firstChild);
675
- undoPositioned(effect.element);
676
- setStyle(effect.element.firstChild, {bottom: oldInnerBottom}); }}
677
- }, arguments[1] || {})
678
- );
679
- }
680
-
681
- // Bug in opera makes the TD containing this element expand for a instance after finish
682
- Effect.Squish = function(element) {
683
- return new Effect.Scale(element, window.opera ? 1 : 0,
684
- { restoreAfterFinish: true,
685
- beforeSetup: function(effect) { with(Element) {
686
- makeClipping(effect.element); }},
687
- afterFinishInternal: function(effect) { with(Element) {
688
- hide(effect.element);
689
- undoClipping(effect.element); }}
690
- });
691
- }
692
-
693
- Effect.Grow = function(element) {
694
- element = $(element);
695
- var options = Object.extend({
696
- direction: 'center',
697
- moveTransistion: Effect.Transitions.sinoidal,
698
- scaleTransition: Effect.Transitions.sinoidal,
699
- opacityTransition: Effect.Transitions.full
700
- }, arguments[1] || {});
701
- var oldStyle = {
702
- top: element.style.top,
703
- left: element.style.left,
704
- height: element.style.height,
705
- width: element.style.width,
706
- opacity: Element.getInlineOpacity(element) };
707
-
708
- var dims = Element.getDimensions(element);
709
- var initialMoveX, initialMoveY;
710
- var moveX, moveY;
711
-
712
- switch (options.direction) {
713
- case 'top-left':
714
- initialMoveX = initialMoveY = moveX = moveY = 0;
715
- break;
716
- case 'top-right':
717
- initialMoveX = dims.width;
718
- initialMoveY = moveY = 0;
719
- moveX = -dims.width;
720
- break;
721
- case 'bottom-left':
722
- initialMoveX = moveX = 0;
723
- initialMoveY = dims.height;
724
- moveY = -dims.height;
725
- break;
726
- case 'bottom-right':
727
- initialMoveX = dims.width;
728
- initialMoveY = dims.height;
729
- moveX = -dims.width;
730
- moveY = -dims.height;
731
- break;
732
- case 'center':
733
- initialMoveX = dims.width / 2;
734
- initialMoveY = dims.height / 2;
735
- moveX = -dims.width / 2;
736
- moveY = -dims.height / 2;
737
- break;
738
- }
739
-
740
- return new Effect.MoveBy(element, initialMoveY, initialMoveX, {
741
- duration: 0.01,
742
- beforeSetup: function(effect) { with(Element) {
743
- hide(effect.element);
744
- makeClipping(effect.element);
745
- makePositioned(effect.element);
746
- }},
747
- afterFinishInternal: function(effect) {
748
- new Effect.Parallel(
749
- [ new Effect.Opacity(effect.element, { sync: true, to: 1.0, from: 0.0, transition: options.opacityTransition }),
750
- new Effect.MoveBy(effect.element, moveY, moveX, { sync: true, transition: options.moveTransition }),
751
- new Effect.Scale(effect.element, 100, {
752
- scaleMode: { originalHeight: dims.height, originalWidth: dims.width },
753
- sync: true, scaleFrom: window.opera ? 1 : 0, transition: options.scaleTransition, restoreAfterFinish: true})
754
- ], Object.extend({
755
- beforeSetup: function(effect) { with(Element) {
756
- setStyle(effect.effects[0].element, {height: '0px'});
757
- show(effect.effects[0].element); }},
758
- afterFinishInternal: function(effect) { with(Element) {
759
- [undoClipping, undoPositioned].call(effect.effects[0].element);
760
- setStyle(effect.effects[0].element, oldStyle); }}
761
- }, options)
762
- )
763
- }
764
- });
765
- }
766
-
767
- Effect.Shrink = function(element) {
768
- element = $(element);
769
- var options = Object.extend({
770
- direction: 'center',
771
- moveTransistion: Effect.Transitions.sinoidal,
772
- scaleTransition: Effect.Transitions.sinoidal,
773
- opacityTransition: Effect.Transitions.none
774
- }, arguments[1] || {});
775
- var oldStyle = {
776
- top: element.style.top,
777
- left: element.style.left,
778
- height: element.style.height,
779
- width: element.style.width,
780
- opacity: Element.getInlineOpacity(element) };
781
-
782
- var dims = Element.getDimensions(element);
783
- var moveX, moveY;
784
-
785
- switch (options.direction) {
786
- case 'top-left':
787
- moveX = moveY = 0;
788
- break;
789
- case 'top-right':
790
- moveX = dims.width;
791
- moveY = 0;
792
- break;
793
- case 'bottom-left':
794
- moveX = 0;
795
- moveY = dims.height;
796
- break;
797
- case 'bottom-right':
798
- moveX = dims.width;
799
- moveY = dims.height;
800
- break;
801
- case 'center':
802
- moveX = dims.width / 2;
803
- moveY = dims.height / 2;
804
- break;
805
- }
806
-
807
- return new Effect.Parallel(
808
- [ new Effect.Opacity(element, { sync: true, to: 0.0, from: 1.0, transition: options.opacityTransition }),
809
- new Effect.Scale(element, window.opera ? 1 : 0, { sync: true, transition: options.scaleTransition, restoreAfterFinish: true}),
810
- new Effect.MoveBy(element, moveY, moveX, { sync: true, transition: options.moveTransition })
811
- ], Object.extend({
812
- beforeStartInternal: function(effect) { with(Element) {
813
- [makePositioned, makeClipping].call(effect.effects[0].element) }},
814
- afterFinishInternal: function(effect) { with(Element) {
815
- [hide, undoClipping, undoPositioned].call(effect.effects[0].element);
816
- setStyle(effect.effects[0].element, oldStyle); }}
817
- }, options)
818
- );
819
- }
820
-
821
- Effect.Pulsate = function(element) {
822
- element = $(element);
823
- var options = arguments[1] || {};
824
- var oldOpacity = Element.getInlineOpacity(element);
825
- var transition = options.transition || Effect.Transitions.sinoidal;
826
- var reverser = function(pos){ return transition(1-Effect.Transitions.pulse(pos)) };
827
- reverser.bind(transition);
828
- return new Effect.Opacity(element,
829
- Object.extend(Object.extend({ duration: 3.0, from: 0,
830
- afterFinishInternal: function(effect) { Element.setStyle(effect.element, {opacity: oldOpacity}); }
831
- }, options), {transition: reverser}));
832
- }
833
-
834
- Effect.Fold = function(element) {
835
- element = $(element);
836
- var oldStyle = {
837
- top: element.style.top,
838
- left: element.style.left,
839
- width: element.style.width,
840
- height: element.style.height };
841
- Element.makeClipping(element);
842
- return new Effect.Scale(element, 5, Object.extend({
843
- scaleContent: false,
844
- scaleX: false,
845
- afterFinishInternal: function(effect) {
846
- new Effect.Scale(element, 1, {
847
- scaleContent: false,
848
- scaleY: false,
849
- afterFinishInternal: function(effect) { with(Element) {
850
- [hide, undoClipping].call(effect.element);
851
- setStyle(effect.element, oldStyle);
852
- }} });
853
- }}, arguments[1] || {}));
854
- }