Finite le funzioni di stampa, corretti bug

This commit is contained in:
Luca Trupiano 2025-04-02 19:21:14 +02:00
parent 1c466de115
commit aff19537ba
4 changed files with 78 additions and 75 deletions

View File

@ -592,6 +592,10 @@ a[target="_blank"]::after {
background-color: #cfdeec! important;
}
#printArea {
background-color: #ffffff! important;
}
/* Dialoghi
Prove Luca:

View File

@ -50,7 +50,7 @@
<script type="module" src="./js/dataMgr_5.2.js"></script>
</head>
<body class="body-vis">
<body class="">
<script type="text/javascript">
var currStyle = "style2";
var newStyle = Cookies.get('LiDa_style');
@ -74,7 +74,7 @@
};
</script>
<div class="h-100 site-container container-fluid">
<div class="h-100 site-container container-fluid body-vis">
<div>
<nav
class="navbar border navbar-expand-lg navbar-light bg-light justify-content-between fixed-top">
@ -2297,7 +2297,7 @@
<div id="printArea" style="display: none">
</div>
<script src="./js/lib/jquery.popuplayer.js"></script>
<script src="./js/lib/jquery.popuplayer.js"></script>
</body>
<div class="modal-busy" id="loader" style="display: none">

View File

@ -512,10 +512,11 @@ $(document).ready(function() {
let idris = '#e' + ris
if ($(idris).attr('class') != null) {
//console.log($(idris).attr('class').replace(' frm', ''))
clausesinrs.push($(idris).attr('class').replace(' frm', ''))
clausesinrs.push($(idris).attr('class').replace(' frm', '').replace('font-weight-bold mark', ''))
}
$(idris).addClass("font-weight-bold mark ")
//$(idris).addClass("font-weight-bold mark ")
$(whereToDisplay).find(idris).addClass("font-weight-bold mark ")
}
if (listarisultati.length == 0) {
@ -534,7 +535,7 @@ $(document).ready(function() {
//evidenzio i periodi se unità di ricerca è impostato come periodo
if (listaPeriodiRisultato.length) {
for (var msid of clausesinrs) {
loadPeriodo(msid.split(' ')[0])
loadPeriodo(msid.split(' ')[0],whereToDisplay)
}
@ -550,7 +551,7 @@ $(document).ready(function() {
if (listaClausoleRisultato.length) {
for (var clsid of clausesinrs) {
let tmpid = clsid.split(' ')
loadClausola(tmpid[0], tmpid[1], tmpid[2], tmpid[3])
loadClausola(tmpid[0], tmpid[1], tmpid[2], tmpid[3],whereToDisplay)
}
/*for (var clsid of listaClausoleRisultato) {
let tmpid = clsid.split('-')
@ -588,6 +589,7 @@ $(document).ready(function() {
if (!telive.length > 0 || !showingComments) {
$('#displaynote').empty();
$('#displaynote').append($(emptyNoteList))
$("#printRiferimentiCorrenti").prop("disabled", true);
}
showingComments = false;
@ -745,15 +747,15 @@ $(document).ready(function() {
function loadPeriodo(idperiodo) {
function loadPeriodo(idperiodo, whereToDisplay = cantoDisplayed) {
if (!isPeriodoInCanto(idperiodo, cantoDisplayed) && !(cantoDisplayed.includes('#vistaFrasi'))) {
if (!isPeriodoInCanto(idperiodo, whereToDisplay) && !(whereToDisplay.includes('#vistaFrasi')) && !(whereToDisplay.includes('#printArea'))) {
return
}
$(cantoDisplayed).find(' .' + idperiodo).each(function() {
$(whereToDisplay).find(' .' + idperiodo).each(function() {
var pstp = $(this).attr('class').split(" ")[1]
if (pstp == 'sentencetag')
$(this).attr('style', 'display: d-flex;');
@ -782,14 +784,14 @@ $(document).ready(function() {
}
function loadClausola(idperiodo, funzionefrase, fromn, ton) {
function loadClausola(idperiodo, funzionefrase, fromn, ton, whereToDisplay = cantoDisplayed) {
if (!isPeriodoInCanto(idperiodo, cantoDisplayed) && !(cantoDisplayed.includes('#vistaFrasi')))
if (!isPeriodoInCanto(idperiodo, whereToDisplay) && !(whereToDisplay.includes('#vistaFrasi')) && !(whereToDisplay.includes('#printArea')))
return
if (fromn == null || ton == null) {
$(cantoDisplayed).find(' .' + idperiodo + '.' + funzionefrase).each(function() {
$(whereToDisplay).find(' .' + idperiodo + '.' + funzionefrase).each(function() {
var tpstp = $(this).attr('class').split(" ")[1]
$(this).css('color', colorssp(mapsynttypestopalette[tpstp]));
@ -802,7 +804,7 @@ $(document).ready(function() {
})
}
else {
$(cantoDisplayed).find(' .' + idperiodo).each(function() {
$(whereToDisplay).find(' .' + idperiodo).each(function() {
var vid = parseInt($(this).attr('id').replace('e', ''))
if (vid >= parseInt(fromn)
&& vid <= parseInt(ton)) {
@ -885,6 +887,7 @@ $(document).ready(function() {
})
$('#displaynote').empty()
$('#displaynote').append($(emptyNoteList))
$("#printRiferimentiCorrenti").prop("disabled", true);
}
}
@ -1782,6 +1785,7 @@ $(document).ready(function() {
$(".filterRiferimentiOff").css('display', 'none');
$('#displaynote').empty()
$('#displaynote').append($(emptyNoteList))
$("#printRiferimentiCorrenti").prop("disabled", true);
}
@ -1925,6 +1929,7 @@ $(document).ready(function() {
$('#displaynote').empty()
$('#displaynote').append($(emptyNoteList))
$("#printRiferimentiCorrenti").prop("disabled", true);
}
manageRisultatoCommmenti = function(start, offset = showOffset) {
@ -1933,6 +1938,7 @@ $(document).ready(function() {
elencoRiferimenti.empty();
$("#displaynote").empty();
$('#displaynote').append($(emptyNoteList));
$("#printRiferimentiCorrenti").prop("disabled", true);
$(".filterRiferimentiOn").css('display', 'none');
$(".filterRiferimentiOff").css('display', 'none');
@ -2046,7 +2052,8 @@ $(document).ready(function() {
for (var tres of uniq_res) {
if (tres.includes('Proemio'))
tres = tres.replace('Proemio', '0')
$('#' + tres + '_res').addClass("mark ")
//$('#' + tres + '_res').addClass("mark ")
$(whereToDisplay).find('#' + tres + '_res').addClass("mark ")
}

View File

@ -547,40 +547,6 @@ $(document).ready(function() {
$("#printPeriodoCorrente").prop("disabled", true);
});
/*
// Evento: click sull'icona stampa
$('#stampa0').on('click', function() {
var htmlPrintTemplatePre = `<html><head><meta charset="UTF-8"><title>LiDa Dashboard</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/gitbrent/bootstrap4-toggle@3.6.1/css/bootstrap4-toggle.min.css">
<link rel="stylesheet" href="https://code.jquery.com/ui/1.13.1/themes/base/jquery-ui.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Spectral">
<link rel="stylesheet" href="./css/jquery.popuplayer.min.css">
<link rel="stylesheet" id="style2-Boot" href="./css/bootstrap.min.lida2.css">
<link rel="stylesheet" id="style2-Custom" href="./css/custom2_4.3.css">
<link rel="stylesheet" href="./css/collapsemod.css">
<link rel="stylesheet" href="./css/bootstrap-slider.css">
</head><body class="body-vis">`
//var htmlPrintTemplatePost = `<script>document.onreadystatechange = function () {if (document.readyState === "complete") {window.print(); window.close()}};</script></body></html>`
var htmlPrintTemplatePost = `<script type="module" src="https://unpkg.com/ionicons@5.5.2/dist/ionicons/ionicons.esm.js"></script>
<script nomodule src="https://unpkg.com/ionicons@5.5.2/dist/ionicons/ionicons.js"></script>
<script>document.onreadystatechange = function () {if (document.readyState === "complete") {window.print();}};</script></body></html>`
// Riferimenti correnti:
//var element = $('#displaynote')[0].innerHTML;
// Canto corrente:
//var element = $('#displaycanto')[0].innerHTML;
// Lista risultati:
var element = $('#vistaFrasi')[0].innerHTML;
var printWin=window.open('','','left=0,top=0,toolbar=0,scrollbars=0,status=0');
printWin.document.write(htmlPrintTemplatePre + element + htmlPrintTemplatePost);
printWin.document.close();
printWin.focus();
});
*/
// Evento: click sull'icona stampa
$('#stampa1').on('click', function() {
var div2print = "#printArea";
@ -593,10 +559,12 @@ $(document).ready(function() {
need2print += preparePrint(printableElements[i],need2print,div2print);
};
};
if (need2print > 0) {
$('body .site-container').css({display:'none'});
$('body '+div2print).css({display:''});
if (need2print > 1) {
$('#printSummaryId').css({display:''});
};
window.print();
$('body '+div2print).empty()
$('body '+div2print).css({display:'none'});
@ -773,7 +741,9 @@ $(document).ready(function() {
const condLIplaceholderText2d = 'Trascina qui almeno 2 clausole o condizioni, oppure attiva le clausole inattive';
const condLIplaceholderPart1 = '<li id="';
const condLIplaceholderPart2 = '" class="mx-0 my-1 p-1 pl-3 list-group-item align-items-center border text-muted small bg-light ui-state-disabled">';
const printSeparator = '<div><p class="text-muted text-center align-bottom border-bottom p-4 mx-4">&nbsp;</p></div>';
const printSummary = '<div id="printSummaryId" style="display: none;"><p class="text-muted p-1 mx-4 mt-4 mb-0"><ul id="printSummaryUl" class="p-1 pb-0 mx-4 my-0"></ul></p></div><div><p class="text-muted text-center align-bottom border-bottom p-0 mx-4">&nbsp;</p></div>';
// Variabili e costanti funzionali
var minimapScrolling = false;
var tabID = 0;
@ -808,10 +778,15 @@ $(document).ready(function() {
element = $('.canto[style*="display: d-flex"]')
content = $(element).clone(true);
$(content).addClass("blog-main");
$(content).addClass("bg-light");
if (needSeparator > 0){
//insert separator
} else {
$('body '+div2print).append(printSummary);
}
$('body '+div2print).append('<div><h3 class="font-weight-bold px-4 pt-0 pb-4"><a name="cantoCorrente" style="text-decoration: none;">Canto</a> <small class="text-muted">(visualizzato)</small></h3></div>')
$('body '+div2print).append(content);
$('#printSummaryUl').append('<li><a href="#cantoCorrente"><span class="h6 font-weight-bold">Canto</span></a></li>');
result = 1;
break;
case "riferimentiCorrenti":
@ -824,22 +799,26 @@ $(document).ready(function() {
$(content).find('.collapse').addClass('show')
$(content).find('.collapsed').removeClass('collapsed')
$(content).find('a').each(function() {
if (($(this).prop("innerText") == "Nota completa") || ($(this).prop("innerText") == "Nota")) {
$(this).remove();
if (($(this).prop("innerText") == "Nota completa") || ($(this).prop("innerText") == "Nota")) {
$(this).remove();
}
});
$(content).find("b").each(function() {
var text = $(this).text();
text = text.replace('Nota / ', 'Nota');
text = text.replace(' / Nota completa: ', 'Nota completa: ');
$(this).text(text);
});
if (needSeparator > 0){
$('body '+div2print).append(printSeparator);
} else {
$('body '+div2print).append(printSummary);
}
});
$(content).find("b").each(function() {
var text = $(this).text();
text = text.replace('Nota / ', 'Nota');
text = text.replace(' / Nota completa: ', 'Nota completa: ');
$(this).text(text);
});
if (needSeparator > 0){
//insert separator
}
$('body '+div2print).append(content);
result = 1;
};
$('body '+div2print).append('<div><h3 class="font-weight-bold px-4 pt-0 pb-4"><a name="riferimentiCorrenti" style="text-decoration: none;">Riferimenti</a> <small class="text-muted">(visualizzati)</small></h3></div>')
$('body '+div2print).append(content);
$('#printSummaryUl').append('<li><a href="#riferimentiCorrenti"><span class="h6 font-weight-bold">Riferimenti</span></a></li>');
result = 1;
};
break;
case "periodoCorrente":
if ($('#structGroupCard0').css('display') == 'none') {
@ -849,9 +828,13 @@ $(document).ready(function() {
content = $(element).clone();
$(content).find('.noPrintA').remove()
if (needSeparator > 0){
//insert separator
$('body '+div2print).append(printSeparator);
} else {
$('body '+div2print).append(printSummary);
}
$('body '+div2print).append('<div><h3 class="font-weight-bold px-4 pt-0 pb-4"><a name="periodoCorrente" style="text-decoration: none;">Struttura del periodo</a> <small class="text-muted">(visualizzata)</small></h3></div>')
$('body '+div2print).append(content);
$('#printSummaryUl').append('<li><a href="#periodoCorrente"><span class="h6 font-weight-bold">Struttura del periodo</span></a></li>');
result = 1;
};
break;
@ -874,33 +857,42 @@ $(document).ready(function() {
$(dstSelect).val(srcVal)
});
if (needSeparator > 0){
//insert separator
$('body '+div2print).append(printSeparator);
} else {
$('body '+div2print).append(printSummary);
};
$('body '+div2print).append('<div><h3 class="font-weight-bold px-4 pt-0 pb-4"><a name="rigaRicerca" style="text-decoration: none;">Filtri di ricerca</a></h3></div>')
$('body '+div2print).append(content);
$('#printSummaryUl').append('<li><a href="#rigaRicerca"><span class="h6 font-weight-bold">Filtri di ricerca</span></a></li>');
result = 1;
break;
case "risultatiLista":
if (listarisultati.length) {
// ricerca sintattico-grammaticale
if (needSeparator > 0){
//insert separator
}
$('body '+div2print).append(printSeparator);
} else {
$('body '+div2print).append(printSummary);
};
$('body '+div2print).append('<div><h3 class="font-weight-bold px-4 pt-0 pb-4"><a name="risultatiLista" style="text-decoration: none;">Risultati della ricerca sintattica/grammaticale</a> <small class="text-muted">(lista)</small></h3></div>')
showFrasi(1, numeroContesti, div2print);
//$(div2print).find('.noPrintA').remove()
$(div2print).find('.noPrintA').css({display:'none'});
$('#printSummaryUl').append('<li><a href="#risultatiLista"><span class="h6 font-weight-bold">Risultati della ricerca sintattica/grammaticale</span></a></li>');
result = 1;
} else {
if (isSearchRiferimenti) {
// ricerca riferimenti
if (needSeparator > 0){
//insert separator
$('body '+div2print).append(printSeparator);
} else {
$('body '+div2print).append(printSummary);
};
console.log(numeroContesti)
$('body '+div2print).append('<div><h3 class="font-weight-bold px-4 pt-0 pb-4"><a name="risultatiLista" style="text-decoration: none;">Risultati della ricerca per riferimenti</a> <small class="text-muted">(lista)</small></h3></div>')
showRiferimentiFrasi(0, numeroContesti, div2print)
//$(div2print).find('.noPrintA').remove()
$(div2print).find('.noPrintA').css({display:'none'});
$('#printSummaryUl').append('<li><a href="#risultatiLista"><span class="h6 font-weight-bold">Risultati della ricerca per riferimenti</span></a></li>');
result = 1;
} else {
} else {
console.log("Nessun risultato visualizzato");
};
};