diff --git a/files.js b/files.js
index 2aa9960..62e7f55 100644
--- a/files.js
+++ b/files.js
@@ -619,8 +619,10 @@ function layoutPDFClues(doc, style) {
let openPuzzleInput = document.getElementById('open-puzzle-input');
let openWordlistInput = document.getElementById('open-wordlist-input');
+let addWordlistInput = document.getElementById('add-wordlist-input');
openPuzzleInput.addEventListener('change', openFile, false);
openWordlistInput.addEventListener('change', openWordlistFile, false);
+addWordlistInput.addEventListener('change', addWordlistFile, false);
openPuzzleInput.onclick = function () {
this.value = null;
};
diff --git a/index.html b/index.html
index 1d98986..372d135 100644
--- a/index.html
+++ b/index.html
@@ -61,6 +61,10 @@
Export as:
+
+
diff --git a/wordlist.js b/wordlist.js
index 8013803..017cca3 100644
--- a/wordlist.js
+++ b/wordlist.js
@@ -33,23 +33,11 @@ function addToWordlist(newWords) {
}
}
-function sortWordlist() {
- for (let i = 3; i < wordlist.length; i++) {
- wordlist[i].sort();
- }
+function addWordlist(){
+ document.getElementById("add-wordlist-input").click();
}
-function openWordlist() {
- document.getElementById("open-wordlist-input").click();
-}
-
-function openWordlistFile(e) {
- wordlist = [
- [], [], [], [], [],
- [], [], [], [], [],
- [], [], [], [], [], []
- ];
-
+function addWordlistFile(e){
const file = e.target.files[0];
if (!file) {
return;
@@ -65,6 +53,29 @@ function openWordlistFile(e) {
reader.readAsText(file);
}
+function clearWordlist(){
+ wordlist = [
+ [], [], [], [], [],
+ [], [], [], [], [],
+ [], [], [], [], [], []
+ ];
+}
+
+function sortWordlist() {
+ for (let i = 3; i < wordlist.length; i++) {
+ wordlist[i].sort();
+ }
+}
+
+function openWordlist() {
+ document.getElementById("open-wordlist-input").click();
+}
+
+function openWordlistFile(e) {
+ clearWordlist();
+ addWordlistFile(e);
+}
+
function openDefaultWordlist(url) {
let textFile = new XMLHttpRequest();
textFile.open("GET", url, true);