alessandro trinca tornidor commited on
Commit
9cb8062
·
1 Parent(s): 0c4660b

doc: add missing docstrings

Browse files
Files changed (1) hide show
  1. static/index.js +28 -0
static/index.js CHANGED
@@ -743,6 +743,18 @@ function insertCellIntoTRow(currentTBody, i, ii, nthOffset) {
743
  currentCell.appendChild(currentUrl)
744
  }
745
 
 
 
 
 
 
 
 
 
 
 
 
 
746
  function getSubstringForTextWithGivenOffset(rowArray, nthRowIdx, nthOffset, nCharsMore = 30) {
747
  try {
748
  const currentRowArr = rowArray.filter(item => {
@@ -788,11 +800,27 @@ function getSubstringForTextWithGivenOffset(rowArray, nthRowIdx, nthOffset, nCha
788
  }
789
  }
790
 
 
 
 
 
 
 
 
 
791
  function getStylePropertyById(id, property, parsing="") {
792
  const element = document.getElementById(id)
793
  return getStylePropertyWithElement(element, property, parsing)
794
  }
795
 
 
 
 
 
 
 
 
 
796
  function getStylePropertyWithElement(element, property, parsing="") {
797
  const howToParse = {
798
  "int": parseInt,
 
743
  currentCell.appendChild(currentUrl)
744
  }
745
 
746
+ /** Given a rowArray (array of objects) and an nthOffset (object), it returns an object containing three substrings:
747
+ * - substring0: the substring before the sliced word
748
+ * - substringWord: the word sliced from the text with the given offset from the nthOffset arg
749
+ * - substring2: the substring after the sliced word
750
+ *
751
+ * @param {Array} rowArray - The array of objects containing text and their corresponding indices.
752
+ * @param {number} nthRowIdx - The index of the row to process.
753
+ * @param {Object} nthOffset - The object containing the offsets and other properties of the word.
754
+ * @param {number} [nCharsMore=30] - The number of characters to include before and after the selected word.
755
+ *
756
+ * @returns {Object} - An object containing the substring before, the selected word, and the substring after.
757
+ * */
758
  function getSubstringForTextWithGivenOffset(rowArray, nthRowIdx, nthOffset, nCharsMore = 30) {
759
  try {
760
  const currentRowArr = rowArray.filter(item => {
 
800
  }
801
  }
802
 
803
+ /** Get the value of a CSS property for an element by its ID.
804
+ *
805
+ * @param {string} id - The ID of the element.
806
+ * @param {string} property - The CSS property to retrieve.
807
+ * @param {string} [parsing=""] - Optional parsing type ("int", "float").
808
+ *
809
+ * returns {string|number} - The value of the CSS property, parsed if specified.
810
+ * */
811
  function getStylePropertyById(id, property, parsing="") {
812
  const element = document.getElementById(id)
813
  return getStylePropertyWithElement(element, property, parsing)
814
  }
815
 
816
+ /** Get the value of a CSS property for a given element.
817
+ *
818
+ * @param {HTMLElement} element - The element to retrieve the property from.
819
+ * @param {string} property - The CSS property to retrieve.
820
+ * @param {string} [parsing=""] - Optional parsing type ("int", "float").
821
+ *
822
+ * returns {string|number} - The value of the CSS property, parsed if specified.
823
+ * */
824
  function getStylePropertyWithElement(element, property, parsing="") {
825
  const howToParse = {
826
  "int": parseInt,