Corretti bug stampa ed errori icone

This commit is contained in:
Luca Trupiano 2025-03-27 12:51:16 +01:00
parent acd4ab5a47
commit 265a6097d9
4 changed files with 185 additions and 11 deletions

View File

@ -40,7 +40,7 @@
-->
<script type="text/javascript" src="./js/lib/bootstrap-slider.js"></script>
<script type="module" src="./js/browseMgr_5.2.js"></script>
<script type="text/javascript" src="./js/minimap_4.3.js"></script>
<script type="text/javascript" src="./js/minimap_5.2.js"></script>
<script type="text/javascript" src="./js/partext.js"></script>
<script type="text/javascript" src="./js/utilsMgr_5.2.js"></script>
<script type="text/javascript" src="./js/citazionijson.js"></script>
@ -603,7 +603,7 @@
</div>
<div class="d-flex flex-wrap-reverse ml-auto align-items-center justify-content-end px-1 pt-1 pb-0">
<button id="closeStruct0"
class="btn btn-sm btn-outline-warning btn-outline-warning-mod closeStruct rounded text-warning align-self-end px-1 pb-0 ml-1 mb-1">
class="btn btn-sm btn-outline-warning btn-outline-warning-mod closeStruct rounded text-warning align-self-end noPrintA px-1 pb-0 ml-1 mb-1">
<ion-icon name="close-circle"></ion-icon>
</button>
</div>
@ -1983,7 +1983,7 @@
class="row no-gutters flex-nowrap align-items-start justify-content-end">
<div class="col-auto flex-fill align-self-start"></div>
<div
class="col-auto pr-1 align-self-end align-items-end justify-content-end text-right text-success position-absolute">
class="col-auto pr-1 align-self-end align-items-end justify-content-end text-right text-success position-absolute noPrintA">
<button id="claCollapsexX1Xx"
class="btn btn-sm btn-link claCollBtn collapsed px-4 pb-0 border text-success btn-outline-success bg-light"
data-toggle="collapse" data-target="#collapseClaxX1Xx"
@ -2044,7 +2044,7 @@
class="row no-gutters flex-nowrap align-items-start justify-content-end">
<div class="col-auto flex-fill align-self-start"></div>
<div
class="col-auto pr-1 align-self-end align-items-end justify-content-end text-right text-success position-absolute">
class="col-auto pr-1 align-self-end align-items-end justify-content-end text-right text-success position-absolute noPrintA">
<button id="claCollapsexR1Rx"
class="btn btn-sm btn-link claCollBtn collapsed px-4 pb-0 border text-success btn-outline-success bg-light"
data-toggle="collapse" data-target="#collapseClaxR1Rx"

View File

