Permalink
Browse files

Updated word filtering to allow as many parts of speech as the user w…

…ants.
  • Loading branch information...
Alamantus committed May 26, 2016
1 parent bdf9327 commit 2a9fecae89a3812fddd1f404946b3bcb1436d793
Showing with 67 additions and 33 deletions.
  1. +1 −2 announcement.php
  2. +6 −0 css/styles.css
  3. +11 −10 index.php
  4. +2 −2 js/dictionaryBuilder.js
  5. +1 −1 js/min/dictionaryBuilder.js
  6. +1 −1 js/min/ui.js
  7. +45 −17 js/ui.js
View
@@ -1,2 +1 @@
You can now use Keyboard Shortcuts! Check About Lexiconga (Ctrl+H) to find out what they are!<br>
Check the <a href="https://github.com/Alamantus/DictionaryBuilder/releases" target="_blank">update log</a> for other changes.
The Filter system has been updated—you can now filter on as many parts of speech as you want!
View
@@ -189,6 +189,12 @@ input[type=checkbox] {
cursor: pointer;
}
.searchOption, .filterOption {
font-size:12px;
display: inline-block;
margin: 0 8px 0 0;
}
#wordFilter {
margin: 10px 0;
}
View
@@ -104,21 +104,22 @@
<input type="text" id="searchBox" onclick="this.select();" onchange="ShowDictionary()" style="display:inline;" />&nbsp;
<span style="display:inline;cursor:pointer;font-size:10px;font-weight:bold;" onclick="document.getElementById('searchBox').value='';ShowDictionary();">Clear Search</span>
</div>
<div id="searchOptions" style="font-size:12px;">
<label style="display:inline;margin:0;">Word <input type="checkbox" id="searchOptionWord" checked="checked" onchange="ShowDictionary()" /></label>&nbsp;&nbsp;
<label style="display:inline;margin:0;">Equivalent <input type="checkbox" id="searchOptionSimple" checked="checked" onchange="ShowDictionary()" /></label>&nbsp;&nbsp;
<label style="display:inline;margin:0;">Explanation <input type="checkbox" id="searchOptionLong" checked="checked" onchange="ShowDictionary()" /></label>
<div id="searchOptions">
<label class="searchOption">Word <input type="checkbox" id="searchOptionWord" checked="checked" onchange="ShowDictionary()" /></label>
<label class="searchOption">Equivalent <input type="checkbox" id="searchOptionSimple" checked="checked" onchange="ShowDictionary()" /></label>
<label class="searchOption">Explanation <input type="checkbox" id="searchOptionLong" checked="checked" onchange="ShowDictionary()" /></label>
<br />
<label style="display:inline;margin:0;">Search Case-Sensitive <input type="checkbox" id="searchCaseSensitive" onchange="ShowDictionary()" /></label>
<label style="display:inline;margin:0;" title="Note: Matching diacritics will appear but may not highlight.">Ignore Diacritics/Accents <input type="checkbox" id="searchIgnoreDiacritics" onchange="ShowDictionary()" /></label>
<label class="searchOption">Search Case-Sensitive <input type="checkbox" id="searchCaseSensitive" onchange="ShowDictionary()" /></label>
<label class="searchOption" title="Note: Matching diacritics will appear but may not highlight.">Ignore Diacritics/Accents <input type="checkbox" id="searchIgnoreDiacritics" onchange="ShowDictionary()" /></label>
</div>
</label>
</div>
<label style="display:block;"><b>Filter Words </b><select id="wordFilter" onchange="ShowDictionary()">
<option value="">All</option>
</select>
</label>
<label style="display:block;margin-bottom:0;"><b>Filter Words</b></label>
<div id="filterOptions" style="display:block"></div>
<div style="display:block;">
<span style="display:inline;cursor:pointer;font-size:12px;font-weight:bold;" onclick="ToggleAllFilters(true)">Check All</span>&nbsp;/&nbsp;<span style="display:inline;cursor:pointer;font-size:12px;font-weight:bold;" onclick="ToggleAllFilters(false)">Uncheck All</span>
</div>
</div>
<div id="filterWordCount"></div>
View
@@ -152,7 +152,7 @@ function DeleteWord(index) {
}
function ShowDictionary() {
var filter = document.getElementById("wordFilter").value;
var filters = GetSelectedFilters();
var searchResults = [];
var search = htmlEntitiesParseForSearchEntry(document.getElementById("searchBox").value);
@@ -196,7 +196,7 @@ function ShowDictionary() {
if (currentDictionary.words.length > 0) {
for (var i = 0; i < currentDictionary.words.length; i++) {
if (filter == "" || (filter != "" && currentDictionary.words[i].partOfSpeech == filter)) {
if (filters.length == 0 || (filters.length > 0 && filters.indexOf(currentDictionary.words[i].partOfSpeech) > -1)) {
if (search == "" || (search != "" && (searchByWord || searchBySimple || searchByLong) && searchResults.indexOf(currentDictionary.words[i].wordId) >= 0)) {
if (!currentDictionary.words[i].hasOwnProperty("pronunciation")) {
currentDictionary.words[i].pronunciation = ""; //Account for new property

Large diffs are not rendered by default.

Oops, something went wrong.
Oops, something went wrong.

0 comments on commit 2a9feca

Please sign in to comment.