lib/assets/scripts/vendor/codemirror/codemirror.js
function makeDisplay(place) {
    var d = {};
    var input = d.input = elt("textarea", null, null, "position: absolute; padding: 0; width: 1px; height: 1em; outline: none;");
    input.setAttribute("wrap", "off"); input.setAttribute("autocorrect", "off"); input.setAttribute("autocapitalize", "off");
    // Wraps and hides input textarea
    d.inputDiv = elt("div", [input], null, "overflow: hidden; position: relative; width: 3px; height: 0px;");
    // The actual fake scrollbars.
    d.scrollbarH = elt("div", [elt("div", null, null, "height: 1px")], "CodeMirror-hscrollbar");
    d.scrollbarV = elt("div", [elt("div", null, null, "width: 1px")], "CodeMirror-vscrollbar");
    d.scrollbarFiller = elt("div", null, "CodeMirror-scrollbar-filler");
    // DIVs containing the selection and the actual code
    d.lineDiv = elt("div");
    d.selectionDiv = elt("div", null, null, "position: relative; z-index: 1");
    // Blinky cursor, and element used to ensure cursor fits at the end of a line
    d.cursor = elt("pre", "\u00a0", "CodeMirror-cursor");
    // Secondary cursor, shown when on a 'jump' in bi-directional text
    d.otherCursor = elt("pre", "\u00a0", "CodeMirror-cursor CodeMirror-secondarycursor");
    // Used to measure text size
    d.measure = elt("div", null, "CodeMirror-measure");
    // Wraps everything that needs to exist inside the vertically-padded coordinate system
    d.lineSpace = elt("div", [d.measure, d.selectionDiv, d.lineDiv, d.cursor, d.otherCursor],
                         null, "position: relative; outline: none");
    // Moved around its parent to cover visible view
    d.mover = elt("div", [elt("div", [d.lineSpace], "CodeMirror-lines")], null, "position: relative");
    // Set to the height of the text, causes scrolling
    d.sizer = elt("div", [d.mover], "CodeMirror-sizer");
    // D is needed because behavior of elts with overflow: auto and padding is inconsistent across browsers
    d.heightForcer = elt("div", "\u00a0", null, "position: absolute; height: " + scrollerCutOff + "px");
    // Will contain the gutters, if any
    d.gutters = elt("div", null, "CodeMirror-gutters");
    d.lineGutter = null;
    // Helper element to properly size the gutter backgrounds
    var scrollerInner = elt("div", [d.sizer, d.heightForcer, d.gutters], null, "position: relative; min-height: 100%");
    // Provides scrolling
    d.scroller = elt("div", [scrollerInner], "CodeMirror-scroll");
    d.scroller.setAttribute("tabIndex", "-1");
    // The element in which the editor lives.
    d.wrapper = elt("div", [d.inputDiv, d.scrollbarH, d.scrollbarV,
                            d.scrollbarFiller, d.scroller], "CodeMirror");
    // Work around IE7 z-index bug
    if (ie_lt8) { d.gutters.style.zIndex = -1; d.scroller.style.paddingRight = 0; }
    if (place.appendChild) place.appendChild(d.wrapper); else place(d.wrapper);

    // Needed to hide big blue blinking cursor on Mobile Safari
    if (ios) input.style.width = "0px";
    if (!webkit) d.scroller.draggable = true;
    // Needed to handle Tab key in KHTML
    if (khtml) { d.inputDiv.style.height = "1px"; d.inputDiv.style.position = "absolute"; }
    // Need to set a minimum width to see the scrollbar on IE7 (but must not set it on IE8).
    else if (ie_lt8) d.scrollbarH.style.minWidth = d.scrollbarV.style.minWidth = "18px";

    // Current visible range (may be bigger than the view window).
    d.viewOffset = d.showingFrom = d.showingTo = d.lastSizeC = 0;

    // Used to only resize the line number gutter when necessary (when
    // the amount of lines crosses a boundary that makes its width change)
    d.lineNumWidth = d.lineNumInnerWidth = d.lineNumChars = null;
    // See readInput and resetInput
    d.prevInput = "";
    // Set to true when a non-horizontal-scrolling widget is added. As
    // an optimization, widget aligning is skipped when d is false.
    d.alignWidgets = false;
    // Flag that indicates whether we currently expect input to appear
    // (after some event like 'keypress' or 'input') and are polling
    // intensively.
    d.pollingFast = false;
    // Self-resetting timeout for the poller
    d.poll = new Delayed();
    // True when a drag from the editor is active
    d.draggingText = false;

    d.cachedCharWidth = d.cachedTextHeight = null;
    d.measureLineCache = [];
    d.measureLineCachePos = 0;

    // Tracks when resetInput has punted to just putting a short
    // string instead of the (large) selection.
    d.inaccurateSelection = false;

    // Used to adjust overwrite behaviour when a paste has been
    // detected
    d.pasteIncoming = false;

    return d;
  }
function makeDisplay(place) {
    var d = {};
    var input = d.input = elt("textarea", null, null, "position: absolute; padding: 0; width: 1px; height: 1em; outline: none;");
    input.setAttribute("wrap", "off"); input.setAttribute("autocorrect", "off"); input.setAttribute("autocapitalize", "off");
    // Wraps and hides input textarea
    d.inputDiv = elt("div", [input], null, "overflow: hidden; position: relative; width: 3px; height: 0px;");
    // The actual fake scrollbars.
    d.scrollbarH = elt("div", [elt("div", null, null, "height: 1px")], "CodeMirror-hscrollbar");
    d.scrollbarV = elt("div", [elt("div", null, null, "width: 1px")], "CodeMirror-vscrollbar");
    d.scrollbarFiller = elt("div", null, "CodeMirror-scrollbar-filler");
    // DIVs containing the selection and the actual code
    d.lineDiv = elt("div");
    d.selectionDiv = elt("div", null, null, "position: relative; z-index: 1");
    // Blinky cursor, and element used to ensure cursor fits at the end of a line
    d.cursor = elt("pre", "\u00a0", "CodeMirror-cursor");
    // Secondary cursor, shown when on a 'jump' in bi-directional text
    d.otherCursor = elt("pre", "\u00a0", "CodeMirror-cursor CodeMirror-secondarycursor");
    // Used to measure text size
    d.measure = elt("div", null, "CodeMirror-measure");
    // Wraps everything that needs to exist inside the vertically-padded coordinate system
    d.lineSpace = elt("div", [d.measure, d.selectionDiv, d.lineDiv, d.cursor, d.otherCursor],
                         null, "position: relative; outline: none");
    // Moved around its parent to cover visible view
    d.mover = elt("div", [elt("div", [d.lineSpace], "CodeMirror-lines")], null, "position: relative");
    // Set to the height of the text, causes scrolling
    d.sizer = elt("div", [d.mover], "CodeMirror-sizer");
    // D is needed because behavior of elts with overflow: auto and padding is inconsistent across browsers
    d.heightForcer = elt("div", "\u00a0", null, "position: absolute; height: " + scrollerCutOff + "px");
    // Will contain the gutters, if any
    d.gutters = elt("div", null, "CodeMirror-gutters");
    d.lineGutter = null;
    // Helper element to properly size the gutter backgrounds
    var scrollerInner = elt("div", [d.sizer, d.heightForcer, d.gutters], null, "position: relative; min-height: 100%");
    // Provides scrolling
    d.scroller = elt("div", [scrollerInner], "CodeMirror-scroll");
    d.scroller.setAttribute("tabIndex", "-1");
    // The element in which the editor lives.
    d.wrapper = elt("div", [d.inputDiv, d.scrollbarH, d.scrollbarV,
                            d.scrollbarFiller, d.scroller], "CodeMirror");
    // Work around IE7 z-index bug
    if (ie_lt8) { d.gutters.style.zIndex = -1; d.scroller.style.paddingRight = 0; }
    if (place.appendChild) place.appendChild(d.wrapper); else place(d.wrapper);

    // Needed to hide big blue blinking cursor on Mobile Safari
    if (ios) input.style.width = "0px";
    if (!webkit) d.scroller.draggable = true;
    // Needed to handle Tab key in KHTML
    if (khtml) { d.inputDiv.style.height = "1px"; d.inputDiv.style.position = "absolute"; }
    // Need to set a minimum width to see the scrollbar on IE7 (but must not set it on IE8).
    else if (ie_lt8) d.scrollbarH.style.minWidth = d.scrollbarV.style.minWidth = "18px";

    // Current visible range (may be bigger than the view window).
    d.viewOffset = d.showingFrom = d.showingTo = d.lastSizeC = 0;

    // Used to only resize the line number gutter when necessary (when
    // the amount of lines crosses a boundary that makes its width change)
    d.lineNumWidth = d.lineNumInnerWidth = d.lineNumChars = null;
    // See readInput and resetInput
    d.prevInput = "";
    // Set to true when a non-horizontal-scrolling widget is added. As
    // an optimization, widget aligning is skipped when d is false.
    d.alignWidgets = false;
    // Flag that indicates whether we currently expect input to appear
    // (after some event like 'keypress' or 'input') and are polling
    // intensively.
    d.pollingFast = false;
    // Self-resetting timeout for the poller
    d.poll = new Delayed();
    // True when a drag from the editor is active
    d.draggingText = false;

    d.cachedCharWidth = d.cachedTextHeight = null;
    d.measureLineCache = [];
    d.measureLineCachePos = 0;

    // Tracks when resetInput has punted to just putting a short
    // string instead of the (large) selection.
    d.inaccurateSelection = false;

    // Used to adjust overwrite behaviour when a paste has been
    // detected
    d.pasteIncoming = false;

    return d;
  }
function makeDisplay ( place ) { var d = { } ; var input = d . input = elt ( "textarea" , null , null , "position: absolute; padding: 0; width: 1px; height: 1em; outline: none;" ) ; input . setAttribute ( "wrap" , "off" ) ; input . setAttribute ( "autocorrect" , "off" ) ; input . setAttribute ( "autocapitalize" , "off" ) ; // Wraps and hides input textarea d . inputDiv = elt ( "div" , [ input ] , null , "overflow: hidden; position: relative; width: 3px; height: 0px;" ) ; // The actual fake scrollbars. d . scrollbarH = elt ( "div" , [ elt ( "div" , null , null , "height: 1px" ) ] , "CodeMirror-hscrollbar" ) ; d . scrollbarV = elt ( "div" , [ elt ( "div" , null , null , "width: 1px" ) ] , "CodeMirror-vscrollbar" ) ; d . scrollbarFiller = elt ( "div" , null , "CodeMirror-scrollbar-filler" ) ; // DIVs containing the selection and the actual code d . lineDiv = elt ( "div" ) ; d . selectionDiv = elt ( "div" , null , null , "position: relative; z-index: 1" ) ; // Blinky cursor, and element used to ensure cursor fits at the end of a line d . cursor = elt ( "pre" , "\u00a0" , "CodeMirror-cursor" ) ; // Secondary cursor, shown when on a 'jump' in bi-directional text d . otherCursor = elt ( "pre" , "\u00a0" , "CodeMirror-cursor CodeMirror-secondarycursor" ) ; // Used to measure text size d . measure = elt ( "div" , null , "CodeMirror-measure" ) ; // Wraps everything that needs to exist inside the vertically-padded coordinate system d . lineSpace = elt ( "div" , [ d . measure , d . selectionDiv , d . lineDiv , d . cursor , d . otherCursor ] , null , "position: relative; outline: none" ) ; // Moved around its parent to cover visible view d . mover = elt ( "div" , [ elt ( "div" , [ d . lineSpace ] , "CodeMirror-lines" ) ] , null , "position: relative" ) ; // Set to the height of the text, causes scrolling d . sizer = elt ( "div" , [ d . mover ] , "CodeMirror-sizer" ) ; // D is needed because behavior of elts with overflow: auto and padding is inconsistent across browsers d . heightForcer = elt ( "div" , "\u00a0" , null , "position: absolute; height: " + scrollerCutOff + "px" ) ; // Will contain the gutters, if any d . gutters = elt ( "div" , null , "CodeMirror-gutters" ) ; d . lineGutter = null ; // Helper element to properly size the gutter backgrounds var scrollerInner = elt ( "div" , [ d . sizer , d . heightForcer , d . gutters ] , null , "position: relative; min-height: 100%" ) ; // Provides scrolling d . scroller = elt ( "div" , [ scrollerInner ] , "CodeMirror-scroll" ) ; d . scroller . setAttribute ( "tabIndex" , "-1" ) ; // The element in which the editor lives. d . wrapper = elt ( "div" , [ d . inputDiv , d . scrollbarH , d . scrollbarV , d . scrollbarFiller , d . scroller ] , "CodeMirror" ) ; // Work around IE7 z-index bug if ( ie_lt8 ) { d . gutters . style . zIndex = - 1 ; d . scroller . style . paddingRight = 0 ; } if ( place . appendChild ) place . appendChild ( d . wrapper ) ; else place ( d . wrapper ) ; // Needed to hide big blue blinking cursor on Mobile Safari if ( ios ) input . style . width = "0px" ; if ( ! webkit ) d . scroller . draggable = true ; // Needed to handle Tab key in KHTML if ( khtml ) { d . inputDiv . style . height = "1px" ; d . inputDiv . style . position = "absolute" ; } // Need to set a minimum width to see the scrollbar on IE7 (but must not set it on IE8). else if ( ie_lt8 ) d . scrollbarH . style . minWidth = d . scrollbarV . style . minWidth = "18px" ; // Current visible range (may be bigger than the view window). d . viewOffset = d . showingFrom = d . showingTo = d . lastSizeC = 0 ; // Used to only resize the line number gutter when necessary (when // the amount of lines crosses a boundary that makes its width change) d . lineNumWidth = d . lineNumInnerWidth = d . lineNumChars = null ; // See readInput and resetInput d . prevInput = "" ; // Set to true when a non-horizontal-scrolling widget is added. As // an optimization, widget aligning is skipped when d is false. d . alignWidgets = false ; // Flag that indicates whether we currently expect input to appear // (after some event like 'keypress' or 'input') and are polling // intensively. d . pollingFast = false ; // Self-resetting timeout for the poller d . poll = new Delayed ( ) ; // True when a drag from the editor is active d . draggingText = false ; d . cachedCharWidth = d . cachedTextHeight = null ; d . measureLineCache = [ ] ; d . measureLineCachePos = 0 ; // Tracks when resetInput has punted to just putting a short // string instead of the (large) selection. d . inaccurateSelection = false ; // Used to adjust overwrite behaviour when a paste has been // detected d . pasteIncoming = false ; return d ; }
DISPLAY CONSTRUCTOR
DISPLAY CONSTRUCTOR