alessandro trinca tornidor
commited on
Commit
·
9113af3
1
Parent(s):
de48b4c
refactor: remove or rewrite some console.log()
Browse files- static/index.js +3 -11
static/index.js
CHANGED
|
@@ -347,7 +347,6 @@ function textStemming(textSplitNewline) {
|
|
| 347 |
});
|
| 348 |
});
|
| 349 |
});
|
| 350 |
-
console.log("textStemming::wordsStemsDict:", wordsStemsDict, "#")
|
| 351 |
return { nTotalRows, wordsStemsDict };
|
| 352 |
}
|
| 353 |
|
|
@@ -527,9 +526,7 @@ function setElementCssClassByOldClass(oldClassName, currentClass) {
|
|
| 527 |
try {
|
| 528 |
let oldClassElement = document.getElementsByClassName(oldClassName)
|
| 529 |
oldClassElement[0].className = currentClass
|
| 530 |
-
} catch {
|
| 531 |
-
console.log("not found...")
|
| 532 |
-
}
|
| 533 |
}
|
| 534 |
|
| 535 |
/**
|
|
@@ -562,7 +559,7 @@ async function getWordsFrequency() {
|
|
| 562 |
let currentTableOfWords = document.getElementById("id-current-table-of-words")
|
| 563 |
currentTableOfWords.innerHTML = ""
|
| 564 |
const choiceWordFreqAnalyzerEl = document.getElementById('id-input-webserver-wordfreq-checkbox')
|
| 565 |
-
console.log("choiceWordFreqAnalyzerEl checked:", choiceWordFreqAnalyzerEl.checked, "#")
|
| 566 |
switch (choiceWordFreqAnalyzerEl.checked) {
|
| 567 |
case true: // webserver
|
| 568 |
await wordsFrequencyAnalyzers['id-input-webserver-wordfreq-checkbox'](validChildContent)
|
|
@@ -651,10 +648,8 @@ function extractStringValues(obj) {
|
|
| 651 |
* // Returns: [{ a: "hello", b: { c: "world" } }]
|
| 652 |
*/
|
| 653 |
function arrayFilterNestedValue(array, nestedValue) {
|
| 654 |
-
console.log("arrayFilterNestedValue...", array.length, "#")
|
| 655 |
return array.filter(item => {
|
| 656 |
let valuesFromObject = extractStringValues(item).join(" ")
|
| 657 |
-
console.log("arrayFilterNestedValue::contains:", valuesFromObject.toLowerCase().includes(nestedValue.toLowerCase()), valuesFromObject, "#")
|
| 658 |
return valuesFromObject.toLowerCase().includes(nestedValue.toLowerCase());
|
| 659 |
});
|
| 660 |
}
|
|
@@ -683,9 +678,7 @@ async function updateWordsFrequencyTables() {
|
|
| 683 |
|
| 684 |
let inputFilter = document.getElementById("filter-words-frequency")
|
| 685 |
let inputFilterValue = inputFilter.value
|
| 686 |
-
console.log("updateWordsFrequencyTables::inputFilter.value:", inputFilter.value, inputFilterValue !== undefined && inputFilter.value !== "", "#")
|
| 687 |
if (inputFilterValue !== undefined && inputFilter.value !== "") {
|
| 688 |
-
console.log("dentro...")
|
| 689 |
reduced = arrayFilterNestedValue(reduced, inputFilterValue)
|
| 690 |
}
|
| 691 |
|
|
@@ -766,7 +759,7 @@ function insertListOfWords(i, iReduced, nTotalRows, wordListElement, currentTabl
|
|
| 766 |
a.innerText = `${iReduced["word_prefix"]}: ${iReduced["count"]} repetitions`
|
| 767 |
a.addEventListener("click", function() {
|
| 768 |
currentTableOfWords.innerHTML = ""
|
| 769 |
-
console.log(
|
| 770 |
insertCurrentTable(i, iReduced, nTotalRows, currentTableOfWords)
|
| 771 |
setElementCssClassByOldClass(underlinedClicked, underlinedPrimary)
|
| 772 |
a.className = underlinedClicked
|
|
@@ -814,7 +807,6 @@ function insertCellIntoTRow(currentTBody, i, ii, nthOffset, nTotalRows) {
|
|
| 814 |
* @function updateWordsFreqIfPressEnter
|
| 815 |
*/
|
| 816 |
function updateWordsFreqIfPressEnter() {
|
| 817 |
-
console.log("updateWordsFreqIfPressEnter::", event.key, "#")
|
| 818 |
if(event.key==='Enter'){
|
| 819 |
updateWordsFrequencyTables()
|
| 820 |
}
|
|
|
|
| 347 |
});
|
| 348 |
});
|
| 349 |
});
|
|
|
|
| 350 |
return { nTotalRows, wordsStemsDict };
|
| 351 |
}
|
| 352 |
|
|
|
|
| 526 |
try {
|
| 527 |
let oldClassElement = document.getElementsByClassName(oldClassName)
|
| 528 |
oldClassElement[0].className = currentClass
|
| 529 |
+
} catch {}
|
|
|
|
|
|
|
| 530 |
}
|
| 531 |
|
| 532 |
/**
|
|
|
|
| 559 |
let currentTableOfWords = document.getElementById("id-current-table-of-words")
|
| 560 |
currentTableOfWords.innerHTML = ""
|
| 561 |
const choiceWordFreqAnalyzerEl = document.getElementById('id-input-webserver-wordfreq-checkbox')
|
| 562 |
+
console.log("choiceWordFreqAnalyzerEl checked:", typeof choiceWordFreqAnalyzerEl.checked, choiceWordFreqAnalyzerEl.checked, "#")
|
| 563 |
switch (choiceWordFreqAnalyzerEl.checked) {
|
| 564 |
case true: // webserver
|
| 565 |
await wordsFrequencyAnalyzers['id-input-webserver-wordfreq-checkbox'](validChildContent)
|
|
|
|
| 648 |
* // Returns: [{ a: "hello", b: { c: "world" } }]
|
| 649 |
*/
|
| 650 |
function arrayFilterNestedValue(array, nestedValue) {
|
|
|
|
| 651 |
return array.filter(item => {
|
| 652 |
let valuesFromObject = extractStringValues(item).join(" ")
|
|
|
|
| 653 |
return valuesFromObject.toLowerCase().includes(nestedValue.toLowerCase());
|
| 654 |
});
|
| 655 |
}
|
|
|
|
| 678 |
|
| 679 |
let inputFilter = document.getElementById("filter-words-frequency")
|
| 680 |
let inputFilterValue = inputFilter.value
|
|
|
|
| 681 |
if (inputFilterValue !== undefined && inputFilter.value !== "") {
|
|
|
|
| 682 |
reduced = arrayFilterNestedValue(reduced, inputFilterValue)
|
| 683 |
}
|
| 684 |
|
|
|
|
| 759 |
a.innerText = `${iReduced["word_prefix"]}: ${iReduced["count"]} repetitions`
|
| 760 |
a.addEventListener("click", function() {
|
| 761 |
currentTableOfWords.innerHTML = ""
|
| 762 |
+
console.log(`insertListOfWords::'a', ${iReduced["word_prefix"]}: ${iReduced["count"]} repetitions`)
|
| 763 |
insertCurrentTable(i, iReduced, nTotalRows, currentTableOfWords)
|
| 764 |
setElementCssClassByOldClass(underlinedClicked, underlinedPrimary)
|
| 765 |
a.className = underlinedClicked
|
|
|
|
| 807 |
* @function updateWordsFreqIfPressEnter
|
| 808 |
*/
|
| 809 |
function updateWordsFreqIfPressEnter() {
|
|
|
|
| 810 |
if(event.key==='Enter'){
|
| 811 |
updateWordsFrequencyTables()
|
| 812 |
}
|