66 lines
2.3 KiB
HTML
66 lines
2.3 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width">
|
|
<head>
|
|
<title>Surly Anagram Server (emscripted)</title>
|
|
<style>
|
|
@media screen and (min-width: 680px) { #cheatsheet { float: right; } }
|
|
#cheatsheet { font-size: 71%; cursor: pointer; }
|
|
#cheatsheet table, #cheatsheet caption { background: #d9d9d9; color: #000; }
|
|
#cheatsheet.hidden { cursor: zoom-in; }
|
|
#cheatsheet caption:after { content: "«" }
|
|
#cheatsheet.hidden caption:after { content: "»" }
|
|
#cheatsheet.hidden tbody { display: none; }
|
|
//#cheatsheet { float: right; }
|
|
#cheatsheet th { text-align: left }
|
|
#cheatsheet caption { font-weight: bold; }
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div id="cheatsheet"
|
|
onclick="document.getElementById('cheatsheet').classList.toggle('hidden')">
|
|
<table>
|
|
<caption>Cheatsheet</caption>
|
|
<tr><th>letters... <td> Letters available to anagram
|
|
<tr><th>=word <td> word must be in result
|
|
<tr><th>>n <td> words must contain at least n letters
|
|
<tr><th><n <td> words must contain at most n letters
|
|
<tr><th>' <td> words with apostrophes are considered
|
|
<tr><th>n <td> choose a word with exactly n letters
|
|
<tr><th>-n <td> display at most n results (limit 10000)
|
|
<tr><th>? <td> display candidate words, not whole phrases
|
|
<tr><td colspan=2>Hit enter to get full (up to 10000) results
|
|
<tr><td colspan=2>Source (web app and unix commandline program) on
|
|
<a href="https://github.com/jepler/anagram">github</a>
|
|
</table>
|
|
</div>
|
|
<form id="f" onsubmit="javascript:update();return false"><input type="text" id="query" name="q" value="" oninput="javascript:update()">
|
|
</form>
|
|
<pre id="results">
|
|
<script>
|
|
var last = '';
|
|
var Module;
|
|
if(typeof Module==="undefined") Module={};
|
|
Module['onRuntimeInitialized'] = function() {
|
|
update = function() {
|
|
var search = document.getElementById("query").value;
|
|
document.location.hash = '#' + search;
|
|
if(search == last) return false;
|
|
document.getElementById("results").innerText=Module.ana(search);
|
|
last = search;
|
|
return false;
|
|
}
|
|
if(document.location.hash) {
|
|
document.getElementById("query").value = decodeURIComponent(
|
|
document.location.hash.substr(1));
|
|
update();
|
|
}
|
|
}
|
|
</script>
|
|
<script src="ana.js"></script>
|
|
<script>
|
|
document.getElementById("query").focus()
|
|
</script>
|
|
</body>
|
|
</html>
|