Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed highlight effect

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1005 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
commit e79801d7f254572e195a0048fc912571b51aa23d 1 parent ae5f3c7
@dhh dhh authored
Showing with 12 additions and 2 deletions.
  1. +12 −2 actionpack/lib/action_view/helpers/javascripts/prototype.js
View
14 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();
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.