Sha256: 9fffc3d0fc9bf69a35ded9b39a43872b96689f25ff660979071999fc712a18c6

Contents?: true

Size: 904 Bytes

Versions: 7

Compression:

Stored size: 904 Bytes

Contents

var RuledTable = Class.create();
RuledTable.prototype = {
  
  initialize: function(element_id) {
    var table = $(element_id);
    var rows = table.getElementsByTagName('tr');
    for (var i = 0; i < rows.length; i++) {
      this.setupRow(rows[i]);
    }
  },
  
  onMouseOverRow: function(event) {
    // Element.addClassName(this, 'highlight');
    this.className = this.className.replace(/\s*\bhighlight\b|$/, ' highlight'); // faster than the above
  },
  
  onMouseOutRow: function(event) {
    // Element.removeClassName(this, 'highlight');
    this.className = this.className.replace(/\s*\bhighlight\b\s*/, ' '); // faster than the above
  },
  
  setupRow: function(row) {
    Event.observe(row, 'mouseover', this.onMouseOverRow.bindAsEventListener(row));
    Event.observe(row, 'mouseout', this.onMouseOutRow.bindAsEventListener(row));
    if (this.onRowSetup) this.onRowSetup(row);
  }
  
};

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
radiant-0.5.0 public/javascripts/ruledtable.js
radiant-0.5.1 public/javascripts/ruledtable.js
radiant-0.5.2 public/javascripts/ruledtable.js
radiant-0.6.0 public/javascripts/ruledtable.js
radiant-0.6.1 public/javascripts/ruledtable.js
radiant-0.6.2 public/javascripts/ruledtable.js
radiant-0.6.3 public/javascripts/ruledtable.js