123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- import {arrayResponse} from './processData.js'
- import {queryDTO, getData} from './toExport.js'
- import {processOccData, processSingleContext} from './processData.js'
- import {flask_be_address} from './config.js'
- export function checkContext() {
- $("#lauchSearchContext").css("display", "none");
- let resulTable = document.getElementById("result");
- const checkBoxes = resulTable.querySelectorAll('input[type="checkbox"]');
- let arrayContesti = [];
-
- var selected = [];
- $('#result input:checked').each(function() {
- //selected.push($(this).attr('id'));
- var checkNum = $(this).attr('id');
- selected.push(checkNum);
- });
-
- for (var i=0; i<arrayResponse.length; i++) {
- for (var j=0; j<selected.length; j++) {
- if (arrayResponse[i]["cod"] == selected[j]) {
- arrayResponse[i]["selected"] = true;
- arrayContesti.push(arrayResponse[i]);
- }
- }
- }
-
- queryDTO["listResults"] = arrayContesti;
-
- console.log(queryDTO);
-
- $("#result").html("");
- $("#loader").css("display", "block");
-
- getData('/get_context', queryDTO)
- // After request finishes, process response data
- .done(response => processOccData(response))
- .fail(err => {
- console.log(err);
- $("#loader").css("display", "none");
- alert('Something went wrong!');
- });
- // .always(response => console.log(response));
- }
- export function goToSingleContext(num, parole, periodi, brani) {
- let params = {"indice": num, "parole": parole, "periodi": periodi, "brani": brani};
-
- let queryGSC = {
- elem: arrayResponse[num],
- params: params
- }
-
- getData('/get_single_context', queryGSC)
- // After request finishes, process response data
- .done(response => processSingleContext(response))
- .fail(err => {
- console.log(err);
- $("#loader").css("display", "none");
- alert('Something went wrong!');
- });
- }
|