From 678ba6fcf117ee91cfe845dc27011e1ca8b92936 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucio=20Andr=C3=A9s=20Illanes=20Albornoz?= Date: Sat, 24 Nov 2018 13:16:11 +0100 Subject: [PATCH] index.html, assets/js/{clipboard,lex,matrix,ui/controls}.js: removes non-functional ANSI export format. index.html, assets/js/{clipboard,lex,matrix,ui/controls}.js: removes Irssi export format due to lack of interest on #MiRCart. --- assets/js/clipboard.js | 23 +--------------------- assets/js/lex.js | 8 -------- assets/js/matrix.js | 41 ---------------------------------------- assets/js/ui/controls.js | 2 +- index.html | 2 +- 5 files changed, 3 insertions(+), 73 deletions(-) diff --git a/assets/js/clipboard.js b/assets/js/clipboard.js index 6ede8f3..930bf52 100644 --- a/assets/js/clipboard.js +++ b/assets/js/clipboard.js @@ -1,7 +1,7 @@ var clipboard = (function () { var exports = { - format: "irssi", + format: "mirc", importing: false, visible: false, canvas: document.createElement("canvas"), @@ -72,21 +72,6 @@ var clipboard = (function () { data = data || import_textarea.value } - var irssi_style_regex = /^\s*\/exec -out printf ("%b" )?"/; - - // turn irssi style into mirc style - if (data.match(irssi_style_regex)){ - data = data.replace(/\\x03/gm, '\x03') - .replace(/(\\x..)+/gm, unicode.unescapeFromEscapedBytes) - .replace(/\\x5C/g, '\\') - .replace(/\\n/gm, '\n') - .replace(/\\`/gm, '`') - .replace(/\\"/gm, '"') - .replace(/\\\$/gm, '$') - .replace(irssi_style_regex, '') - .replace(/"\s*$/, '') - } - var to_json = function(string, opts){ var lines_in = string.split(/\r?\n/) var lines_out = [] @@ -185,12 +170,6 @@ var clipboard = (function () { case 'mirc': output = canvas.mirc({cutoff: 425}) break - case 'irssi': - output = canvas.irssi({cutoff: 425}) - break - case 'ansi': - output = canvas.ansi() - break } if (output.cutoff){ cutoff_warning_el.style.display = 'block' diff --git a/assets/js/lex.js b/assets/js/lex.js index 9bfd128..c17f142 100644 --- a/assets/js/lex.js +++ b/assets/js/lex.js @@ -64,14 +64,6 @@ Lex.prototype.mirc = function(bg_, fg_){ return [bg_, fg_, "\x03" + (this.fg&15) + "," + ((this.bg&15) < 10 && !charIsNaN ? "0" : "") + (this.bg&15) + char] } } -Lex.prototype.ansi = function(){ - var fg = ansi_fg[ this.fg&15 ] - var bg = ansi_bg[ this.bg&15 ] - var c = this.sanitize() - if (c == "\\") c = "\\\\" - if (c == '"') c = '\\"' - return "\\e[" + fg + ";" + bg + "m" + c -} Lex.prototype.assign = function (lex){ this.fg = lex.fg this.bg = lex.bg diff --git a/assets/js/matrix.js b/assets/js/matrix.js index 840ddf4..c3caf43 100644 --- a/assets/js/matrix.js +++ b/assets/js/matrix.js @@ -239,23 +239,6 @@ Matrix.prototype.ascii = function () { var txt = lines.join("\n") return txt } -Matrix.prototype.ansi = function (opts) { - var lines = this.aa.map(function(row, y){ - var last, line = "" - row.forEach(function(lex, x) { - if (lex.eqColor(last)) { - line += lex.sanitize() - } - else { - line += lex.ansi() - last = lex - } - }) - return line - }) - var txt = lines.filter(function(line){ return line.length > 0 }).join('\\e[0m\\n') + "\\e[0m" - return 'echo -e "' + txt + '"' -} Matrix.prototype.mirc = function (opts) { var cutoff = false var lines = this.aa.map(function(row, y){ @@ -284,30 +267,6 @@ Matrix.prototype.mirc = function (opts) { } return txt } -Matrix.prototype.irssi = function(opts){ - var mirc = this.mirc(opts) - var txt = mirc - // .replace(/\%/g, '%%') - .replace(/\\/g, '\\x5C') - .replace(/\"/g, '\\\"') - // .replace(/\'/g, '\\\'') - .replace(/\`/g, '\\\`') - .replace(/\$/g, '\\$') - // .replace(/\n\s+/g, '\n') - // .replace(/\s+$/g, '\n') - // .replace(/^\n+/, '') - .replace(/\n/g, '\\n') - .replace(/\x02/g, '\\x02') - .replace(/\x03/g, '\\x03') - - txt = unicode.escapeToEscapedBytes(txt) - txt = '/exec -out printf "%b" "' + txt + '"\n' - if (mirc.cutoff){ - txt = new String(txt) - txt.cutoff = true - } - return txt -} var undo = (function(){ diff --git a/assets/js/ui/controls.js b/assets/js/ui/controls.js index 96c7d3a..4997bbe 100644 --- a/assets/js/ui/controls.js +++ b/assets/js/ui/controls.js @@ -150,7 +150,7 @@ var controls = (function(){ controls.save_format.name = 'save_format' controls.save_format.memorable = true var cs = controls.save_format.controls - cs.mirc.use = cs.irssi.use = cs.ascii.use = function(){ + cs.mirc.use = cs.ascii.use = function(){ clipboard.export_data() } // diff --git a/index.html b/index.html index a9bf160..1f6148b 100644 --- a/index.html +++ b/index.html @@ -62,7 +62,7 @@
- ascii *irssi mirc ansi + ascii *mirc