笙默考试管理系统-MyExamTest----codemirror(37)

笙默考试管理系统-MyExamTest----codemirror(36

目录

一、 笙默考试管理系统-MyExamTest

二、 笙默考试管理系统-MyExamTest

三、 笙默考试管理系统-MyExamTest

四、 笙默考试管理系统-MyExamTest

五、 笙默考试管理系统-MyExamTest

  • 笙默考试管理系统-MyExamTest

 collapse: function(lines) {

            lines.splice.apply(lines, [lines.length, 0].concat(this.lines));

        },

        insertHeight: function(at, lines, height) {

            this.height += height;

            this.lines.splice.apply(this.lines, [at, 0].concat(lines));

            for (var i = 0, e = lines.length; i < e; ++i) lines[i].parent = this;

        },

        iterN: function(at, n, op) {

            for (var e = at + n; at < e; ++at)

                if (op(this.lines[at])) return true;

        }

};

  • 笙默考试管理系统-MyExamTest

    function BranchChunk(children) {

        this.children = children;

        var size = 0, height = 0;

        for (var i = 0, e = children.length; i < e; ++i) {

            var ch = children[i];

            size += ch.chunkSize(); height += ch.height;

            ch.parent = this;

        }

  • 笙默考试管理系统-MyExamTest

        this.size = size;

        this.height = height;

        this.parent = null;

    }

    BranchChunk.prototype = {

        chunkSize: function() { return this.size; },

        remove: function(at, n, callbacks) {

            this.size -= n;

            for (var i = 0; i < this.children.length; ++i) {

                var child = this.children[i], sz = child.chunkSize();

                if (at < sz) {

  • 笙默考试管理系统-MyExamTest

                    var rm = Math.min(n, sz - at), oldHeight = child.height;

                    child.remove(at, rm, callbacks);

                    this.height -= oldHeight - child.height;

                    if (sz == rm) { this.children.splice(i--, 1); child.parent = null; }

                    if ((n -= rm) == 0) break;

                    at = 0;

                } else at -= sz;

            }

            if (this.size - n < 25) {

                var lines = [];

                this.collapse(lines);

                this.children = [new LeafChunk(lines)];

            }

        },

  • 笙默考试管理系统-MyExamTest

        collapse: function(lines) {

            for (var i = 0, e = this.children.length; i < e; ++i) this.children[i].collapse(lines);

        },

        insert: function(at, lines) {

            var height = 0;

            for (var i = 0, e = lines.length; i < e; ++i) height += lines[i].height;

            this.insertHeight(at, lines, height);

        },

你可能感兴趣的:(笙默考试管理系统,javascript,java,前端)