anagrams/web_gui/index.html
2023-02-24 09:32:06 +01:00

133 lines
4.1 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta content="text/html;charset=utf-8" http-equiv="Content-Type"/>
<title>Anagram calculator</title>
<style>
body {
background-color: black;
text-align: center;
color: white;
}
#upload_dict_label {
display: inline-block;
background-color: #333;
padding: 15px;
margin: 15px;
text-align: center;
display: inline-block;
font-size: 24px;
border-radius: 15px;
box-shadow: 5px 6px #222;
border: solid;
border-color: black;
}
#upload_dict_label:hover {
background-color: #444;
}
#upload_dict_label:active {
background-color: #444;
box-shadow: 0px 0px #444;
transform: translateY(9px);
}
#main_div {
border-radius: 15px;
background-color: #555555;
padding: 15px;
margin: 15px;
text-align: center;
display: inline-block;
}
#spinner {
margin: 30px;
display: none;
}
#result {
text-align: left;
}
#word_div {
margin: 30px;
}
.lds-dual-ring {
display: inline-block;
width: 80px;
height: 80px;
}
.lds-dual-ring:after {
content: " ";
display: block;
width: 64px;
height: 64px;
margin: 8px;
border-radius: 50%;
border: 6px solid #fff;
border-color: #fff transparent #fff transparent;
animation: lds-dual-ring 1.2s linear infinite;
}
@keyframes lds-dual-ring {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
</style>
<!-- Katex for latex rendering -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.16.4/dist/katex.min.css" integrity="sha384-vKruj+a13U8yHIkAyGgK1J3ArTLzrFGBbBc0tDp4ad/EyewESeXE/Iv67Aj8gKZ0" crossorigin="anonymous">
<!-- The loading of KaTeX is deferred to speed up page rendering -->
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.4/dist/katex.min.js" integrity="sha384-PwRUT/YqbnEjkZO0zZxNqcxACrXe+j766U2amXcgMg5457rve2Y7I6ZJSm2A0mS4" crossorigin="anonymous"></script>
<!-- To automatically render math in text elements, include the auto-render extension: -->
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.4/dist/contrib/auto-render.min.js" integrity="sha384-+VBxd3r6XgURycqtZ117nYw44OOcIax56Z4dCRWbxyPt0Koah1uHoK0o4+/RRE05" crossorigin="anonymous"
onload="renderMathInElement(document.body);"></script>
</head>
<body>
<div id="main_div">
<p> Load <a href="./dict.dat">dict.dat</a> before starting </p>
<p> Wildcards are implemented but increase a lot the precomputing complexity</p>
<p> The precomputation time has a complexity if \(\mathcal{O}(\sum_{i=0}^W \binom{S}{i} . n)\) where \(S\) is the maximum size of the words, \(W\) the maximum number of wild card, and \(n\) the size of the dictionary. For \(S = 15\) and \(W = 3\), this is more or less \(500 . n\)</p>
<p> The wildcard caracter is '?'</p>
<p> Sources in rust are available <a href="./lib.rs">here</a> </p>
<h3> TODO: </h3>
<ul>
<li> Allow query-time resolution of wild cards when there are more wildcards than the number of precomputed wild cards</li>
</ul>
<div id="upload_dict_div">
<label id="upload_dict_label" for="upload_dict">Select the dictionary</label>
<input type="file" id="upload_dict" style="opacity:0">
<div>
<label id="nb_wild_card_label" for="nb_wild_card"> Select the number of precomputed wild card: </label>
<input type="number" id="nb_wild_card" value=0>
</div>
</div>
<!-- Thanks https://loading.io/css/ for the spinner -->
<div id="spinner" class="lds-dual-ring"></div>
<div id="word_div">
<label id="word_label" for="select_word">Enter word: </label>
<input type="text" id="select_word">
<p id="ask_dict">Please select a dictionnary</p>
</div>
<div>
<ul id="result"></ul>
<div>
</div>
<script type="module">
import init from './pkg/anagrams_web.js';
async function run() {
await init();
}
run();
</script>
</body>
</html>