mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2025-04-09 10:41:05 +00:00
Some more documentation!
This commit is contained in:
parent
74104922b6
commit
9f341b90b9
@ -1,8 +1,13 @@
|
|||||||
|
// This callback is called on a socket.on "corpus_analysis_send_meta_data".
|
||||||
|
// Handels incoming corpus metadata
|
||||||
function recvMetaData(payload) {
|
function recvMetaData(payload) {
|
||||||
results.metaData.init(payload)
|
results.metaData.init(payload)
|
||||||
console.log(results.metaData);
|
console.log(results.metaData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This callback is called in socket.on "corpus_analysis_inspect_match" but
|
||||||
|
// only if the response.type is "sub-results".
|
||||||
|
// Saves the incoming inspect match results into results.subResultsData.
|
||||||
function saveSubResultsChoices(response) {
|
function saveSubResultsChoices(response) {
|
||||||
console.log("Recieve match with context");
|
console.log("Recieve match with context");
|
||||||
results.subResultsData.init();
|
results.subResultsData.init();
|
||||||
@ -28,8 +33,9 @@ function saveSubResultsChoices(response) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This callback is called on socket.on "query".
|
||||||
|
// Does some hiding, showing disabling etc.
|
||||||
function querySetup(payload) {
|
function querySetup(payload) {
|
||||||
// This is called when a query was successfull
|
|
||||||
// some hiding and resetting
|
// some hiding and resetting
|
||||||
let textarea = subResultsIdListElement.getElementsByTagName("textarea")[0];
|
let textarea = subResultsIdListElement.getElementsByTagName("textarea")[0];
|
||||||
textarea.innerText = "";
|
textarea.innerText = "";
|
||||||
@ -54,6 +60,8 @@ function querySetup(payload) {
|
|||||||
results.data.match_count = payload.match_count;
|
results.data.match_count = payload.match_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This callback is called on socket.on "query_results"
|
||||||
|
// this handels the incoming result chunks
|
||||||
function queryRenderResults(payload) {
|
function queryRenderResults(payload) {
|
||||||
let resultItems; // array of built html result items row element
|
let resultItems; // array of built html result items row element
|
||||||
// This is called when results are transmitted and being recieved
|
// This is called when results are transmitted and being recieved
|
||||||
|
@ -363,12 +363,14 @@
|
|||||||
<script>
|
<script>
|
||||||
// ###### Defining global variables used in other functions ######
|
// ###### Defining global variables used in other functions ######
|
||||||
var addToSubResultsElement; // Button to start adding matches to sub-results
|
var addToSubResultsElement; // Button to start adding matches to sub-results
|
||||||
|
var addToSubResultsFromInspectElement; // button in inspect mdoal to add this match to the sub results
|
||||||
var client; // CorpusAnalysisClient first undefined on DOMContentLoaded defined
|
var client; // CorpusAnalysisClient first undefined on DOMContentLoaded defined
|
||||||
var collapsibleElements; // All collapsibleElements on this page
|
var collapsibleElements; // All collapsibleElements on this page
|
||||||
var contextModal; // Modal to open on inspect for further match context
|
var contextModal; // Modal to open on inspect for further match context
|
||||||
var data; // full JSON object holding match results
|
var data; // full JSON object holding match results
|
||||||
var expertModeSwitchElement; // Expert mode switch Element
|
var expertModeSwitchElement; // Expert mode switch Element
|
||||||
var initDisplay; // CorpusAnalysisDisplay object first undfined on DOMContentLoaded defined
|
var initDisplay; // CorpusAnalysisDisplay object first undfined on DOMContentLoaded defined
|
||||||
|
var interactionElements; // Interaction elements and their parameters
|
||||||
var matchCountElement; // Total nr. of matches will be displayed in this element
|
var matchCountElement; // Total nr. of matches will be displayed in this element
|
||||||
var progress; // global progress value
|
var progress; // global progress value
|
||||||
var queryDisplay; // CorpusAnalysisDisplay object first undfined on DOMContentLoaded defined
|
var queryDisplay; // CorpusAnalysisDisplay object first undfined on DOMContentLoaded defined
|
||||||
@ -381,13 +383,11 @@
|
|||||||
var results; // results object
|
var results; // results object
|
||||||
var resultsList; // resultsList object
|
var resultsList; // resultsList object
|
||||||
var resultsListOptions; // specifies ResultsList options
|
var resultsListOptions; // specifies ResultsList options
|
||||||
var textLookupCountElement // Nr of texts the matches occured in will be shown in this element
|
|
||||||
var interactionElements; // Interaction elements and their parameters
|
|
||||||
var textTitlesElement; // matched text titles
|
|
||||||
var subResultsIdListElement; // list showing marked matches for sub corpus creation
|
|
||||||
var subResultsExportElement; // button to download sub results
|
|
||||||
var subResultsCreateElement; // if presses sub results will be created from ids
|
var subResultsCreateElement; // if presses sub results will be created from ids
|
||||||
var addToSubResultsFromInspectElement; // button in inspect mdoal to add this match to the sub results
|
var subResultsExportElement; // button to download sub results
|
||||||
|
var subResultsIdListElement; // list showing marked matches for sub corpus creation
|
||||||
|
var textLookupCountElement // Nr of texts the matches occured in will be shown in this element
|
||||||
|
var textTitlesElement; // matched text titles
|
||||||
|
|
||||||
// ###### Defining local scope variables ######
|
// ###### Defining local scope variables ######
|
||||||
let contextPerItemElement; // Form Element for display option
|
let contextPerItemElement; // Form Element for display option
|
||||||
@ -406,8 +406,9 @@
|
|||||||
let xpath; // xpath to grab first resultsList page pagination element
|
let xpath; // xpath to grab first resultsList page pagination element
|
||||||
|
|
||||||
// ###### Initialize variables ######
|
// ###### Initialize variables ######
|
||||||
client = undefined;
|
|
||||||
addToSubResultsElement = document.getElementById("add-to-sub-results");
|
addToSubResultsElement = document.getElementById("add-to-sub-results");
|
||||||
|
addToSubResultsFromInspectElement = document.getElementById("add-to-sub-results-from-inspect");
|
||||||
|
client = undefined;
|
||||||
collapsibleElements = document.querySelector('.collapsible.expandable');
|
collapsibleElements = document.querySelector('.collapsible.expandable');
|
||||||
contextModal = document.getElementById("context-modal");
|
contextModal = document.getElementById("context-modal");
|
||||||
contextPerItemElement = document.getElementById("display-options-form-result_context");
|
contextPerItemElement = document.getElementById("display-options-form-result_context");
|
||||||
@ -428,12 +429,11 @@
|
|||||||
queryResultsProgressElement = document.getElementById("query-results-progress");
|
queryResultsProgressElement = document.getElementById("query-results-progress");
|
||||||
queryResultsUserFeedbackElement = document.getElementById("query-results-user-feedback");
|
queryResultsUserFeedbackElement = document.getElementById("query-results-user-feedback");
|
||||||
receivedMatchCountElement = document.getElementById("received-match-count");
|
receivedMatchCountElement = document.getElementById("received-match-count");
|
||||||
|
subResultsCreateElement = document.getElementById("sub-results-create-div");
|
||||||
|
subResultsExportElement = document.getElementById("sub-results-export");
|
||||||
|
subResultsIdListElement = document.getElementById("sub-results-match-ids-div");
|
||||||
textLookupCountElement = document.getElementById("text-lookup-count");
|
textLookupCountElement = document.getElementById("text-lookup-count");
|
||||||
textTitlesElement = document.getElementById("text-titles");
|
textTitlesElement = document.getElementById("text-titles");
|
||||||
subResultsIdListElement = document.getElementById("sub-results-match-ids-div");
|
|
||||||
subResultsExportElement = document.getElementById("sub-results-export");
|
|
||||||
subResultsCreateElement = document.getElementById("sub-results-create-div");
|
|
||||||
addToSubResultsFromInspectElement = document.getElementById("add-to-sub-results-from-inspect");
|
|
||||||
|
|
||||||
// ###### js list options and intialization ######
|
// ###### js list options and intialization ######
|
||||||
displayOptionsData = ResultsList.getDisplayOptions(displayOptionsFormElement);
|
displayOptionsData = ResultsList.getDisplayOptions(displayOptionsFormElement);
|
||||||
@ -531,8 +531,11 @@
|
|||||||
// live update of lr context per item if context value is changed
|
// live update of lr context per item if context value is changed
|
||||||
contextPerItemElement.onchange = results.jsList.changeContext;
|
contextPerItemElement.onchange = results.jsList.changeContext;
|
||||||
|
|
||||||
// stuff that happens in the list table and should also be checked and
|
// Initialization of interactionElemnts
|
||||||
// updated if the pagination is used
|
// An interactionElement is an object identifing a switch or button via
|
||||||
|
// htmlID. Callbacks are set for these elements which will be triggered on
|
||||||
|
// a pagination interaction by the user or if the status of the element has
|
||||||
|
// been altered. (Like the switche has ben turned on or off).
|
||||||
interactionElements = new Array();
|
interactionElements = new Array();
|
||||||
let expertModeInteraction = new InteractionElement("display-options-form-expert_mode");
|
let expertModeInteraction = new InteractionElement("display-options-form-expert_mode");
|
||||||
expertModeInteraction.setCallback("on",
|
expertModeInteraction.setCallback("on",
|
||||||
@ -565,18 +568,6 @@
|
|||||||
results.jsList)
|
results.jsList)
|
||||||
interactionElements.push(expertModeInteraction, subResultsInteraction, activateInspectInteraction, changeContextInteraction);
|
interactionElements.push(expertModeInteraction, subResultsInteraction, activateInspectInteraction, changeContextInteraction);
|
||||||
|
|
||||||
|
|
||||||
// eventListener if pagination is used to apply new context size to new page
|
|
||||||
// and also activate inspect match if progress is 100
|
|
||||||
// also adds more interaction buttons like add to sub results
|
|
||||||
for (let element of paginationElements) {
|
|
||||||
element.addEventListener("click", (event) => {
|
|
||||||
results.jsList.pageChangeEventInteractionHandler(interactionElements);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// checks if a change for every interactionElement happens and executes
|
// checks if a change for every interactionElement happens and executes
|
||||||
// the callbacks accordingly
|
// the callbacks accordingly
|
||||||
for (let interaction of interactionElements) {
|
for (let interaction of interactionElements) {
|
||||||
@ -596,8 +587,19 @@
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// eventListener if pagination is used to apply new context size to new page
|
||||||
|
// and also activate inspect match if progress is 100
|
||||||
|
// also adds more interaction buttons like add to sub results
|
||||||
|
for (let element of paginationElements) {
|
||||||
|
element.addEventListener("click", (event) => {
|
||||||
|
results.jsList.pageChangeEventInteractionHandler(interactionElements);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// ### Download events and sub-results creation ###
|
||||||
// Add onclick to open download modal when Export Results button is pressed
|
// Add onclick to open download modal when Export Results button is pressed
|
||||||
queryResultsExportElement.onclick = () => {
|
queryResultsExportElement.onclick = () => {
|
||||||
exportModal.open();
|
exportModal.open();
|
||||||
@ -631,7 +633,7 @@
|
|||||||
results.data.createSubResultsData();
|
results.data.createSubResultsData();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add onclick to open download modal when sub results button is pressed
|
// Add onclick to open download modal when sub-results button is pressed
|
||||||
subResultsExportElement.onclick = () => {
|
subResultsExportElement.onclick = () => {
|
||||||
exportModal.open();
|
exportModal.open();
|
||||||
console.log(results.subResultsData);
|
console.log(results.subResultsData);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user