@ -467,10 +467,10 @@ $(document).ready(function() {
comandiGrp.attr('class', 'btn-group flex-nowrap d-inline pr-3 mt-1 mr-3 align-text-bottom');
comandiGrp.attr('role', "group")
var spanBadgeExpand = $('<button class="btn btn-sm btn-outline-primary espandiFrase px-1 pt-1 pb-0"/>');
var spanBadgeExpand = $('<button class="btn btn-sm btn-outline-primary espandiFrase noPrintA px-1 pt-1 pb-0"/>');
var expandIcon = '<ion-icon name="expand-outline"></ion-icon>';
//spanBadgeExpand.attr('class', 'btn btn-sm btn-outline-primary espandiFrase px-1 pt-1 pb-0');
var spanBadgeReduce = $('<button class="btn btn-sm btn-outline-secondary riduciFrase px-1 pt-1 pb-0 ml-1 disabled"/>');
var spanBadgeReduce = $('<button class="btn btn-sm btn-outline-secondary riduciFrase noPrintA px-1 pt-1 pb-0 ml-1 disabled"/>');
var reduceIcon = '<ion-icon name="contract-outline"></ion-icon>';
//spanBadgeReduce.attr('class', 'btn btn-sm btn-outline-secondary riduciFrase px-1 pt-1 pb-0 ml-1 disabled');
@ -1215,7 +1215,7 @@ $(document).ready(function() {
var rigaNota = $('<div class="p-0 m-0">');
var buttons = $('<div class="d-flex flex-wrap-reverse ml-auto align-items-center justify-content-end px-1 pt-1 pb-0">')
var closeButton = $('<button id="closeNote' + id + '"' +
'class="btn btn-sm btn-outline-warning btn-outline-warning-mod closeNote rounded text-warning align-self-end px-1 pb-0 ml-1 mb-1">' +
'class="btn btn-sm btn-outline-warning btn-outline-warning-mod closeNote rounded text-warning align-self-end noPrintA px-1 pb-0 ml-1 mb-1">' +
'<ion-icon name="close-circle"></ion-icon>');
closeButton.appendTo(buttons);
if (len > 1) {
@ -1363,7 +1363,7 @@ $(document).ready(function() {
var rigaNota = $('<div class="px-3 py-1 m-0">');
var buttons = $('<div class="d-flex flex-wrap-reverse ml-auto align-items-center justify-content-end p-1">')
var collapseButton = $('<button id="collapseBtnNote' + id + '_' + pos + '"' +
'class="btn btn-sm btn-outline-primary bg-light collapseNote border rounded text-primary align-self-end px-1 pb-0"' +
'class="btn btn-sm btn-outline-primary bg-light collapseNote border rounded text-primary align-self-end noPrintA px-1 pb-0"' +
'data-toggle="collapse" data-target="#collapseNote' + id + '_' + pos + '"' +
'aria-expanded="true" aria-controls="collapseNote' + id + '_' + pos + '">' +
'<ion-icon name="archive"></ion-icon>');

168
js/minimap_5.2.js Normal file
View File

@ -0,0 +1,168 @@
/**
*
*/
//import {cssTableMainHeight} from './script_5.0.mod.js'
const displayCantoId = '#displaycanto';
const displayCantoWrapperId = '#displaycantoWrapper';
const minimapviewerId = '#minimapviewer';
const displayminimapId = '#displayminimap';
const visCantoClass = '.visCanto';
const fillerClass = '.filler';
const bodyScript = '<script type="module" src="https://cdn.jsdelivr.net/npm/ionicons@latest/dist/ionicons/ionicons.esm.js"></script> <script nomodule src="https://cdn.jsdelivr.net/npm/ionicons@latest/dist/ionicons/ionicons.js"></script>'
const cssTableMainHeightBis = 0.95;
let minimap = document.createElement('div');
let viewer = document.createElement('div');
let minimapContent = document.createElement('iframe');
let realScale;
let currentMinimap = '';
let initOffset = '';
let correctionFactor = 1;
let scrollCorrectionFactor = 0.997;
function drawMinimap(name, onlyContent = false, cantoOffset = 0){
//var cantoHeightToSet = $("body")[0].clientHeight*cssCantoHeight;
var maxCantoHeightToSet = $("body")[0].clientHeight*cssTableMainHeightBis-110; // 63 padding top + 47 margine bottom
$(visCantoClass).css("max-height", maxCantoHeightToSet);
$(displayCantoId).css("max-height", maxCantoHeightToSet);
currentMinimap = name;
if (currentMinimap == '#vistaFrasi') {
//correctionFactor = 1.003;
correctionFactor = 1.009;
scrollCorrectionFactor = 0.997;
//scrollCorrectionFactor = 1;
} else {
correctionFactor = 1;
scrollCorrectionFactor = 0.997;
};
initOffset = parseInt($("body").css("padding-top").replace("px", ""))+63;
if ($(displayminimapId).lenght > 0) {
$(displayminimapId)[0].remove();
}
showMinimap(onlyContent);
if (onlyContent == false) {
$(displayCantoWrapperId).scrollTop(cantoOffset);
$(minimapviewerId).offset({ top: initOffset});
var minimapTopPos = $(minimapviewerId).offset().top;
$(minimapviewerId).draggable({
axis: "y",
containment: $(displayminimapId),
scroll: false,
start: function(event, ui) { minimapScrolling = true; },
stop: function(event, ui) {
minimapScrolling = false;
latestOffset = $(displayCantoWrapperId).scrollTop()
},
drag: function(event, ui) {
minimapScrolling = true;
$(displayCantoWrapperId).scrollTop((ui.offset.top - minimapTopPos) / (realScale*correctionFactor));
}
});
trackScrollCanto();
};
}
function showMinimap(onlyContent) {
viewer.className = 'minimap__viewer';
viewer.id = 'minimapviewer';
minimapContent.className = 'minimap__content';
minimap.append(viewer, minimapContent);
$(displayminimapId).append(minimap);
let html = $(currentMinimap)[0].outerHTML;
if (html == null | html == '')
return;
let iFrameDoc = minimapContent.contentWindow.document;
var cssLinkb = document.createElement("link");
cssLinkb.href = $("#" + currStyle + "-Boot")[0].href;
cssLinkb.rel = "stylesheet";
cssLinkb.type = "text/css";
var cssLinkscroll = document.createElement("link");
cssLinkscroll.href = $("#" + currStyle + "-Custom")[0].href;
cssLinkscroll.rel = "stylesheet";
cssLinkscroll.type = "text/css";
iFrameDoc.open();
iFrameDoc.write('<div class="blog-main w-100 " style="display: d-flex;">'); // da pulire...
iFrameDoc.write(html);
iFrameDoc.write('</div>');
iFrameDoc.write(bodyScript);
iFrameDoc.close();
iFrameDoc.head.appendChild(cssLinkb);
iFrameDoc.head.appendChild(cssLinkscroll);
let bgCanto = $(visCantoClass).css('background-color');
$('iframe').contents().find('body').css('background-color', bgCanto + ' !important;');
var infoHeightToSet = $("body")[0].clientHeight*cssTableMainHeightBis - $(visCantoClass)[0].clientHeight-2-63-2-46
$("#displayinfo").css("maxHeight", infoHeightToSet+"px");
$("#displayinfo").css("height", infoHeightToSet+"px");
$("#displaynote").css("maxHeight", infoHeightToSet+"px");
$("#displaynote").css("height", infoHeightToSet+"px");
$(".visInfo").css("height", (infoHeightToSet+4)+"px");
getDimensionsDiv(false, onlyContent);
}
function getDimensionsDiv(onlyViewer = false, onlyContent = false) {
var srcCantoWidth = $(currentMinimap)[0].clientWidth;
var srcCantoHeight = $(currentMinimap)[0].clientHeight;
var maxHeight = ($("#colMinimap")[0].clientHeight)-68; //h attuale dello spazio minimap; -63 top padding, -1 bordo col, -4 bordi iframe
var maxWidth = $(displayminimapId)[0].clientWidth; //w attuale della minimap (css)
var miniCantoWidth = srcCantoWidth+64; //w prevista del canto nella minimap 64: padding pr + blank space
var miniCantoHeight = srcCantoHeight*correctionFactor; //h prevista del canto nella minimap
var resizableWidth = $(visCantoClass)[0].clientWidth;
var resizableHeight = $(visCantoClass)[0].clientHeight;
var resizableRatio = resizableHeight/resizableWidth;
var heightRatio = resizableHeight/srcCantoHeight;
if (onlyViewer == false) {
realScale= Math.min((maxWidth/miniCantoWidth), (maxHeight/miniCantoHeight), 1);
minimapContent.style.transform = `scale(${realScale})`;
minimapContent.style.height = miniCantoHeight + "px";
minimapContent.style.width = maxWidth/realScale + "px";
}
let viewerHeight = (miniCantoHeight*realScale*heightRatio/correctionFactor)-2; // -2 = bordi
let viewerWidth = Math.min(viewerHeight/resizableRatio, maxWidth-1)+2; // -3 bordi
var displayminimapHeight = (miniCantoHeight*realScale)+6;
$(displayminimapId).height(displayminimapHeight);
$(fillerClass).height(Math.max(maxHeight-displayminimapHeight)+2, 0);
if (onlyContent == false) {
viewer.style.height = viewerHeight + "px";
viewer.style.width = viewerWidth + "px";
trackScrollCanto();
};
};
function trackScrollCanto() {
var minimapHeight = ($(currentMinimap)[0].clientHeight+32)*realScale;
var posDbefore = $(displayCantoWrapperId).scrollTop();
var srcCantoHeight = $(currentMinimap)[0].clientHeight;
var posAfter = (minimapHeight*posDbefore*correctionFactor)/(srcCantoHeight*scrollCorrectionFactor);
$(minimapviewerId).offset({ top: initOffset + posAfter});
latestOffset = posDbefore;
};

View File

@ -806,7 +806,7 @@ $(document).ready(function() {
switch (el2pr) {
case "cantoCorrente":
element = $('.canto[style*="display: d-flex"]')
content = $(element).clone();
content = $(element).clone(true);
if (needSeparator > 0){
//insert separator
}
@ -818,7 +818,8 @@ $(document).ready(function() {
console.log("Nessuna commento visualizzato");
} else {
element = $('#displaynote')[0].innerHTML;
content = $(element).clone();
content = $(element).clone(true);
$(content).find('.noPrintA').remove()
$(content).find('.collapse').addClass('show')
$(content).find('.collapsed').removeClass('collapsed')
$(content).find('a').each(function() {
@ -845,6 +846,7 @@ $(document).ready(function() {
} else {
element = $('#displayinfo')[0].innerHTML;
content = $(element).clone();
$(content).find('.noPrintA').remove()
if (needSeparator > 0){
//insert separator
}
@ -858,7 +860,7 @@ $(document).ready(function() {
} else {
element = $('#rigaRicercaSemplice')[0].innerHTML;
};
content = $(element).clone();
content = $(element).clone(true);
$(content).find('.noPrintA').remove()
$(content).find('.noPrintB').removeClass('show')
if (needSeparator > 0){
@ -874,6 +876,8 @@ $(document).ready(function() {
//insert separator
}
showFrasi(1, numeroContesti, div2print);
//$(div2print).find('.noPrintA').remove()
$(div2print).find('.noPrintA').css({display:'none'});
result = 1;
} else {
if (isSearchRiferimenti) {
@ -882,6 +886,8 @@ $(document).ready(function() {
//insert separator
};
showRiferimentiFrasi(1, numeroContesti, div2print)
//$(div2print).find('.noPrintA').remove()
$(div2print).find('.noPrintA').css({display:'none'});
result = 1;
} else {
console.log("Nessun risultato visualizzato");