1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
| <html> <body style="text-align:center;> <div style="text-align:center;width:100%;"> <div> <input type="text" id="word" placeholder="goodbye world"/> <input type="button" id="submit_face" value="submit"/> <br/> <span id="result"></span> <br/> <span id="result_reverse"></span> </div> </div> </body>
<script src="https://code.jquery.com/jquery-1.8.3.js"></script> <script type="text/javascript"> function drawWord(word) { let map = { "a" : "ɐ", "b" : "q", "c" : "ɔ", "d" : "p", "e" : "ǝ", "f" : "ɟ", "g" : "ɓ", "h" : "ɥ", "i" : "ı", "j" : "ſ", "k" : "ʞ", "l" : "ן", "m" : "ɯ", "n" : "u", "o" : "o", "p" : "d", "q" : "b", "r" : "ɹ", "s" : "s", "t" : "ʇ", "u" : "n", "v" : "ʌ", "w" : "ʍ", "x" : "x", "y" : "ʎ", "z" : "z" } let result = word.split("").reduce((r, c) => {return r.concat(map[c] || c)}, ""); console.log("result", result); $("#result").text(result); $("#result_reverse").text(result.split("").reverse().join("")); } $(document).ready(function() { drawWord("goodbye world"); $("#submit_face").click(function(){ var d = $("#word").val(); drawWord(d); }); }); </script> </html>
|