random

- collection of un-sorted bollocks
git clone git://git.acid.vegas/random.git
Log | Files | Refs | Archive

zalgo.html (6266B)

      1 <html>
      2 <head>
      3 	<style type="text/css">
      4 		body{background-color:#312E43;color:#FFF}
      5 		.zalgo_td {font-size:32px;width:48px;border:#000 1px solid;text-align:center}
      6 		.zalgo_ref_table {border:#000 1px solid}
      7 		#lulz_container{padding:50px;border:#000 1px solid}
      8 	</style>
      9 	<script>
     10 		var zalgo_up = [
     11 			'\u030d', '\u030e', '\u0304', '\u0305',
     12 			'\u033f', '\u0311', '\u0306', '\u0310',
     13 			'\u0352', '\u0357', '\u0351', '\u0307',
     14 			'\u0308', '\u030a', '\u0342', '\u0343',
     15 			'\u0344', '\u034a', '\u034b', '\u034c',
     16 			'\u0303', '\u0302', '\u030c', '\u0350',
     17 			'\u0300', '\u0301', '\u030b', '\u030f',
     18 			'\u0312', '\u0313', '\u0314', '\u033d',
     19 			'\u0309', '\u0363', '\u0364', '\u0365',
     20 			'\u0366', '\u0367', '\u0368', '\u0369',
     21 			'\u036a', '\u036b', '\u036c', '\u036d',
     22 			'\u036e', '\u036f', '\u033e', '\u035b',
     23 			'\u0346', '\u031a'
     24 		];
     25 		var zalgo_down = [
     26 			'\u0316', '\u0317', '\u0318', '\u0319',
     27 			'\u031c', '\u031d', '\u031e', '\u031f',
     28 			'\u0320', '\u0324', '\u0325', '\u0326',
     29 			'\u032d', '\u032e', '\u032f', '\u0330',
     30 			'\u0329', '\u032a', '\u032b', '\u032c',
     31 			'\u0331', '\u0332', '\u0333', '\u0339',
     32 			'\u033a', '\u033b', '\u033c', '\u0345',
     33 			'\u0347', '\u0348', '\u0349', '\u034d',
     34 			'\u034e', '\u0353', '\u0354', '\u0355',
     35 			'\u0356', '\u0359', '\u035a', '\u0323'
     36 		];
     37 		var zalgo_mid = [
     38 			'\u0315', '\u031b', '\u0340', '\u0341',
     39 			'\u0358', '\u0321', '\u0322', '\u0327',
     40 			'\u0328', '\u0334', '\u0335', '\u0336',
     41 			'\u034f', '\u035c', '\u035d', '\u035e',
     42 			'\u035f', '\u0360', '\u0362', '\u0338',
     43 			'\u0337', '\u0361', '\u0489'
     44 		];
     45 		function rand(max) {
     46 			return Math.floor(Math.random() * max);
     47 		}
     48 		function rand_zalgo(array) {
     49 			var ind = Math.floor(Math.random() * array.length);
     50 			return array[ind];
     51 		}
     52 		function toggle(id) {
     53 			if(document.getElementById(id).style.display == "none")
     54 				document.getElementById(id).style.display = "block";
     55 			else
     56 				document.getElementById(id).style.display = "none";
     57 		}
     58 		function is_zalgo_char(c) {
     59 			var i;
     60 			for(i=0; i<zalgo_up.length; i++)
     61 				if(c == zalgo_up[i])
     62 					return true;
     63 			for(i=0; i<zalgo_down.length; i++)
     64 				if(c == zalgo_down[i])
     65 					return true;
     66 			for(i=0; i<zalgo_mid.length; i++)
     67 				if(c == zalgo_mid[i])
     68 					return true;
     69 			return false;
     70 		}
     71 		function draw_zalgo_table(elid) {
     72 			var container = document.getElementById(elid);
     73 			var html = '';
     74 			html += '<b>UP:</b><br />\n';
     75 			html += '<table class="zalgo_ref_table">\n';
     76 			html += '<tr>\n';
     77 			for(var i=0; i<zalgo_up.length; i++) {
     78 				if(!(i % 10))
     79 					html += '</tr><tr>';
     80 				html += '<td class="zalgo_td">' + zalgo_up[i] + '</td>\n';
     81 			}
     82 			html += '</tr>\n';
     83 			html += '</table>\n';
     84 			html += '<br /><b>MIDDLE:</b><br />\n';
     85 			html += '<table class="zalgo_ref_table">\n';
     86 			html += '<tr>\n';
     87 			for(var i=0; i<zalgo_mid.length; i++) {
     88 				if(!(i % 10))
     89 					html += '</tr><tr>';
     90 				html += '<td class="zalgo_td">' + zalgo_mid[i] + '</td>\n';
     91 			}
     92 			html += '</tr>\n';
     93 			html += '</table>\n';
     94 			html += '<br /><b>DOWN:</b><br />\n';
     95 			html += '<table class="zalgo_ref_table">\n';
     96 			html += '<tr>\n';
     97 			for(var i=0; i<zalgo_down.length; i++) {
     98 				if(!(i % 10))
     99 					html += '</tr><tr>';
    100 				html += '<td class="zalgo_td">' + zalgo_down[i] + '</td>\n';
    101 			}
    102 			html += '</tr>\n';
    103 			html += '</table>\n';
    104 			container.innerHTML = html;
    105 		}
    106 		function zalgo_textarea(id) {
    107 			var p = document.getElementById(id);
    108 			var txt = p.value;
    109 			var newtxt = '';
    110 			for(var i=0; i<txt.length; i++) {
    111 				if(is_zalgo_char(txt.substr(i, 1)))
    112 					continue;
    113 				var num_up;
    114 				var num_mid;
    115 				var num_down;
    116 				newtxt += txt.substr(i, 1);
    117 				if(document.getElementById('zalgo_opt_mini').checked) {
    118 					num_up = rand(8);
    119 					num_mid = rand(2);
    120 					num_down = rand(8);
    121 				} else if(document.getElementById('zalgo_opt_normal').checked) {
    122 					num_up = rand(16) / 2 + 1;
    123 					num_mid = rand(6) / 2;
    124 					num_down = rand(16) / 2 + 1;
    125 				} else {
    126 					num_up = rand(64) / 4 + 3;
    127 					num_mid = rand(16) / 4 + 1;
    128 					num_down = rand(64) / 4 + 3;
    129 				}
    130 				if(document.getElementById('zalgo_opt_up').checked)
    131 					for(var j=0; j<num_up; j++)
    132 						newtxt += rand_zalgo(zalgo_up);
    133 				if(document.getElementById('zalgo_opt_mid').checked)
    134 					for(var j=0; j<num_mid; j++)
    135 						newtxt += rand_zalgo(zalgo_mid);
    136 				if(document.getElementById('zalgo_opt_down').checked)
    137 					for(var j=0; j<num_down; j++)
    138 						newtxt += rand_zalgo(zalgo_down);
    139 			}
    140 			var container = document.getElementById('lulz_container');
    141 			while(container.childNodes.length)
    142 				container.removeChild(container.childNodes[0]);
    143 			var lines = newtxt.split("\n");
    144 			for(var i=0; i<lines.length; i++) {
    145 				var n = document.createElement('text');
    146 				n.innerHTML = lines[i];
    147 				container.appendChild(n);
    148 				var nl = document.createElement('br');
    149 				container.appendChild(nl);
    150 			}
    151 		}
    152 	</script>
    153 </head>
    154 <body>
    155 	<center>
    156 	<h1>Zalgo Text Generator</h1>
    157 	<table id="zalgotable"><tbody><tr>
    158 				<td align="center" id="lulz_container" height="200" width="170">
    159 					<p align="center" id=lulz></p>
    160 				</td>
    161 				</tr><tr>
    162 				<td style="border:#000 1px solid;"  width=200>
    163 					<input id=zalgo_txt value="im gay" size=50><br><br>
    164 					<FORM id=zalgo_form action=""><INPUT id=zalgo_btn onclick="zalgo_textarea('zalgo_txt');" type=button value="Zalgo"> 
    165 						<INPUT id=zalgo_ref style="FLOAT: right" onclick="toggle('reference');" type=button value="Toggle Reference"> 
    166 						<table>
    167 							<tbody>
    168 								<tr>
    169 									<td>
    170 										<input id=zalgo_opt_up type=checkbox CHECKED>Up
    171 										<br><input id=zalgo_opt_mid type=checkbox CHECKED>Middle
    172 										<br><input id=zalgo_opt_down type=checkbox CHECKED>Down
    173 									</td>
    174 									<td>
    175 										<input id=zalgo_opt_mini type=radio name=optval>Minimal
    176 										<br><input id=zalgo_opt_normal type=radio CHECKED name=optval>Medium
    177 										<br><input id=zalgo_opt_maxi type=radio name=optval>Maximum
    178 									</td>
    179 								</tr>
    180 							</tbody>
    181 						</table>
    182 					</form>
    183 					<script> zalgo_textarea('zalgo_txt'); </script>
    184 				</td>
    185 			</tr>
    186 		</tbody>
    187 	</table>
    188 	<div id=reference style="display:none">
    189 		<h2>Zalgo Character Reference</h2>
    190 		<p id=zalgo_ref_tablex><script> draw_zalgo_table('zalgo_ref_tablex');</script></p>
    191 	</div>
    192 </body>
    193 </html>