bivouac 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (135) hide show
  1. data/README +15 -0
  2. data/bin/bivouac +5 -10
  3. data/doc/rdoc/classes/BivouacHelpers/HtmlView.html +46 -37
  4. data/doc/rdoc/classes/BivouacHelpers/ScriptAculoUsView.html +27 -20
  5. data/doc/rdoc/created.rid +1 -1
  6. data/doc/rdoc/files/README.html +45 -1
  7. data/doc/rdoc/files/lib/bivouac/helpers/view/goh/html_rb.html +1 -1
  8. data/doc/rdoc/files/lib/bivouac/helpers/view/goh/javascript_rb.html +1 -1
  9. data/doc/rdoc/files/lib/bivouac/helpers/view/goh/scriptaculous_rb.html +1 -1
  10. data/examples/bivouac_sample/Rakefile +0 -0
  11. data/examples/bivouac_sample/app/controllers/toggle_sortable.rb +2 -1
  12. data/examples/bivouac_sample/app/views/_sortable_result.rb +1 -1
  13. data/examples/bivouac_sample/script/console +0 -0
  14. data/examples/bivouac_sample/script/generate +0 -0
  15. data/examples/bivouac_sample/script/plugin +0 -0
  16. data/examples/bivouac_sample/script/server +0 -0
  17. data/examples/blog/Rakefile +56 -0
  18. data/examples/blog/app/blog.rb +107 -0
  19. data/examples/blog/app/controllers/comment.rb +17 -0
  20. data/examples/blog/app/controllers/index.rb +15 -0
  21. data/examples/blog/app/controllers/login.rb +33 -0
  22. data/examples/blog/app/controllers/logout.rb +15 -0
  23. data/examples/blog/app/controllers/not_found.rb +14 -0
  24. data/examples/blog/app/controllers/post.rb +48 -0
  25. data/examples/blog/app/helpers/_helpers.rb +30 -0
  26. data/examples/blog/app/helpers/blog.rb +14 -0
  27. data/examples/blog/app/models/comment.rb +18 -0
  28. data/examples/blog/app/models/post.rb +19 -0
  29. data/examples/blog/app/models/user.rb +12 -0
  30. data/examples/blog/app/views/_partials.rb +81 -0
  31. data/examples/blog/app/views/index/index.rb +23 -0
  32. data/examples/blog/app/views/layouts/default_layout.rb +40 -0
  33. data/examples/blog/app/views/login/login.rb +27 -0
  34. data/examples/blog/app/views/not_found.rb +13 -0
  35. data/examples/blog/app/views/post/add.rb +12 -0
  36. data/examples/blog/app/views/post/edit.rb +12 -0
  37. data/examples/blog/app/views/post/view.rb +14 -0
  38. data/examples/blog/config/console.rc +12 -0
  39. data/examples/blog/config/database.yml +3 -0
  40. data/examples/blog/config/environment.rb +58 -0
  41. data/examples/blog/db/blog.db +0 -0
  42. data/examples/blog/db/create.rb +11 -0
  43. data/examples/blog/db/migrate/001_users.rb +22 -0
  44. data/examples/blog/db/migrate/002_posts.rb +24 -0
  45. data/examples/blog/db/migrate/003_comments.rb +24 -0
  46. data/examples/blog/log/Blog.log +382 -0
  47. data/examples/{blog_goh → blog}/public/images/camping.png +0 -0
  48. data/examples/{blog_goh → blog}/public/index.html +3 -2
  49. data/examples/blog/public/javascripts/builder.js +136 -0
  50. data/examples/blog/public/javascripts/controls.js +965 -0
  51. data/examples/blog/public/javascripts/dragdrop.js +974 -0
  52. data/examples/blog/public/javascripts/effects.js +1122 -0
  53. data/examples/blog/public/javascripts/prototype.js +4320 -0
  54. data/examples/blog/public/javascripts/scriptaculous.js +58 -0
  55. data/examples/blog/public/javascripts/slider.js +275 -0
  56. data/examples/blog/public/javascripts/sound.js +55 -0
  57. data/examples/blog/public/javascripts/unittest.js +568 -0
  58. data/examples/blog/public/stylesheets/autocomplete.css +22 -0
  59. data/examples/blog/public/stylesheets/blog.css +107 -0
  60. data/examples/blog/script/console +12 -0
  61. data/examples/blog/script/generate +17 -0
  62. data/examples/blog/script/plugin +16 -0
  63. data/examples/blog/script/server +135 -0
  64. data/examples/blog/test/test_comment.rb +22 -0
  65. data/examples/blog/test/test_index.rb +22 -0
  66. data/examples/blog/test/test_login.rb +22 -0
  67. data/examples/blog/test/test_logout.rb +18 -0
  68. data/examples/blog/test/test_post.rb +30 -0
  69. data/examples/blog/test/test_post_new.rb +22 -0
  70. data/lib/bivouac.rb +2 -2
  71. data/lib/bivouac/commands/generate.rb +48 -8
  72. data/lib/bivouac/commands/plugin.rb +30 -15
  73. data/lib/bivouac/ext/filtering_camping.rb +46 -0
  74. data/lib/bivouac/helpers/view/goh/html.rb +9 -0
  75. data/lib/bivouac/helpers/view/goh/scriptaculous.rb +12 -8
  76. data/lib/bivouac/tasks/bivouac.rb +1 -0
  77. data/lib/bivouac/tasks/framework.rake +8 -8
  78. data/lib/bivouac/tasks/plugins.rake +17 -1
  79. data/lib/bivouac/template.rb +0 -0
  80. data/lib/bivouac/template/{application_goh.rb → application.rb} +36 -12
  81. data/lib/bivouac/template/application/{helpers_goh.rb → helpers.rb} +1 -1
  82. data/lib/bivouac/template/console.rb +2 -4
  83. data/lib/bivouac/template/environment.rb +1 -1
  84. data/lib/bivouac/template/generate.rb +0 -0
  85. data/lib/bivouac/template/generate/create.rb +0 -0
  86. data/lib/bivouac/template/generate/helper.rb +12 -0
  87. data/lib/bivouac/template/generate/migrate.rb +0 -0
  88. data/lib/bivouac/template/generate/migrate_end.rb +1 -0
  89. data/lib/bivouac/template/plugin.rb +6 -1
  90. data/lib/bivouac/template/server.rb +124 -3
  91. data/lib/bivouac/template/static/builder.js +19 -19
  92. data/lib/bivouac/template/static/controls.js +74 -74
  93. data/lib/bivouac/template/static/dragdrop.js +167 -166
  94. data/lib/bivouac/template/static/effects.js +171 -163
  95. data/lib/bivouac/template/static/not_found_controller.rb +8 -4
  96. data/lib/bivouac/template/static/prototype.js +218 -119
  97. data/lib/bivouac/template/static/scriptaculous.js +22 -20
  98. data/lib/bivouac/template/static/slider.js +39 -39
  99. data/lib/bivouac/template/static/sound.js +11 -11
  100. data/lib/bivouac/template/static/unittest.js +16 -16
  101. metadata +96 -60
  102. data/examples/blog_goh/app/blog.rb +0 -72
  103. data/examples/blog_goh/app/controllers/add.rb +0 -19
  104. data/examples/blog_goh/app/controllers/comment.rb +0 -9
  105. data/examples/blog_goh/app/controllers/edit.rb +0 -18
  106. data/examples/blog_goh/app/controllers/index.rb +0 -8
  107. data/examples/blog_goh/app/controllers/info.rb +0 -11
  108. data/examples/blog_goh/app/controllers/login.rb +0 -15
  109. data/examples/blog_goh/app/controllers/logout.rb +0 -8
  110. data/examples/blog_goh/app/controllers/view.rb +0 -9
  111. data/examples/blog_goh/app/models/comment.rb +0 -5
  112. data/examples/blog_goh/app/models/post.rb +0 -5
  113. data/examples/blog_goh/app/models/user.rb +0 -4
  114. data/examples/blog_goh/app/views/_form.rb +0 -16
  115. data/examples/blog_goh/app/views/_login.rb +0 -13
  116. data/examples/blog_goh/app/views/_post.rb +0 -9
  117. data/examples/blog_goh/app/views/add.rb +0 -9
  118. data/examples/blog_goh/app/views/edit.rb +0 -9
  119. data/examples/blog_goh/app/views/index.rb +0 -12
  120. data/examples/blog_goh/app/views/layout.rb +0 -18
  121. data/examples/blog_goh/app/views/login.rb +0 -6
  122. data/examples/blog_goh/app/views/logout.rb +0 -6
  123. data/examples/blog_goh/app/views/view.rb +0 -20
  124. data/examples/blog_goh/config/environment.rb +0 -27
  125. data/examples/blog_goh/db/Blog.db +0 -0
  126. data/examples/blog_goh/db/create.rb +0 -8
  127. data/examples/blog_goh/db/migrate/comment.rb +0 -15
  128. data/examples/blog_goh/db/migrate/post.rb +0 -15
  129. data/examples/blog_goh/db/migrate/user.rb +0 -15
  130. data/examples/blog_goh/log/Blog.log +0 -75
  131. data/examples/blog_goh/public/stylesheets/style.css +0 -10
  132. data/examples/blog_goh/script/generate +0 -3
  133. data/examples/blog_goh/script/server +0 -5
  134. data/lib/bivouac/template/application/postamble.rb +0 -195
  135. data/lib/camping/cookies_sessions.rb +0 -39
