diff --git a/index.html b/index.html
index d02f66e..d5cba37 100644
--- a/index.html
+++ b/index.html
@@ -15,6 +15,7 @@
+
diff --git a/js/dictionaryBuilder.js b/js/dictionaryBuilder.js
index 51c5428..a266465 100644
--- a/js/dictionaryBuilder.js
+++ b/js/dictionaryBuilder.js
@@ -180,24 +180,6 @@ function DeleteWord(index) {
SaveAndUpdateDictionary(true);
}
-function CloseUpdateConflictArea() {
- document.getElementById("updateConflict").style.display = "none";
-}
-
-function ClearForm() {
- document.getElementById("word").value = "";
- document.getElementById("pronunciation").value = "";
- document.getElementById("partOfSpeech").value = "";
- document.getElementById("simpleDefinition").value = "";
- document.getElementById("longDefinition").value = "";
- document.getElementById("editIndex").value = "";
-
- document.getElementById("newWordButtonArea").style.display = "block";
- document.getElementById("editWordButtonArea").style.display = "none";
- document.getElementById("errorMessage").innerHTML = "";
- document.getElementById("updateConflict").style.display = "none";
-}
-
function UpdateFilter() {
ShowDictionary();
}
@@ -251,19 +233,6 @@ function ShowDictionary() {
dictionaryArea.innerHTML = dictionaryText;
}
-function ToggleDescription() {
- var descriptionToggle = document.getElementById("descriptionToggle");
- var descriptionArea = document.getElementById("dictionaryDescription");
-
- if (descriptionArea.style.display == "none") {
- descriptionArea.style.display = "block";
- descriptionToggle.innerHTML = "Hide Description";
- } else {
- descriptionArea.style.display = "none";
- descriptionToggle.innerHTML = "Show Description";
- }
-}
-
function DictionaryEntry(itemIndex) {
var entryText = "
🔗";
@@ -315,34 +284,6 @@ function ManagementArea(itemIndex) {
return managementHTML;
}
-function ShowAbout() {
- document.getElementById("aboutScreen").style.display = "block";
-}
-
-function HideAbout() {
- document.getElementById("aboutScreen").style.display = "none";
-}
-
-function ToggleCaseSensitiveOption() {
- if (document.getElementById("dictionaryAllowDuplicates").checked) {
- document.getElementById("dictionaryCaseSensitive").disabled = true;
- } else {
- document.getElementById("dictionaryCaseSensitive").disabled = false;
- }
-}
-
-function ShowSettings() {
- document.getElementById("settingsScreen").style.display = "block";
- document.getElementById("dictionaryNameEdit").value = htmlEntitiesParse(currentDictionary.name);
- document.getElementById("dictionaryDescriptionEdit").value = htmlEntitiesParse(currentDictionary.description);
- document.getElementById("dictionaryPartsOfSpeechEdit").value = htmlEntitiesParse(currentDictionary.settings.partsOfSpeech);
- document.getElementById("dictionaryAllowDuplicates").checked = currentDictionary.settings.allowDuplicates;
- document.getElementById("dictionaryCaseSensitive").checked = currentDictionary.settings.caseSensitive;
- document.getElementById("dictionarySortByEquivalent").checked = currentDictionary.settings.sortByEquivalent;
- document.getElementById("dictionaryIsComplete").checked = currentDictionary.settings.isComplete;
- document.getElementById("numberOfWordsInDictionary").innerHTML = currentDictionary.words.length.toString();
-}
-
function SaveSettings() {
if (htmlEntities(document.getElementById("dictionaryNameEdit").value) != "") {
currentDictionary.name = htmlEntities(document.getElementById("dictionaryNameEdit").value);
@@ -364,14 +305,6 @@ function SaveSettings() {
SaveAndUpdateDictionary(true);
}
-function HideSettingsWhenComplete() {
- if (currentDictionary.settings.isComplete) {
- document.getElementById("hideIfComplete").style.display = "none";
- } else {
- document.getElementById("hideIfComplete").style.display = "block";
- }
-}
-
function CheckForPartsOfSpeechChange () {
if (htmlEntities(document.getElementById("dictionaryPartsOfSpeechEdit").value) != currentDictionary.settings.partsOfSpeech) {
if (htmlEntities(document.getElementById("dictionaryPartsOfSpeechEdit").value) != "") {
@@ -381,34 +314,6 @@ function CheckForPartsOfSpeechChange () {
}
}
-function SetPartsOfSpeech () {
- var partsOfSpeechSelect = document.getElementById("partOfSpeech");
- var wordFilterSelect = document.getElementById("wordFilter");
- if (partsOfSpeechSelect.options.length > 0) {
- for (var i = partsOfSpeechSelect.options.length - 1; i >= 0; i--) {
- partsOfSpeechSelect.removeChild(partsOfSpeechSelect.options[i]);
- wordFilterSelect.removeChild(wordFilterSelect.options[i + 1]);
- }
- }
- var newPartsOfSpeech = htmlEntitiesParse(currentDictionary.settings.partsOfSpeech).trim().split(",");
- for (var j = 0; j < newPartsOfSpeech.length; j++) {
- var partOfSpeechOption = document.createElement('option');
- partOfSpeechOption.appendChild(document.createTextNode(newPartsOfSpeech[j].trim()));
- partOfSpeechOption.value = newPartsOfSpeech[j].trim();
- partsOfSpeechSelect.appendChild(partOfSpeechOption);
-
- var wordFilterOption = document.createElement('option');
- wordFilterOption.appendChild(document.createTextNode(newPartsOfSpeech[j].trim()));
- wordFilterOption.value = newPartsOfSpeech[j].trim();
- wordFilterSelect.appendChild(wordFilterOption);
- }
-}
-
-function HideSettings() {
- document.getElementById("settingsScreen").style.display = "none";
- document.getElementById("wordEntryForm").style.display = (currentDictionary.settings.isComplete) ? "none" : "block";
-}
-
function EmptyWholeDictionary() {
if (confirm("This will delete the entire current dictionary. If you do not have a backed up export, you will lose it forever!\n\nDo you still want to delete?")) {
currentDictionary = JSON.parse(defaultDictionaryJSON);
diff --git a/js/ui.js b/js/ui.js
new file mode 100644
index 0000000..52a0015
--- /dev/null
+++ b/js/ui.js
@@ -0,0 +1,94 @@
+function CloseUpdateConflictArea() {
+ document.getElementById("updateConflict").style.display = "none";
+}
+
+function ClearForm() {
+ document.getElementById("word").value = "";
+ document.getElementById("pronunciation").value = "";
+ document.getElementById("partOfSpeech").value = "";
+ document.getElementById("simpleDefinition").value = "";
+ document.getElementById("longDefinition").value = "";
+ document.getElementById("editIndex").value = "";
+
+ document.getElementById("newWordButtonArea").style.display = "block";
+ document.getElementById("editWordButtonArea").style.display = "none";
+ document.getElementById("errorMessage").innerHTML = "";
+ document.getElementById("updateConflict").style.display = "none";
+}
+
+function ToggleDescription() {
+ var descriptionToggle = document.getElementById("descriptionToggle");
+ var descriptionArea = document.getElementById("dictionaryDescription");
+
+ if (descriptionArea.style.display == "none") {
+ descriptionArea.style.display = "block";
+ descriptionToggle.innerHTML = "Hide Description";
+ } else {
+ descriptionArea.style.display = "none";
+ descriptionToggle.innerHTML = "Show Description";
+ }
+}
+
+function ShowAbout() {
+ document.getElementById("aboutScreen").style.display = "block";
+}
+
+function HideAbout() {
+ document.getElementById("aboutScreen").style.display = "none";
+}
+
+function ToggleCaseSensitiveOption() {
+ if (document.getElementById("dictionaryAllowDuplicates").checked) {
+ document.getElementById("dictionaryCaseSensitive").disabled = true;
+ } else {
+ document.getElementById("dictionaryCaseSensitive").disabled = false;
+ }
+}
+
+function ShowSettings() {
+ document.getElementById("settingsScreen").style.display = "block";
+ document.getElementById("dictionaryNameEdit").value = htmlEntitiesParse(currentDictionary.name);
+ document.getElementById("dictionaryDescriptionEdit").value = htmlEntitiesParse(currentDictionary.description);
+ document.getElementById("dictionaryPartsOfSpeechEdit").value = htmlEntitiesParse(currentDictionary.settings.partsOfSpeech);
+ document.getElementById("dictionaryAllowDuplicates").checked = currentDictionary.settings.allowDuplicates;
+ document.getElementById("dictionaryCaseSensitive").checked = currentDictionary.settings.caseSensitive;
+ document.getElementById("dictionarySortByEquivalent").checked = currentDictionary.settings.sortByEquivalent;
+ document.getElementById("dictionaryIsComplete").checked = currentDictionary.settings.isComplete;
+ document.getElementById("numberOfWordsInDictionary").innerHTML = currentDictionary.words.length.toString();
+}
+
+function HideSettingsWhenComplete() {
+ if (currentDictionary.settings.isComplete) {
+ document.getElementById("hideIfComplete").style.display = "none";
+ } else {
+ document.getElementById("hideIfComplete").style.display = "block";
+ }
+}
+
+function SetPartsOfSpeech () {
+ var partsOfSpeechSelect = document.getElementById("partOfSpeech");
+ var wordFilterSelect = document.getElementById("wordFilter");
+ if (partsOfSpeechSelect.options.length > 0) {
+ for (var i = partsOfSpeechSelect.options.length - 1; i >= 0; i--) {
+ partsOfSpeechSelect.removeChild(partsOfSpeechSelect.options[i]);
+ wordFilterSelect.removeChild(wordFilterSelect.options[i + 1]);
+ }
+ }
+ var newPartsOfSpeech = htmlEntitiesParse(currentDictionary.settings.partsOfSpeech).trim().split(",");
+ for (var j = 0; j < newPartsOfSpeech.length; j++) {
+ var partOfSpeechOption = document.createElement('option');
+ partOfSpeechOption.appendChild(document.createTextNode(newPartsOfSpeech[j].trim()));
+ partOfSpeechOption.value = newPartsOfSpeech[j].trim();
+ partsOfSpeechSelect.appendChild(partOfSpeechOption);
+
+ var wordFilterOption = document.createElement('option');
+ wordFilterOption.appendChild(document.createTextNode(newPartsOfSpeech[j].trim()));
+ wordFilterOption.value = newPartsOfSpeech[j].trim();
+ wordFilterSelect.appendChild(wordFilterOption);
+ }
+}
+
+function HideSettings() {
+ document.getElementById("settingsScreen").style.display = "none";
+ document.getElementById("wordEntryForm").style.display = (currentDictionary.settings.isComplete) ? "none" : "block";
+}
\ No newline at end of file