import {funzioneRicerca} from './toExport.js' import {checkContext, goToSingleContext} from './cercaContesti.js' import {createNewCC} from './createCooccorrenza.js' document.querySelector('#lauchSearch').addEventListener('click', funzioneRicerca); document.querySelector('#lauchSearchContext').addEventListener('click', checkContext); $(document).on("click", ".singleContext", function (ev) { var num = this.id; var parole = 31; var periodi = 0; var brani = 0; goToSingleContext(num, parole, periodi, brani); }); var occ = 0; $("#btnGroupAddon").click(function() { $("#cooccorrenze_options").css("display", "flex"); $("#inner_altro").css("display", "none"); $("#inner_lemmatizzato").css("display", "flex"); if (occ > 8) { alert("Hai esaurito i parametri a disposizione"); } else { occ = occ + 1; createNewCC(occ); } }); $(document).on("click", ".deleteCC", function (ev) { var deleteID = "occ_" + this.id; const element = document.getElementById(deleteID); element.remove(); let numb = document.getElementById("search_form").childElementCount; if (numb < 2) { $("#cooccorrenze_options").css("display", "none"); $("#inner_altro").css("display", "flex"); $("#inner_lemmatizzato").css("display", "none"); } }); $(document).on("change", ".flViewBy", function (ev) { var check_tipo = this.value; var parent = this.parentElement.parentElement.parentElement.parentElement.parentElement; var cc = parent.getElementsByClassName("lemmatizzata"); if (check_tipo == "forma") { cc[0].disabled = true; cc[0].checked = false; } else if (check_tipo == "lemma"){ cc[0].disabled = false; } }); $( "#context-title" ).on( "click", function() { $( "#additional_info" ).toggle( "slow", function() { // Animation complete. }); }); $(document).on("click", ".page-item", function (ev) { $(".page-item").removeClass("active"); var name = this.id; this.className = "page-item active"; var num = name.replace("getPage_", ""); var page = "pag_" + num; $("#" + page).css("display", "block"); $(".page:not(#" + page +")").css("display", "none"); }); $(document).on("click", "#prev", function (ev) { var el = document.getElementsByClassName("page-item active")[0]; var name = el.id; var n = name.replace("getPage_", ""); var num = parseInt(n) - 1; if (num < 0) { alert("No pages found"); } else { var page = "pag_" + num; var getPage = "getPage_" + num; var elPage = document.getElementById(getPage); if (elPage !== null) { $(".page-item").removeClass("active"); elPage.classList.add("active"); $("#" + page).css("display", "block"); $(".page:not(#" + page +")").css("display", "none"); } } }); $(document).on("click", "#next", function (ev) { var el = document.getElementsByClassName("page-item active")[0]; var name = el.id; var n = name.replace("getPage_", ""); var num = parseInt(n) + 1; if (num < 0) { alert("No pages found"); } else { var page = "pag_" + num; var getPage = "getPage_" + num; var elPage = document.getElementById(getPage); if (elPage !== null) { $(".page-item").removeClass("active"); elPage.classList.add("active"); $("#" + page).css("display", "block"); $(".page:not(#" + page +")").css("display", "none"); } } });