gettext 1.2.0-mswin32 → 1.3.0-mswin32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/ChangeLog +74 -0
- data/NEWS +16 -0
- data/README +9 -9
- data/data/locale/cs/LC_MESSAGES/rails.mo +0 -0
- data/data/locale/cs/LC_MESSAGES/rgettext.mo +0 -0
- data/data/locale/de/LC_MESSAGES/rails.mo +0 -0
- data/data/locale/de/LC_MESSAGES/rgettext.mo +0 -0
- data/data/locale/el/LC_MESSAGES/rails.mo +0 -0
- data/data/locale/el/LC_MESSAGES/rgettext.mo +0 -0
- data/data/locale/es/LC_MESSAGES/rails.mo +0 -0
- data/data/locale/es/LC_MESSAGES/rgettext.mo +0 -0
- data/data/locale/fr/LC_MESSAGES/rails.mo +0 -0
- data/data/locale/fr/LC_MESSAGES/rgettext.mo +0 -0
- data/data/locale/it/LC_MESSAGES/rgettext.mo +0 -0
- data/data/locale/ja/LC_MESSAGES/rails.mo +0 -0
- data/data/locale/ja/LC_MESSAGES/rgettext.mo +0 -0
- data/data/locale/ko/LC_MESSAGES/rails.mo +0 -0
- data/data/locale/ko/LC_MESSAGES/rgettext.mo +0 -0
- data/data/locale/nl/LC_MESSAGES/rails.mo +0 -0
- data/data/locale/nl/LC_MESSAGES/rgettext.mo +0 -0
- data/data/locale/pt_BR/LC_MESSAGES/rails.mo +0 -0
- data/data/locale/pt_BR/LC_MESSAGES/rgettext.mo +0 -0
- data/data/locale/sv/LC_MESSAGES/rgettext.mo +0 -0
- data/lib/gettext.rb +9 -4
- data/lib/gettext/locale.rb +11 -5
- data/lib/gettext/locale_cgi.rb +2 -5
- data/lib/gettext/locale_object.rb +68 -21
- data/lib/gettext/poparser.rb +2 -2
- data/lib/gettext/rails.rb +150 -30
- data/lib/gettext/version.rb +1 -1
- data/po/cs/rails.po +27 -27
- data/po/cs/rgettext.po +8 -8
- data/po/de/rails.po +28 -28
- data/po/de/rgettext.po +8 -8
- data/po/el/rails.po +25 -25
- data/po/el/rgettext.po +8 -8
- data/po/es/rails.po +25 -25
- data/po/es/rgettext.po +8 -8
- data/po/fr/rails.po +26 -26
- data/po/fr/rgettext.po +8 -8
- data/po/it/rgettext.po +8 -8
- data/po/ja/rails.po +23 -23
- data/po/ja/rgettext.po +8 -8
- data/po/ko/rails.po +23 -23
- data/po/ko/rgettext.po +8 -8
- data/po/nl/rails.po +25 -25
- data/po/nl/rgettext.po +8 -8
- data/po/pt_BR/rails.po +25 -25
- data/po/pt_BR/rgettext.po +8 -8
- data/po/rails.pot +25 -25
- data/po/rgettext.pot +8 -8
- data/po/sv/rgettext.po +8 -8
- data/samples/rails/README +3 -2
- data/samples/rails/Rakefile +6 -217
- data/samples/rails/app/controllers/application.rb +1 -0
- data/samples/rails/app/models/article.rb +7 -16
- data/samples/rails/config/database.yml +2 -1
- data/samples/rails/lib/tasks/gettext.rake +18 -0
- data/samples/rails/locale/ja/LC_MESSAGES/blog.mo +0 -0
- data/samples/rails/po/ja/blog.po +12 -0
- data/samples/rails/public/index.html +15 -17
- data/samples/rails/public/javascripts/controls.js +30 -1
- data/samples/rails/public/javascripts/dragdrop.js +210 -145
- data/samples/rails/public/javascripts/effects.js +261 -399
- data/samples/rails/public/javascripts/prototype.js +131 -72
- data/test/gettext_test.rb +5 -0
- data/test/gettext_test_locale.rb +133 -9
- metadata +5 -4
- data/samples/rails/script/benchmarker +0 -19
- data/samples/rails/script/profiler +0 -34
@@ -11,8 +11,8 @@
|
|
11
11
|
// converts rgb() and #xxx to #xxxxxx format,
|
12
12
|
// returns self (or first argument) if not convertable
|
13
13
|
String.prototype.parseColor = function() {
|
14
|
-
color =
|
15
|
-
if(this.slice(0,4) ==
|
14
|
+
var color = '#';
|
15
|
+
if(this.slice(0,4) == 'rgb(') {
|
16
16
|
var cols = this.slice(4,this.length-1).split(',');
|
17
17
|
var i=0; do { color += parseInt(cols[i]).toColorPart() } while (++i<3);
|
18
18
|
} else {
|
@@ -26,8 +26,8 @@ String.prototype.parseColor = function() {
|
|
26
26
|
|
27
27
|
Element.collectTextNodesIgnoreClass = function(element, ignoreclass) {
|
28
28
|
var children = $(element).childNodes;
|
29
|
-
var text =
|
30
|
-
var classtest = new RegExp(
|
29
|
+
var text = '';
|
30
|
+
var classtest = new RegExp('^([^ ]+ )*' + ignoreclass+ '( [^ ]+)*$','i');
|
31
31
|
|
32
32
|
for (var i = 0; i < children.length; i++) {
|
33
33
|
if(children[i].nodeType==3) {
|
@@ -41,157 +41,70 @@ Element.collectTextNodesIgnoreClass = function(element, ignoreclass) {
|
|
41
41
|
return text;
|
42
42
|
}
|
43
43
|
|
44
|
+
Element.setStyle = function(element, style) {
|
45
|
+
element = $(element);
|
46
|
+
for(k in style) element.style[k.camelize()] = style[k];
|
47
|
+
}
|
48
|
+
|
44
49
|
Element.setContentZoom = function(element, percent) {
|
45
|
-
element
|
46
|
-
element.style.fontSize = (percent/100) + "em";
|
50
|
+
Element.setStyle(element, {fontSize: (percent/100) + 'em'});
|
47
51
|
if(navigator.appVersion.indexOf('AppleWebKit')>0) window.scrollBy(0,0);
|
48
52
|
}
|
49
53
|
|
50
54
|
Element.getOpacity = function(element){
|
51
|
-
var opacity;
|
52
|
-
if (opacity = Element.getStyle(element,
|
55
|
+
var opacity;
|
56
|
+
if (opacity = Element.getStyle(element, 'opacity'))
|
53
57
|
return parseFloat(opacity);
|
54
|
-
if (opacity = (Element.getStyle(element,
|
58
|
+
if (opacity = (Element.getStyle(element, 'filter') || '').match(/alpha\(opacity=(.*)\)/))
|
55
59
|
if(opacity[1]) return parseFloat(opacity[1]) / 100;
|
56
60
|
return 1.0;
|
57
61
|
}
|
58
62
|
|
59
63
|
Element.setOpacity = function(element, value){
|
60
64
|
element= $(element);
|
61
|
-
|
62
|
-
|
63
|
-
|
65
|
+
if (value == 1){
|
66
|
+
Element.setStyle(element, { opacity:
|
67
|
+
(/Gecko/.test(navigator.userAgent) && !/Konqueror|Safari|KHTML/.test(navigator.userAgent)) ?
|
68
|
+
0.999999 : null });
|
64
69
|
if(/MSIE/.test(navigator.userAgent))
|
65
|
-
|
70
|
+
Element.setStyle(element, {filter: Element.getStyle(element,'filter').replace(/alpha\([^\)]*\)/gi,'')});
|
66
71
|
} else {
|
67
72
|
if(value < 0.00001) value = 0;
|
68
|
-
|
73
|
+
Element.setStyle(element, {opacity: value});
|
69
74
|
if(/MSIE/.test(navigator.userAgent))
|
70
|
-
|
71
|
-
|
75
|
+
Element.setStyle(element,
|
76
|
+
{ filter: Element.getStyle(element,'filter').replace(/alpha\([^\)]*\)/gi,'') +
|
77
|
+
'alpha(opacity='+value*100+')' });
|
72
78
|
}
|
73
79
|
}
|
74
80
|
|
75
81
|
Element.getInlineOpacity = function(element){
|
76
|
-
|
77
|
-
var op;
|
78
|
-
op = element.style.opacity;
|
79
|
-
if (typeof op != "undefined" && op != "") return op;
|
80
|
-
return "";
|
82
|
+
return $(element).style.opacity || '';
|
81
83
|
}
|
82
|
-
|
83
|
-
Element.
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
// Element.toggleClass(element, className1, className2) toggles between both classes,
|
94
|
-
// defaulting to className1 if neither exist
|
95
|
-
toggle: function(element, className) {
|
96
|
-
if(Element.Class.has(element, className)) {
|
97
|
-
Element.Class.remove(element, className);
|
98
|
-
if(arguments.length == 3) Element.Class.add(element, arguments[2]);
|
99
|
-
} else {
|
100
|
-
Element.Class.add(element, className);
|
101
|
-
if(arguments.length == 3) Element.Class.remove(element, arguments[2]);
|
102
|
-
}
|
103
|
-
},
|
104
|
-
|
105
|
-
// gets space-delimited classnames of an element as an array
|
106
|
-
get: function(element) {
|
107
|
-
return $(element).className.split(' ');
|
108
|
-
},
|
109
|
-
|
110
|
-
// functions adapted from original functions by Gavin Kistner
|
111
|
-
remove: function(element) {
|
112
|
-
element = $(element);
|
113
|
-
var removeClasses = arguments;
|
114
|
-
$R(1,arguments.length-1).each( function(index) {
|
115
|
-
element.className =
|
116
|
-
element.className.split(' ').reject(
|
117
|
-
function(klass) { return (klass == removeClasses[index]) } ).join(' ');
|
118
|
-
});
|
119
|
-
},
|
120
|
-
|
121
|
-
add: function(element) {
|
122
|
-
element = $(element);
|
123
|
-
for(var i = 1; i < arguments.length; i++) {
|
124
|
-
Element.Class.remove(element, arguments[i]);
|
125
|
-
element.className += (element.className.length > 0 ? ' ' : '') + arguments[i];
|
126
|
-
}
|
127
|
-
},
|
128
|
-
|
129
|
-
// returns true if all given classes exist in said element
|
130
|
-
has: function(element) {
|
131
|
-
element = $(element);
|
132
|
-
if(!element || !element.className) return false;
|
133
|
-
var regEx;
|
134
|
-
for(var i = 1; i < arguments.length; i++) {
|
135
|
-
if((typeof arguments[i] == 'object') &&
|
136
|
-
(arguments[i].constructor == Array)) {
|
137
|
-
for(var j = 0; j < arguments[i].length; j++) {
|
138
|
-
regEx = new RegExp("(^|\\s)" + arguments[i][j] + "(\\s|$)");
|
139
|
-
if(!regEx.test(element.className)) return false;
|
140
|
-
}
|
141
|
-
} else {
|
142
|
-
regEx = new RegExp("(^|\\s)" + arguments[i] + "(\\s|$)");
|
143
|
-
if(!regEx.test(element.className)) return false;
|
144
|
-
}
|
145
|
-
}
|
146
|
-
return true;
|
147
|
-
},
|
148
|
-
|
149
|
-
// expects arrays of strings and/or strings as optional paramters
|
150
|
-
// Element.Class.has_any(element, ['classA','classB','classC'], 'classD')
|
151
|
-
has_any: function(element) {
|
152
|
-
element = $(element);
|
153
|
-
if(!element || !element.className) return false;
|
154
|
-
var regEx;
|
155
|
-
for(var i = 1; i < arguments.length; i++) {
|
156
|
-
if((typeof arguments[i] == 'object') &&
|
157
|
-
(arguments[i].constructor == Array)) {
|
158
|
-
for(var j = 0; j < arguments[i].length; j++) {
|
159
|
-
regEx = new RegExp("(^|\\s)" + arguments[i][j] + "(\\s|$)");
|
160
|
-
if(regEx.test(element.className)) return true;
|
161
|
-
}
|
162
|
-
} else {
|
163
|
-
regEx = new RegExp("(^|\\s)" + arguments[i] + "(\\s|$)");
|
164
|
-
if(regEx.test(element.className)) return true;
|
165
|
-
}
|
166
|
-
}
|
167
|
-
return false;
|
168
|
-
},
|
169
|
-
|
170
|
-
childrenWith: function(element, className) {
|
171
|
-
var children = $(element).getElementsByTagName('*');
|
172
|
-
var elements = new Array();
|
173
|
-
|
174
|
-
for (var i = 0; i < children.length; i++)
|
175
|
-
if (Element.Class.has(children[i], className))
|
176
|
-
elements.push(children[i]);
|
177
|
-
|
178
|
-
return elements;
|
179
|
-
}
|
180
|
-
}
|
181
|
-
|
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
|
+
|
182
95
|
/*--------------------------------------------------------------------------*/
|
183
96
|
|
184
97
|
var Effect = {
|
185
98
|
tagifyText: function(element) {
|
186
|
-
var tagifyStyle =
|
187
|
-
if(/MSIE/.test(navigator.userAgent)) tagifyStyle +=
|
99
|
+
var tagifyStyle = 'position:relative';
|
100
|
+
if(/MSIE/.test(navigator.userAgent)) tagifyStyle += ';zoom:1';
|
188
101
|
element = $(element);
|
189
102
|
$A(element.childNodes).each( function(child) {
|
190
103
|
if(child.nodeType==3) {
|
191
104
|
child.nodeValue.toArray().each( function(character) {
|
192
105
|
element.insertBefore(
|
193
106
|
Builder.node('span',{style: tagifyStyle},
|
194
|
-
character ==
|
107
|
+
character == ' ' ? String.fromCharCode(160) : character),
|
195
108
|
child);
|
196
109
|
});
|
197
110
|
Element.remove(child);
|
@@ -211,11 +124,10 @@ var Effect = {
|
|
211
124
|
speed: 0.1,
|
212
125
|
delay: 0.0
|
213
126
|
}, arguments[2] || {});
|
214
|
-
var
|
215
|
-
var delay = options.delay;
|
127
|
+
var masterDelay = options.delay;
|
216
128
|
|
217
129
|
$A(elements).each( function(element, index) {
|
218
|
-
new effect(element, Object.extend(options, { delay:
|
130
|
+
new effect(element, Object.extend(options, { delay: index * options.speed + masterDelay }));
|
219
131
|
});
|
220
132
|
}
|
221
133
|
};
|
@@ -346,13 +258,15 @@ Effect.Base.prototype = {
|
|
346
258
|
if(this.setup) this.setup();
|
347
259
|
this.event('afterSetup');
|
348
260
|
}
|
349
|
-
if(this.
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
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
|
+
}
|
356
270
|
},
|
357
271
|
cancel: function() {
|
358
272
|
if(!this.options.sync) Effect.Queue.remove(this);
|
@@ -361,6 +275,9 @@ Effect.Base.prototype = {
|
|
361
275
|
event: function(eventName) {
|
362
276
|
if(this.options[eventName + 'Internal']) this.options[eventName + 'Internal'](this);
|
363
277
|
if(this.options[eventName]) this.options[eventName](this);
|
278
|
+
},
|
279
|
+
inspect: function() {
|
280
|
+
return '#<Effect:' + $H(this).inspect() + ',options:' + $H(this.options).inspect() + '>';
|
364
281
|
}
|
365
282
|
}
|
366
283
|
|
@@ -390,7 +307,7 @@ Object.extend(Object.extend(Effect.Opacity.prototype, Effect.Base.prototype), {
|
|
390
307
|
this.element = $(element);
|
391
308
|
// make this work on IE on elements without 'layout'
|
392
309
|
if(/MSIE/.test(navigator.userAgent) && (!this.element.hasLayout))
|
393
|
-
this.element
|
310
|
+
Element.setStyle(this.element, {zoom: 1});
|
394
311
|
var options = Object.extend({
|
395
312
|
from: Element.getOpacity(this.element) || 0.0,
|
396
313
|
to: 1.0
|
@@ -414,20 +331,16 @@ Object.extend(Object.extend(Effect.MoveBy.prototype, Effect.Base.prototype), {
|
|
414
331
|
// Bug in Opera: Opera returns the "real" position of a static element or
|
415
332
|
// relative element that does not have top/left explicitly set.
|
416
333
|
// ==> Always set top and left for position relative elements in your stylesheets
|
417
|
-
// (to 0 if you do not need them)
|
418
|
-
|
334
|
+
// (to 0 if you do not need them)
|
419
335
|
Element.makePositioned(this.element);
|
420
336
|
this.originalTop = parseFloat(Element.getStyle(this.element,'top') || '0');
|
421
337
|
this.originalLeft = parseFloat(Element.getStyle(this.element,'left') || '0');
|
422
338
|
},
|
423
339
|
update: function(position) {
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
setPosition: function(topd, leftd) {
|
429
|
-
this.element.style.top = topd + "px";
|
430
|
-
this.element.style.left = leftd + "px";
|
340
|
+
Element.setStyle(this.element, {
|
341
|
+
top: this.toTop * position + this.originalTop + 'px',
|
342
|
+
left: this.toLeft * position + this.originalLeft + 'px'
|
343
|
+
});
|
431
344
|
}
|
432
345
|
});
|
433
346
|
|
@@ -447,33 +360,31 @@ Object.extend(Object.extend(Effect.Scale.prototype, Effect.Base.prototype), {
|
|
447
360
|
this.start(options);
|
448
361
|
},
|
449
362
|
setup: function() {
|
450
|
-
var effect = this;
|
451
|
-
|
452
363
|
this.restoreAfterFinish = this.options.restoreAfterFinish || false;
|
453
364
|
this.elementPositioning = Element.getStyle(this.element,'position');
|
454
365
|
|
455
|
-
|
366
|
+
this.originalStyle = {};
|
456
367
|
['top','left','width','height','fontSize'].each( function(k) {
|
457
|
-
|
458
|
-
});
|
368
|
+
this.originalStyle[k] = this.element.style[k];
|
369
|
+
}.bind(this));
|
459
370
|
|
460
371
|
this.originalTop = this.element.offsetTop;
|
461
372
|
this.originalLeft = this.element.offsetLeft;
|
462
373
|
|
463
|
-
var fontSize = Element.getStyle(this.element,'font-size') ||
|
374
|
+
var fontSize = Element.getStyle(this.element,'font-size') || '100%';
|
464
375
|
['em','px','%'].each( function(fontSizeType) {
|
465
376
|
if(fontSize.indexOf(fontSizeType)>0) {
|
466
|
-
|
467
|
-
|
377
|
+
this.fontSize = parseFloat(fontSize);
|
378
|
+
this.fontSizeType = fontSizeType;
|
468
379
|
}
|
469
|
-
});
|
380
|
+
}.bind(this));
|
470
381
|
|
471
382
|
this.factor = (this.options.scaleTo - this.options.scaleFrom)/100;
|
472
383
|
|
473
384
|
this.dims = null;
|
474
385
|
if(this.options.scaleMode=='box')
|
475
|
-
this.dims = [this.element.
|
476
|
-
if(this.options.scaleMode
|
386
|
+
this.dims = [this.element.offsetHeight, this.element.offsetWidth];
|
387
|
+
if(/^content/.test(this.options.scaleMode))
|
477
388
|
this.dims = [this.element.scrollHeight, this.element.scrollWidth];
|
478
389
|
if(!this.dims)
|
479
390
|
this.dims = [this.options.scaleMode.originalHeight,
|
@@ -482,32 +393,28 @@ Object.extend(Object.extend(Effect.Scale.prototype, Effect.Base.prototype), {
|
|
482
393
|
update: function(position) {
|
483
394
|
var currentScale = (this.options.scaleFrom/100.0) + (this.factor * position);
|
484
395
|
if(this.options.scaleContent && this.fontSize)
|
485
|
-
this.element
|
396
|
+
Element.setStyle(this.element, {fontSize: this.fontSize * currentScale + this.fontSizeType });
|
486
397
|
this.setDimensions(this.dims[0] * currentScale, this.dims[1] * currentScale);
|
487
398
|
},
|
488
399
|
finish: function(position) {
|
489
|
-
if (this.restoreAfterFinish)
|
490
|
-
var effect = this;
|
491
|
-
['top','left','width','height','fontSize'].each( function(k) {
|
492
|
-
effect.element.style[k] = effect.originalStyle[k];
|
493
|
-
});
|
494
|
-
}
|
400
|
+
if (this.restoreAfterFinish) Element.setStyle(this.element, this.originalStyle);
|
495
401
|
},
|
496
402
|
setDimensions: function(height, width) {
|
497
|
-
var
|
498
|
-
if(this.options.scaleX)
|
499
|
-
if(this.options.scaleY)
|
403
|
+
var d = {};
|
404
|
+
if(this.options.scaleX) d.width = width + 'px';
|
405
|
+
if(this.options.scaleY) d.height = height + 'px';
|
500
406
|
if(this.options.scaleFromCenter) {
|
501
407
|
var topd = (height - this.dims[0])/2;
|
502
408
|
var leftd = (width - this.dims[1])/2;
|
503
409
|
if(this.elementPositioning == 'absolute') {
|
504
|
-
if(this.options.scaleY)
|
505
|
-
if(this.options.scaleX)
|
410
|
+
if(this.options.scaleY) d.top = this.originalTop-topd + 'px';
|
411
|
+
if(this.options.scaleX) d.left = this.originalLeft-leftd + 'px';
|
506
412
|
} else {
|
507
|
-
if(this.options.scaleY)
|
508
|
-
if(this.options.scaleX)
|
413
|
+
if(this.options.scaleY) d.top = -topd + 'px';
|
414
|
+
if(this.options.scaleX) d.left = -leftd + 'px';
|
509
415
|
}
|
510
416
|
}
|
417
|
+
Element.setStyle(this.element, d);
|
511
418
|
}
|
512
419
|
});
|
513
420
|
|
@@ -515,41 +422,32 @@ Effect.Highlight = Class.create();
|
|
515
422
|
Object.extend(Object.extend(Effect.Highlight.prototype, Effect.Base.prototype), {
|
516
423
|
initialize: function(element) {
|
517
424
|
this.element = $(element);
|
518
|
-
var options = Object.extend({
|
519
|
-
startcolor: "#ffff99"
|
520
|
-
}, arguments[1] || {});
|
425
|
+
var options = Object.extend({ startcolor: '#ffff99' }, arguments[1] || {});
|
521
426
|
this.start(options);
|
522
427
|
},
|
523
428
|
setup: function() {
|
524
429
|
// Prevent executing on elements not in the layout flow
|
525
|
-
if(this.element
|
430
|
+
if(Element.getStyle(this.element, 'display')=='none') { this.cancel(); return; }
|
526
431
|
// Disable background image during the effect
|
527
|
-
this.
|
528
|
-
|
432
|
+
this.oldStyle = {
|
433
|
+
backgroundImage: Element.getStyle(this.element, 'background-image') };
|
434
|
+
Element.setStyle(this.element, {backgroundImage: 'none'});
|
529
435
|
if(!this.options.endcolor)
|
530
436
|
this.options.endcolor = Element.getStyle(this.element, 'background-color').parseColor('#ffffff');
|
531
|
-
if
|
532
|
-
this.options.restorecolor = this.element
|
437
|
+
if(!this.options.restorecolor)
|
438
|
+
this.options.restorecolor = Element.getStyle(this.element, 'background-color');
|
533
439
|
// init color calculations
|
534
|
-
this.
|
535
|
-
|
536
|
-
parseInt(this.options.startcolor.slice(3,5),16),
|
537
|
-
parseInt(this.options.startcolor.slice(5),16) ];
|
538
|
-
this.colors_delta = [
|
539
|
-
parseInt(this.options.endcolor.slice(1,3),16)-this.colors_base[0],
|
540
|
-
parseInt(this.options.endcolor.slice(3,5),16)-this.colors_base[1],
|
541
|
-
parseInt(this.options.endcolor.slice(5),16)-this.colors_base[2]];
|
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));
|
542
442
|
},
|
543
443
|
update: function(position) {
|
544
|
-
|
545
|
-
return Math.round(
|
546
|
-
});
|
547
|
-
this.element.style.backgroundColor = "#" +
|
548
|
-
colors[0].toColorPart() + colors[1].toColorPart() + colors[2].toColorPart();
|
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)) });
|
549
446
|
},
|
550
447
|
finish: function() {
|
551
|
-
this.element.
|
552
|
-
|
448
|
+
Element.setStyle(this.element, Object.extend(this.oldStyle, {
|
449
|
+
backgroundColor: this.options.restorecolor
|
450
|
+
}));
|
553
451
|
}
|
554
452
|
});
|
555
453
|
|
@@ -562,6 +460,7 @@ Object.extend(Object.extend(Effect.ScrollTo.prototype, Effect.Base.prototype), {
|
|
562
460
|
setup: function() {
|
563
461
|
Position.prepare();
|
564
462
|
var offsets = Position.cumulativeOffset(this.element);
|
463
|
+
if(this.options.offset) offsets[1] += this.options.offset;
|
565
464
|
var max = window.innerHeight ?
|
566
465
|
window.height - window.innerHeight :
|
567
466
|
document.body.scrollHeight -
|
@@ -584,42 +483,38 @@ Effect.Fade = function(element) {
|
|
584
483
|
var options = Object.extend({
|
585
484
|
from: Element.getOpacity(element) || 1.0,
|
586
485
|
to: 0.0,
|
587
|
-
afterFinishInternal: function(effect)
|
588
|
-
|
589
|
-
|
590
|
-
|
591
|
-
}
|
592
|
-
}
|
486
|
+
afterFinishInternal: function(effect) { with(Element) {
|
487
|
+
if(effect.options.to!=0) return;
|
488
|
+
hide(effect.element);
|
489
|
+
setStyle(effect.element, {opacity: oldOpacity}); }}
|
593
490
|
}, arguments[1] || {});
|
594
491
|
return new Effect.Opacity(element,options);
|
595
492
|
}
|
596
493
|
|
597
494
|
Effect.Appear = function(element) {
|
598
495
|
var options = Object.extend({
|
599
|
-
from: (Element.getStyle(element,
|
496
|
+
from: (Element.getStyle(element, 'display') == 'none' ? 0.0 : Element.getOpacity(element) || 0.0),
|
600
497
|
to: 1.0,
|
601
|
-
beforeSetup: function(effect)
|
602
|
-
|
603
|
-
|
498
|
+
beforeSetup: function(effect) { with(Element) {
|
499
|
+
setOpacity(effect.element, effect.options.from);
|
500
|
+
show(effect.element); }}
|
604
501
|
}, arguments[1] || {});
|
605
502
|
return new Effect.Opacity(element,options);
|
606
503
|
}
|
607
504
|
|
608
505
|
Effect.Puff = function(element) {
|
609
506
|
element = $(element);
|
610
|
-
var
|
611
|
-
var oldPosition = element.style.position;
|
507
|
+
var oldStyle = { opacity: Element.getInlineOpacity(element), position: Element.getStyle(element, 'position') };
|
612
508
|
return new Effect.Parallel(
|
613
509
|
[ new Effect.Scale(element, 200,
|
614
510
|
{ sync: true, scaleFromCenter: true, scaleContent: true, restoreAfterFinish: true }),
|
615
511
|
new Effect.Opacity(element, { sync: true, to: 0.0 } ) ],
|
616
512
|
Object.extend({ duration: 1.0,
|
617
|
-
beforeSetupInternal: function(effect)
|
618
|
-
|
619
|
-
afterFinishInternal: function(effect)
|
620
|
-
|
621
|
-
effect.effects[0].element
|
622
|
-
Element.setInlineOpacity(effect.effects[0].element, oldOpacity); }
|
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); }}
|
623
518
|
}, arguments[1] || {})
|
624
519
|
);
|
625
520
|
}
|
@@ -631,18 +526,15 @@ Effect.BlindUp = function(element) {
|
|
631
526
|
Object.extend({ scaleContent: false,
|
632
527
|
scaleX: false,
|
633
528
|
restoreAfterFinish: true,
|
634
|
-
afterFinishInternal: function(effect)
|
635
|
-
|
636
|
-
Element.hide(effect.element);
|
637
|
-
Element.undoClipping(effect.element);
|
638
|
-
}
|
529
|
+
afterFinishInternal: function(effect) { with(Element) {
|
530
|
+
[hide, undoClipping].call(effect.element); }}
|
639
531
|
}, arguments[1] || {})
|
640
532
|
);
|
641
533
|
}
|
642
534
|
|
643
535
|
Effect.BlindDown = function(element) {
|
644
536
|
element = $(element);
|
645
|
-
var oldHeight = element
|
537
|
+
var oldHeight = Element.getStyle(element, 'height');
|
646
538
|
var elementDimensions = Element.getDimensions(element);
|
647
539
|
return new Effect.Scale(element, 100,
|
648
540
|
Object.extend({ scaleContent: false,
|
@@ -650,15 +542,15 @@ Effect.BlindDown = function(element) {
|
|
650
542
|
scaleFrom: 0,
|
651
543
|
scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width},
|
652
544
|
restoreAfterFinish: true,
|
653
|
-
afterSetup: function(effect) {
|
654
|
-
|
655
|
-
effect.element
|
656
|
-
|
657
|
-
},
|
658
|
-
afterFinishInternal: function(effect) {
|
659
|
-
|
660
|
-
effect.element
|
661
|
-
}
|
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
|
+
}}
|
662
554
|
}, arguments[1] || {})
|
663
555
|
);
|
664
556
|
}
|
@@ -674,16 +566,13 @@ Effect.SwitchOff = function(element) {
|
|
674
566
|
new Effect.Scale(effect.element, 1, {
|
675
567
|
duration: 0.3, scaleFromCenter: true,
|
676
568
|
scaleX: false, scaleContent: false, restoreAfterFinish: true,
|
677
|
-
beforeSetup: function(effect) {
|
678
|
-
|
679
|
-
|
680
|
-
|
681
|
-
|
682
|
-
|
683
|
-
|
684
|
-
Element.undoPositioned(effect.element);
|
685
|
-
Element.setInlineOpacity(effect.element, oldOpacity);
|
686
|
-
}
|
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
|
+
}}
|
687
576
|
})
|
688
577
|
}
|
689
578
|
});
|
@@ -691,29 +580,28 @@ Effect.SwitchOff = function(element) {
|
|
691
580
|
|
692
581
|
Effect.DropOut = function(element) {
|
693
582
|
element = $(element);
|
694
|
-
var
|
695
|
-
|
696
|
-
|
583
|
+
var oldStyle = {
|
584
|
+
top: Element.getStyle(element, 'top'),
|
585
|
+
left: Element.getStyle(element, 'left'),
|
586
|
+
opacity: Element.getInlineOpacity(element) };
|
697
587
|
return new Effect.Parallel(
|
698
588
|
[ new Effect.MoveBy(element, 100, 0, { sync: true }),
|
699
589
|
new Effect.Opacity(element, { sync: true, to: 0.0 }) ],
|
700
590
|
Object.extend(
|
701
591
|
{ duration: 0.5,
|
702
|
-
beforeSetup: function(effect) {
|
703
|
-
|
704
|
-
afterFinishInternal: function(effect) {
|
705
|
-
|
706
|
-
|
707
|
-
effect.effects[0].element.style.left = oldLeft;
|
708
|
-
effect.effects[0].element.style.top = oldTop;
|
709
|
-
Element.setInlineOpacity(effect.effects[0].element, oldOpacity); }
|
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); }}
|
710
597
|
}, arguments[1] || {}));
|
711
598
|
}
|
712
599
|
|
713
600
|
Effect.Shake = function(element) {
|
714
601
|
element = $(element);
|
715
|
-
var
|
716
|
-
|
602
|
+
var oldStyle = {
|
603
|
+
top: Element.getStyle(element, 'top'),
|
604
|
+
left: Element.getStyle(element, 'left') };
|
717
605
|
return new Effect.MoveBy(element, 0, 20,
|
718
606
|
{ duration: 0.05, afterFinishInternal: function(effect) {
|
719
607
|
new Effect.MoveBy(effect.element, 0, -40,
|
@@ -725,39 +613,39 @@ Effect.Shake = function(element) {
|
|
725
613
|
new Effect.MoveBy(effect.element, 0, 40,
|
726
614
|
{ duration: 0.1, afterFinishInternal: function(effect) {
|
727
615
|
new Effect.MoveBy(effect.element, 0, -20,
|
728
|
-
{ duration: 0.05, afterFinishInternal: function(effect) {
|
729
|
-
|
730
|
-
effect.element
|
731
|
-
|
732
|
-
}}) }}) }}) }}) }}) }});
|
616
|
+
{ duration: 0.05, afterFinishInternal: function(effect) { with(Element) {
|
617
|
+
undoPositioned(effect.element);
|
618
|
+
setStyle(effect.element, oldStyle);
|
619
|
+
}}}) }}) }}) }}) }}) }});
|
733
620
|
}
|
734
621
|
|
735
622
|
Effect.SlideDown = function(element) {
|
736
623
|
element = $(element);
|
737
624
|
Element.cleanWhitespace(element);
|
738
625
|
// SlideDown need to have the content of the element wrapped in a container element with fixed height!
|
739
|
-
var oldInnerBottom = element.firstChild
|
626
|
+
var oldInnerBottom = Element.getStyle(element.firstChild, 'bottom');
|
740
627
|
var elementDimensions = Element.getDimensions(element);
|
741
|
-
return new Effect.Scale(element, 100,
|
742
|
-
|
628
|
+
return new Effect.Scale(element, 100, Object.extend({
|
629
|
+
scaleContent: false,
|
743
630
|
scaleX: false,
|
744
631
|
scaleFrom: 0,
|
745
|
-
scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width},
|
632
|
+
scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width},
|
746
633
|
restoreAfterFinish: true,
|
747
|
-
afterSetup: function(effect) {
|
748
|
-
|
749
|
-
|
750
|
-
|
751
|
-
element
|
752
|
-
|
753
|
-
|
754
|
-
afterUpdateInternal: function(effect) {
|
755
|
-
effect.element.firstChild
|
756
|
-
(effect.dims[0] - effect.element.clientHeight) + 'px'; },
|
757
|
-
afterFinishInternal: function(effect) {
|
758
|
-
|
759
|
-
|
760
|
-
effect.element
|
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}); }}
|
761
649
|
}, arguments[1] || {})
|
762
650
|
);
|
763
651
|
}
|
@@ -765,122 +653,111 @@ Effect.SlideDown = function(element) {
|
|
765
653
|
Effect.SlideUp = function(element) {
|
766
654
|
element = $(element);
|
767
655
|
Element.cleanWhitespace(element);
|
768
|
-
var oldInnerBottom = element.firstChild
|
656
|
+
var oldInnerBottom = Element.getStyle(element.firstChild, 'bottom');
|
769
657
|
return new Effect.Scale(element, 0,
|
770
658
|
Object.extend({ scaleContent: false,
|
771
659
|
scaleX: false,
|
772
660
|
scaleMode: 'box',
|
773
661
|
scaleFrom: 100,
|
774
662
|
restoreAfterFinish: true,
|
775
|
-
beforeStartInternal: function(effect) {
|
776
|
-
|
777
|
-
|
778
|
-
|
779
|
-
|
780
|
-
|
781
|
-
afterUpdateInternal: function(effect) {
|
782
|
-
|
783
|
-
|
784
|
-
afterFinishInternal: function(effect) {
|
785
|
-
|
786
|
-
|
787
|
-
|
788
|
-
effect.element.firstChild
|
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}); }}
|
789
677
|
}, arguments[1] || {})
|
790
678
|
);
|
791
679
|
}
|
792
680
|
|
681
|
+
// Bug in opera makes the TD containing this element expand for a instance after finish
|
793
682
|
Effect.Squish = function(element) {
|
794
|
-
// Bug in opera makes the TD containing this element expand for a instance after finish
|
795
683
|
return new Effect.Scale(element, window.opera ? 1 : 0,
|
796
684
|
{ restoreAfterFinish: true,
|
797
|
-
beforeSetup: function(effect) {
|
798
|
-
|
799
|
-
afterFinishInternal: function(effect) {
|
800
|
-
|
801
|
-
|
685
|
+
beforeSetup: function(effect) { with(Element) {
|
686
|
+
makeClipping(effect.element); }},
|
687
|
+
afterFinishInternal: function(effect) { with(Element) {
|
688
|
+
hide(effect.element);
|
689
|
+
undoClipping(effect.element); }}
|
802
690
|
});
|
803
691
|
}
|
804
692
|
|
805
693
|
Effect.Grow = function(element) {
|
806
694
|
element = $(element);
|
807
|
-
var options =
|
808
|
-
|
809
|
-
|
810
|
-
|
811
|
-
|
812
|
-
|
813
|
-
var
|
814
|
-
|
815
|
-
|
816
|
-
|
817
|
-
|
818
|
-
|
819
|
-
|
820
|
-
var
|
821
|
-
var opacityTransition = options.opacityTransition || Effect.Transitions.full;
|
822
|
-
|
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);
|
823
709
|
var initialMoveX, initialMoveY;
|
824
710
|
var moveX, moveY;
|
825
711
|
|
826
|
-
switch (direction) {
|
712
|
+
switch (options.direction) {
|
827
713
|
case 'top-left':
|
828
714
|
initialMoveX = initialMoveY = moveX = moveY = 0;
|
829
715
|
break;
|
830
716
|
case 'top-right':
|
831
|
-
initialMoveX =
|
717
|
+
initialMoveX = dims.width;
|
832
718
|
initialMoveY = moveY = 0;
|
833
|
-
moveX = -
|
719
|
+
moveX = -dims.width;
|
834
720
|
break;
|
835
721
|
case 'bottom-left':
|
836
722
|
initialMoveX = moveX = 0;
|
837
|
-
initialMoveY =
|
838
|
-
moveY = -
|
723
|
+
initialMoveY = dims.height;
|
724
|
+
moveY = -dims.height;
|
839
725
|
break;
|
840
726
|
case 'bottom-right':
|
841
|
-
initialMoveX =
|
842
|
-
initialMoveY =
|
843
|
-
moveX = -
|
844
|
-
moveY = -
|
727
|
+
initialMoveX = dims.width;
|
728
|
+
initialMoveY = dims.height;
|
729
|
+
moveX = -dims.width;
|
730
|
+
moveY = -dims.height;
|
845
731
|
break;
|
846
732
|
case 'center':
|
847
|
-
initialMoveX =
|
848
|
-
initialMoveY =
|
849
|
-
moveX = -
|
850
|
-
moveY = -
|
733
|
+
initialMoveX = dims.width / 2;
|
734
|
+
initialMoveY = dims.height / 2;
|
735
|
+
moveX = -dims.width / 2;
|
736
|
+
moveY = -dims.height / 2;
|
851
737
|
break;
|
852
738
|
}
|
853
739
|
|
854
740
|
return new Effect.MoveBy(element, initialMoveY, initialMoveX, {
|
855
741
|
duration: 0.01,
|
856
|
-
beforeSetup: function(effect) {
|
857
|
-
|
858
|
-
|
859
|
-
|
860
|
-
},
|
742
|
+
beforeSetup: function(effect) { with(Element) {
|
743
|
+
hide(effect.element);
|
744
|
+
makeClipping(effect.element);
|
745
|
+
makePositioned(effect.element);
|
746
|
+
}},
|
861
747
|
afterFinishInternal: function(effect) {
|
862
748
|
new Effect.Parallel(
|
863
|
-
[ new Effect.Opacity(effect.element, { sync: true, to: 1.0, from: 0.0, transition: opacityTransition }),
|
864
|
-
new Effect.MoveBy(effect.element, moveY, moveX, { sync: true, transition: moveTransition }),
|
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 }),
|
865
751
|
new Effect.Scale(effect.element, 100, {
|
866
|
-
scaleMode: { originalHeight:
|
867
|
-
sync: true, scaleFrom: window.opera ? 1 : 0, transition: scaleTransition, restoreAfterFinish: true})
|
752
|
+
scaleMode: { originalHeight: dims.height, originalWidth: dims.width },
|
753
|
+
sync: true, scaleFrom: window.opera ? 1 : 0, transition: options.scaleTransition, restoreAfterFinish: true})
|
868
754
|
], Object.extend({
|
869
|
-
beforeSetup: function(effect) {
|
870
|
-
|
871
|
-
|
872
|
-
|
873
|
-
|
874
|
-
|
875
|
-
var els = el.style;
|
876
|
-
Element.undoClipping(el);
|
877
|
-
Element.undoPositioned(el);
|
878
|
-
els.top = oldTop;
|
879
|
-
els.left = oldLeft;
|
880
|
-
els.height = oldHeight;
|
881
|
-
els.width = originalWidth + 'px';
|
882
|
-
Element.setInlineOpacity(el, oldOpacity);
|
883
|
-
}
|
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); }}
|
884
761
|
}, options)
|
885
762
|
)
|
886
763
|
}
|
@@ -889,66 +766,54 @@ Effect.Grow = function(element) {
|
|
889
766
|
|
890
767
|
Effect.Shrink = function(element) {
|
891
768
|
element = $(element);
|
892
|
-
var options =
|
893
|
-
|
894
|
-
|
895
|
-
|
896
|
-
|
897
|
-
|
898
|
-
var
|
899
|
-
|
900
|
-
|
901
|
-
|
902
|
-
|
903
|
-
|
904
|
-
|
905
|
-
var
|
906
|
-
|
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);
|
907
783
|
var moveX, moveY;
|
908
784
|
|
909
|
-
switch (direction) {
|
785
|
+
switch (options.direction) {
|
910
786
|
case 'top-left':
|
911
787
|
moveX = moveY = 0;
|
912
788
|
break;
|
913
789
|
case 'top-right':
|
914
|
-
moveX =
|
790
|
+
moveX = dims.width;
|
915
791
|
moveY = 0;
|
916
792
|
break;
|
917
793
|
case 'bottom-left':
|
918
794
|
moveX = 0;
|
919
|
-
moveY =
|
795
|
+
moveY = dims.height;
|
920
796
|
break;
|
921
797
|
case 'bottom-right':
|
922
|
-
moveX =
|
923
|
-
moveY =
|
798
|
+
moveX = dims.width;
|
799
|
+
moveY = dims.height;
|
924
800
|
break;
|
925
801
|
case 'center':
|
926
|
-
moveX =
|
927
|
-
moveY =
|
802
|
+
moveX = dims.width / 2;
|
803
|
+
moveY = dims.height / 2;
|
928
804
|
break;
|
929
805
|
}
|
930
806
|
|
931
807
|
return new Effect.Parallel(
|
932
|
-
[ new Effect.Opacity(element, { sync: true, to: 0.0, from: 1.0, transition: opacityTransition }),
|
933
|
-
new Effect.Scale(element, window.opera ? 1 : 0, { sync: true, transition: scaleTransition, restoreAfterFinish: true}),
|
934
|
-
new Effect.MoveBy(element, moveY, moveX, { sync: true, transition: moveTransition })
|
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 })
|
935
811
|
], Object.extend({
|
936
|
-
beforeStartInternal: function(effect) {
|
937
|
-
|
938
|
-
|
939
|
-
|
940
|
-
|
941
|
-
var el = effect.effects[0].element;
|
942
|
-
var els = el.style;
|
943
|
-
Element.hide(el);
|
944
|
-
Element.undoClipping(el);
|
945
|
-
Element.undoPositioned(el);
|
946
|
-
els.top = oldTop;
|
947
|
-
els.left = oldLeft;
|
948
|
-
els.height = oldHeight;
|
949
|
-
els.width = oldWidth;
|
950
|
-
Element.setInlineOpacity(el, oldOpacity);
|
951
|
-
}
|
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); }}
|
952
817
|
}, options)
|
953
818
|
);
|
954
819
|
}
|
@@ -962,16 +827,17 @@ Effect.Pulsate = function(element) {
|
|
962
827
|
reverser.bind(transition);
|
963
828
|
return new Effect.Opacity(element,
|
964
829
|
Object.extend(Object.extend({ duration: 3.0, from: 0,
|
965
|
-
afterFinishInternal: function(effect) { Element.
|
830
|
+
afterFinishInternal: function(effect) { Element.setStyle(effect.element, {opacity: oldOpacity}); }
|
966
831
|
}, options), {transition: reverser}));
|
967
832
|
}
|
968
833
|
|
969
834
|
Effect.Fold = function(element) {
|
970
835
|
element = $(element);
|
971
|
-
var
|
972
|
-
|
973
|
-
|
974
|
-
|
836
|
+
var oldStyle = {
|
837
|
+
top: element.style.top,
|
838
|
+
left: element.style.left,
|
839
|
+
width: element.style.width,
|
840
|
+
height: element.style.height };
|
975
841
|
Element.makeClipping(element);
|
976
842
|
return new Effect.Scale(element, 5, Object.extend({
|
977
843
|
scaleContent: false,
|
@@ -980,13 +846,9 @@ Effect.Fold = function(element) {
|
|
980
846
|
new Effect.Scale(element, 1, {
|
981
847
|
scaleContent: false,
|
982
848
|
scaleY: false,
|
983
|
-
afterFinishInternal: function(effect) {
|
984
|
-
|
985
|
-
|
986
|
-
|
987
|
-
effect.element.style.left = originalLeft;
|
988
|
-
effect.element.style.width = originalWidth;
|
989
|
-
effect.element.style.height = originalHeight;
|
990
|
-
} });
|
849
|
+
afterFinishInternal: function(effect) { with(Element) {
|
850
|
+
[hide, undoClipping].call(effect.element);
|
851
|
+
setStyle(effect.element, oldStyle);
|
852
|
+
}} });
|
991
853
|
}}, arguments[1] || {}));
|
992
854
|
}
|