mirror of
https://github.com/lalbornoz/roar.git
synced 2024-11-26 08:56:36 +00:00
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:
parent
7a26476aec
commit
678ba6fcf1
@ -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'
|
||||
|
@ -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
|
||||
|
@ -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(){
|
||||
|
||||
|
2
assets/js/ui/controls.js
vendored
2
assets/js/ui/controls.js
vendored
@ -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()
|
||||
}
|
||||
//
|
||||
|
@ -62,7 +62,7 @@
|
||||
</div>
|
||||
|
||||
<div id="import_rapper">
|
||||
<span id="format_el">ascii *irssi mirc ansi</span>
|
||||
<span id="format_el">ascii *mirc</span>
|
||||
<span id="import_buttons">
|
||||
<button id="import_button">import</button>
|
||||
</span>
|
||||
|
Loading…
Reference in New Issue
Block a user