sistemato bottone filtra con risultato di riferimenti

This commit is contained in:
nicola 2025-03-11 17:18:17 +01:00
parent 5712bf5a86
commit 251b3b99f7
1 changed files with 20 additions and 5 deletions

View File

@ -1015,6 +1015,7 @@ $(document).ready(function() {
var cid = $(this).attr('id');
var queryComment = false;
var idClass = $(this).attr('class');
var parentClass = $(this).parent().attr('class');
filterOn = true;
if (idClass.includes("filterRiferimentiOn")) {
@ -1027,10 +1028,15 @@ $(document).ready(function() {
if (!hasCommentsJson(cid)) {
return
}
if (showingComments) {
if (getListaIdCommenti().length>0) {
if (filterOn) {
$(".filterRiferimentiOn").css('display', 'inline-block');
$(".filterRiferimentiOff").css('display', 'none');
if (parentClass.includes("mark")){
$(".filterRiferimentiOn").css('display', 'inline-block');
$(".filterRiferimentiOff").css('display', 'none');
}else{
$(".filterRiferimentiOn").css('display', 'none');
$(".filterRiferimentiOff").css('display', 'none');
}
} else {
$(".filterRiferimentiOff").css('display', 'inline-block');
$(".filterRiferimentiOn").css('display', 'none');
@ -1140,11 +1146,18 @@ $(document).ready(function() {
}
var toTitleCase = str => str.replace(/(^\w|\s\w)(\S*)/g, (_, m1, m2) => m1.toUpperCase() + m2.toLowerCase())
function createNoteEntry(comments, id, pos, queryComment) {
function isCommentInResult(idComment){
const tmplistaidcomm = getListaIdCommenti()
if (tmplistaidcomm.length && tmplistaidcomm.includes(idComment)) {
return true;
}
return false;
}
function createNoteEntry(comments, id, pos, queryComment) {
var idref = comments.Id
if (tmplistaidcomm.length && tmplistaidcomm.includes(idref)) { // Nik riferimenti
if (isCommentInResult(idref)) {
var noteCard = $('<div class="card card-body bg-light border-success well well-sm mx-1 mb-1 mt-0 p-0" id="noteCard' + id + '_' + pos + '"' + ' name= "' + idref + '">');
noteAdded = true;
}
@ -1816,6 +1829,8 @@ $(document).ready(function() {
elencoRiferimenti.empty();
$("#displaynote").empty();
filterOn = true;
$(".filterRiferimentiOn").css('display', 'none');
$(".filterRiferimentiOff").css('display', 'none');
if (cantoDisplayed != '#vistaFrasi') {
prevCantoDisplayed = cantoDisplayed;