/ ana.html
ana.html
1 <!DOCTYPE html> 2 <html> 3 <meta charset="UTF-8"> 4 <meta name="viewport" content="width=device-width"> 5 <head> 6 <title>Surly Anagram Server (emscripted)</title> 7 <style> 8 @media screen and (min-width: 680px) { #cheatsheet { float: right; } } 9 #cheatsheet { font-size: 71%; cursor: pointer; } 10 #cheatsheet table, #cheatsheet caption { background: #d9d9d9; color: #000; } 11 #cheatsheet.hidden { cursor: zoom-in; } 12 #cheatsheet caption:after { content: "«" } 13 #cheatsheet.hidden caption:after { content: "»" } 14 #cheatsheet.hidden tbody { display: none; } 15 //#cheatsheet { float: right; } 16 #cheatsheet th { text-align: left } 17 #cheatsheet caption { font-weight: bold; } 18 </style> 19 </head> 20 <body> 21 <div id="cheatsheet" 22 onclick="document.getElementById('cheatsheet').classList.toggle('hidden')"> 23 <table> 24 <caption>Cheatsheet</caption> 25 <tr><th>letters... <td> Letters available to anagram 26 <tr><th>=word <td> word must be in result 27 <tr><th>>n <td> words must contain at least n letters 28 <tr><th><n <td> words must contain at most n letters 29 <tr><th>' <td> words with apostrophes are considered 30 <tr><th>n <td> choose a word with exactly n letters 31 <tr><th>-n <td> display at most n results (limit 1000) 32 <tr><th>? <td> display candidate words, not whole phrases 33 <tr><td colspan=2>Hit enter to get full (up to 1000) results 34 <tr><td colspan=2>Source (web app and unix commandline program) on 35 <a href="https://github.com/jepler/anagram">github</a> 36 </table> 37 </div> 38 39 <form id="f" onsubmit="javascript:update();return false"><input type="text" id="query" name="q" value="" oninput="javascript:update()"> 40 </form> 41 <pre id="results"> 42 <script> 43 var last = ''; 44 var Module; 45 if(typeof Module==="undefined") Module={}; 46 Module['onRuntimeInitialized'] = function() { 47 update = function() { 48 var search = document.getElementById("query").value; 49 document.location.hash = '#' + search; 50 if(search == last) return false;; 51 document.getElementById("results").innerText=Module.ana(search); 52 last = search; 53 return false; 54 } 55 if(document.location.hash) { 56 document.getElementById("query").value = decodeURIComponent( 57 document.location.hash.substr(1)); 58 update(); 59 } 60 } 61 </script> 62 <script src="ana.js"></script> 63 <script> 64 document.getElementById("query").focus() 65 </script> 66 </body> 67 </html>