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

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

目录

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

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

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

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

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

  • 笙默考试管理系统-MyExamTest

  return chunk.lines[n];

    }

    function lineNo(line) {

        if (line.parent == null) return null;

        var cur = line.parent, no = indexOf(cur.lines, line);

        for (var chunk = cur.parent; chunk; cur = chunk, chunk = chunk.parent) {

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

                if (chunk.children[i] == cur) break;

                no += chunk.children[i].chunkSize();

            }

        }

        return no;

    }

    function lineAtHeight(chunk, h) {

        var n = 0;

        outer: do {

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

                var child = chunk.children[i], ch = child.height;

                if (h < ch) { chunk = child; continue outer; }

                h -= ch;

                n += child.chunkSize();

            }

  • 笙默考试管理系统-MyExamTest

            return n;

        } while (!chunk.lines);

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

            var line = chunk.lines[i], lh = line.height;

            if (h < lh) break;

            h -= lh;

        }

        return n + i;

    }

    function heightAtLine(chunk, n) {

        var h = 0;

        outer: do {

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

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

                if (n < sz) { chunk = child; continue outer; }

                n -= sz;

                h += child.height;

            }

  • 笙默考试管理系统-MyExamTest

            return h;

        } while (!chunk.lines);

        for (var i = 0; i < n; ++i) h += chunk.lines[i].height;

        return h;

    }

    // The history object 'chunks' changes that are made close together

    // and at almost the same time into bigger undoable units.

    function History() {

        this.time = 0;

        this.done = []; this.undone = [];

}

  • 笙默考试管理系统-MyExamTest

    History.prototype = {

        addChange: function(start, added, old) {

            this.undone.length = 0;

            var time = +new Date, last = this.done[this.done.length - 1];

            if (time - this.time > 400 || !last ||

                last.start > start + added || last.start + last.added < start - last.added + last.old.length)

                this.done.push({start: start, added: added, old: old});

            else {

                var oldoff = 0;

                if (start < last.start) {

                    for (var i = last.start - start - 1; i >= 0; --i)

                        last.old.unshift(old[i]);

                    last.added += last.start - start;

                    last.start = start;

                }

  • 笙默考试管理系统-MyExamTest

                else if (last.start < start) {

                    oldoff = start - last.start;

                    added += oldoff;

                }

                for (var i = last.added - oldoff, e = old.length; i < e; ++i)

                    last.old.push(old[i]);

                if (last.added < added) last.added = added;

            }

            this.time = time;

        }

    };

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