rem: var field = el[0] || el; if (field.type == 'radio' || field.type == 'checkbox') event = 'click'; else if (obs && field.type == 'text' || field.type == 'textarea') event = 'keyup'; else event = 'change'; return event; 
add: var field = el[0] || el, e = 'change'; if (field.type == 'radio' || field.type == 'checkbox') e = 'click'; else if (obs && field.type == 'text' || field.type == 'textarea') e = 'keyup'; return e; 
context: (function($) {  $.extend({ // Translate field to event    fieldEvent: function(el, obs) {      var field = el[0] || el;      if (field.type == 'radio' || field.type == 'checkbox') event = 'click';      else if (obs && field.type == 'text' || field.type == 'textarea') event = 'keyup';      else event = 'change';      return event;    }  });  $.fn.extend({ // Delayed observer for fields and forms    delayedObserver: function(delay, callback){      var el = $(this);      if (typeof window.delayedObserverStack == 'undefined') window.delayedObserverStack = [];      if (typeof window.delayedObserverCallback == 'undefined') {        window.delayedObserverCallback = function(stackPos) {          observed = window.delayedObserverStack[stackPos];          if (observed.timer) clearTimeout(observed.timer);             observed.timer = setTimeout(function(){            observed.timer = null;            observed.callback(observed.obj, observed.obj.formVal());          }, observed.delay * 1000);          observed.oldVal = observed.obj.formVal();        }      }      window.delayedObserverStack.push({        obj: el, timer: null, delay: delay,         oldVal: el.formVal(), callback: callback      });           var stackPos = window.delayedObserverStack.length-1;      if (el[0].tagName == 'FORM') {        $(':input', el).each(function(){          var field = $(this);          field.bind($.fieldEvent(field, delay), function(){            observed = window.delayedObserverStack[stackPos];            if (observed.obj.formVal() == observed.obj.oldVal) return;            else window.delayedObserverCallback(stackPos);          });        });      } else {        el.bind($.fieldEvent(el, delay), function(){          observed = window.delayedObserverStack[stackPos];          if (observed.obj.formVal() == observed.obj.oldVal) return;          else window.delayedObserverCallback(stackPos);        });      };    },    formVal: function() { // Gets form values      var el = this[0];      if(el.tagName == 'FORM') return this.serialize();      if(el.type == 'checkbox' || self.type == 'radio') return this.filter('input:checked').val() || '';      else return this.val();    }  });})(jQuery);
meta: 4185	/local1/tlutelli/issta_data/temp/all_js/javascript/2007_temp/2007/4185/60b184bc654298dc41df5463a174a7bed258d9b3/jrails.js/buggy/javascripts/sources/jrails.js