commit 3748504e1f449eb6bada4290fe579f38f89f0f94 Author: acidvegas Date: Mon Jun 24 22:47:59 2019 -0400 Initial commit diff --git a/data/script.js b/data/script.js new file mode 100644 index 0000000..7858d13 --- /dev/null +++ b/data/script.js @@ -0,0 +1,116 @@ +function formReset() { + document.getElementById('showcase').innerHTML = "*HTML view will appear here*"; +} + +function toggle(bool) { + if (bool == true) { + return false; + } + else { + return true; + } +} + +function convert() { + if (document.getElementById('text').value == "") { + return false; + } + document.getElementById('html').value = null; + document.getElementById('showcase').innerHTML = null; + lines = document.getElementById('text').value.split("\n"); + reg = new RegExp("(([0-9]{1,2})?((?:,([0-9]{1,2}))?))|(||||)"); + var showcase = ""; + for (var i = 0, all=lines.length; i < all; i++) { + var line = lines[i]; + line = line.replace(new RegExp('<','g'),'<'); + line = line.replace(new RegExp('>','g'),'>'); + var match, lastf = "1", lastb = "0"; + var bold, italic, underline, reverse = false; + var first = true; + while ((match = reg.exec(line)) != null) { + var f, b, span; + if (match[2] != null) { + f = Number(match[2]) + if (f > 15) { f = f-16; } + f = f.toString(); + if (match[4] != null) { + b = Number(match[4]) + if (b > 15) { b = b-16; } + b = b.toString(); + } + else { + b = lastb; + } + } + else if (match[2] == null && (match[5] == null || match[5] == '')) { + if (match[5] == null) { + f = "1"; b = "0"; + } + else { + f = "1"; b = "0"; + bold = false; + italic = false; + underline = false; + reverse = false; + } + } + else { + f = lastf, b = lastb; + if (match[5] == '') { + bold = toggle(bold); + } + else if (match[5] == '') { + italic = toggle(italic); + } + else if (match[5] == '') { + underline = toggle(underline); + } + else if (match[5] == '') { + reverse = toggle(reverse); + } + } + if (reverse == false) { + span = 'f'+f+' b'+b; + } + else { + span = 'f'+b+' b'+f; + } + if (bold == true) { span += ' _b'; } + if (italic == true) { span += ' _i'; } + if (underline == true) { span += ' _u'; } + if (first == false) { + line = line.replace(match[0],''); + } + else { + line = line.replace(match[0],''); + first = false; + } + lastf = f; lastb = b; + } + if (first == false) { + showcase += (line+"\n"); + } + else { + showcase += (line+"\n"); + } + } + showcase = showcase.replace(new RegExp("\\<\/span>","g"),""); + document.getElementById('showcase').innerHTML = ("
\n"+showcase+"
"); + document.getElementById('html').value = "\n\n\n\nIRC2HTML - https://git.supernets.org/acidvegas/irc2html\n\n\n\n"; + document.getElementById('html').value += document.getElementById('showcase').innerHTML; + document.getElementById('html').value += "\n\n"; + return false; +} + +function Submit() { + if (document.getElementById('text').value != "" && document.getElementById('text').value != null) { + return true; + } + return false; +} + +function Download() { + document.location='data:text/html,'+encodeURIComponent(document.getElementById('html').value); +} + +window.onload = convert; diff --git a/data/style.css b/data/style.css new file mode 100644 index 0000000..bd62933 --- /dev/null +++ b/data/style.css @@ -0,0 +1,50 @@ +@charset "utf-8"; + +._b{font-weight:bold;} +._i{font-style:italic;} +._u{text-decoration:underline;} +.f0{color:#ffffff;} +.f1{color:#000000;} +.f2{color:#00007f;} +.f3{color:#009300;} +.f4{color:#ff0000;} +.f5{color:#7f0000;} +.f6{color:#9c009c;} +.f7{color:#fc7f00;} +.f8{color:#ffff00;} +.f9{color:#00fc00;} +.f10{color:#009393;} +.f11{color:#00ffff;} +.f12{color:#0000fc;} +.f13{color:#ff00ff;} +.f14{color:#7f7f7f;} +.f15{color:#d2d2d2;} +.b0{background-color:#ffffff;} +.b1{background-color:#000000;} +.b2{background-color:#00007f;} +.b3{background-color:#009300;} +.b4{background-color:#ff0000;} +.b5{background-color:#7f0000;} +.b6{background-color:#9c009c;} +.b7{background-color:#fc7f00;} +.b8{background-color:#ffff00;} +.b9{background-color:#00fc00;} +.b10{background-color:#009393;} +.b11{background-color:#00ffff;} +.b12{background-color:#0000fc;} +.b13{background-color:#ff00ff;} +.b14{background-color:#7f7f7f;} +.b15{background-color:#d2d2d2;} + +html, body, p{font-family:segoe ui, trebuchet MS,Lucida Sans Unicode, Lucida Sans, Sans-Serif;} +h1{font-size:1.5em;text-align:center;} +h2{font-size:1em;font-weight:700;} +h6{font-size:1em;text-align:center;} +pre{font-family:Consolas, Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono, Bitstream Vera Sans Mono, monospace, serif;margin:0;} +textarea{background-color:#F8F8F8;border:solid 1px #ddd;display:block;font-family:Consolas, Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono, Bitstream Vera Sans Mono, monospace, serif;font-size:0.9em;height:36em;padding:1%;resize:none;width:97%;} + +.butt{width:150px;} +.container{margin:0;width:100%;} +.hidden{display:none;} +.placeholder{color:gray;} +.showcase{border:solid 1px #ddd;display:block;font-size:0.9em;padding:1%;} diff --git a/index.html b/index.html new file mode 100644 index 0000000..cbd6e3c --- /dev/null +++ b/index.html @@ -0,0 +1,50 @@ + + + + IRC2HTML + + + + + + + + + +