12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- import {arrayResponse} from './processData.js'
- import {queryDTO, flask_be_address, getData} from './toExport.js'
- import {processOccData, processSingleContext} from './processData.js'
- export function checkContext() {
- 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!');
- });
- }
|