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.
This commit is contained in:
Lucio Andrés Illanes Albornoz 2018-11-24 13:16:11 +01:00
parent 7a26476aec
commit 678ba6fcf1
5 changed files with 3 additions and 73 deletions

View File

@ -1,7 +1,7 @@
var clipboard = (function () { var clipboard = (function () {
var exports = { var exports = {
format: "irssi", format: "mirc",
importing: false, importing: false,
visible: false, visible: false,
canvas: document.createElement("canvas"), canvas: document.createElement("canvas"),
@ -72,21 +72,6 @@ var clipboard = (function () {
data = data || import_textarea.value 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 to_json = function(string, opts){
var lines_in = string.split(/\r?\n/) var lines_in = string.split(/\r?\n/)
var lines_out = [] var lines_out = []
@ -185,12 +170,6 @@ var clipboard = (function () {
case 'mirc': case 'mirc':
output = canvas.mirc({cutoff: 425}) output = canvas.mirc({cutoff: 425})
break break
case 'irssi':
output = canvas.irssi({cutoff: 425})
break
case 'ansi':
output = canvas.ansi()
break
} }
if (output.cutoff){ if (output.cutoff){
cutoff_warning_el.style.display = 'block' cutoff_warning_el.style.display = 'block'

View File

@ -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] 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){ Lex.prototype.assign = function (lex){
this.fg = lex.fg this.fg = lex.fg
this.bg = lex.bg this.bg = lex.bg

View File

@ -239,23 +239,6 @@ Matrix.prototype.ascii = function () {
var txt = lines.join("\n") var txt = lines.join("\n")
return txt 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) { Matrix.prototype.mirc = function (opts) {
var cutoff = false var cutoff = false
var lines = this.aa.map(function(row, y){ var lines = this.aa.map(function(row, y){
@ -284,30 +267,6 @@ Matrix.prototype.mirc = function (opts) {
} }
return txt 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(){ var undo = (function(){

View File

@ -150,7 +150,7 @@ var controls = (function(){
controls.save_format.name = 'save_format' controls.save_format.name = 'save_format'
controls.save_format.memorable = true controls.save_format.memorable = true
var cs = controls.save_format.controls 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() clipboard.export_data()
} }
// //

View File

@ -62,7 +62,7 @@
</div> </div>
<div id="import_rapper"> <div id="import_rapper">
<span id="format_el">ascii *irssi mirc ansi</span> <span id="format_el">ascii *mirc</span>
<span id="import_buttons"> <span id="import_buttons">
<button id="import_button">import</button> <button id="import_button">import</button>
</span> </span>