This demo performs 25 text transforms in real time. Type anything! The output can be used on any webpage, program or social network. (⚠ Requires Chrome 72+)
for(_="&&E](p):DvalueYinXodePoXtWStrXg.fromCW(VVo)U[o-o>=,92i[E],[12'}Eo<=<br>[...6,119Ep<]?r+=Vp+:'3,{0]):p>{for(o=>6,0 ',,07.XnerHTML32,7,,,,ɐqɔpǝɟƃɥᵎɾʞןɯuodbɹsʇnʌʍxʎz,U+'?'ᵃᵇᶜᵈᵉᶠᵍʰⁱʲᵏˡᵐⁿᵒᵖ۹ʳˢᵗᵘᵛʷˣʸᶻ'b=` <Xput size=99 id=A Y='Hello JS1k'><p id=z>`,(A.onXput=i of(z=' [[6,93276⓪215,1007⓿183247Vo+65248)73734997,,{CℭHℌRℜZℨIℑ 101841945 04944,{CℂHℍRℝZℤNℕPℙQℚ 36174 15354 20564 309 257117908758(0)365̶'̴'̷'̲'4857?'⁰¹²³⁴⁵⁶⁷⁸⁹'48]:659065]:97297]:U'¡„#$%⅋,)(*+‘-˙/0⥝ᘔε߈S9⏌86:⸵>=<¿@]\\\\[^_`}|{~']33],,1,b='d=9;d--;)b+=V768+111*Math.random()|0);return U+b}]]))n of(r='v=A.Y]))p=n.cWAt(),3]3][n3][n]:p>475822649101]+09631132744D55Dr+=n;6]E(r=r].reverse().joX('')+''),z+=r+' })()";G=/[-U-YDE]/.exec(_);)with(_.split(G))_=join(shift());eval(_)
Zm9yKF89IiYmRV0ocCk6RHZhbHVlWWluWG9kZVBvWHRXU3RyWGcuZnJvbUNXKFZWbylVW28tH28+PR4sOTIdaVscRRwbXSxbGjEyGSd9GEVvPD0XPGJyPhZbLi4uFRo2LDExORRFcDwTXT9yKz0SElZwKxwROicQMyx7MBAPXSk6cD4Oe2ZvcigMbz0+Cxo2LBkwCScsCCwZMDcHLlhuZXJIVE1MBhozMiwZNwUaLCwsLATJkHHJlHDHncmfxoPJpeG1jsm+yp7Xn8mvdW9kYsm5c8qHbsqMyo14yo56AwQsC1UrJwI/J+G1g+G1h+G2nO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) functions or strings used to convert:
// - the chars A-Z (U+41 - U+5A) \
// - the chars a-z (U+61 - U+7A) |-- these three transforms are encoded as code point offsets from the original ASCII chars.
// - the chars 0-9 (U+30 - U+39) /
// - the special chars (among CHINPQRZ0)
// - the ASCII chars except space/DEL (U+21 - U+7E)
// - All Unicode chars
// - ... and an extra option to reverse the string
b.innerHTML = " <input size=99 id=A value='Hello JS1k'><p id=o>";
(
// On load, and when the text input is edited
A.oninput = c => {
// Reset the output paragraph.
// A non-breaking space is placed before the first transform.
o.innerHTML = " ";
// Loop on all the transforms, the current transform is called `i`.
for(i of
[
// Circled (U+24b6-U+24cf ⒶⓏ U+24d0-U+24e9 ⓐⓩ U+2460-U+2468 ①⑨ U+24ea ⓪)
[
6, // A-Z
9327, // a-z
9263, // 1-9
{0: '⓪'} // special char: 0
],
// Circled negative (U+1f150-U+1f169 🅐🅩 U+1f150-U+1f169 🅐🅩 U+278a-U+2792 ➊➒ U+24FF ⓿)
[
32, // A-Z
127215, // a-z
10073, // 1-9
{0: '⓿'} // special char: 0
],
// Squared (U+1F130-U+1F149 🄰🅉)
[
32, // A-Z
127183, // a-z
],
// Squared negative (U+1F170-U+U+1F189 🅰🆉)
[
32, // A-Z
127247, // a-z
],
// Fullwidth (U+ff01-U+ff5e !~)
[
, // A-Z
, // a-z
, // 0-9
, // other chars
c => String.fromCodePoint(c + 65248) // ASCII
],
// Math bold (U+1d41a-U+1d433 𝐚𝐳 U+1d400-U+1d419 𝐀𝐙 U+1d7ce-U+1d7d7 𝟎𝟗)
[
6, // A-Z
119737, // a-z
120734, // 0-9
],
// Math fraktur (U+1d51e-U+1d537 𝔞𝔷 U+1d504-U+1d51c 𝔄𝔜 + exceptions: CHIRZ U+212d U+210c U+2111 U+211c U+2128 ℭℌℑℜℨ)
[
6, // A-Z
119997, // a-z
, // 0-9
{C:"ℭ",H:"ℌ",R:"ℜ",Z:"ℨ",I:"ℑ"} // special chars: CHRZI
],
// Math bold fraktur (U+1d586-U+1d59f 𝖆𝖟 U+1d56c-U+1d585 𝕬𝖅)
[
6, // A-Z
120101, // a-z
],
// Math bold italic (U+1d482-U+1d49b 𝒂𝒛 U+1d468-U+1d481 𝑨𝒁)
[
6, // A-Z
119841, // a-z
],
// Math bold script (U+1d4ea-U+1d503 𝓪𝔃 U+1d4d0-U+1d4e9 𝓐𝓩)
[
6, // A-Z
119945, // a-z
],
// Math double struck (U+1d552-U+1d56b 𝕒𝕫 U+1d538 𝔸 U+1d7d8-U+1d7e1 𝟘𝟡 exceptions: CHNPQRZ U+2102 U+210d U+2115 U+2119 U+211a U+211d U+2124 ℂℍℕℙℚℝℤ)
[
6, // A-Z
120049, // a-z
120744, // 0-9
{C:"ℂ",H:"ℍ",R:"ℝ",Z:"ℤ",N:"ℕ",P:"ℙ",Q:"ℚ"} // special chars: CHRZNPQ
],
// Math monospace (U+1d68a-U+1d6a3 𝚊𝚣 U+1d670-U+1d689 𝙰𝚉 U+1d7f6-U+1d7ff 𝟶𝟿)
[
6, // A-Z
120361, // a-z
120774, // 0-9
],
// Math sans (U+1d5ba-U+1d5d3 𝖺𝗓 U+1d5a0-U+1d5b9 𝖠𝖹 U+1d7e2-U+1d7eb 𝟢𝟫)
[
6, // A-Z
120153, // a-z
120754, // 0-9
],
// Math sans bold (U+1d5ee-U+1d607 𝗮𝘇 U+1d5d4-U+1d5ed 𝗔𝗭 U+1d7ec-U+1d7f5 𝟬𝟵)
[
6, // A-Z
120205, // a-z
120764, // 0-9
],
// Math sans bold italic (U+1d656-U+1d66f 𝙖𝙯 U+1d63c-U+1d655 𝘼𝙕)
[
6, // A-Z
120309, // a-z
],
// Math sans italic (U+1d622-U+1d63b 𝘢𝘻 U+1d608-U+1d621 𝘈𝘡)
[
6, // A-Z
120257, // a-z
],
// Parenthesized (U+249c-U+24b5 ⒜⒵ U+1f110-U+1f129 🄐🄩 U+2474-U+247c ⑴⑼ 0)
[
117908, // A-Z
9275, // a-z
9283, // 0-9
{0: '(0)'} // Special char: 0
],
// Regional indicator (U+1f1e6-U+1f1ff 🇦 🇿)
[
32, // A-Z
127365, // a-z
],
// Strikethrough (U+0336)
[
, // A-Z
, // a-z
, // 0-9
, // other chars
, // ASCII
c => String.fromCodePoint(c) + "̶" // Unicode
],
// Tilde strikethrough (U+0334)
[
, // A-Z
, // a-z
, // 0-9
, // other chars
, // ASCII
c => String.fromCodePoint(c) + "̴" // Unicode
],
// Cross hatching (U+0337)
[
, // A-Z
, // a-z
, // 0-9
, // other chars
, // ASCII
c => String.fromCodePoint(c) + "̷" // Unicode
],
// Underline (U+0332)
[
, // A-Z
, // a-z
, // 0-9
, // other chars
, // ASCII
c => String.fromCodePoint(c) + "̲" // Unicode
],
// Superscript (ᵃᵇᶜᵈᵉᶠᵍʰⁱʲᵏˡᵐⁿᵒᵖ۹ʳˢᵗᵘᵛʷˣʸᶻ ⁰¹²³⁴⁵⁶⁷⁸⁹)
[
, // A-Z
, // a-z
, // 0-9
, // special chars
c => // ASCII
(c >= 0x30 && c <= 0x39) ? "⁰¹²³⁴⁵⁶⁷⁸⁹"[c - 48] : // 0-9
(c >= 0x41 && c <= 0x5A) ? "ᵃᵇᶜᵈᵉᶠᵍʰⁱʲᵏˡᵐⁿᵒᵖ۹ʳˢᵗᵘᵛʷˣʸᶻ"[c - 65] : // A-Z
(c >= 0x61 && c <= 0x7a) ? "ᵃᵇᶜᵈᵉᶠᵍʰⁱʲᵏˡᵐⁿᵒᵖ۹ʳˢᵗᵘᵛʷˣʸᶻ"[c - 97] : // a-z
String.fromCodePoint(c) // Other
],
// Inverted (top-bottom)
[
, // A-Z
, // a-z
, // 0-9
, // other chars
c => [..."¡„#$%⅋,)(*+‘-˙/0⥝ᘔε߈S9⏌86:⸵>=<¿@ɐqɔpǝɟƃɥᵎɾʞןɯuodbɹsʇnʌʍxʎz]\\[^_`ɐqɔpǝɟƃɥᵎɾʞןɯuodbɹsʇnʌʍxʎz}|{~"][c - 33] // ASCII
, // Unicode
, 1 // reverse
],
// Zalgo
[
, // A-Z
, // a-z
, // 0-9
, // other chars
, // ASCII
c => { b = ""; for(d = 9; d--;) b += String.fromCodePoint(0x300 + Math.random()* 0x6F | 0); return String.fromCodePoint(c) + b } // Unicode
],
]){
// Reset the result of the current transform, called `r`.
r = "";
// Loop on all the glyphs of the input, the char is stored in `c`.
// NB: the "..." operator was buggy on Chrome 71, so I waited the second month of the compo to submit it, hoping that enough people updated to Chrome 72.
for(c of v = [...A.value]){
// The char's code point is saved into `p`.
p = c.codePointAt();
// First, replace the special chars (if the transform contains a special char that matches `c`).
if(i[3] && i[3][c]) r += i[3][c];
// Then, replace the chars 0-9 (if the transform contains a code point offset for these chars).
else if(p > 0x30 - 1 && p < 0x39 + 1 && i[2]) r += String.fromCodePoint(p + i[2]);
// Then, replace the chars A-Z (if the transform contains a code point offset for these chars).
// To save bytes, the A-Z chars offset is not stored directly, the difference with the a-z chars offset is stored instead.
// This difference is generally 6 or 32, so RegPack will compress these numbers better than raw offsets.
else if(p > 0x41 - 1 && p < 0x5A + 1 && i[0]) r += String.fromCodePoint(p + i[1]+i[0]);
// Then, replace the chars a-z (if the transform contains a code point offset for these chars).
else if(p > 0x61 - 1 && p < 0x7a + 1 && i[1]) r += String.fromCodePoint(p + i[1]);
// Then replace the ASCII chars (if the transform contains a function to transform them).
else if(p > 0x21 - 1 && p < 0x7e + 1 && i[4]) r += i[4](p);
// Then replace all the Unicode chars (if the transform contains a function to transform them).
else if(i[5]) r += i[5](p);
// If a char has no transform available, output it unchanged.
else r += c;
}
// If the transform enables the "reverse" option, the string is reversed and a line break is added.
if(i[6]) r = [...r].reverse().join("") + "<br>";
// The transformed string output is added to the output paragraph.
// A non-breaking space is added before the next transform.
o.innerHTML += r + "<br><br> ";
}
}
)()
// To fit in 1024b, I edited the minified code produced by terser-online:
// <p id=o> => <p id=z>
// A.oninput=(n=>...) => A.oninput=o=>...
// In RegPack, the vars "b o C H R Z N P Q I" must not be reassigned
// After RegPack, replace the spaces with non-breaking spaces