diff --git a/css/styles.css b/css/styles.css index d8a5347..56af25a 100644 --- a/css/styles.css +++ b/css/styles.css @@ -204,6 +204,13 @@ input[type=checkbox] { margin: 10px 0; } +#filterWordCount { + margin: 10px 10px; + display: block; + font-weight: bold; + font-style: italic; +} + entry { display: block; width: 90%; diff --git a/index.php b/index.php index 8d7ef51..a65c511 100644 --- a/index.php +++ b/index.php @@ -118,6 +118,8 @@ require_once(SITE_LOCATION . '/php/notificationconditiontree.php'); + +
diff --git a/js/dictionaryBuilder.js b/js/dictionaryBuilder.js index ba62e83..7fdf30b 100644 --- a/js/dictionaryBuilder.js +++ b/js/dictionaryBuilder.js @@ -219,6 +219,7 @@ function ShowDictionary() { var dictionaryArea = document.getElementById("theDictionary"); var dictionaryText = ""; + var numberOfWordsDisplayed = 0; if (currentDictionary.words.length > 0) { for (var i = 0; i < currentDictionary.words.length; i++) { @@ -231,6 +232,7 @@ function ShowDictionary() { currentDictionary.words[i].wordId = i + 1; //Account for new property } dictionaryText += DictionaryEntry(i); + numberOfWordsDisplayed++; } } } @@ -239,6 +241,7 @@ function ShowDictionary() { } dictionaryArea.innerHTML = dictionaryText; + ShowFilterWordCount(numberOfWordsDisplayed); } function DictionaryEntry(itemIndex) { diff --git a/js/publicView.js b/js/publicView.js index 9304f4a..a494b2e 100644 --- a/js/publicView.js +++ b/js/publicView.js @@ -53,6 +53,7 @@ function ShowPublicDictionary() { var dictionaryArea = document.getElementById("theDictionary"); var dictionaryText = ""; + var numberOfWordsDisplayed = 0; if (publicDictionary.words.length > 0) { for (var i = 0; i < publicDictionary.words.length; i++) { @@ -65,6 +66,7 @@ function ShowPublicDictionary() { publicDictionary.words[i].wordId = i + 1; //Account for new property } dictionaryText += PublicDictionaryEntry(i); + numberOfWordsDisplayed++; } } } @@ -72,6 +74,7 @@ function ShowPublicDictionary() { dictionaryText = "There are no entries in the dictionary." } dictionaryArea.innerHTML = dictionaryText; + ShowFilterWordCount(numberOfWordsDisplayed); } else { document.getElementById("dictionaryContainer").innerHTML = publicDictionary; } diff --git a/js/ui.js b/js/ui.js index 5fb483a..3a65ec9 100644 --- a/js/ui.js +++ b/js/ui.js @@ -379,6 +379,18 @@ function SetPartsOfSpeech () { } } +function ShowFilterWordCount(numberOfWords) { + var filter = document.getElementById("wordFilter").value; + var search = htmlEntitiesParseForSearchEntry(document.getElementById("searchBox").value); + var wordCounter = document.getElementById("filterWordCount"); + + if (filter != "" || search != "") { + wordCounter.innerHTML = "Showing " + numberOfWords.toString() + " result" + ((numberOfWords > 1) ? "s" : ""); + } else { + wordCounter.innerHTML = ""; + } +} + function HideSettings() { document.getElementById("settingsScreen").style.display = "none"; document.getElementById("wordEntryForm").style.display = (currentDictionary.settings.isComplete) ? "none" : "block"; diff --git a/view/index.php b/view/index.php index b321e32..7020a80 100644 --- a/view/index.php +++ b/view/index.php @@ -102,6 +102,8 @@ catch (PDOException $ex) {} + +