o: ActiveSupport::Cache::Entry	:@compressedF:@expires_in0:@created_atf1355470625.218669:@value"^{I"
class:EFI"BundledAsset;�FI"logical_path;�FI"mercury/history_buffer.js;�FI"
pathname;�FI"{/Users/brownjohn/.rvm/gems/ruby-1.9.3-p194/gems/mercury-rails-0.8.0/app/assets/javascripts/mercury/history_buffer.js.coffee;�FI"content_type;�FI"application/javascript;�FI"
mtime;�FI"2012-08-08T16:13:36+08:00;�FI"length;�FiSI"digest;�F"%9934b8f107bd50a865d91d96c319d4baI"source;�FI"S(function() {

  this.Mercury.HistoryBuffer = (function() {

    function HistoryBuffer(maxLength) {
      this.maxLength = maxLength != null ? maxLength : 200;
      this.index = 0;
      this.stack = [];
      this.markerRegExp = /<em class="mercury-marker"><\/em>/g;
    }

    HistoryBuffer.prototype.push = function(item) {
      if (jQuery.type(item) === 'string') {
        if (this.stack[this.index] && this.stack[this.index].replace(this.markerRegExp, '') === item.replace(this.markerRegExp, '')) {
          return;
        }
      } else if (jQuery.type(item) === 'object' && item.html) {
        if (this.stack[this.index] && this.stack[this.index].html === item.html) {
          return;
        }
      }
      this.stack = this.stack.slice(0, this.index + 1);
      this.stack.push(item);
      if (this.stack.length > this.maxLength) {
        this.stack.shift();
      }
      return this.index = this.stack.length - 1;
    };

    HistoryBuffer.prototype.undo = function() {
      if (this.index < 1) {
        return null;
      }
      this.index -= 1;
      return this.stack[this.index];
    };

    HistoryBuffer.prototype.redo = function() {
      if (this.index >= this.stack.length - 1) {
        return null;
      }
      this.index += 1;
      return this.stack[this.index];
    };

    return HistoryBuffer;

  })();

}).call(this);
;�FI"required_assets_digest;�F"%ad360850c5950663863182a1201e6365I"
_version;�F"%9f3b95dd7ea3030dc35985c0a8020862