mirror of
				https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
				synced 2025-11-03 20:02:47 +00:00 
			
		
		
		
	Add match nr
This commit is contained in:
		@@ -93,11 +93,9 @@ RessourceList.options = {
 | 
			
		||||
class ResultList extends List {
 | 
			
		||||
 | 
			
		||||
  createResultRowElement(item, chunk) {
 | 
			
		||||
    let values, cpos, token, matchRowElement, lcCellElement, hitCellElement, rcCellElement, textTitlesCellElement;
 | 
			
		||||
    let values, cpos, token, matchRowElement, lcCellElement, hitCellElement, rcCellElement, textTitlesCellElement, matchNrElement;
 | 
			
		||||
    // gather values from item
 | 
			
		||||
    values = item.values();
 | 
			
		||||
    console.log("CHONK");
 | 
			
		||||
    console.log(chunk);
 | 
			
		||||
 | 
			
		||||
    // get infos for full match row
 | 
			
		||||
    matchRowElement = document.createElement("tr");
 | 
			
		||||
@@ -116,6 +114,8 @@ class ResultList extends List {
 | 
			
		||||
    hitCellElement.classList.add("match-hit");
 | 
			
		||||
    textTitlesCellElement = document.createElement("td");
 | 
			
		||||
    textTitlesCellElement.classList.add("titles");
 | 
			
		||||
    matchNrElement = document.createElement("td");
 | 
			
		||||
    matchNrElement.classList.add("match-nr");
 | 
			
		||||
    matchRowElement.appendChild(hitCellElement);
 | 
			
		||||
    for (cpos of values["hit"]) {
 | 
			
		||||
      token = chunk["cpos_lookup"][cpos];
 | 
			
		||||
@@ -132,6 +132,8 @@ class ResultList extends List {
 | 
			
		||||
    hitCellElement.appendChild(inspectBtn);
 | 
			
		||||
    textTitlesCellElement.innerText = [...textTitles].join(", ");
 | 
			
		||||
    matchRowElement.insertAdjacentHTML("afterbegin", textTitlesCellElement.outerHTML);
 | 
			
		||||
    matchNrElement.innerText = values["index"] + 1;
 | 
			
		||||
    matchRowElement.insertAdjacentHTML("afterbegin", matchNrElement.outerHTML);
 | 
			
		||||
 | 
			
		||||
    // get infos for right context of match
 | 
			
		||||
    rcCellElement = document.createElement("td");
 | 
			
		||||
@@ -141,7 +143,6 @@ class ResultList extends List {
 | 
			
		||||
      token = chunk["cpos_lookup"][cpos];
 | 
			
		||||
      rcCellElement.insertAdjacentHTML("beforeend", `<span class="token" data-cpos="${cpos}">${token["word"]} </span>`);
 | 
			
		||||
    }
 | 
			
		||||
    console.log(matchRowElement);
 | 
			
		||||
    return matchRowElement
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user