From d9353e3d7dcfe168c401e1acc381528b6250aa5d Mon Sep 17 00:00:00 2001 From: Stephan Porada Date: Thu, 23 Apr 2020 12:07:08 +0200 Subject: [PATCH] Clean up --- app/static/js/nopaque.lists.js | 7 +++- app/templates/corpora/analyse_corpus.html.j2 | 39 +++++++++----------- 2 files changed, 22 insertions(+), 24 deletions(-) diff --git a/app/static/js/nopaque.lists.js b/app/static/js/nopaque.lists.js index 74641fe6..281bb37c 100644 --- a/app/static/js/nopaque.lists.js +++ b/app/static/js/nopaque.lists.js @@ -129,8 +129,11 @@ RessourceList.options = { class ResultsList extends List { constructor(idOrElement, options={}) { super(idOrElement, options); - this.eventTokens = {}; // all span tokens which are holdeing events if expert mode is on - this.currentExpertTokenElements = {}; + this.eventTokens = {}; // all span tokens which are holdeing events if expert + // mode is on. Collected here to delete later on + this.currentExpertTokenElements = {}; // all token elements which have added + // classes like chip and hoverable for expert view. Collected + //here to delete later on } diff --git a/app/templates/corpora/analyse_corpus.html.j2 b/app/templates/corpora/analyse_corpus.html.j2 index 610a23ce..53502a6a 100644 --- a/app/templates/corpora/analyse_corpus.html.j2 +++ b/app/templates/corpora/analyse_corpus.html.j2 @@ -277,25 +277,12 @@ // ###### Defining global variables used in other functions ###### var client; // CorpusAnalysisClient first undefined on DOMContentLoaded defined var collapsibleElements; // All collapsibleElements on this page - var collapsibleElements; // all collapsibles on site var contextModal; // Modal to open on inspect for further match context - var contextPerItemElement; - var contextSentencesElement; - var displayOptionsData; // Getting form data from display options - var displayOptionsFormElement; // Form holding the display informations - var downloadResultsJSONElement; // button for downloading results as JSON var expertModeSwitchElement; // Expert mode switch Element - var exportModal; // Download options modal - var firstPageElement; // first page element of resultsList pagination - var hitsPerPageInputElement; var initDisplay; // CorpusAnalysisDisplay object first undfined on DOMContentLoaded defined - var initDisplayElement; // Element for initialization using initDisplay - var initModal; var matchCountElement; // Total nr. of matches will be displayed in this element - var paginationElements; var progress; // global progress value var queryDisplay; // CorpusAnalysisDisplay object first undfined on DOMContentLoaded defined - var queryDisplayElement; // Element for initialization using queryDisplay var queryFormElement; // the query form var queryResultsDeterminateElement; // The progress bar for recieved results var queryResultsExportElement; // Download button opens download modal @@ -307,7 +294,21 @@ var resultsList; // resultsList object var resultsListOptions; // specifies ResultsList options var textLookupCountElement // Nr of texts the matches occured in will be shown in this element - var xpath; // xpath to grab first resultsList page pagination element + + // ###### Defining local scope variables ###### + let contextPerItemElement; // Form Element for display option + let contextSentencesElement; // Form Element for display option in inspect + let displayOptionsData; // Getting form data from display options + let displayOptionsFormElement; // Form holding the display informations + let downloadResultsJSONElement; // button for downloading results as JSON + let exportModal; // Download options modal + let firstPageElement; // first page element of resultsList pagination + let hitsPerPageInputElement; + let initDisplayElement; // Element for initialization using initDisplay + let initModal; + let paginationElements; + let queryDisplayElement; // Element for initialization using queryDisplay + let xpath; // xpath to grab first resultsList page pagination element // ###### Initialize variables ###### client = undefined; @@ -330,6 +331,8 @@ queryResultsUserFeedbackElement = document.getElementById("query-results-user-feedback"); receivedMatchCountElement = document.getElementById("received-match-count"); textLookupCountElement = document.getElementById("text-lookup-count"); + hitsPerPageInputElement = document.getElementById("display-options-form-results_per_page"); + contextPerItemElement = document.getElementById("display-options-form-result_context"); // ###### js list options and intialization ###### displayOptionsData = ResultsList.getDisplayOptions(displayOptionsFormElement); @@ -411,20 +414,12 @@ }); // live update of hits per page if hits per page value is changed - hitsPerPageInputElement = document.getElementById("display-options-form-results_per_page"); let changeHitsPerPageBind = results.resultsList.changeHitsPerPage.bind(results.resultsList); hitsPerPageInputElement.onchange = changeHitsPerPageBind; // live update of lr context per item if context value is changed - contextPerItemElement = document.getElementById("display-options-form-result_context"); contextPerItemElement.onchange = results.resultsList.changeContext; - // live update of context sentences in inspect modal - contextSentencesElement.onchange = (event) => { - let sValue = event.target.value; - console.log(sValue); - } - // eventListener if pagination is used to apply new context size to new page // and also activate inspect match if progress is 100 for (let element of paginationElements) {