eating tofu

master
Boyana 2 years ago
parent f331e08400
commit 3a8c7e57f5

@ -31,6 +31,13 @@
<th>Cyrillic</th> <th>Cyrillic</th>
<th>Emoji</th> <th>Emoji</th>
</tr> </tr>
<tr>
<td id="BIN"></td>
<td id="HEX"></td>
<td id="DC"></td>
<td id="CY"></td>
<td id="E"></td>
</tr>
</table> </table>
</body> </body>
@ -65,9 +72,11 @@
']': 'sht', ']': 'sht',
'[': 'sh', '[': 'sh',
'|': 'yu', '|': 'yu',
' ': ' ',
} }
e = { e = {
'a': '📇', ' ': ' ',
'a': '📇',
'b': '🚝', 'b': '🚝',
'c': '🚱', 'c': '🚱',
'd': '🚯', 'd': '🚯',
@ -103,18 +112,31 @@ e = {
var charles = document.getElementById("input").value; var charles = document.getElementById("input").value;
var charlesBinary=""; var charlesBinary="";
var charlesHex=""; var charlesHex="";
var charlesDc=""; var charlesDec="";
var charlesCY=""; var charlesCY="";
var charlesE=""; var charlesE="";
for (var i=0;i<charles.length;i++){ for (var i=0;i<charles.length;i++){
console.log(i,charles.charCodeAt(i)); console.log(i,charles.charCodeAt(i));
charlesBinary=charlesBinary+charles.charCodeAt(i).toString(2); charlesBinary=charlesBinary+charles.charCodeAt(i).toString(2);
charlesHex=charlesHex+charles.charCodeAt(i).toString(16); charlesHex=charlesHex+charles.charCodeAt(i).toString(16);
charlesDc=charlesDc+charles.charCodeAt(i).toString(10); charlesDec=charlesDec+charles.charCodeAt(i).toString(10);
charlesCY=charlesCY+d[charles[i]]; if (d[charles[i]]==null){
charlesE=charlesE+e[charles[i]]; charlesCY=charlesCY+"□";
}else{
charlesCY=charlesCY+d[charles[i]];
}
if (e[charles[i]]==null){
charlesE=charlesE+"□";
}else{
charlesE=charlesE+e[charles[i]];
}
} }
console.log(charles,charlesBinary,charlesHex,charlesDc,charlesCY,charlesE); console.log(charles,charlesBinary,charlesHex,charlesDec,charlesCY,charlesE);
document.getElementById("E").innerText=charlesE;
document.getElementById("BIN").innerText=charlesBinary;
document.getElementById("DC").innerText=charlesDec;
document.getElementById("HEX").innerText=charlesHex;
document.getElementById("CY").innerText=charlesCY;
} }
</script> </script>
</html> </html>

Loading…
Cancel
Save