mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2025-01-18 05:50:34 +00:00
mv socket on event on match_context to nopaque.js
This commit is contained in:
parent
21371efde6
commit
da766b32ca
@ -164,6 +164,42 @@ nopaque.socket.on("foreign_jobs_update", function(msg) {
|
||||
for (let subscriber of nopaque.foreignJobsSubscribers) {subscriber._update(patch);}
|
||||
});
|
||||
|
||||
// get context of one match if inspected
|
||||
nopaque.socket.on("match_context", function(message) {
|
||||
console.log("### match_context ###");
|
||||
console.log(message);
|
||||
contextResultsElement.innerHTML = "<p> </p>";
|
||||
document.getElementById("context-modal-loading").classList.add("hide");
|
||||
document.getElementById("context-modal-ready").classList.remove("hide");
|
||||
|
||||
let sentenceElement, token, tokenElement;
|
||||
|
||||
lookup["cpos"] = {...lookup["cpos"], ...message["cpos_lookup"]};
|
||||
lookup["s"] = message["context_s_cpos"];
|
||||
lookup["text"] = {...lookup["text"], ...message["text_lookup"]};
|
||||
|
||||
for (let [key, value] of Object.entries(message['context_s_cpos'])) {
|
||||
sentenceElement = document.createElement("p");
|
||||
for (cpos of value) {
|
||||
token = lookup["cpos"][cpos];
|
||||
tokenElement = document.createElement("span");
|
||||
tokenElement.classList.add("token");
|
||||
if (message["match_cpos_list"].includes(cpos)) {
|
||||
tokenElement.classList.add("bold");
|
||||
}
|
||||
tokenElement.dataset.cpos = cpos;
|
||||
tokenElement.innerText = token["word"];
|
||||
// if (expertModeSwitchElement.checked) {
|
||||
// tokenElement.classList.add("chip");
|
||||
// addToolTipToTokenElement(tokenElement, token);
|
||||
// }
|
||||
// tokenElements.add(tokenElement);
|
||||
sentenceElement.append(tokenElement);
|
||||
sentenceElement.append(document.createTextNode(" "));
|
||||
}
|
||||
contextResultsElement.append(sentenceElement);
|
||||
}
|
||||
});
|
||||
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
M.AutoInit();
|
||||
|
@ -444,43 +444,6 @@
|
||||
"position": "top",
|
||||
"transitionMovement": 0});
|
||||
}
|
||||
|
||||
// get context of one match if inspected
|
||||
nopaque.socket.on("match_context", function(message) {
|
||||
console.log("### match_context ###");
|
||||
console.log(message);
|
||||
contextResultsElement.innerHTML = "<p> </p>";
|
||||
document.getElementById("context-modal-loading").classList.add("hide");
|
||||
document.getElementById("context-modal-ready").classList.remove("hide");
|
||||
|
||||
let sentenceElement, token, tokenElement;
|
||||
|
||||
lookup["cpos"] = {...lookup["cpos"], ...message["cpos_lookup"]};
|
||||
lookup["s"] = message["context_s_cpos"];
|
||||
lookup["text"] = {...lookup["text"], ...message["text_lookup"]};
|
||||
|
||||
for (let [key, value] of Object.entries(message['context_s_cpos'])) {
|
||||
sentenceElement = document.createElement("p");
|
||||
for (cpos of value) {
|
||||
token = lookup["cpos"][cpos];
|
||||
tokenElement = document.createElement("span");
|
||||
tokenElement.classList.add("token");
|
||||
if (message["match_cpos_list"].includes(cpos)) {
|
||||
tokenElement.classList.add("bold");
|
||||
}
|
||||
tokenElement.dataset.cpos = cpos;
|
||||
tokenElement.innerText = token["word"];
|
||||
// if (expertModeSwitchElement.checked) {
|
||||
// tokenElement.classList.add("chip");
|
||||
// addToolTipToTokenElement(tokenElement, token);
|
||||
// }
|
||||
// tokenElements.add(tokenElement);
|
||||
sentenceElement.append(tokenElement);
|
||||
sentenceElement.append(document.createTextNode(" "));
|
||||
}
|
||||
contextResultsElement.append(sentenceElement);
|
||||
}
|
||||
});
|
||||
// collapsible display options
|
||||
var elem = document.querySelector('.collapsible.expandable');
|
||||
</script>
|
||||
|
Loading…
x
Reference in New Issue
Block a user