1
mirror of git://git.acid.vegas/random.git synced 2024-12-04 13:36:39 +00:00
random/zalgo.html

194 lines
6.1 KiB
HTML
Raw Normal View History

<html>
<head>
<style type="text/css">
body{background-color:#312E43;color:#FFF}
.zalgo_td {font-size:32px;width:48px;border:#000 1px solid;text-align:center}
.zalgo_ref_table {border:#000 1px solid}
#lulz_container{padding:50px;border:#000 1px solid}
</style>
<script>
var zalgo_up = [
'\u030d', '\u030e', '\u0304', '\u0305',
'\u033f', '\u0311', '\u0306', '\u0310',
'\u0352', '\u0357', '\u0351', '\u0307',
'\u0308', '\u030a', '\u0342', '\u0343',
'\u0344', '\u034a', '\u034b', '\u034c',
'\u0303', '\u0302', '\u030c', '\u0350',
'\u0300', '\u0301', '\u030b', '\u030f',
'\u0312', '\u0313', '\u0314', '\u033d',
'\u0309', '\u0363', '\u0364', '\u0365',
'\u0366', '\u0367', '\u0368', '\u0369',
'\u036a', '\u036b', '\u036c', '\u036d',
'\u036e', '\u036f', '\u033e', '\u035b',
'\u0346', '\u031a'
];
var zalgo_down = [
'\u0316', '\u0317', '\u0318', '\u0319',
'\u031c', '\u031d', '\u031e', '\u031f',
'\u0320', '\u0324', '\u0325', '\u0326',
'\u032d', '\u032e', '\u032f', '\u0330',
'\u0329', '\u032a', '\u032b', '\u032c',
'\u0331', '\u0332', '\u0333', '\u0339',
'\u033a', '\u033b', '\u033c', '\u0345',
'\u0347', '\u0348', '\u0349', '\u034d',
'\u034e', '\u0353', '\u0354', '\u0355',
'\u0356', '\u0359', '\u035a', '\u0323'
];
var zalgo_mid = [
'\u0315', '\u031b', '\u0340', '\u0341',
'\u0358', '\u0321', '\u0322', '\u0327',
'\u0328', '\u0334', '\u0335', '\u0336',
'\u034f', '\u035c', '\u035d', '\u035e',
'\u035f', '\u0360', '\u0362', '\u0338',
'\u0337', '\u0361', '\u0489'
];
function rand(max) {
return Math.floor(Math.random() * max);
}
function rand_zalgo(array) {
var ind = Math.floor(Math.random() * array.length);
return array[ind];
}
function toggle(id) {
if(document.getElementById(id).style.display == "none")
document.getElementById(id).style.display = "block";
else
document.getElementById(id).style.display = "none";
}
function is_zalgo_char(c) {
var i;
for(i=0; i<zalgo_up.length; i++)
if(c == zalgo_up[i])
return true;
for(i=0; i<zalgo_down.length; i++)
if(c == zalgo_down[i])
return true;
for(i=0; i<zalgo_mid.length; i++)
if(c == zalgo_mid[i])
return true;
return false;
}
function draw_zalgo_table(elid) {
var container = document.getElementById(elid);
var html = '';
html += '<b>UP:</b><br />\n';
html += '<table class="zalgo_ref_table">\n';
html += '<tr>\n';
for(var i=0; i<zalgo_up.length; i++) {
if(!(i % 10))
html += '</tr><tr>';
html += '<td class="zalgo_td">' + zalgo_up[i] + '</td>\n';
}
html += '</tr>\n';
html += '</table>\n';
html += '<br /><b>MIDDLE:</b><br />\n';
html += '<table class="zalgo_ref_table">\n';
html += '<tr>\n';
for(var i=0; i<zalgo_mid.length; i++) {
if(!(i % 10))
html += '</tr><tr>';
html += '<td class="zalgo_td">' + zalgo_mid[i] + '</td>\n';
}
html += '</tr>\n';
html += '</table>\n';
html += '<br /><b>DOWN:</b><br />\n';
html += '<table class="zalgo_ref_table">\n';
html += '<tr>\n';
for(var i=0; i<zalgo_down.length; i++) {
if(!(i % 10))
html += '</tr><tr>';
html += '<td class="zalgo_td">' + zalgo_down[i] + '</td>\n';
}
html += '</tr>\n';
html += '</table>\n';
container.innerHTML = html;
}
function zalgo_textarea(id) {
var p = document.getElementById(id);
var txt = p.value;
var newtxt = '';
for(var i=0; i<txt.length; i++) {
if(is_zalgo_char(txt.substr(i, 1)))
continue;
var num_up;
var num_mid;
var num_down;
newtxt += txt.substr(i, 1);
if(document.getElementById('zalgo_opt_mini').checked) {
num_up = rand(8);
num_mid = rand(2);
num_down = rand(8);
} else if(document.getElementById('zalgo_opt_normal').checked) {
num_up = rand(16) / 2 + 1;
num_mid = rand(6) / 2;
num_down = rand(16) / 2 + 1;
} else {
num_up = rand(64) / 4 + 3;
num_mid = rand(16) / 4 + 1;
num_down = rand(64) / 4 + 3;
}
if(document.getElementById('zalgo_opt_up').checked)
for(var j=0; j<num_up; j++)
newtxt += rand_zalgo(zalgo_up);
if(document.getElementById('zalgo_opt_mid').checked)
for(var j=0; j<num_mid; j++)
newtxt += rand_zalgo(zalgo_mid);
if(document.getElementById('zalgo_opt_down').checked)
for(var j=0; j<num_down; j++)
newtxt += rand_zalgo(zalgo_down);
}
var container = document.getElementById('lulz_container');
while(container.childNodes.length)
container.removeChild(container.childNodes[0]);
var lines = newtxt.split("\n");
for(var i=0; i<lines.length; i++) {
var n = document.createElement('text');
n.innerHTML = lines[i];
container.appendChild(n);
var nl = document.createElement('br');
container.appendChild(nl);
}
}
</script>
</head>
<body>
<center>
<h1>Zalgo Text Generator</h1>
<table id="zalgotable"><tbody><tr>
<td align="center" id="lulz_container" height="200" width="170">
<p align="center" id=lulz></p>
</td>
</tr><tr>
<td style="border:#000 1px solid;" width=200>
<input id=zalgo_txt value="im gay" size=50><br><br>
<FORM id=zalgo_form action=""><INPUT id=zalgo_btn onclick="zalgo_textarea('zalgo_txt');" type=button value="Zalgo">
<INPUT id=zalgo_ref style="FLOAT: right" onclick="toggle('reference');" type=button value="Toggle Reference">
<table>
<tbody>
<tr>
<td>
<input id=zalgo_opt_up type=checkbox CHECKED>Up
<br><input id=zalgo_opt_mid type=checkbox CHECKED>Middle
<br><input id=zalgo_opt_down type=checkbox CHECKED>Down
</td>
<td>
<input id=zalgo_opt_mini type=radio name=optval>Minimal
<br><input id=zalgo_opt_normal type=radio CHECKED name=optval>Medium
<br><input id=zalgo_opt_maxi type=radio name=optval>Maximum
</td>
</tr>
</tbody>
</table>
</form>
<script> zalgo_textarea('zalgo_txt'); </script>
</td>
</tr>
</tbody>
</table>
<div id=reference style="display:none">
<h2>Zalgo Character Reference</h2>
<p id=zalgo_ref_tablex><script> draw_zalgo_table('zalgo_ref_tablex');</script></p>
</div>
</body>
</html>