@@ -1,50 +1,50 @@
1
- // script.aculo.us effects.js v1.8.1, Thu Jan 03 22:07:12 -0500 2008
1
+ // script.aculo.us effects.js v1.8.2, Tue Nov 18 18:30:58 +0100 2008
2
2
 
3
- // Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
3
+ // Copyright (c) 2005-2008 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
4
4
  // Contributors:
5
5
  // Justin Palmer (http://encytemedia.com/)
6
6
  // Mark Pilgrim (http://diveintomark.org/)
7
7
  // Martin Bialasinki
8
- //
8
+ //
9
9
  // script.aculo.us is freely distributable under the terms of an MIT-style license.
10
- // For details, see the script.aculo.us web site: http://script.aculo.us/
10
+ // For details, see the script.aculo.us web site: http://script.aculo.us/
11
11
 
12
- // converts rgb() and #xxx to #xxxxxx format,
13
- // returns self (or first argument) if not convertable
14
- String.prototype.parseColor = function() {
12
+ // converts rgb() and #xxx to #xxxxxx format,
13
+ // returns self (or first argument) if not convertable
14
+ String.prototype.parseColor = function() {
15
15
  var color = '#';
16
- if (this.slice(0,4) == 'rgb(') {
17
- var cols = this.slice(4,this.length-1).split(',');
18
- var i=0; do { color += parseInt(cols[i]).toColorPart() } while (++i<3);
19
- } else {
20
- if (this.slice(0,1) == '#') {
21
- if (this.length==4) for(var i=1;i<4;i++) color += (this.charAt(i) + this.charAt(i)).toLowerCase();
22
- if (this.length==7) color = this.toLowerCase();
23
- }
24
- }
25
- return (color.length==7 ? color : (arguments[0] || this));
16
+ if (this.slice(0,4) == 'rgb(') {
17
+ var cols = this.slice(4,this.length-1).split(',');
18
+ var i=0; do { color += parseInt(cols[i]).toColorPart() } while (++i<3);
19
+ } else {
20
+ if (this.slice(0,1) == '#') {
21
+ if (this.length==4) for(var i=1;i<4;i++) color += (this.charAt(i) + this.charAt(i)).toLowerCase();
22
+ if (this.length==7) color = this.toLowerCase();
23
+ }
24
+ }
25
+ return (color.length==7 ? color : (arguments[0] || this));
26
26
  };
27
27
 
28
28
  /*--------------------------------------------------------------------------*/
29
29
 
30
- Element.collectTextNodes = function(element) {
30
+ Element.collectTextNodes = function(element) {
31
31
  return $A($(element).childNodes).collect( function(node) {
32
- return (node.nodeType==3 ? node.nodeValue :
32
+ return (node.nodeType==3 ? node.nodeValue :
33
33
  (node.hasChildNodes() ? Element.collectTextNodes(node) : ''));
34
34
  }).flatten().join('');
35
35
  };
36
36
 
37
- Element.collectTextNodesIgnoreClass = function(element, className) {
37
+ Element.collectTextNodesIgnoreClass = function(element, className) {
38
38
  return $A($(element).childNodes).collect( function(node) {
39
- return (node.nodeType==3 ? node.nodeValue :
40
- ((node.hasChildNodes() && !Element.hasClassName(node,className)) ?
39
+ return (node.nodeType==3 ? node.nodeValue :
40
+ ((node.hasChildNodes() && !Element.hasClassName(node,className)) ?
41
41
  Element.collectTextNodesIgnoreClass(node, className) : ''));
42
42
  }).flatten().join('');
43
43
  };
44
44
 
45
45
  Element.setContentZoom = function(element, percent) {
46
- element = $(element);
47
- element.setStyle({fontSize: (percent/100) + 'em'});
46
+ element = $(element);
47
+ element.setStyle({fontSize: (percent/100) + 'em'});
48
48
  if (Prototype.Browser.WebKit) window.scrollBy(0,0);
49
49
  return element;
50
50
  };
@@ -72,28 +72,23 @@ var Effect = {
72
72
  Transitions: {
73
73
  linear: Prototype.K,
74
74
  sinoidal: function(pos) {
75
- return (-Math.cos(pos*Math.PI)/2) + 0.5;
75
+ return (-Math.cos(pos*Math.PI)/2) + .5;
76
76
  },
77
77
  reverse: function(pos) {
78
78
  return 1-pos;
79
79
  },
80
80
  flicker: function(pos) {
81
- var pos = ((-Math.cos(pos*Math.PI)/4) + 0.75) + Math.random()/4;
81
+ var pos = ((-Math.cos(pos*Math.PI)/4) + .75) + Math.random()/4;
82
82
  return pos > 1 ? 1 : pos;
83
83
  },
84
84
  wobble: function(pos) {
85
- return (-Math.cos(pos*Math.PI*(9*pos))/2) + 0.5;
85
+ return (-Math.cos(pos*Math.PI*(9*pos))/2) + .5;
86
86
  },
87
- pulse: function(pos, pulses) {
88
- pulses = pulses || 5;
89
- return (
90
- ((pos % (1/pulses)) * pulses).round() == 0 ?
91
- ((pos * pulses * 2) - (pos * pulses * 2).floor()) :
92
- 1 - ((pos * pulses * 2) - (pos * pulses * 2).floor())
93
- );
87
+ pulse: function(pos, pulses) {
88
+ return (-Math.cos((pos*((pulses||5)-.5)*2)*Math.PI)/2) + .5;
94
89
  },
95
- spring: function(pos) {
96
- return 1 - (Math.cos(pos * 4.5 * Math.PI) * Math.exp(-pos * 6));
90
+ spring: function(pos) {
91
+ return 1 - (Math.cos(pos * 4.5 * Math.PI) * Math.exp(-pos * 6));
97
92
  },
98
93
  none: function(pos) {
99
94
  return 0;
@@ -114,14 +109,14 @@ var Effect = {
114
109
  tagifyText: function(element) {
115
110
  var tagifyStyle = 'position:relative';
116
111
  if (Prototype.Browser.IE) tagifyStyle += ';zoom:1';
117
-
112
+
118
113
  element = $(element);
119
114
  $A(element.childNodes).each( function(child) {
120
115
  if (child.nodeType==3) {
121
116
  child.nodeValue.toArray().each( function(character) {
122
117
  element.insertBefore(
123
118
  new Element('span', {style: tagifyStyle}).update(
124
- character == ' ' ? String.fromCharCode(160) : character),
119
+ character == ' ' ? String.fromCharCode(160) : character),
125
120
  child);
126
121
  });
127
122
  Element.remove(child);
@@ -130,13 +125,13 @@ var Effect = {
130
125
  },
131
126
  multiple: function(element, effect) {
132
127
  var elements;
133
- if (((typeof element == 'object') ||
134
- Object.isFunction(element)) &&
128
+ if (((typeof element == 'object') ||
129
+ Object.isFunction(element)) &&
135
130
  (element.length))
136
131
  elements = element;
137
132
  else
138
133
  elements = $(element).childNodes;
139
-
134
+
140
135
  var options = Object.extend({
141
136
  speed: 0.1,
142
137
  delay: 0.0
@@ -158,7 +153,7 @@ var Effect = {
158
153
  var options = Object.extend({
159
154
  queue: { position:'end', scope:(element.id || 'global'), limit: 1 }
160
155
  }, arguments[2] || { });
161
- Effect[element.visible() ?
156
+ Effect[element.visible() ?
162
157
  Effect.PAIRS[effect][1] : Effect.PAIRS[effect][0]](element, options);
163
158
  }
164
159
  };
@@ -170,20 +165,20 @@ Effect.DefaultOptions.transition = Effect.Transitions.sinoidal;
170
165
  Effect.ScopedQueue = Class.create(Enumerable, {
171
166
  initialize: function() {
172
167
  this.effects = [];
173
- this.interval = null;
168
+ this.interval = null;
174
169
  },
175
170
  _each: function(iterator) {
176
171
  this.effects._each(iterator);
177
172
  },
178
173
  add: function(effect) {
179
174
  var timestamp = new Date().getTime();
180
-
181
- var position = Object.isString(effect.options.queue) ?
175
+
176
+ var position = Object.isString(effect.options.queue) ?
182
177
  effect.options.queue : effect.options.queue.position;
183
-
178
+
184
179
  switch(position) {
185
180
  case 'front':
186
- // move unstarted effects after this effect
181
+ // move unstarted effects after this effect
187
182
  this.effects.findAll(function(e){ return e.state=='idle' }).each( function(e) {
188
183
  e.startOn += effect.finishOn;
189
184
  e.finishOn += effect.finishOn;
@@ -197,13 +192,13 @@ Effect.ScopedQueue = Class.create(Enumerable, {
197
192
  timestamp = this.effects.pluck('finishOn').max() || timestamp;
198
193
  break;
199
194
  }
200
-
195
+
201
196
  effect.startOn += timestamp;
202
197
  effect.finishOn += timestamp;
203
198
 
204
199
  if (!effect.options.queue.limit || (this.effects.length < effect.options.queue.limit))
205
200
  this.effects.push(effect);
206
-
201
+
207
202
  if (!this.interval)
208
203
  this.interval = setInterval(this.loop.bind(this), 15);
209
204
  },
@@ -216,7 +211,7 @@ Effect.ScopedQueue = Class.create(Enumerable, {
216
211
  },
217
212
  loop: function() {
218
213
  var timePos = new Date().getTime();
219
- for(var i=0, len=this.effects.length;i<len;i++)
214
+ for(var i=0, len=this.effects.length;i<len;i++)
220
215
  this.effects[i] && this.effects[i].loop(timePos);
221
216
  }
222
217
  });
@@ -225,7 +220,7 @@ Effect.Queues = {
225
220
  instances: $H(),
226
221
  get: function(queueName) {
227
222
  if (!Object.isString(queueName)) return queueName;
228
-
223
+
229
224
  return this.instances.get(queueName) ||
230
225
  this.instances.set(queueName, new Effect.ScopedQueue());
231
226
  }
@@ -250,23 +245,35 @@ Effect.Base = Class.create({
250
245
  this.fromToDelta = this.options.to-this.options.from;
251
246
  this.totalTime = this.finishOn-this.startOn;
252
247
  this.totalFrames = this.options.fps*this.options.duration;
253
-
254
- eval('this.render = function(pos){ '+
255
- 'if (this.state=="idle"){this.state="running";'+
256
- codeForEvent(this.options,'beforeSetup')+
257
- (this.setup ? 'this.setup();':'')+
258
- codeForEvent(this.options,'afterSetup')+
259
- '};if (this.state=="running"){'+
260
- 'pos=this.options.transition(pos)*'+this.fromToDelta+'+'+this.options.from+';'+
261
- 'this.position=pos;'+
262
- codeForEvent(this.options,'beforeUpdate')+
263
- (this.update ? 'this.update(pos);':'')+
264
- codeForEvent(this.options,'afterUpdate')+
265
- '}}');
266
-
248
+
249
+ this.render = (function() {
250
+ function dispatch(effect, eventName) {
251
+ if (effect.options[eventName + 'Internal'])
252
+ effect.options[eventName + 'Internal'](effect);
253
+ if (effect.options[eventName])
254
+ effect.options[eventName](effect);
255
+ }
256
+
257
+ return function(pos) {
258
+ if (this.state === "idle") {
259
+ this.state = "running";
260
+ dispatch(this, 'beforeSetup');
261
+ if (this.setup) this.setup();
262
+ dispatch(this, 'afterSetup');
263
+ }
264
+ if (this.state === "running") {
265
+ pos = (this.options.transition(pos) * this.fromToDelta) + this.options.from;
266
+ this.position = pos;
267
+ dispatch(this, 'beforeUpdate');
268
+ if (this.update) this.update(pos);
269
+ dispatch(this, 'afterUpdate');
270
+ }
271
+ };
272
+ })();
273
+
267
274
  this.event('beforeStart');
268
275
  if (!this.options.sync)
269
- Effect.Queues.get(Object.isString(this.options.queue) ?
276
+ Effect.Queues.get(Object.isString(this.options.queue) ?
270
277
  'global' : this.options.queue.scope).add(this);
271
278
  },
272
279
  loop: function(timePos) {
@@ -275,9 +282,9 @@ Effect.Base = Class.create({
275
282
  this.render(1.0);
276
283
  this.cancel();
277
284
  this.event('beforeFinish');
278
- if (this.finish) this.finish();
285
+ if (this.finish) this.finish();
279
286
  this.event('afterFinish');
280
- return;
287
+ return;
281
288
  }
282
289
  var pos = (timePos - this.startOn) / this.totalTime,
283
290
  frame = (pos * this.totalFrames).round();
@@ -289,7 +296,7 @@ Effect.Base = Class.create({
289
296
  },
290
297
  cancel: function() {
291
298
  if (!this.options.sync)
292
- Effect.Queues.get(Object.isString(this.options.queue) ?
299
+ Effect.Queues.get(Object.isString(this.options.queue) ?
293
300
  'global' : this.options.queue.scope).remove(this);
294
301
  this.state = 'finished';
295
302
  },
@@ -327,10 +334,10 @@ Effect.Parallel = Class.create(Effect.Base, {
327
334
  Effect.Tween = Class.create(Effect.Base, {
328
335
  initialize: function(object, from, to) {
329
336
  object = Object.isString(object) ? $(object) : object;
330
- var args = $A(arguments), method = args.last(),
337
+ var args = $A(arguments), method = args.last(),
331
338
  options = args.length == 5 ? args[3] : null;
332
339
  this.method = Object.isFunction(method) ? method.bind(object) :
333
- Object.isFunction(object[method]) ? object[method].bind(object) :
340
+ Object.isFunction(object[method]) ? object[method].bind(object) :
334
341
  function(value) { object[method] = value };
335
342
  this.start(Object.extend({ from: from, to: to }, options || { }));
336
343
  },
@@ -394,7 +401,7 @@ Effect.Move = Class.create(Effect.Base, {
394
401
 
395
402
  // for backwards compatibility
396
403
  Effect.MoveBy = function(element, toTop, toLeft) {
397
- return new Effect.Move(element,
404
+ return new Effect.Move(element,
398
405
  Object.extend({ x: toLeft, y: toTop }, arguments[3] || { }));
399
406
  };
400
407
 
@@ -416,15 +423,15 @@ Effect.Scale = Class.create(Effect.Base, {
416
423
  setup: function() {
417
424
  this.restoreAfterFinish = this.options.restoreAfterFinish || false;
418
425
  this.elementPositioning = this.element.getStyle('position');
419
-
426
+
420
427
  this.originalStyle = { };
421
428
  ['top','left','width','height','fontSize'].each( function(k) {
422
429
  this.originalStyle[k] = this.element.style[k];
423
430
  }.bind(this));
424
-
431
+
425
432
  this.originalTop = this.element.offsetTop;
426
433
  this.originalLeft = this.element.offsetLeft;
427
-
434
+
428
435
  var fontSize = this.element.getStyle('font-size') || '100%';
429
436
  ['em','px','%','pt'].each( function(fontSizeType) {
430
437
  if (fontSize.indexOf(fontSizeType)>0) {
@@ -432,9 +439,9 @@ Effect.Scale = Class.create(Effect.Base, {
432
439
  this.fontSizeType = fontSizeType;
433
440
  }
434
441
  }.bind(this));
435
-
442
+
436
443
  this.factor = (this.options.scaleTo - this.options.scaleFrom)/100;
437
-
444
+
438
445
  this.dims = null;
439
446
  if (this.options.scaleMode=='box')
440
447
  this.dims = [this.element.offsetHeight, this.element.offsetWidth];
@@ -509,17 +516,16 @@ Effect.Highlight = Class.create(Effect.Base, {
509
516
 
510
517
  Effect.ScrollTo = function(element) {
511
518
  var options = arguments[1] || { },
512
- scrollOffsets = document.viewport.getScrollOffsets(),
513
- elementOffsets = $(element).cumulativeOffset(),
514
- max = (window.height || document.body.scrollHeight) - document.viewport.getHeight();
519
+ scrollOffsets = document.viewport.getScrollOffsets(),
520
+ elementOffsets = $(element).cumulativeOffset();
515
521
 
516
522
  if (options.offset) elementOffsets[1] += options.offset;
517
523
 
518
524
  return new Effect.Tween(null,
519
525
  scrollOffsets.top,
520
- elementOffsets[1] > max ? max : elementOffsets[1],
526
+ elementOffsets[1],
521
527
  options,
522
- function(p){ scrollTo(scrollOffsets.left, p.round()) }
528
+ function(p){ scrollTo(scrollOffsets.left, p.round()); }
523
529
  );
524
530
  };
525
531
 
@@ -531,9 +537,9 @@ Effect.Fade = function(element) {
531
537
  var options = Object.extend({
532
538
  from: element.getOpacity() || 1.0,
533
539
  to: 0.0,
534
- afterFinishInternal: function(effect) {
540
+ afterFinishInternal: function(effect) {
535
541
  if (effect.options.to!=0) return;
536
- effect.element.hide().setStyle({opacity: oldOpacity});
542
+ effect.element.hide().setStyle({opacity: oldOpacity});
537
543
  }
538
544
  }, arguments[1] || { });
539
545
  return new Effect.Opacity(element,options);
@@ -549,15 +555,15 @@ Effect.Appear = function(element) {
549
555
  effect.element.forceRerendering();
550
556
  },
551
557
  beforeSetup: function(effect) {
552
- effect.element.setOpacity(effect.options.from).show();
558
+ effect.element.setOpacity(effect.options.from).show();
553
559
  }}, arguments[1] || { });
554
560
  return new Effect.Opacity(element,options);
555
561
  };
556
562
 
557
563
  Effect.Puff = function(element) {
558
564
  element = $(element);
559
- var oldStyle = {
560
- opacity: element.getInlineOpacity(),
565
+ var oldStyle = {
566
+ opacity: element.getInlineOpacity(),
561
567
  position: element.getStyle('position'),
562
568
  top: element.style.top,
563
569
  left: element.style.left,
@@ -565,12 +571,12 @@ Effect.Puff = function(element) {
565
571
  height: element.style.height
566
572
  };
567
573
  return new Effect.Parallel(
568
- [ new Effect.Scale(element, 200,
569
- { sync: true, scaleFromCenter: true, scaleContent: true, restoreAfterFinish: true }),
570
- new Effect.Opacity(element, { sync: true, to: 0.0 } ) ],
571
- Object.extend({ duration: 1.0,
574
+ [ new Effect.Scale(element, 200,
575
+ { sync: true, scaleFromCenter: true, scaleContent: true, restoreAfterFinish: true }),
576
+ new Effect.Opacity(element, { sync: true, to: 0.0 } ) ],
577
+ Object.extend({ duration: 1.0,
572
578
  beforeSetupInternal: function(effect) {
573
- Position.absolutize(effect.effects[0].element)
579
+ Position.absolutize(effect.effects[0].element);
574
580
  },
575
581
  afterFinishInternal: function(effect) {
576
582
  effect.effects[0].element.hide().setStyle(oldStyle); }
@@ -582,12 +588,12 @@ Effect.BlindUp = function(element) {
582
588
  element = $(element);
583
589
  element.makeClipping();
584
590
  return new Effect.Scale(element, 0,
585
- Object.extend({ scaleContent: false,
586
- scaleX: false,
591
+ Object.extend({ scaleContent: false,
592
+ scaleX: false,
587
593
  restoreAfterFinish: true,
588
594
  afterFinishInternal: function(effect) {
589
595
  effect.element.hide().undoClipping();
590
- }
596
+ }
591
597
  }, arguments[1] || { })
592
598
  );
593
599
  };
@@ -595,15 +601,15 @@ Effect.BlindUp = function(element) {
595
601
  Effect.BlindDown = function(element) {
596
602
  element = $(element);
597
603
  var elementDimensions = element.getDimensions();
598
- return new Effect.Scale(element, 100, Object.extend({
599
- scaleContent: false,
604
+ return new Effect.Scale(element, 100, Object.extend({
605
+ scaleContent: false,
600
606
  scaleX: false,
601
607
  scaleFrom: 0,
602
608
  scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width},
603
609
  restoreAfterFinish: true,
604
610
  afterSetup: function(effect) {
605
- effect.element.makeClipping().setStyle({height: '0px'}).show();
606
- },
611
+ effect.element.makeClipping().setStyle({height: '0px'}).show();
612
+ },
607
613
  afterFinishInternal: function(effect) {
608
614
  effect.element.undoClipping();
609
615
  }
@@ -618,16 +624,16 @@ Effect.SwitchOff = function(element) {
618
624
  from: 0,
619
625
  transition: Effect.Transitions.flicker,
620
626
  afterFinishInternal: function(effect) {
621
- new Effect.Scale(effect.element, 1, {
627
+ new Effect.Scale(effect.element, 1, {
622
628
  duration: 0.3, scaleFromCenter: true,
623
629
  scaleX: false, scaleContent: false, restoreAfterFinish: true,
624
- beforeSetup: function(effect) {
630
+ beforeSetup: function(effect) {
625
631
  effect.element.makePositioned().makeClipping();
626
632
  },
627
633
  afterFinishInternal: function(effect) {
628
634
  effect.element.hide().undoClipping().undoPositioned().setStyle({opacity: oldOpacity});
629
635
  }
630
- })
636
+ });
631
637
  }
632
638
  }, arguments[1] || { }));
633
639
  };
@@ -639,16 +645,16 @@ Effect.DropOut = function(element) {
639
645
  left: element.getStyle('left'),
640
646
  opacity: element.getInlineOpacity() };
641
647
  return new Effect.Parallel(
642
- [ new Effect.Move(element, {x: 0, y: 100, sync: true }),
648
+ [ new Effect.Move(element, {x: 0, y: 100, sync: true }),
643
649
  new Effect.Opacity(element, { sync: true, to: 0.0 }) ],
644
650
  Object.extend(
645
651
  { duration: 0.5,
646
652
  beforeSetup: function(effect) {
647
- effect.effects[0].element.makePositioned();
653
+ effect.effects[0].element.makePositioned();
648
654
  },
649
655
  afterFinishInternal: function(effect) {
650
656
  effect.effects[0].element.hide().undoPositioned().setStyle(oldStyle);
651
- }
657
+ }
652
658
  }, arguments[1] || { }));
653
659
  };
654
660
 
@@ -676,7 +682,7 @@ Effect.Shake = function(element) {
676
682
  new Effect.Move(effect.element,
677
683
  { x: -distance, y: 0, duration: split, afterFinishInternal: function(effect) {
678
684
  effect.element.undoPositioned().setStyle(oldStyle);
679
- }}) }}) }}) }}) }}) }});
685
+ }}); }}); }}); }}); }}); }});
680
686
  };
681
687
 
682
688
  Effect.SlideDown = function(element) {
@@ -684,9 +690,9 @@ Effect.SlideDown = function(element) {
684
690
  // SlideDown need to have the content of the element wrapped in a container element with fixed height!
685
691
  var oldInnerBottom = element.down().getStyle('bottom');
686
692
  var elementDimensions = element.getDimensions();
687
- return new Effect.Scale(element, 100, Object.extend({
688
- scaleContent: false,
689
- scaleX: false,
693
+ return new Effect.Scale(element, 100, Object.extend({
694
+ scaleContent: false,
695
+ scaleX: false,
690
696
  scaleFrom: window.opera ? 0 : 1,
691
697
  scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width},
692
698
  restoreAfterFinish: true,
@@ -694,11 +700,11 @@ Effect.SlideDown = function(element) {
694
700
  effect.element.makePositioned();
695
701
  effect.element.down().makePositioned();
696
702
  if (window.opera) effect.element.setStyle({top: ''});
697
- effect.element.makeClipping().setStyle({height: '0px'}).show();
703
+ effect.element.makeClipping().setStyle({height: '0px'}).show();
698
704
  },
699
705
  afterUpdateInternal: function(effect) {
700
706
  effect.element.down().setStyle({bottom:
701
- (effect.dims[0] - effect.element.clientHeight) + 'px' });
707
+ (effect.dims[0] - effect.element.clientHeight) + 'px' });
702
708
  },
703
709
  afterFinishInternal: function(effect) {
704
710
  effect.element.undoClipping().undoPositioned();
@@ -712,8 +718,8 @@ Effect.SlideUp = function(element) {
712
718
  var oldInnerBottom = element.down().getStyle('bottom');
713
719
  var elementDimensions = element.getDimensions();
714
720
  return new Effect.Scale(element, window.opera ? 0 : 1,
715
- Object.extend({ scaleContent: false,
716
- scaleX: false,
721
+ Object.extend({ scaleContent: false,
722
+ scaleX: false,
717
723
  scaleMode: 'box',
718
724
  scaleFrom: 100,
719
725
  scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width},
@@ -723,7 +729,7 @@ Effect.SlideUp = function(element) {
723
729
  effect.element.down().makePositioned();
724
730
  if (window.opera) effect.element.setStyle({top: ''});
725
731
  effect.element.makeClipping().show();
726
- },
732
+ },
727
733
  afterUpdateInternal: function(effect) {
728
734
  effect.element.down().setStyle({bottom:
729
735
  (effect.dims[0] - effect.element.clientHeight) + 'px' });
@@ -736,15 +742,15 @@ Effect.SlideUp = function(element) {
736
742
  );
737
743
  };
738
744
 
739
- // Bug in opera makes the TD containing this element expand for a instance after finish
745
+ // Bug in opera makes the TD containing this element expand for a instance after finish
740
746
  Effect.Squish = function(element) {
741
- return new Effect.Scale(element, window.opera ? 1 : 0, {
747
+ return new Effect.Scale(element, window.opera ? 1 : 0, {
742
748
  restoreAfterFinish: true,
743
749
  beforeSetup: function(effect) {
744
- effect.element.makeClipping();
745
- },
750
+ effect.element.makeClipping();
751
+ },
746
752
  afterFinishInternal: function(effect) {
747
- effect.element.hide().undoClipping();
753
+ effect.element.hide().undoClipping();
748
754
  }
749
755
  });
750
756
  };
@@ -764,13 +770,13 @@ Effect.Grow = function(element) {
764
770
  width: element.style.width,
765
771
  opacity: element.getInlineOpacity() };
766
772
 
767
- var dims = element.getDimensions();
773
+ var dims = element.getDimensions();
768
774
  var initialMoveX, initialMoveY;
769
775
  var moveX, moveY;
770
-
776
+
771
777
  switch (options.direction) {
772
778
  case 'top-left':
773
- initialMoveX = initialMoveY = moveX = moveY = 0;
779
+ initialMoveX = initialMoveY = moveX = moveY = 0;
774
780
  break;
775
781
  case 'top-right':
776
782
  initialMoveX = dims.width;
@@ -795,11 +801,11 @@ Effect.Grow = function(element) {
795
801
  moveY = -dims.height / 2;
796
802
  break;
797
803
  }
798
-
804
+
799
805
  return new Effect.Move(element, {
800
806
  x: initialMoveX,
801
807
  y: initialMoveY,
802
- duration: 0.01,
808
+ duration: 0.01,
803
809
  beforeSetup: function(effect) {
804
810
  effect.element.hide().makeClipping().makePositioned();
805
811
  },
@@ -808,17 +814,17 @@ Effect.Grow = function(element) {
808
814
  [ new Effect.Opacity(effect.element, { sync: true, to: 1.0, from: 0.0, transition: options.opacityTransition }),
809
815
  new Effect.Move(effect.element, { x: moveX, y: moveY, sync: true, transition: options.moveTransition }),
810
816
  new Effect.Scale(effect.element, 100, {
811
- scaleMode: { originalHeight: dims.height, originalWidth: dims.width },
817
+ scaleMode: { originalHeight: dims.height, originalWidth: dims.width },
812
818
  sync: true, scaleFrom: window.opera ? 1 : 0, transition: options.scaleTransition, restoreAfterFinish: true})
813
819
  ], Object.extend({
814
820
  beforeSetup: function(effect) {
815
- effect.effects[0].element.setStyle({height: '0px'}).show();
821
+ effect.effects[0].element.setStyle({height: '0px'}).show();
816
822
  },
817
823
  afterFinishInternal: function(effect) {
818
- effect.effects[0].element.undoClipping().undoPositioned().setStyle(oldStyle);
824
+ effect.effects[0].element.undoClipping().undoPositioned().setStyle(oldStyle);
819
825
  }
820
826
  }, options)
821
- )
827
+ );
822
828
  }
823
829
  });
824
830
  };
@@ -840,7 +846,7 @@ Effect.Shrink = function(element) {
840
846
 
841
847
  var dims = element.getDimensions();
842
848
  var moveX, moveY;
843
-
849
+
844
850
  switch (options.direction) {
845
851
  case 'top-left':
846
852
  moveX = moveY = 0;
@@ -857,19 +863,19 @@ Effect.Shrink = function(element) {
857
863
  moveX = dims.width;
858
864
  moveY = dims.height;
859
865
  break;
860
- case 'center':
866
+ case 'center':
861
867
  moveX = dims.width / 2;
862
868
  moveY = dims.height / 2;
863
869
  break;
864
870
  }
865
-
871
+
866
872
  return new Effect.Parallel(
867
873
  [ new Effect.Opacity(element, { sync: true, to: 0.0, from: 1.0, transition: options.opacityTransition }),
868
874
  new Effect.Scale(element, window.opera ? 1 : 0, { sync: true, transition: options.scaleTransition, restoreAfterFinish: true}),
869
875
  new Effect.Move(element, { x: moveX, y: moveY, sync: true, transition: options.moveTransition })
870
- ], Object.extend({
876
+ ], Object.extend({
871
877
  beforeStartInternal: function(effect) {
872
- effect.effects[0].element.makePositioned().makeClipping();
878
+ effect.effects[0].element.makePositioned().makeClipping();
873
879
  },
874
880
  afterFinishInternal: function(effect) {
875
881
  effect.effects[0].element.hide().undoClipping().undoPositioned().setStyle(oldStyle); }
@@ -879,12 +885,14 @@ Effect.Shrink = function(element) {
879
885
 
880
886
  Effect.Pulsate = function(element) {
881
887
  element = $(element);
882
- var options = arguments[1] || { };
883
- var oldOpacity = element.getInlineOpacity();
884
- var transition = options.transition || Effect.Transitions.sinoidal;
885
- var reverser = function(pos){ return transition(1-Effect.Transitions.pulse(pos, options.pulses)) };
886
- reverser.bind(transition);
887
- return new Effect.Opacity(element,
888
+ var options = arguments[1] || { },
889
+ oldOpacity = element.getInlineOpacity(),
890
+ transition = options.transition || Effect.Transitions.linear,
891
+ reverser = function(pos){
892
+ return 1 - transition((-Math.cos((pos*(options.pulses||5)*2)*Math.PI)/2) + .5);
893
+ };
894
+
895
+ return new Effect.Opacity(element,
888
896
  Object.extend(Object.extend({ duration: 2.0, from: 0,
889
897
  afterFinishInternal: function(effect) { effect.element.setStyle({opacity: oldOpacity}); }
890
898
  }, options), {transition: reverser}));
@@ -898,12 +906,12 @@ Effect.Fold = function(element) {
898
906
  width: element.style.width,
899
907
  height: element.style.height };
900
908
  element.makeClipping();
901
- return new Effect.Scale(element, 5, Object.extend({
909
+ return new Effect.Scale(element, 5, Object.extend({
902
910
  scaleContent: false,
903
911
  scaleX: false,
904
912
  afterFinishInternal: function(effect) {
905
- new Effect.Scale(element, 1, {
906
- scaleContent: false,
913
+ new Effect.Scale(element, 1, {
914
+ scaleContent: false,
907
915
  scaleY: false,
908
916
  afterFinishInternal: function(effect) {
909
917
  effect.element.hide().undoClipping().setStyle(oldStyle);
@@ -918,7 +926,7 @@ Effect.Morph = Class.create(Effect.Base, {
918
926
  var options = Object.extend({
919
927
  style: { }
920
928
  }, arguments[1] || { });
921
-
929
+
922
930
  if (!Object.isString(options.style)) this.style = $H(options.style);
923
931
  else {
924
932
  if (options.style.include(':'))
@@ -936,18 +944,18 @@ Effect.Morph = Class.create(Effect.Base, {
936
944
  effect.transforms.each(function(transform) {
937
945
  effect.element.style[transform.style] = '';
938
946
  });
939
- }
947
+ };
940
948
  }
941
949
  }
942
950
  this.start(options);
943
951
  },
944
-
952
+
945
953
  setup: function(){
946
954
  function parseColor(color){
947
955
  if (!color || ['rgba(0, 0, 0, 0)','transparent'].include(color)) color = '#ffffff';
948
956
  color = color.parseColor();
949
957
  return $R(0,2).map(function(i){
950
- return parseInt( color.slice(i*2+1,i*2+3), 16 )
958
+ return parseInt( color.slice(i*2+1,i*2+3), 16 );
951
959
  });
952
960
  }
953
961
  this.transforms = this.style.map(function(pair){
@@ -967,9 +975,9 @@ Effect.Morph = Class.create(Effect.Base, {
967
975
  }
968
976
 
969
977
  var originalValue = this.element.getStyle(property);
970
- return {
971
- style: property.camelize(),
972
- originalValue: unit=='color' ? parseColor(originalValue) : parseFloat(originalValue || 0),
978
+ return {
979
+ style: property.camelize(),
980
+ originalValue: unit=='color' ? parseColor(originalValue) : parseFloat(originalValue || 0),
973
981
  targetValue: unit=='color' ? parseColor(value) : value,
974
982
  unit: unit
975
983
  };
@@ -980,13 +988,13 @@ Effect.Morph = Class.create(Effect.Base, {
980
988
  transform.unit != 'color' &&
981
989
  (isNaN(transform.originalValue) || isNaN(transform.targetValue))
982
990
  )
983
- )
991
+ );
984
992
  });
985
993
  },
986
994
  update: function(position) {
987
995
  var style = { }, transform, i = this.transforms.length;
988
996
  while(i--)
989
- style[(transform = this.transforms[i]).style] =
997
+ style[(transform = this.transforms[i]).style] =
990
998
  transform.unit=='color' ? '#'+
991
999
  (Math.round(transform.originalValue[0]+
992
1000
  (transform.targetValue[0]-transform.originalValue[0])*position)).toColorPart() +
@@ -995,7 +1003,7 @@ Effect.Morph = Class.create(Effect.Base, {
995
1003
  (Math.round(transform.originalValue[2]+
996
1004
  (transform.targetValue[2]-transform.originalValue[2])*position)).toColorPart() :
997
1005
  (transform.originalValue +
998
- (transform.targetValue - transform.originalValue) * position).toFixed(3) +
1006
+ (transform.targetValue - transform.originalValue) * position).toFixed(3) +
999
1007
  (transform.unit === null ? '' : transform.unit);
1000
1008
  this.element.setStyle(style, true);
1001
1009
  }
@@ -1032,7 +1040,7 @@ Effect.Transform = Class.create({
1032
1040
  });
1033
1041
 
1034
1042
  Element.CSS_PROPERTIES = $w(
1035
- 'backgroundColor backgroundPosition borderBottomColor borderBottomStyle ' +
1043
+ 'backgroundColor backgroundPosition borderBottomColor borderBottomStyle ' +
1036
1044
  'borderBottomWidth borderLeftColor borderLeftStyle borderLeftWidth ' +
1037
1045
  'borderRightColor borderRightStyle borderRightWidth borderSpacing ' +
1038
1046
  'borderTopColor borderTopStyle borderTopWidth bottom clip color ' +
@@ -1041,7 +1049,7 @@ Element.CSS_PROPERTIES = $w(
1041
1049
  'maxWidth minHeight minWidth opacity outlineColor outlineOffset ' +
1042
1050
  'outlineWidth paddingBottom paddingLeft paddingRight paddingTop ' +
1043
1051
  'right textIndent top width wordSpacing zIndex');
1044
-
1052
+
1045
1053
  Element.CSS_LENGTH = /^(([\+\-]?[0-9\.]+)(em|ex|px|in|cm|mm|pt|pc|\%))|0$/;
1046
1054
 
1047
1055
  String.__parseStyleElement = document.createElement('div');
@@ -1053,11 +1061,11 @@ String.prototype.parseStyle = function(){
1053
1061
  String.__parseStyleElement.innerHTML = '<div style="' + this + '"></div>';
1054
1062
  style = String.__parseStyleElement.childNodes[0].style;
1055
1063
  }
1056
-
1064
+
1057
1065
  Element.CSS_PROPERTIES.each(function(property){
1058
- if (style[property]) styleRules.set(property, style[property]);
1066
+ if (style[property]) styleRules.set(property, style[property]);
1059
1067
  });
1060
-
1068
+
1061
1069
  if (Prototype.Browser.IE && this.include('opacity'))
1062
1070
  styleRules.set('opacity', this.match(/opacity:\s*((?:0|1)?(?:\.\d*)?)/)[1]);
1063
1071
 
@@ -1083,7 +1091,7 @@ if (document.defaultView && document.defaultView.getComputedStyle) {
1083
1091
  if (!styles.opacity) styles.opacity = element.getOpacity();
1084
1092
  return styles;
1085
1093
  };
1086
- };
1094
+ }
1087
1095
 
1088
1096
  Effect.Methods = {
1089
1097
  morph: function(element, style) {
@@ -1092,7 +1100,7 @@ Effect.Methods = {
1092
1100
  return element;
1093
1101
  },
1094
1102
  visualEffect: function(element, effect, options) {
1095
- element = $(element)
1103
+ element = $(element);
1096
1104
  var s = effect.dasherize().camelize(), klass = s.charAt(0).toUpperCase() + s.substring(1);
1097
1105
  new Effect[klass](element, options);
1098
1106
  return element;
@@ -1106,17 +1114,17 @@ Effect.Methods = {
1106
1114
 
1107
1115
  $w('fade appear grow shrink fold blindUp blindDown slideUp slideDown '+
1108
1116
  'pulsate shake puff squish switchOff dropOut').each(
1109
- function(effect) {
1117
+ function(effect) {
1110
1118
  Effect.Methods[effect] = function(element, options){
1111
1119
  element = $(element);
1112
1120
  Effect[effect.charAt(0).toUpperCase() + effect.substring(1)](element, options);
1113
1121
  return element;
1114
- }
1122
+ };
1115
1123
  }
1116
1124
  );
1117
1125
 
1118
- $w('getInlineOpacity forceRerendering setContentZoom collectTextNodes collectTextNodesIgnoreClass getStyles').each(
1126
+ $w('getInlineOpacity forceRerendering setContentZoom collectTextNodes collectTextNodesIgnoreClass getStyles').each(
1119
1127
  function(f) { Effect.Methods[f] = Element[f]; }
1120
1128
  );
1121
1129
 
1122
- Element.addMethods(Effect.Methods);
1130
+ Element.addMethods(Effect.Methods);