diff --git a/static/js/terminal/index.js b/static/js/terminal/index.js index 9c8b554..d577bb1 100644 --- a/static/js/terminal/index.js +++ b/static/js/terminal/index.js @@ -70,17 +70,21 @@ function Terminal(options){ this.cols = options.cols; this.rows = options.rows; - // set handler - options.handler = typeof options.handler === 'function' ? options.handler : function (){}; - this.handler = options.handler; + // set ondata + options.ondata = typeof options.ondata === 'function' ? options.ondata : function (){}; + this.ondata = options.ondata; - // set handle title - options.handleTitle = typeof options.handleTitle === 'function' ? options.handleTitle : function (){}; - this.handleTitle = options.handleTitle; + // set ontitle + options.ontitle = typeof options.ontitle === 'function' ? options.ontitle : function (){}; + this.ontitle = options.ontitle; + + // set onscreen + options.onscreen = typeof options.onscreen === 'function' ? options.onscreen : function (){}; + this.onscreen = options.onscreen; // set convert eol - options.convertEol = options.convertEol === true; - this.convertEol = options.convertEol; + options.convertEOL = options.convertEOL === true; + this.convertEOL = options.convertEOL; // set options this.options = options; diff --git a/static/js/terminal/lib/close.js b/static/js/terminal/lib/close.js index 0b6ca9e..922f687 100644 --- a/static/js/terminal/lib/close.js +++ b/static/js/terminal/lib/close.js @@ -15,7 +15,7 @@ module.exports = function (Terminal){ this.readable = false; this.writable = false; this.write = function (){}; - this.handler = function (){}; - this.handlerTitle = function (){}; + this.ondata = function (){}; + this.ontitle = function (){}; }; }; diff --git a/static/js/terminal/lib/options.js b/static/js/terminal/lib/options.js index 0db661c..6377a91 100644 --- a/static/js/terminal/lib/options.js +++ b/static/js/terminal/lib/options.js @@ -11,7 +11,6 @@ module.exports = function (Terminal){ Terminal.cursor = true; Terminal.cursorBlink = true; Terminal.cursorBlinkSpeed = 500; - Terminal.visualBell = true; Terminal.popOnBell = true; Terminal.scrollback = 640; Terminal.screenKeys = false; @@ -24,7 +23,6 @@ module.exports = function (Terminal){ cursor: Terminal.cursor, cursorBlink: Terminal.cursorBlink, cursorBlinkSpeed: Terminal.cursorBlinkSpeed, - visualBell: Terminal.visualBell, popOnBell: Terminal.popOnBell, scrollback: Terminal.scrollback, screenKeys: Terminal.screenKeys, diff --git a/static/js/terminal/lib/refresh.js b/static/js/terminal/lib/refresh.js index 15d701d..4bd2241 100644 --- a/static/js/terminal/lib/refresh.js +++ b/static/js/terminal/lib/refresh.js @@ -156,5 +156,7 @@ module.exports = function (Terminal){ } this.screen = screen(this.fgColor, this.bgColor, this.screenLines.join('')); + + this.onscreen.call(this, this.screen); }; }; diff --git a/static/js/terminal/lib/write.js b/static/js/terminal/lib/write.js index 732ffe0..37b8c0c 100644 --- a/static/js/terminal/lib/write.js +++ b/static/js/terminal/lib/write.js @@ -16,7 +16,7 @@ module.exports = function (Terminal){ if (!this.queue) { setTimeout(function (){ - context.handler(context.queue); + context.ondata.call(context, context.queue); context.queue = ''; }, 1); @@ -30,19 +30,9 @@ module.exports = function (Terminal){ */ Terminal.prototype.bell = function (){ // buffers automatically when created - var snd = new Audio('bell.wav'); + var bell = new Audio('bell.wav'); - snd.play(); - - if (!this.visualBell) return; - - var context = this; - - this.element.style.borderColor = 'white'; - - setTimeout(function (){ - context.element.style.borderColor = ''; - }, 10); + bell.play(); if (this.popOnBell) this.focus(); }; @@ -80,7 +70,7 @@ module.exports = function (Terminal){ case '\n': case '\x0b': case '\x0c': - if (this.convertEol) { + if (this.convertEOL) { this.x = 0; } @@ -424,7 +414,7 @@ module.exports = function (Terminal){ case 2: if (this.params[1]) { this.title = this.params[1]; - this.handleTitle(this.title); + this.ontitle.call(this, this.title); } break; case 3: