Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Update to Prototype 1.2.0

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1198 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
commit d547c3f5ecd0318d9d3ddb95778867d4c43273c2 1 parent c11cc30
@sstephenson sstephenson authored
View
279 actionpack/lib/action_view/helpers/javascripts/prototype.js
@@ -1,12 +1,17 @@
-/* Prototype: an object-oriented Javascript library, version 1.1.0
+/* Prototype: an object-oriented Javascript library, version 1.2.0
* (c) 2005 Sam Stephenson <sam@conio.net>
*
- * Prototype is freely distributable under the terms of an MIT-style license.
- * For details, see http://prototype.conio.net/
- */
+ * THIS FILE IS AUTOMATICALLY GENERATED. When sending patches, please diff
+ * against the source tree, available from the Prototype darcs repository.
+ *
+ * Prototype is freely distributable under the terms of an MIT-style license.
+ *
+ * For details, see the Prototype web site: http://prototype.conio.net/
+ *
+/*--------------------------------------------------------------------------*/
var Prototype = {
- Version: '1.1.0'
+ Version: '1.2.0'
}
var Class = {
@@ -62,28 +67,33 @@ var Try = {
}
}
-// Deprecated accessor for Element.toggle
-var Toggle = { display: function() { Element.toggle(arguments); } }
+/*--------------------------------------------------------------------------*/
-var Element = {
- toggle: function() {
- for (var i = 0; i < arguments.length; i++) {
- var element = $(arguments[i]);
- element.style.display =
- (element.style.display == 'none' ? '' : 'none');
- }
- }
- hide: function() {
- for (var i = 0; i < arguments.length; i++) {
- var element = $(arguments[i]);
- element.style.display = 'none';
- }
- }
- show: function() {
- for (var i = 0; i < arguments.length; i++) {
- var element = $(arguments[i]);
- element.style.display = '';
+var PeriodicalExecuter = Class.create();
+PeriodicalExecuter.prototype = {
+ initialize: function(callback, frequency) {
+ this.callback = callback;
+ this.frequency = frequency;
+ this.currentlyExecuting = false;
+
+ this.registerCallback();
+ },
+
+ registerCallback: function() {
+ setTimeout(this.onTimerEvent.bind(this), this.frequency * 1000);
+ },
+
+ onTimerEvent: function() {
+ if (!this.currentlyExecuting) {
+ try {
+ this.currentlyExecuting = true;
+ this.callback();
+ } finally {
+ this.currentlyExecuting = false;
+ }
}
+
+ this.registerCallback();
}
}
@@ -106,22 +116,34 @@ function $() {
return elements;
}
-function getElementsByClassName(className) {
- var children = document.getElementsByTagName('*') || document.all;
- var elements = new Array();
-
- for (var i = 0; i < children.length; i++) {
- var child = children[i];
- var classNames = child.className.split(' ');
- for (var j = 0; j < classNames.length; j++) {
- if (classNames[j] == className) {
- elements.push(child);
- break;
- }
- }
+/*--------------------------------------------------------------------------*/
+
+if (!Array.prototype.push) {
+ Array.prototype.push = function() {
+ var startLength = this.length;
+ for (var i = 0; i < arguments.length; i++)
+ this[startLength + i] = arguments[i];
+ return this.length;
+ }
+}
+
+if (!Function.prototype.apply) {
+ // Based on code from http://www.youngpup.net/
+ Function.prototype.apply = function(object, parameters) {
+ var parameterStrings = new Array();
+ if (!object) object = window;
+ if (!parameters) parameters = new Array();
+
+ for (var i = 0; i < parameters.length; i++)
+ parameterStrings[i] = 'x[' + i + ']';
+
+ object.__apply__ = this;
+ var result = eval('obj.__apply__(' +
+ parameterStrings[i].join(', ') + ')');
+ object.__apply__ = null;
+
+ return result;
}
-
- return elements;
}
/*--------------------------------------------------------------------------*/
@@ -169,6 +191,9 @@ Ajax.Request.prototype = (new Ajax.Base()).extend({
setTimeout((function() {this.respondToReadyState(1)}).bind(this), 10);
}
+ this.transport.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
+ this.transport.setRequestHeader('X-Prototype-Version', Prototype.Version);
+
if (this.options.method == 'post') {
this.transport.setRequestHeader('Connection', 'close');
this.transport.setRequestHeader('Content-type',
@@ -212,11 +237,11 @@ Ajax.Updater.prototype = (new Ajax.Base()).extend({
},
updateContent: function() {
- if (!this.options.insertion) {
- this.container.innerHTML = this.request.transport.responseText;
- } else {
+ if (this.options.insertion) {
new this.options.insertion(this.container,
this.request.transport.responseText);
+ } else {
+ this.container.innerHTML = this.request.transport.responseText;
}
if (this.onComplete) {
@@ -241,6 +266,15 @@ var Field = {
for (var i = 0; i < arguments.length; i++)
if ($(arguments[i]).value == '') return false;
return true;
+ },
+
+ select: function(element) {
+ $(element).select();
+ },
+
+ activate: function(element) {
+ $(element).focus();
+ $(element).select();
}
}
@@ -270,6 +304,31 @@ var Form = {
elements.push(tagElements[j]);
}
return elements;
+ },
+
+ disable: function(form) {
+ var elements = Form.getElements(form);
+ for (var i = 0; i < elements.length; i++) {
+ var element = elements[i];
+ element.blur();
+ element.disable = 'true';
+ }
+ },
+
+ focusFirstElement: function(form) {
+ form = $(form);
+ var elements = Form.getElements(form);
+ for (var i = 0; i < elements.length; i++) {
+ var element = elements[i];
+ if (element.type != 'hidden' && !element.disabled) {
+ Field.activate(element);
+ break;
+ }
+ }
+ },
+
+ reset: function(form) {
+ $(form).reset();
}
}
@@ -319,12 +378,17 @@ Form.Element.Serializers = {
select: function(element) {
var index = element.selectedIndex;
- return [element.name, (index >= 0) ? element.options[index].value : ''];
+ var value = element.options[index].value || element.options[index].text;
+ return [element.name, (index >= 0) ? value : ''];
}
}
/*--------------------------------------------------------------------------*/
+var $F = Form.Element.getValue;
+
+/*--------------------------------------------------------------------------*/
+
Abstract.TimedObserver = function() {}
Abstract.TimedObserver.prototype = {
initialize: function(element, frequency, callback) {
@@ -368,6 +432,65 @@ Form.Observer.prototype = (new Abstract.TimedObserver()).extend({
/*--------------------------------------------------------------------------*/
+document.getElementsByClassName = function(className) {
+ var children = document.getElementsByTagName('*') || document.all;
+ var elements = new Array();
+
+ for (var i = 0; i < children.length; i++) {
+ var child = children[i];
+ var classNames = child.className.split(' ');
+ for (var j = 0; j < classNames.length; j++) {
+ if (classNames[j] == className) {
+ elements.push(child);
+ break;
+ }
+ }
+ }
+
+ return elements;
+}
+
+/*--------------------------------------------------------------------------*/
+
+var Element = {
+ toggle: function() {
+ for (var i = 0; i < arguments.length; i++) {
+ var element = $(arguments[i]);
+ element.style.display =
+ (element.style.display == 'none' ? '' : 'none');
+ }
+ },
+
+ hide: function() {
+ for (var i = 0; i < arguments.length; i++) {
+ var element = $(arguments[i]);
+ element.style.display = 'none';
+ }
+ },
+
+ show: function() {
+ for (var i = 0; i < arguments.length; i++) {
+ var element = $(arguments[i]);
+ element.style.display = '';
+ }
+ },
+
+ remove: function(element) {
+ element = $(element);
+ element.parentNode.removeChild(element);
+ },
+
+ getHeight: function(element) {
+ element = $(element);
+ return element.offsetHeight;
+ }
+}
+
+var Toggle = new Object();
+Toggle.display = Element.toggle;
+
+/*--------------------------------------------------------------------------*/
+
Abstract.Insertion = function(adjacency) {
this.adjacency = adjacency;
}
@@ -484,7 +607,7 @@ Effect.Fade.prototype = {
if (this.timer) clearTimeout(this.timer);
this.setOpacity(this.element, this.current);
this.current -= 10;
- this.timer = setTimeout(this.fade.bind(this), 100);
+ this.timer = setTimeout(this.fade.bind(this), 50);
},
isFinished: function() {
@@ -494,7 +617,7 @@ Effect.Fade.prototype = {
setOpacity: function(element, opacity) {
opacity = (opacity == 100) ? 99.999 : opacity;
element.style.filter = "alpha(opacity:"+opacity+")";
- element.style.opacity = opacity/100;
+ element.style.opacity = opacity/100 /*//*/;
}
}
@@ -503,13 +626,13 @@ Effect.Scale.prototype = {
initialize: function(element, percent) {
this.element = $(element);
this.startScale = 1.0;
- this.startHeight = this.element.height || this.element.offsetHeight;
- this.startWidth = this.element.width || this.element.offsetWidth;
+ this.startHeight = this.element.offsetHeight;
+ this.startWidth = this.element.offsetWidth;
this.currentHeight = this.startHeight;
this.currentWidth = this.startWidth;
- this.finishScale = (percent/100);
+ this.finishScale = (percent/100) /*//*/;
if (this.element.style.fontSize=="") this.sizeEm = 1.0;
- if (this.element.style.fontSize && this.element.style.fontSize.indexOf("em")>0)
+ if (this.element.style.fontSize.indexOf("em")>0)
this.sizeEm = parseFloat(this.element.style.fontSize);
if(this.element.effect_scale) {
clearTimeout(this.element.effect_scale.timer);
@@ -537,7 +660,7 @@ Effect.Scale.prototype = {
if (this.options.step) this.options.step(this);
this.setDimensions(this.element, this.currentWidth, this.currentHeight);
if(this.sizeEm) this.element.style.fontSize = this.sizeEm*this.currentScale + "em";
- this.currentScale += (this.factor/10);
+ this.currentScale += (this.factor/10) /*//*/;
this.currentWidth = this.startWidth * this.currentScale;
this.currentHeight = this.startHeight * this.currentScale;
this.timer = setTimeout(this.scale.bind(this), 50);
@@ -577,13 +700,9 @@ Effect.Puff.prototype = {
fade: function(effect) {
topd = (((effect.currentScale)*effect.startHeight) - effect.startHeight)/2;
leftd = (((effect.currentScale)*effect.startWidth) - effect.startWidth)/2;
- if(this.element.style.position='absolute') {
- this.element.style.top = this.startTop-topd + "px";
- this.element.style.left = this.startLeft-leftd + "px";
- } else {
- this.element.style.top = -topd + "px";
- this.element.style.left = -leftd + "px";
- }
+ this.element.style.position='absolute';
+ this.element.style.top = this.startTop-topd + "px";
+ this.element.style.left = this.startLeft-leftd + "px";
this.opacity -= 10;
this.setOpacity(this.element, this.opacity);
if(navigator.appVersion.indexOf('AppleWebKit')>0) this.element.innerHTML += ''; //force redraw on safari
@@ -594,7 +713,7 @@ Effect.Puff.prototype = {
setOpacity: function(element, opacity) {
opacity = (opacity == 100) ? 99.999 : opacity;
element.style.filter = "alpha(opacity:"+opacity+")";
- element.style.opacity = opacity/100;
+ element.style.opacity = opacity/100 /*//*/;
}
}
@@ -613,7 +732,7 @@ Effect.Appear.prototype = {
if (this.timer) clearTimeout(this.timer);
this.setOpacity(this.element, this.current);
this.current += 10;
- this.timer = setTimeout(this.fade.bind(this), 100);
+ this.timer = setTimeout(this.fade.bind(this), 50);
},
isFinished: function() {
@@ -623,37 +742,23 @@ Effect.Appear.prototype = {
setOpacity: function(element, opacity) {
opacity = (opacity == 100) ? 99.999 : opacity;
element.style.filter = "alpha(opacity:"+opacity+")";
- element.style.opacity = opacity/100;
+ element.style.opacity = opacity/100 /*//*/;
element.style.display = '';
}
}
-/*--------------------------------------------------------------------------*/
-
-PeriodicalExecuter = Class.create();
-PeriodicalExecuter.prototype = {
- initialize: function(what, frequency) {
- this.what = what;
- this.frequency = frequency;
- this.currentlyExecuting = false;
-
- this.registerCallback();
- },
-
- registerCallback: function() {
- setTimeout(this.onTimerEvent.bind(this), this.frequency * 1000);
- },
-
- onTimerEvent: function() {
- if (!this.currentlyExecuting) {
- try {
- this.currentlyExecuting = true;
- this.what();
- } finally {
- this.currentlyExecuting = false;
- }
+Effect.ContentZoom = Class.create();
+Effect.ContentZoom.prototype = {
+ initialize: function(element, percent) {
+ this.element = $(element);
+ if (this.element.style.fontSize=="") this.sizeEm = 1.0;
+ if (this.element.style.fontSize.indexOf("em")>0)
+ this.sizeEm = parseFloat(this.element.style.fontSize);
+ if(this.element.effect_contentzoom) {
+ this.sizeEm = this.element.effect_contentzoom.sizeEm;
}
-
- this.registerCallback();
+ this.element.effect_contentzoom = this;
+ this.element.style.fontSize = this.sizeEm*(percent/100) + "em" /*//*/;
+ if(navigator.appVersion.indexOf('AppleWebKit')>0) { this.element.scrollTop -= 1; };
}
}
View
279 railties/html/javascripts/prototype.js
@@ -1,12 +1,17 @@
-/* Prototype: an object-oriented Javascript library, version 1.1.0
+/* Prototype: an object-oriented Javascript library, version 1.2.0
* (c) 2005 Sam Stephenson <sam@conio.net>
*
- * Prototype is freely distributable under the terms of an MIT-style license.
- * For details, see http://prototype.conio.net/
- */
+ * THIS FILE IS AUTOMATICALLY GENERATED. When sending patches, please diff
+ * against the source tree, available from the Prototype darcs repository.
+ *
+ * Prototype is freely distributable under the terms of an MIT-style license.
+ *
+ * For details, see the Prototype web site: http://prototype.conio.net/
+ *
+/*--------------------------------------------------------------------------*/
var Prototype = {
- Version: '1.1.0'
+ Version: '1.2.0'
}
var Class = {
@@ -62,28 +67,33 @@ var Try = {
}
}
-// Deprecated accessor for Element.toggle
-var Toggle = { display: function() { Element.toggle(arguments); } }
+/*--------------------------------------------------------------------------*/
-var Element = {
- toggle: function() {
- for (var i = 0; i < arguments.length; i++) {
- var element = $(arguments[i]);
- element.style.display =
- (element.style.display == 'none' ? '' : 'none');
- }
- }
- hide: function() {
- for (var i = 0; i < arguments.length; i++) {
- var element = $(arguments[i]);
- element.style.display = 'none';
- }
- }
- show: function() {
- for (var i = 0; i < arguments.length; i++) {
- var element = $(arguments[i]);
- element.style.display = '';
+var PeriodicalExecuter = Class.create();
+PeriodicalExecuter.prototype = {
+ initialize: function(callback, frequency) {
+ this.callback = callback;
+ this.frequency = frequency;
+ this.currentlyExecuting = false;
+
+ this.registerCallback();
+ },
+
+ registerCallback: function() {
+ setTimeout(this.onTimerEvent.bind(this), this.frequency * 1000);
+ },
+
+ onTimerEvent: function() {
+ if (!this.currentlyExecuting) {
+ try {
+ this.currentlyExecuting = true;
+ this.callback();
+ } finally {
+ this.currentlyExecuting = false;
+ }
}
+
+ this.registerCallback();
}
}
@@ -106,22 +116,34 @@ function $() {
return elements;
}
-function getElementsByClassName(className) {
- var children = document.getElementsByTagName('*') || document.all;
- var elements = new Array();
-
- for (var i = 0; i < children.length; i++) {
- var child = children[i];
- var classNames = child.className.split(' ');
- for (var j = 0; j < classNames.length; j++) {
- if (classNames[j] == className) {
- elements.push(child);
- break;
- }
- }
+/*--------------------------------------------------------------------------*/
+
+if (!Array.prototype.push) {
+ Array.prototype.push = function() {
+ var startLength = this.length;
+ for (var i = 0; i < arguments.length; i++)
+ this[startLength + i] = arguments[i];
+ return this.length;
+ }
+}
+
+if (!Function.prototype.apply) {
+ // Based on code from http://www.youngpup.net/
+ Function.prototype.apply = function(object, parameters) {
+ var parameterStrings = new Array();
+ if (!object) object = window;
+ if (!parameters) parameters = new Array();
+
+ for (var i = 0; i < parameters.length; i++)
+ parameterStrings[i] = 'x[' + i + ']';
+
+ object.__apply__ = this;
+ var result = eval('obj.__apply__(' +
+ parameterStrings[i].join(', ') + ')');
+ object.__apply__ = null;
+
+ return result;
}
-
- return elements;
}
/*--------------------------------------------------------------------------*/
@@ -169,6 +191,9 @@ Ajax.Request.prototype = (new Ajax.Base()).extend({
setTimeout((function() {this.respondToReadyState(1)}).bind(this), 10);
}
+ this.transport.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
+ this.transport.setRequestHeader('X-Prototype-Version', Prototype.Version);
+
if (this.options.method == 'post') {
this.transport.setRequestHeader('Connection', 'close');
this.transport.setRequestHeader('Content-type',
@@ -212,11 +237,11 @@ Ajax.Updater.prototype = (new Ajax.Base()).extend({
},
updateContent: function() {
- if (!this.options.insertion) {
- this.container.innerHTML = this.request.transport.responseText;
- } else {
+ if (this.options.insertion) {
new this.options.insertion(this.container,
this.request.transport.responseText);
+ } else {
+ this.container.innerHTML = this.request.transport.responseText;
}
if (this.onComplete) {
@@ -241,6 +266,15 @@ var Field = {
for (var i = 0; i < arguments.length; i++)
if ($(arguments[i]).value == '') return false;
return true;
+ },
+
+ select: function(element) {
+ $(element).select();
+ },
+
+ activate: function(element) {
+ $(element).focus();
+ $(element).select();
}
}
@@ -270,6 +304,31 @@ var Form = {
elements.push(tagElements[j]);
}
return elements;
+ },
+
+ disable: function(form) {
+ var elements = Form.getElements(form);
+ for (var i = 0; i < elements.length; i++) {
+ var element = elements[i];
+ element.blur();
+ element.disable = 'true';
+ }
+ },
+
+ focusFirstElement: function(form) {
+ form = $(form);
+ var elements = Form.getElements(form);
+ for (var i = 0; i < elements.length; i++) {
+ var element = elements[i];
+ if (element.type != 'hidden' && !element.disabled) {
+ Field.activate(element);
+ break;
+ }
+ }
+ },
+
+ reset: function(form) {
+ $(form).reset();
}
}
@@ -319,12 +378,17 @@ Form.Element.Serializers = {
select: function(element) {
var index = element.selectedIndex;
- return [element.name, (index >= 0) ? element.options[index].value : ''];
+ var value = element.options[index].value || element.options[index].text;
+ return [element.name, (index >= 0) ? value : ''];
}
}
/*--------------------------------------------------------------------------*/
+var $F = Form.Element.getValue;
+
+/*--------------------------------------------------------------------------*/
+
Abstract.TimedObserver = function() {}
Abstract.TimedObserver.prototype = {
initialize: function(element, frequency, callback) {
@@ -368,6 +432,65 @@ Form.Observer.prototype = (new Abstract.TimedObserver()).extend({
/*--------------------------------------------------------------------------*/
+document.getElementsByClassName = function(className) {
+ var children = document.getElementsByTagName('*') || document.all;
+ var elements = new Array();
+
+ for (var i = 0; i < children.length; i++) {
+ var child = children[i];
+ var classNames = child.className.split(' ');
+ for (var j = 0; j < classNames.length; j++) {
+ if (classNames[j] == className) {
+ elements.push(child);
+ break;
+ }
+ }
+ }
+
+ return elements;
+}
+
+/*--------------------------------------------------------------------------*/
+
+var Element = {
+ toggle: function() {
+ for (var i = 0; i < arguments.length; i++) {
+ var element = $(arguments[i]);
+ element.style.display =
+ (element.style.display == 'none' ? '' : 'none');
+ }
+ },
+
+ hide: function() {
+ for (var i = 0; i < arguments.length; i++) {
+ var element = $(arguments[i]);
+ element.style.display = 'none';
+ }
+ },
+
+ show: function() {
+ for (var i = 0; i < arguments.length; i++) {
+ var element = $(arguments[i]);
+ element.style.display = '';
+ }
+ },
+
+ remove: function(element) {
+ element = $(element);
+ element.parentNode.removeChild(element);
+ },
+
+ getHeight: function(element) {
+ element = $(element);
+ return element.offsetHeight;
+ }
+}
+
+var Toggle = new Object();
+Toggle.display = Element.toggle;
+
+/*--------------------------------------------------------------------------*/
+
Abstract.Insertion = function(adjacency) {
this.adjacency = adjacency;
}
@@ -484,7 +607,7 @@ Effect.Fade.prototype = {
if (this.timer) clearTimeout(this.timer);
this.setOpacity(this.element, this.current);
this.current -= 10;
- this.timer = setTimeout(this.fade.bind(this), 100);
+ this.timer = setTimeout(this.fade.bind(this), 50);
},
isFinished: function() {
@@ -494,7 +617,7 @@ Effect.Fade.prototype = {
setOpacity: function(element, opacity) {
opacity = (opacity == 100) ? 99.999 : opacity;
element.style.filter = "alpha(opacity:"+opacity+")";
- element.style.opacity = opacity/100;
+ element.style.opacity = opacity/100 /*//*/;
}
}
@@ -503,13 +626,13 @@ Effect.Scale.prototype = {
initialize: function(element, percent) {
this.element = $(element);
this.startScale = 1.0;
- this.startHeight = this.element.height || this.element.offsetHeight;
- this.startWidth = this.element.width || this.element.offsetWidth;
+ this.startHeight = this.element.offsetHeight;
+ this.startWidth = this.element.offsetWidth;
this.currentHeight = this.startHeight;
this.currentWidth = this.startWidth;
- this.finishScale = (percent/100);
+ this.finishScale = (percent/100) /*//*/;
if (this.element.style.fontSize=="") this.sizeEm = 1.0;
- if (this.element.style.fontSize && this.element.style.fontSize.indexOf("em")>0)
+ if (this.element.style.fontSize.indexOf("em")>0)
this.sizeEm = parseFloat(this.element.style.fontSize);
if(this.element.effect_scale) {
clearTimeout(this.element.effect_scale.timer);
@@ -537,7 +660,7 @@ Effect.Scale.prototype = {
if (this.options.step) this.options.step(this);
this.setDimensions(this.element, this.currentWidth, this.currentHeight);
if(this.sizeEm) this.element.style.fontSize = this.sizeEm*this.currentScale + "em";
- this.currentScale += (this.factor/10);
+ this.currentScale += (this.factor/10) /*//*/;
this.currentWidth = this.startWidth * this.currentScale;
this.currentHeight = this.startHeight * this.currentScale;
this.timer = setTimeout(this.scale.bind(this), 50);
@@ -577,13 +700,9 @@ Effect.Puff.prototype = {
fade: function(effect) {
topd = (((effect.currentScale)*effect.startHeight) - effect.startHeight)/2;
leftd = (((effect.currentScale)*effect.startWidth) - effect.startWidth)/2;
- if(this.element.style.position='absolute') {
- this.element.style.top = this.startTop-topd + "px";
- this.element.style.left = this.startLeft-leftd + "px";
- } else {
- this.element.style.top = -topd + "px";
- this.element.style.left = -leftd + "px";
- }
+ this.element.style.position='absolute';
+ this.element.style.top = this.startTop-topd + "px";
+ this.element.style.left = this.startLeft-leftd + "px";
this.opacity -= 10;
this.setOpacity(this.element, this.opacity);
if(navigator.appVersion.indexOf('AppleWebKit')>0) this.element.innerHTML += ''; //force redraw on safari
@@ -594,7 +713,7 @@ Effect.Puff.prototype = {
setOpacity: function(element, opacity) {
opacity = (opacity == 100) ? 99.999 : opacity;
element.style.filter = "alpha(opacity:"+opacity+")";
- element.style.opacity = opacity/100;
+ element.style.opacity = opacity/100 /*//*/;
}
}
@@ -613,7 +732,7 @@ Effect.Appear.prototype = {
if (this.timer) clearTimeout(this.timer);
this.setOpacity(this.element, this.current);
this.current += 10;
- this.timer = setTimeout(this.fade.bind(this), 100);
+ this.timer = setTimeout(this.fade.bind(this), 50);
},
isFinished: function() {
@@ -623,37 +742,23 @@ Effect.Appear.prototype = {
setOpacity: function(element, opacity) {
opacity = (opacity == 100) ? 99.999 : opacity;
element.style.filter = "alpha(opacity:"+opacity+")";
- element.style.opacity = opacity/100;
+ element.style.opacity = opacity/100 /*//*/;
element.style.display = '';
}
}
-/*--------------------------------------------------------------------------*/
-
-PeriodicalExecuter = Class.create();
-PeriodicalExecuter.prototype = {
- initialize: function(what, frequency) {
- this.what = what;
- this.frequency = frequency;
- this.currentlyExecuting = false;
-
- this.registerCallback();
- },
-
- registerCallback: function() {
- setTimeout(this.onTimerEvent.bind(this), this.frequency * 1000);
- },
-
- onTimerEvent: function() {
- if (!this.currentlyExecuting) {
- try {
- this.currentlyExecuting = true;
- this.what();
- } finally {
- this.currentlyExecuting = false;
- }
+Effect.ContentZoom = Class.create();
+Effect.ContentZoom.prototype = {
+ initialize: function(element, percent) {
+ this.element = $(element);
+ if (this.element.style.fontSize=="") this.sizeEm = 1.0;
+ if (this.element.style.fontSize.indexOf("em")>0)
+ this.sizeEm = parseFloat(this.element.style.fontSize);
+ if(this.element.effect_contentzoom) {
+ this.sizeEm = this.element.effect_contentzoom.sizeEm;
}
-
- this.registerCallback();
+ this.element.effect_contentzoom = this;
+ this.element.style.fontSize = this.sizeEm*(percent/100) + "em" /*//*/;
+ if(navigator.appVersion.indexOf('AppleWebKit')>0) { this.element.scrollTop -= 1; };
}
}

0 comments on commit d547c3f

Please sign in to comment.
Something went wrong with that request. Please try again.