1
0
Fork 0

Use spellchecker Typo.js to determine if words are valid.

feature/save-game
Daniel Perelman 5 vuotta sitten
vanhempi a5350b79a6
commit 0855f7d0bc

3
.gitmodules vendored

@ -0,0 +1,3 @@
[submodule "Typo.js"]
path = Typo.js
url = https://github.com/cfinke/Typo.js.git

@ -0,0 +1 @@
Subproject commit 566f9888239c1e26c709da76a2c4ba0e8ba9d1e1

@ -3,6 +3,7 @@
<head>
<title>Anagram Mastermind (non-functional prototype)</title>
<link rel="stylesheet" type="text/css" href="main.css" />
<script type="text/javascript" src="typo/typo.js"></script>
<script src="./wordlist.js"></script>
<script src="./mastermind.js"></script>
<script >

@ -1,4 +1,14 @@
var dictionary;
fetch('typo/dictionaries/en_US/en_US.aff')
.then(response => response.text())
.then(aff => fetch('typo/dictionaries/en_US/en_US.dic')
.then(response => response.text())
.then(dic => {
dictionary = new Typo('en_US', aff, dic);
}));
function isValidWord(str) {
return true;
return dictionary.check(str);
}

Ladataan…
Peruuta
Tallenna