lib/assets/scripts/vendor/codemirror/codemirror.js
function CodeMirror(place, options) {
    if (!(this instanceof CodeMirror)) return new CodeMirror(place, options);
    
    this.options = options = options || {};
    // Determine effective options based on given values and defaults.
    for (var opt in defaults) if (!options.hasOwnProperty(opt) && defaults.hasOwnProperty(opt))
      options[opt] = defaults[opt];
    setGuttersForLineNumbers(options);

    var display = this.display = makeDisplay(place);
    display.wrapper.CodeMirror = this;
    updateGutters(this);
    if (options.autofocus && !mobile) focusInput(this);

    this.view = makeView(new BranchChunk([new LeafChunk([makeLine("", null, textHeight(display))])]));
    this.nextOpId = 0;
    loadMode(this);
    themeChanged(this);
    if (options.lineWrapping)
      this.display.wrapper.className += " CodeMirror-wrap";

    // Initialize the content.
    this.setValue(options.value || "");
    // Override magic textarea content restore that IE sometimes does
    // on our hidden textarea on reload
    if (ie) setTimeout(bind(resetInput, this, true), 20);
    this.view.history = makeHistory();

    registerEventHandlers(this);
    // IE throws unspecified error in certain cases, when
    // trying to access activeElement before onload
    var hasFocus; try { hasFocus = (document.activeElement == display.input); } catch(e) { }
    if (hasFocus || (options.autofocus && !mobile)) setTimeout(bind(onFocus, this), 20);
    else onBlur(this);

    operation(this, function() {
      for (var opt in optionHandlers)
        if (optionHandlers.propertyIsEnumerable(opt))
          optionHandlers[opt](this, options[opt], Init);
      for (var i = 0; i < initHooks.length; ++i) initHooks[i](this);
    })();
  }
function CodeMirror(place, options) {
    if (!(this instanceof CodeMirror)) return new CodeMirror(place, options);
    
    this.options = options = options || {};
    // Determine effective options based on given values and defaults.
    for (var opt in defaults) if (!options.hasOwnProperty(opt) && defaults.hasOwnProperty(opt))
      options[opt] = defaults[opt];
    setGuttersForLineNumbers(options);

    var display = this.display = makeDisplay(place);
    display.wrapper.CodeMirror = this;
    updateGutters(this);
    if (options.autofocus && !mobile) focusInput(this);

    this.view = makeView(new BranchChunk([new LeafChunk([makeLine("", null, textHeight(display))])]));
    this.nextOpId = 0;
    loadMode(this);
    themeChanged(this);
    if (options.lineWrapping)
      this.display.wrapper.className += " CodeMirror-wrap";

    // Initialize the content.
    this.setValue(options.value || "");
    // Override magic textarea content restore that IE sometimes does
    // on our hidden textarea on reload
    if (ie) setTimeout(bind(resetInput, this, true), 20);
    this.view.history = makeHistory();

    registerEventHandlers(this);
    // IE throws unspecified error in certain cases, when
    // trying to access activeElement before onload
    var hasFocus; try { hasFocus = (document.activeElement == display.input); } catch(e) { }
    if (hasFocus || (options.autofocus && !mobile)) setTimeout(bind(onFocus, this), 20);
    else onBlur(this);

    operation(this, function() {
      for (var opt in optionHandlers)
        if (optionHandlers.propertyIsEnumerable(opt))
          optionHandlers[opt](this, options[opt], Init);
      for (var i = 0; i < initHooks.length; ++i) initHooks[i](this);
    })();
  }
function CodeMirror ( place , options ) { if ( ! ( this instanceof CodeMirror ) ) return new CodeMirror ( place , options ) ; this . options = options = options || { } ; // Determine effective options based on given values and defaults. for ( var opt in defaults ) if ( ! options . hasOwnProperty ( opt ) && defaults . hasOwnProperty ( opt ) ) options [ opt ] = defaults [ opt ] ; setGuttersForLineNumbers ( options ) ; var display = this . display = makeDisplay ( place ) ; display . wrapper . CodeMirror = this ; updateGutters ( this ) ; if ( options . autofocus && ! mobile ) focusInput ( this ) ; this . view = makeView ( new BranchChunk ( [ new LeafChunk ( [ makeLine ( "" , null , textHeight ( display ) ) ] ) ] ) ) ; this . nextOpId = 0 ; loadMode ( this ) ; themeChanged ( this ) ; if ( options . lineWrapping ) this . display . wrapper . className += " CodeMirror-wrap" ; // Initialize the content. this . setValue ( options . value || "" ) ; // Override magic textarea content restore that IE sometimes does // on our hidden textarea on reload if ( ie ) setTimeout ( bind ( resetInput , this , true ) , 20 ) ; this . view . history = makeHistory ( ) ; registerEventHandlers ( this ) ; // IE throws unspecified error in certain cases, when // trying to access activeElement before onload var hasFocus ; try { hasFocus = ( document . activeElement == display . input ) ; } catch ( e ) { } if ( hasFocus || ( options . autofocus && ! mobile ) ) setTimeout ( bind ( onFocus , this ) , 20 ) ; else onBlur ( this ) ; operation ( this , function ( ) { for ( var opt in optionHandlers ) if ( optionHandlers . propertyIsEnumerable ( opt ) ) optionHandlers [ opt ] ( this , options [ opt ] , Init ) ; for ( var i = 0 ; i < initHooks . length ; ++ i ) initHooks [ i ] ( this ) ; } ) ( ) ; }
CONSTRUCTOR
CONSTRUCTOR