aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/lib/action_view')
-rw-r--r--actionpack/lib/action_view/helpers/javascripts/controls.js21
-rw-r--r--actionpack/lib/action_view/helpers/javascripts/dragdrop.js10
-rw-r--r--actionpack/lib/action_view/helpers/javascripts/effects.js9
3 files changed, 21 insertions, 19 deletions
diff --git a/actionpack/lib/action_view/helpers/javascripts/controls.js b/actionpack/lib/action_view/helpers/javascripts/controls.js
index 712784ee6d..90a5f1132b 100644
--- a/actionpack/lib/action_view/helpers/javascripts/controls.js
+++ b/actionpack/lib/action_view/helpers/javascripts/controls.js
@@ -61,6 +61,7 @@ Ajax.Autocompleter.prototype = (new Ajax.Base()).extend({
this.observer = null;
+ Event.observe(this.element, "blur", this.onBlur.bindAsEventListener(this));
Event.observe(this.element, "keypress", this.onKeyPress.bindAsEventListener(this));
Event.observe(document, "click", this.onBlur.bindAsEventListener(this));
},
@@ -108,9 +109,15 @@ Ajax.Autocompleter.prototype = (new Ajax.Base()).extend({
}
},
+ addObservers: function(element) {
+ Event.observe(element, "mouseover", this.onHover.bindAsEventListener(this));
+ Event.observe(element, "click", this.onClick.bindAsEventListener(this));
+ },
+
onComplete: function(request) {
- if(!this.changed) {
+ if(!this.changed && this.has_focus) {
this.update.innerHTML = request.responseText;
+ Element.cleanWhitespace(this.update);
Element.cleanWhitespace(this.update.firstChild);
if(this.update.firstChild && this.update.firstChild.childNodes) {
@@ -119,8 +126,7 @@ Ajax.Autocompleter.prototype = (new Ajax.Base()).extend({
for (var i = 0; i < this.entry_count; i++) {
entry = this.get_entry(i);
entry.autocompleteIndex = i;
- Event.observe(entry, "mouseover", this.onHover.bindAsEventListener(this));
- Event.observe(entry, "click", this.onClick.bindAsEventListener(this));
+ this.addObservers(entry);
}
} else {
this.entry_count = 0;
@@ -171,26 +177,29 @@ Ajax.Autocompleter.prototype = (new Ajax.Base()).extend({
},
onHover: function(event) {
- element = Event.findElement(event, 'LI');
+ var element = Event.findElement(event, 'LI');
if(this.index != element.autocompleteIndex)
{
this.index = element.autocompleteIndex;
this.render();
}
+ Event.stop(event);
},
onClick: function(event) {
- element = Event.findElement(event, 'LI');
+ var element = Event.findElement(event, 'LI');
this.index = element.autocompleteIndex;
this.select_entry();
+ Event.stop(event);
},
onBlur: function(event) {
- element = Event.element(event);
+ var element = Event.element(event);
if(element==this.update) return;
while(element.parentNode)
{ element = element.parentNode; if(element==this.update) return; }
this.hide();
+ this.has_focus = false;
this.active = false;
},
diff --git a/actionpack/lib/action_view/helpers/javascripts/dragdrop.js b/actionpack/lib/action_view/helpers/javascripts/dragdrop.js
index 493f0e3855..6086b44ee0 100644
--- a/actionpack/lib/action_view/helpers/javascripts/dragdrop.js
+++ b/actionpack/lib/action_view/helpers/javascripts/dragdrop.js
@@ -235,13 +235,13 @@ Draggable.prototype = {
var options = {
handle: false,
starteffect: function(element) {
- new Effect2.Opacity(element, {duration:0.2, from:1.0, to:0.7});
+ new Effect.Opacity(element, {duration:0.2, from:1.0, to:0.7});
},
reverteffect: function(element, top_offset, left_offset) {
- new Effect2.MoveBy(element, -top_offset, -left_offset, {duration:0.4});
+ new Effect.MoveBy(element, -top_offset, -left_offset, {duration:0.4});
},
endeffect: function(element) {
- new Effect2.Opacity(element, {duration:0.2, from:0.7, to:1.0});
+ new Effect.Opacity(element, {duration:0.2, from:0.7, to:1.0});
},
zindex: 1000
}.extend(arguments[1] || {});
@@ -466,6 +466,4 @@ Sortable = {
return queryComponents.join("&");
}
-}
-
-/*--------------------------------------------------------------------------*/ \ No newline at end of file
+} \ No newline at end of file
diff --git a/actionpack/lib/action_view/helpers/javascripts/effects.js b/actionpack/lib/action_view/helpers/javascripts/effects.js
index 794c4b81a8..9a26c5d712 100644
--- a/actionpack/lib/action_view/helpers/javascripts/effects.js
+++ b/actionpack/lib/action_view/helpers/javascripts/effects.js
@@ -529,7 +529,7 @@ Effect.Pulsate = function(element) {
Effect.Fold = function(element) {
$(element).style.overflow = 'hidden';
- new Effect2.Scale(element, 5, {
+ new Effect.Scale(element, 5, {
scaleContent: false,
scaleTo: 100,
scaleX: false,
@@ -547,11 +547,6 @@ Effect.Fold = function(element) {
Element.setContentZoom = function(element, percent) {
var element = $(element);
-
- var sizeEm = 1.0;
- if (element.style.fontSize.indexOf("em")>0)
- sizeEm = parseFloat(element.style.fontSize);
-
- element.style.fontSize = sizeEm*(percent/100) + "em";
+ element.style.fontSize = (percent/100) + "em";
if(navigator.appVersion.indexOf('AppleWebKit')>0) window.scrollBy(0,0);
}