ansilove.js

A script to display ANSi and artscene related file formats on web pages
Log | Files | Refs | README | LICENSE

commit 736b44f2394ad4ff8b18c89af7703448cf3c80c3
parent f698900597b860dc7f778883cd88a3944a303c3e
Author: Andy Herbert <andy.herbert@gmail.com>
Date:   Tue, 15 Oct 2013 21:00:15 +0100

Added the option to ignore screen clears in ansimations by setting option "2J" to 1 (do not ignore, default), and 0 (ignore).

Diffstat:
Mansilove.js | 7++++---
1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/ansilove.js b/ansilove.js @@ -1110,11 +1110,12 @@ var AnsiLove = (function () { } function Ansimation(bytes, options) { - var timer, interval, file, font, icecolors, bits, palette, canvas, ctx, blinkCanvas, buffer, bufferCtx, blinkCtx, escaped, escapeCode, j, code, values, x, y, savedX, savedY, foreground, background, drawForeground, drawBackground, bold, inverse, blink; + var timer, interval, file, font, icecolors, bits, palette, screenClear, canvas, ctx, blinkCanvas, buffer, bufferCtx, blinkCtx, escaped, escapeCode, j, code, values, x, y, savedX, savedY, foreground, background, drawForeground, drawBackground, bold, inverse, blink; file = new File(bytes); - icecolors = options.icecolors || false; + icecolors = (options.icecolors === undefined) ? false : (options.icecolors === 1); bits = options.bits || 8; + screenClear = (options["2J"] === undefined) ? true : (options["2J"] === 1); switch (bits) { case "ced": @@ -1242,7 +1243,7 @@ var AnsiLove = (function () { } break; case "J": - if (values[0] === 2) { + if (screenClear && values[0] === 2) { x = 1; y = 1; clearScreen(0, 0, canvas.width, canvas.height);