Cantiche caricate all'apertura e pulizia di cesareBrowse.js

This commit is contained in:
nicola 2022-12-06 17:39:52 +01:00
parent bd3e535b6d
commit e822c88f28
2 changed files with 469 additions and 533 deletions

View File

@ -23,7 +23,8 @@ $(document).ready(function() {
$("#cla_Grammaticale").attr('style', "display: none;"); $("#cla_Grammaticale").attr('style', "display: none;");
$("#cla-Sintattico").attr('style', "display: none;"); $("#cla-Sintattico").attr('style', "display: none;");
$("#filtri").attr('style', "display: none;");
$('.tabs__menu-item').on('click', function() { $('.tabs__menu-item').on('click', function() {
$(this).addClass('bg-white').addClass('red'); $(this).addClass('bg-white').addClass('red');
$(this).siblings().removeClass('bg-white').removeClass('red'); $(this).siblings().removeClass('bg-white').removeClass('red');
@ -92,6 +93,8 @@ $(document).ready(function() {
$("#DoveInferno").attr('style', "display: none;"); $("#DoveInferno").attr('style', "display: none;");
$("#cla_Grammaticale").attr('style', "display: none;"); $("#cla_Grammaticale").attr('style', "display: none;");
$("#cla-Sintattico").attr('style', "display: none;"); $("#cla-Sintattico").attr('style', "display: none;");
$("#filtri").attr('style', "display: none;");
}); });
@ -106,6 +109,7 @@ $(document).ready(function() {
$("#cla_Grammaticale").attr('style', "display: none;"); $("#cla_Grammaticale").attr('style', "display: none;");
$("#DoveInferno").attr('style', "display: block;"); $("#DoveInferno").attr('style', "display: block;");
$("#cla-Sintattico").attr('style', "display: none;"); $("#cla-Sintattico").attr('style', "display: none;");
$("#filtri").attr('style', "display: none;");
}); });
jQuery(document).delegate('#tab_grammaticale', 'click', function(e) { jQuery(document).delegate('#tab_grammaticale', 'click', function(e) {
@ -119,6 +123,7 @@ $(document).ready(function() {
$("#DoveInferno").attr('style', "display: none;"); $("#DoveInferno").attr('style', "display: none;");
$("#cla_Grammaticale").attr('style', "display: block;"); $("#cla_Grammaticale").attr('style', "display: block;");
$("#cla-Sintattico").attr('style', "display: none;"); $("#cla-Sintattico").attr('style', "display: none;");
$("#filtri").attr('style', "display: none;");
}); });
@ -133,6 +138,7 @@ $(document).ready(function() {
$("#DoveInferno").attr('style', "display: none;"); $("#DoveInferno").attr('style', "display: none;");
$("#cla_Grammaticale").attr('style', "display: none;"); $("#cla_Grammaticale").attr('style', "display: none;");
$("#cla-Sintattico").attr('style', "display: block;"); $("#cla-Sintattico").attr('style', "display: block;");
$("#filtri").attr('style', "display: none;");
}); });
@ -146,7 +152,8 @@ $(document).ready(function() {
$("#cla-TabContent").attr('style', "display: none;"); $("#cla-TabContent").attr('style', "display: none;");
$("#DoveInferno").attr('style', "display: none;"); $("#DoveInferno").attr('style', "display: none;");
$("#cla_Grammaticale").attr('style', "display: none;"); $("#cla_Grammaticale").attr('style', "display: none;");
$("#cla-Sintattico").attr('style', "display: block;"); $("#cla-Sintattico").attr('style', "display: none;");
$("#filtri").attr('style', "display: block;");
}); });
@ -274,6 +281,109 @@ $(document).ready(function() {
return true; return true;
} }
jQuery(document).delegate('a.set-filterGram', 'click', function(e) {
e.preventDefault();
var content = jQuery('#filtro'),
size = jQuery('#filtri >div').length + 1,
element = null,
element = content.clone();
if (size == 1) {
filterconditions = 1;
jQuery('#filtri').attr('style', "display:block;")
}
else
filterconditions = filterconditions + 1;
let filtroId = 'filtro-' + filterconditions;
element.attr('id', filtroId);
element.find('.delete-written-filter').attr('target', filtroId);
element.find('.edit-written-filter').attr('target', filtroId);
//trasformo il filtro espresso nella clausola in un oggetto JSON
//var condizioni = $("#filterform").serialize().split('&');
//alert (condizioni)
// Creare Condizioni
var categoriaSelectedValue = $('select.catgram').val(); // categoria grammaticale
var lemma_formaValue = $('#lemma_forma').val();
var queryText = $('#queryText').val();
var opzioni_testoValue = $('#opzioni_testo').val();
var cla1DiatesiValue = $('input[name=cla1Diatesi]:checked', '#dettaglifiltriVerboVolgare').val(); //$('#cla1Diatesi').val();
// alert(cla1DiatesiValue)
var condizioni = ["lemma_forma="+lemma_formaValue+",query="+queryText+",categoria="+categoriaSelectedValue+",Genere=Femminile"];
filtro = {}
$('.dettaglifiltriVerboVolgare').attr('style', "display:none;")
$('.dettaglifiltriSostantivoVolgare').attr('style', "display:none;")
$('.savecondition').attr('style', "display:none;")
for (cond in condizioni) {
liscond = condizioni[cond].split('=')
if (liscond[1].trim() != '' & liscond[1].trim() != liscond[0].trim())
filtro[liscond[0]] = liscond[1].replaceAll('%20', ' ')
}
//mostro il filtro nella GUI
let tuttiFiltri = "";
var keys = Object.keys(filtro)//condizioniFiltro)
for (key in keys) {
var dlclass = $('<dl class="flex mb0 pa0 f6 lh-title mv0" />'),
dtclass = $('<dt class="flex mb0 pa0 b mainflabel" />'),
ddclass = $('<dd class="flex mb0 pa0 ml0 gray mainfvalue"/>');
tuttiFiltri = tuttiFiltri + filtro[[keys[key]]] + ", ";
}
//element.find('.listacondizioni').append(dlclass);
let virgola = tuttiFiltri.lastIndexOf(',');
//tuttiFiltri = tuttiFiltri.substring(0, virgola);
tuttiFiltri = condizioni;
let txtAreaFiltri = '<textarea id = ' + 'textarea-' + filterconditions +
' readonly style="resize:none" class="flex mb0 pb0 bg-washed-blue bn" rows="3" cols="60" name="usrtxt" wrap="hard">' +
tuttiFiltri + "</textarea>"
ddclass.append(txtAreaFiltri);
dlclass.append(dtclass);
dlclass.append(ddclass);
element.find('.listacondizioni').append(dlclass);
element.attr('style', 'display.block');
element.appendTo('#filtri');
if (size > 1) {
element.find('.andorconditions').attr('style', 'display.block');
}
//$('a.remove-filter').trigger('click');
var targetDiv = jQuery(this).attr('targetfilter');
rmel = jQuery('#' + targetDiv)
rmeldetail = jQuery('#' + 'dettaglio_' + targetDiv)
jQuery(rmel).remove();
jQuery(rmeldetail).remove();
clausolaVisibile = false;
//aggiungo il filtro a quelli esistenti nel json
filtro['tipoClausola'] = tipoClausola
var clausolaquery = $("#searchValue").val()
filtro['query'] = clausolaquery.trim();
// eventualmente le 2 seguenti non funzionano Nicola
// checkedField = $('#lemma_forma').val();
// filtro['lemma_forma'] = checkedField
condizioniFiltro['filtro-' + filterconditions] = filtro
return true;
});
// Da Luca // Da Luca
var iconReset = '<div class="text-right text-primary radioReset"><ion-icon name="refresh-circle"></ion-icon></div>'; var iconReset = '<div class="text-right text-primary radioReset"><ion-icon name="refresh-circle"></ion-icon></div>';

File diff suppressed because it is too large Load Diff