Added Allow Duplicates option
Fixed Part of Speech Filter Updated styling for entries Updated Dictionary is Complete functionality
This commit is contained in:
parent
310144b9ed
commit
d8b3ab00c5
|
@ -2,6 +2,7 @@
|
||||||
padding: 0;
|
padding: 0;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
border: none;
|
border: none;
|
||||||
|
font-family: Georgia, 'Times New Roman', Times, serif;
|
||||||
}
|
}
|
||||||
|
|
||||||
footer {
|
footer {
|
||||||
|
@ -38,11 +39,25 @@ label span {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
label label {
|
||||||
|
margin-left: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
label span.checkboxlabel {
|
||||||
|
display: inline;
|
||||||
|
margin-left: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
input, textarea {
|
input, textarea {
|
||||||
display: block;
|
display: block;
|
||||||
padding-left: 5px;
|
padding-left: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
input[type=checkbox] {
|
||||||
|
display: inline;
|
||||||
|
margin: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
#longDefinition {
|
#longDefinition {
|
||||||
width: 350px;
|
width: 350px;
|
||||||
height: 200px;
|
height: 200px;
|
||||||
|
@ -69,6 +84,15 @@ input, textarea {
|
||||||
margin: 0 0 5px;
|
margin: 0 0 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#dictionaryDescription {
|
||||||
|
width: 100%;
|
||||||
|
max-height: 400px;
|
||||||
|
overflow-y: auto;
|
||||||
|
padding: 15px;
|
||||||
|
border: 1px solid #cacaca;
|
||||||
|
margin: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
.clickable {
|
.clickable {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
@ -98,6 +122,7 @@ entry {
|
||||||
|
|
||||||
word {
|
word {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
|
font-size: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
partofspeech {
|
partofspeech {
|
||||||
|
@ -105,8 +130,9 @@ partofspeech {
|
||||||
font-size: 10px;
|
font-size: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
shortdefinition {
|
simpledefinition {
|
||||||
display: block;
|
display: block;
|
||||||
|
font-style: italic;
|
||||||
}
|
}
|
||||||
|
|
||||||
longdefinition {
|
longdefinition {
|
||||||
|
@ -167,6 +193,7 @@ longDefinition p {
|
||||||
.deleteConfirm {
|
.deleteConfirm {
|
||||||
display: block;
|
display: block;
|
||||||
font-size: 10px;
|
font-size: 10px;
|
||||||
|
margin: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#settingsBackgroundFade, #aboutBackgroundFade {
|
#settingsBackgroundFade, #aboutBackgroundFade {
|
||||||
|
|
18
index.html
18
index.html
|
@ -76,8 +76,9 @@
|
||||||
<h2>Dictionary Settings</h2>
|
<h2>Dictionary Settings</h2>
|
||||||
<form id="settingsForm">
|
<form id="settingsForm">
|
||||||
<div class="settingsCol">
|
<div class="settingsCol">
|
||||||
|
<div id="hideIfComplete">
|
||||||
<label>
|
<label>
|
||||||
<span>Dictionary name</span>
|
<span>Dictionary Name</span>
|
||||||
<input type="text" id="dictionaryNameEdit" />
|
<input type="text" id="dictionaryNameEdit" />
|
||||||
</label>
|
</label>
|
||||||
<label><span>Dictionary Description/Rules</span>
|
<label><span>Dictionary Description/Rules</span>
|
||||||
|
@ -88,7 +89,16 @@
|
||||||
<input type="text" id="dictionaryPartsOfSpeechEdit" />
|
<input type="text" id="dictionaryPartsOfSpeechEdit" />
|
||||||
</label>
|
</label>
|
||||||
<label>
|
<label>
|
||||||
<span>Dictionary is complete</span>
|
<span class="checkboxlabel">Allow Duplicates</span>
|
||||||
|
<input type="checkbox" id="dictionaryAllowDuplicates" onchange="ToggleCaseSensitiveOption()" />
|
||||||
|
<label>
|
||||||
|
<span class="checkboxlabel">Case-Sensitive</span>
|
||||||
|
<input type="checkbox" id="dictionaryCaseSensitive" />
|
||||||
|
</label>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<label>
|
||||||
|
<span class="checkboxlabel">Dictionary is Complete</span>
|
||||||
<input type="checkbox" id="dictionaryIsComplete" />
|
<input type="checkbox" id="dictionaryIsComplete" />
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
@ -147,11 +157,11 @@
|
||||||
Please note that if you have other parts of speech added to existing words, those words will not update and will keep the old parts of speech. You will need to manually update any words with incorrect parts of speech after the fact, which is why I recommend you update the available parts of speech as one of the first things you do if you need to change them at all!
|
Please note that if you have other parts of speech added to existing words, those words will not update and will keep the old parts of speech. You will need to manually update any words with incorrect parts of speech after the fact, which is why I recommend you update the available parts of speech as one of the first things you do if you need to change them at all!
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
The <b>Allow Duplicates</b> checkbox allows you to control whether or not Dictionary Builder will allow you to add the same word multiple times. If you leave Allow Duplicates unchecked and you try to add a word that is already in the dictionary, Dictionary Builder will tell you that the word already exists and will ask if you want to update it with the newly entered word. <em>Note: Allow Duplicates is not yet in the Settings menu!</em>
|
The <b>Allow Duplicates</b> checkbox allows you to control whether or not Dictionary Builder will allow you to add the same word multiple times. If you leave Allow Duplicates unchecked and you try to add a word that is already in the dictionary, Dictionary Builder will tell you that the word already exists and will ask if you want to update it with the newly entered word.
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
The <b>Case-Sensitive</b> checkbox allows you to control Dictionary Builder's duplicate detection. If you leave Case-Sensitive unchecked, you will be alerted when you are trying to add a word with the same letters to your dictionary a second time. For example, "dog" is identified as the same word as "DOG" or "doG". The dictionary will keep whatever capitalization you save but it will identify words with the same spelling as duplicates. If Case-Sensitive is checked, then it will not identify "dog" and "DOG" as the same word.<br>
|
The <b>Case-Sensitive</b> checkbox allows you to control Dictionary Builder's duplicate detection. If you leave Case-Sensitive unchecked, you will be alerted when you are trying to add a word with the same letters to your dictionary a second time. For example, "dog" is identified as the same word as "DOG" or "doG". The dictionary will keep whatever capitalization you save but it will identify words with the same spelling as duplicates. If Case-Sensitive is checked, then it will not identify "dog" and "DOG" as the same word.<br>
|
||||||
If Allow Duplicates is checked, this checkbox becomes unavailable. <em>Note: Case-Sensitive is not yet in the Settings menu!</em>
|
If Allow Duplicates is checked, this checkbox becomes unavailable.
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
The "<b>Dictionary is complete</b>" checkbox will make the word add/edit form go away so you can view or share it more easily/safely. Plus when you export your dictionary, all of the options to change anything about your dictionary will be excluded when it is re-imported! Your dictionary will become static, and will not be able to be changed or updated without a password. <em>Note: At the moment, ONLY the word form goes away. Nothing else in this paragraph is implemented yet!</em>
|
The "<b>Dictionary is complete</b>" checkbox will make the word add/edit form go away so you can view or share it more easily/safely. Plus when you export your dictionary, all of the options to change anything about your dictionary will be excluded when it is re-imported! Your dictionary will become static, and will not be able to be changed or updated without a password. <em>Note: At the moment, ONLY the word form goes away. Nothing else in this paragraph is implemented yet!</em>
|
||||||
|
|
|
@ -6,8 +6,8 @@ var currentDictionary = {
|
||||||
description: "A new dictionary.",
|
description: "A new dictionary.",
|
||||||
words: [],
|
words: [],
|
||||||
settings: {
|
settings: {
|
||||||
|
allowDuplicates: false,
|
||||||
caseSensitive: false,
|
caseSensitive: false,
|
||||||
preferUpperCase: false,
|
|
||||||
partsOfSpeech: "Noun,Adjective,Verb,Adverb,Preposition,Pronoun,Conjunction",
|
partsOfSpeech: "Noun,Adjective,Verb,Adverb,Preposition,Pronoun,Conjunction",
|
||||||
isComplete: false
|
isComplete: false
|
||||||
},
|
},
|
||||||
|
@ -96,7 +96,7 @@ function AddWord() {
|
||||||
currentDictionary.words.sort(dynamicSort("name"));
|
currentDictionary.words.sort(dynamicSort("name"));
|
||||||
errorMessageArea.innerHTML = "";
|
errorMessageArea.innerHTML = "";
|
||||||
|
|
||||||
ShowDictionary();
|
ShowDictionary(document.getElementById("wordFilter").value);
|
||||||
SaveDictionary();
|
SaveDictionary();
|
||||||
} else {
|
} else {
|
||||||
if (word == "") {
|
if (word == "") {
|
||||||
|
@ -152,7 +152,7 @@ function UpdateWord(wordIndex, word, simpleDefinition, longDefinition, partOfSpe
|
||||||
currentDictionary.words[wordIndex].simpleDefinition = simpleDefinition;
|
currentDictionary.words[wordIndex].simpleDefinition = simpleDefinition;
|
||||||
currentDictionary.words[wordIndex].longDefinition = longDefinition;
|
currentDictionary.words[wordIndex].longDefinition = longDefinition;
|
||||||
currentDictionary.words[wordIndex].partOfSpeech = partOfSpeech;
|
currentDictionary.words[wordIndex].partOfSpeech = partOfSpeech;
|
||||||
ShowDictionary();
|
ShowDictionary(document.getElementById("wordFilter").value);
|
||||||
SaveDictionary();
|
SaveDictionary();
|
||||||
ClearForm();
|
ClearForm();
|
||||||
CloseUpdateConflictArea();
|
CloseUpdateConflictArea();
|
||||||
|
@ -165,7 +165,7 @@ function DeleteWord(index) {
|
||||||
ClearForm();
|
ClearForm();
|
||||||
|
|
||||||
currentDictionary.words.splice(index, 1);
|
currentDictionary.words.splice(index, 1);
|
||||||
ShowDictionary();
|
ShowDictionary(document.getElementById("wordFilter").value);
|
||||||
SaveDictionary();
|
SaveDictionary();
|
||||||
CloseUpdateConflictArea();
|
CloseUpdateConflictArea();
|
||||||
|
|
||||||
|
@ -189,9 +189,7 @@ function ClearForm() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function UpdateFilter() {
|
function UpdateFilter() {
|
||||||
var filter = document.getElementById("wordFilter").value;
|
ShowDictionary(document.getElementById("wordFilter").value);
|
||||||
|
|
||||||
ShowDictionary(filter);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function ShowDictionary(filter) {
|
function ShowDictionary(filter) {
|
||||||
|
@ -244,14 +242,16 @@ function DictionaryEntry(itemIndex) {
|
||||||
entryText += "<br>";
|
entryText += "<br>";
|
||||||
|
|
||||||
if (currentDictionary.words[itemIndex].simpleDefinition != "") {
|
if (currentDictionary.words[itemIndex].simpleDefinition != "") {
|
||||||
entryText += "<simpledefinition> ==> " + currentDictionary.words[itemIndex].simpleDefinition + "</simpledefinition>";
|
entryText += "<simpledefinition>" + currentDictionary.words[itemIndex].simpleDefinition + "</simpledefinition>";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (currentDictionary.words[itemIndex].longDefinition != "") {
|
if (currentDictionary.words[itemIndex].longDefinition != "") {
|
||||||
entryText += "<longdefinition>" + markdown.toHTML(htmlEntitiesParse(currentDictionary.words[itemIndex].longDefinition)) + "</longdefinition>";
|
entryText += "<longdefinition>" + markdown.toHTML(htmlEntitiesParse(currentDictionary.words[itemIndex].longDefinition)) + "</longdefinition>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!currentDictionary.settings.isComplete) {
|
||||||
entryText += ManagementArea(itemIndex);
|
entryText += ManagementArea(itemIndex);
|
||||||
|
}
|
||||||
|
|
||||||
entryText += "</entry>";
|
entryText += "</entry>";
|
||||||
|
|
||||||
|
@ -264,7 +264,7 @@ function ManagementArea(itemIndex) {
|
||||||
managementHTML += "<span class='clickable editButton' onclick='EditWord(" + itemIndex + ")'>Edit</span>";
|
managementHTML += "<span class='clickable editButton' onclick='EditWord(" + itemIndex + ")'>Edit</span>";
|
||||||
managementHTML += "<span class='clickable deleteButton' onclick='document.getElementById(\"delete" + itemIndex + "Confirm\").style.display = \"block\";'>Delete</span>";
|
managementHTML += "<span class='clickable deleteButton' onclick='document.getElementById(\"delete" + itemIndex + "Confirm\").style.display = \"block\";'>Delete</span>";
|
||||||
|
|
||||||
managementHTML += "<div class='deleteConfirm' id='delete" + itemIndex + "Confirm' style='display:none;'>Are you sure you want to delete this entry?<br>";
|
managementHTML += "<div class='deleteConfirm' id='delete" + itemIndex + "Confirm' style='display:none;'>Are you sure you want to delete this entry?<br><br>";
|
||||||
managementHTML += "<span class='clickable deleteCancelButton' onclick='document.getElementById(\"delete" + itemIndex + "Confirm\").style.display = \"none\";'>No</span>";
|
managementHTML += "<span class='clickable deleteCancelButton' onclick='document.getElementById(\"delete" + itemIndex + "Confirm\").style.display = \"none\";'>No</span>";
|
||||||
managementHTML += "<span class='clickable deleteConfirmButton' onclick='DeleteWord(" + itemIndex + ")'>Yes</span>";
|
managementHTML += "<span class='clickable deleteConfirmButton' onclick='DeleteWord(" + itemIndex + ")'>Yes</span>";
|
||||||
managementHTML += "</div>";
|
managementHTML += "</div>";
|
||||||
|
@ -282,11 +282,21 @@ function HideAbout() {
|
||||||
document.getElementById("aboutScreen").style.display = "none";
|
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() {
|
function ShowSettings() {
|
||||||
document.getElementById("settingsScreen").style.display = "block";
|
document.getElementById("settingsScreen").style.display = "block";
|
||||||
document.getElementById("dictionaryNameEdit").value = htmlEntitiesParse(currentDictionary.name);
|
document.getElementById("dictionaryNameEdit").value = htmlEntitiesParse(currentDictionary.name);
|
||||||
document.getElementById("dictionaryDescriptionEdit").value = htmlEntitiesParse(currentDictionary.description);
|
document.getElementById("dictionaryDescriptionEdit").value = htmlEntitiesParse(currentDictionary.description);
|
||||||
document.getElementById("dictionaryPartsOfSpeechEdit").value = htmlEntitiesParse(currentDictionary.settings.partsOfSpeech);
|
document.getElementById("dictionaryPartsOfSpeechEdit").value = htmlEntitiesParse(currentDictionary.settings.partsOfSpeech);
|
||||||
|
document.getElementById("dictionaryAllowDuplicates").checked = currentDictionary.settings.allowDuplicates;
|
||||||
|
document.getElementById("dictionaryCaseSensitive").checked = currentDictionary.settings.caseSensitive;
|
||||||
document.getElementById("dictionaryIsComplete").checked = currentDictionary.settings.isComplete;
|
document.getElementById("dictionaryIsComplete").checked = currentDictionary.settings.isComplete;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -299,12 +309,25 @@ function SaveSettings() {
|
||||||
|
|
||||||
CheckForPartsOfSpeechChange();
|
CheckForPartsOfSpeechChange();
|
||||||
|
|
||||||
|
currentDictionary.settings.allowDuplicates = document.getElementById("dictionaryAllowDuplicates").checked;
|
||||||
|
currentDictionary.settings.caseSensitive = document.getElementById("dictionaryCaseSensitive").checked;
|
||||||
|
|
||||||
currentDictionary.settings.isComplete = document.getElementById("dictionaryIsComplete").checked;
|
currentDictionary.settings.isComplete = document.getElementById("dictionaryIsComplete").checked;
|
||||||
|
|
||||||
ShowDictionary();
|
HideSettingsWhenComplete();
|
||||||
|
|
||||||
|
ShowDictionary(document.getElementById("wordFilter").value);
|
||||||
SaveDictionary();
|
SaveDictionary();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function HideSettingsWhenComplete() {
|
||||||
|
if (currentDictionary.settings.isComplete) {
|
||||||
|
document.getElementById("hideIfComplete").style.display = "none";
|
||||||
|
} else {
|
||||||
|
document.getElementById("hideIfComplete").style.display = "block";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function CheckForPartsOfSpeechChange () {
|
function CheckForPartsOfSpeechChange () {
|
||||||
if (htmlEntities(document.getElementById("dictionaryPartsOfSpeechEdit").value) != currentDictionary.settings.partsOfSpeech) {
|
if (htmlEntities(document.getElementById("dictionaryPartsOfSpeechEdit").value) != currentDictionary.settings.partsOfSpeech) {
|
||||||
if (htmlEntities(document.getElementById("dictionaryPartsOfSpeechEdit").value) != "") {
|
if (htmlEntities(document.getElementById("dictionaryPartsOfSpeechEdit").value) != "") {
|
||||||
|
@ -345,7 +368,7 @@ function HideSettings() {
|
||||||
function EmptyWholeDictionary() {
|
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?")) {
|
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);
|
currentDictionary = JSON.parse(defaultDictionaryJSON);
|
||||||
ShowDictionary();
|
ShowDictionary("");
|
||||||
SaveDictionary();
|
SaveDictionary();
|
||||||
SetPartsOfSpeech();
|
SetPartsOfSpeech();
|
||||||
HideSettings();
|
HideSettings();
|
||||||
|
@ -364,7 +387,10 @@ function LoadDictionary() {
|
||||||
}
|
}
|
||||||
tmpDictionary = null;
|
tmpDictionary = null;
|
||||||
}
|
}
|
||||||
ShowDictionary();
|
|
||||||
|
HideSettingsWhenComplete();
|
||||||
|
|
||||||
|
ShowDictionary("");
|
||||||
|
|
||||||
SetPartsOfSpeech();
|
SetPartsOfSpeech();
|
||||||
|
|
||||||
|
@ -414,6 +440,7 @@ function ImportDictionary() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function WordIndex(word) {
|
function WordIndex(word) {
|
||||||
|
if (!currentDictionary.settings.allowDuplicates) {
|
||||||
for (var i = 0; i < currentDictionary.words.length; i++)
|
for (var i = 0; i < currentDictionary.words.length; i++)
|
||||||
{
|
{
|
||||||
if ((!currentDictionary.settings.caseSensitive && currentDictionary.words[i].name.toLowerCase() == word.toLowerCase()) ||
|
if ((!currentDictionary.settings.caseSensitive && currentDictionary.words[i].name.toLowerCase() == word.toLowerCase()) ||
|
||||||
|
@ -421,6 +448,7 @@ function WordIndex(word) {
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue