Merge branch 'development' of gitlab.ub.uni-bielefeld.de:sfb1288inf/opaque into development

This commit is contained in:
Patrick Jentsch 2020-02-25 11:05:25 +01:00
commit 18163400e1
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"); tokenElement.classList.add("token");
if (message["match_cpos_list"].includes(cpos)) { if (message["match_cpos_list"].includes(cpos)) {
tokenElement.classList.add("bold"); tokenElement.classList.add("bold");
tokenElement.classList.add("light-green");
} }
tokenElement.dataset.cpos = cpos; tokenElement.dataset.cpos = cpos;
tokenElement.innerText = token["word"]; tokenElement.innerText = token["word"];
// if (expertModeSwitchElement.checked) { var expertModeSwitchElement = document.getElementById("expert-mode-switch");
// tokenElement.classList.add("chip"); if (expertModeSwitchElement.checked) {
// addToolTipToTokenElement(tokenElement, token); expertModeOn([tokenElement], message);
// } }
// tokenElements.add(tokenElement);
sentenceElement.append(tokenElement); sentenceElement.append(tokenElement);
sentenceElement.append(document.createTextNode(" ")); sentenceElement.append(document.createTextNode(" "));
} }

View File

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