aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view/helpers/javascripts
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2005-03-26 15:22:18 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2005-03-26 15:22:18 +0000
commite79801d7f254572e195a0048fc912571b51aa23d (patch)
tree480cf23473499fe03d71fed43b07a1c9030f21ce /actionpack/lib/action_view/helpers/javascripts
parentae5f3c74883ae2ea5c0d19151acc8fb33e5fd52c (diff)
downloadrails-e79801d7f254572e195a0048fc912571b51aa23d.tar.gz
rails-e79801d7f254572e195a0048fc912571b51aa23d.tar.bz2
rails-e79801d7f254572e195a0048fc912571b51aa23d.zip
Fixed highlight effect
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1005 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib/action_view/helpers/javascripts')
-rw-r--r--actionpack/lib/action_view/helpers/javascripts/prototype.js14
1 files changed, 12 insertions, 2 deletions
diff --git a/actionpack/lib/action_view/helpers/javascripts/prototype.js b/actionpack/lib/action_view/helpers/javascripts/prototype.js
index fa1539fca4..d634c5c6b5 100644
--- a/actionpack/lib/action_view/helpers/javascripts/prototype.js
+++ b/actionpack/lib/action_view/helpers/javascripts/prototype.js
@@ -89,9 +89,10 @@ function getElementsByClassName(className, element) {
var all = document.all ? document.all : document.getElementsByTagName(element);
var elements = new Array();
- for (var e = 0; e < all.length; e++)
+ for (var e = 0; e < all.length; e++) {
if (all[e].className == className)
elements[elements.length] = all[e];
+ }
return elements;
}
@@ -351,6 +352,12 @@ Form.Observer.prototype = (new Abstract.TimedObserver()).extend({
/*--------------------------------------------------------------------------*/
+Number.prototype.toColorPart = function() {
+ var digits = this.toString(16);
+ if (this < 16) return '0' + digits;
+ return digits;
+}
+
var YellowFader = Class.create();
YellowFader.prototype = {
initialize: function(element) {
@@ -365,11 +372,14 @@ YellowFader.prototype = {
fade: function() {
if (this.isFinished()) return;
if (this.timer) clearTimeout(this.timer); // prevent flicker
- highlight_yellow(this.element, this.current);
+ this.highlight(this.element, this.current);
this.current += 17;
this.timer = setTimeout(this.fade.bind(this), 250);
},
isFinished: function() {
return this.current > this.finish;
+ },
+ highlight: function(element, current) {
+ element.style.backgroundColor = "#ffff" + current.toColorPart();
}
} \ No newline at end of file