Add expert view to inspect view.

This commit is contained in:
stephan 2020-02-25 11:00:30 +01:00
parent 40255c7b79
commit f8aa18e2a7
2 changed files with 11 additions and 11 deletions

View File

@ -206,14 +206,14 @@ nopaque.socket.on("match_context", function(message) {
tokenElement.classList.add("token");
if (message["match_cpos_list"].includes(cpos)) {
tokenElement.classList.add("bold");
tokenElement.classList.add("light-green");
}
tokenElement.dataset.cpos = cpos;
tokenElement.innerText = token["word"];
// if (expertModeSwitchElement.checked) {
// tokenElement.classList.add("chip");
// addToolTipToTokenElement(tokenElement, token);
// }
// tokenElements.add(tokenElement);
var expertModeSwitchElement = document.getElementById("expert-mode-switch");
if (expertModeSwitchElement.checked) {
expertModeOn([tokenElement], message);
}
sentenceElement.append(tokenElement);
sentenceElement.append(document.createTextNode(" "));
}

View File

@ -445,14 +445,14 @@
}
}
// epxert mode
// epxert mode table view
var expertModeSwitchElement = document.getElementById("expert-mode-switch");
expertModeSwitchElement.addEventListener("change", function(event) {
var currentTokenElements = document.getElementsByClassName("token");
var paginationElements = document.getElementsByClassName("pagination");
if (event.target.checked) {
console.log("Checked!");
expertModeOn(currentTokenElements);
expertModeOn(currentTokenElements, result);
for (element of paginationElements) {
element.addEventListener("click", eventHandlerCheck);
element.tokenElements = currentTokenElements;
@ -468,7 +468,7 @@
console.log("pagination used!");
console.log(expertModeSwitchElement.checked);
if (expertModeSwitchElement.checked) {
expertModeOn(event.currentTarget.tokenElements);
expertModeOn(event.currentTarget.tokenElements, result);
} else if (!expertModeSwitchElement.checked) {
event.preventDefault();
console.log("prevented! Destroy");
@ -490,17 +490,17 @@
}
}
function expertModeOn(tokenElements) {
function expertModeOn(tokenElements, result_lookup) {
console.log("expertModeOn!");
for (tokenElement of tokenElements) {
tokenElement.classList.add("chip");
tokenElement.classList.add("hoverable");
tokenElement.classList.add("expert-view");
token = result["cpos_lookup"][tokenElement.dataset.cpos];
token = result_lookup["cpos_lookup"][tokenElement.dataset.cpos];
tokenElement.addEventListener("mouseover", function(event) {
console.log("Mouseover!");
console.log(event.target);
token = result["cpos_lookup"][event.target.dataset.cpos];
token = result_lookup["cpos_lookup"][event.target.dataset.cpos];
addToolTipToTokenElement(event.target, token);
})
}