Aggiungi il changelog per la versione 1.1.0 e aggiorna la versione nel file GAIA-Swissknife.user.js
This commit is contained in:
parent
54466f6e38
commit
407b23fbd2
2 changed files with 170 additions and 97 deletions
15
CHANGELOG.md
Normal file
15
CHANGELOG.md
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
# 🧰 GAIA Swissknife – Changelog
|
||||
|
||||
## v1.1.0 – 2025-04-09
|
||||
- Refactoring in funzioni modulari
|
||||
- Ricostruzione celle curriculum estratta in funzione esterna
|
||||
- Sidebar autorizzazioni: aggregazione e deduplicazione
|
||||
- Modale "richieste iscrizione": input → select automatica + riepilogo corsi
|
||||
- Correzione troncamento nomi file PDF nella prima riga
|
||||
- Link changelog previsto, ma disattivato per coerenza multi-pagina
|
||||
|
||||
## v1.0.0 – 2025-04-04
|
||||
- Versione stabile iniziale
|
||||
- Trasformazione tabella curriculum in DataTable
|
||||
- Evidenziazione "Respinto"
|
||||
- Funzioni operative: ammissioni, apertura schede, messaggi...
|
||||
|
|
@ -3,8 +3,9 @@
|
|||
// @namespace https://gitlab.luigidacunto.com/consultant/gaia-swissknife
|
||||
// @updateURL https://luigidacunto.com/scripts/gaia-swissknife/tampermonkey-script/GAIA-Swissknife.user.js
|
||||
// @downloadURL https://luigidacunto.com/scripts/gaia-swissknife/tampermonkey-script/GAIA-Swissknife.user.js
|
||||
// @changelogURL https://luigidacunto.com/scripts/gaia-swissknife/tampermonkey-script/CHANGELOG.md
|
||||
// @author Luigi D'Acunto
|
||||
// @version 1.0.0
|
||||
// @version 1.1.0
|
||||
// @description Aggiunge funzionalità alle pagine di GAIA
|
||||
// @match https://gaia.cri.it/*
|
||||
// @require https://code.jquery.com/jquery-3.6.0.min.js
|
||||
|
|
@ -30,6 +31,7 @@ GM_addStyle(GM_getResourceText("DataTablesCSS"));
|
|||
|
||||
// Funzione per aggiungere il blocco di intestazione
|
||||
function ensureSwissknifeHeader() {
|
||||
console.log("GAIA Swissknife: Aggiungo intestazione GAIA Swissknife...");
|
||||
if ($('#sezione').length > 0 && $('#gaia-swissknife-header').length === 0) {
|
||||
const headerHTML = `
|
||||
<hr>
|
||||
|
|
@ -41,135 +43,183 @@ GM_addStyle(GM_getResourceText("DataTablesCSS"));
|
|||
}
|
||||
}
|
||||
|
||||
// Funzione per applicare le correzioni di stile alle celle del curriculum
|
||||
function applyStyleFixes() {
|
||||
const url = window.location.href;
|
||||
// Funzione per correggere i filtri della sidebar delle autorizzazioni
|
||||
function fixAutorizzazioniSidebarFilters() {
|
||||
const $ul = $("#sezione-2");
|
||||
if (!$ul.length) return;
|
||||
|
||||
if (url.match(/\/profilo\/\d+\/curriculum\//)) {
|
||||
console.log("GAIA Swissknife: Ricostruzione celle curriculum (versione pulita)...");
|
||||
const voci = {};
|
||||
|
||||
$("td.piu-piccolo").each(function (cellIndex) {
|
||||
const $td = $(this);
|
||||
const rawNodes = Array.from(this.childNodes);
|
||||
// Scansiona tutti i link
|
||||
$ul.find("li[role='presentation'] a").each(function () {
|
||||
const $a = $(this);
|
||||
const text = $a.clone().children().remove().end().text().trim();
|
||||
const badge = parseInt($a.find(".badge").text().trim(), 10);
|
||||
const href = $a.attr("href");
|
||||
|
||||
// 🔍 Filtro nodi significativi: elimina tutti i nodi vuoti o whitespace
|
||||
const nodes = rawNodes.filter(n => {
|
||||
if (n.nodeType === 3) return n.nodeValue.trim() !== "";
|
||||
return true; // elementi HTML validi
|
||||
});
|
||||
if (!text || isNaN(badge)) return;
|
||||
|
||||
console.log(`\n📦 [Cella ${cellIndex + 1}] Analizzo ${nodes.length} nodi validi...`);
|
||||
const newContent = $('<div></div>');
|
||||
if (!voci[text]) {
|
||||
voci[text] = {
|
||||
count: 0,
|
||||
href: href
|
||||
};
|
||||
}
|
||||
|
||||
for (let i = 0; i < nodes.length; i++) {
|
||||
const node = nodes[i];
|
||||
voci[text].count += badge;
|
||||
});
|
||||
|
||||
// Se è un'icona <i>, cerca il contenuto associato
|
||||
if (node.nodeType === 1 && node.tagName === "I") {
|
||||
const $icon = $(node).clone();
|
||||
const $row = $('<div class="gaia-line"></div>').css({
|
||||
"display": "flex",
|
||||
"align-items": "baseline",
|
||||
"gap": "5px",
|
||||
"line-height": "1.4",
|
||||
"margin-bottom": "2px"
|
||||
});
|
||||
$ul.find("li[role='presentation']").remove();
|
||||
|
||||
$icon.css({
|
||||
"margin-right": "4px",
|
||||
"vertical-align": "middle"
|
||||
});
|
||||
Object.entries(voci).forEach(([tipo, info]) => {
|
||||
const $li = $(`
|
||||
<li role="presentation">
|
||||
<a href="${info.href}">
|
||||
${tipo}
|
||||
<span class="badge pull-right">${info.count}</span>
|
||||
</a>
|
||||
</li>
|
||||
`);
|
||||
$ul.append($li);
|
||||
});
|
||||
}
|
||||
// Funzione per ricostruire le celle con i dettagli delle qualifiche nel curriculum in modo pulito
|
||||
function rebuildCurriculumDetailCells() {
|
||||
$("td.piu-piccolo").each(function (cellIndex) {
|
||||
const $td = $(this);
|
||||
const rawNodes = Array.from(this.childNodes);
|
||||
|
||||
$row.append($icon);
|
||||
const nodes = rawNodes.filter(n => {
|
||||
if (n.nodeType === 3) return n.nodeValue.trim() !== "";
|
||||
return true;
|
||||
});
|
||||
|
||||
// 🔄 Trova il prossimo nodo utile: testo o <a>
|
||||
let content = null;
|
||||
let nextIndex = i + 1;
|
||||
console.log(`\n📦 [Cella ${cellIndex + 1}] Analizzo ${nodes.length} nodi validi...`);
|
||||
const newContent = $('<div></div>');
|
||||
|
||||
while (nextIndex < nodes.length) {
|
||||
const nextNode = nodes[nextIndex];
|
||||
for (let i = 0; i < nodes.length; i++) {
|
||||
const node = nodes[i];
|
||||
|
||||
if (nextNode.nodeType === 3) {
|
||||
const text = nextNode.nodeValue.trim();
|
||||
if (text) {
|
||||
content = $('<span></span>').text(text);
|
||||
if (text.length > 40) {
|
||||
content.css({
|
||||
"display": "inline-block",
|
||||
"max-width": "200px",
|
||||
"white-space": "nowrap",
|
||||
"overflow": "hidden",
|
||||
"text-overflow": "ellipsis",
|
||||
"vertical-align": "middle"
|
||||
}).attr("title", text);
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else if (nextNode.nodeType === 1) {
|
||||
const $el = $(nextNode);
|
||||
if (node.nodeType === 1 && node.tagName === "I") {
|
||||
const $icon = $(node).clone();
|
||||
const $row = $('<div class="gaia-line"></div>').css({
|
||||
"display": "flex",
|
||||
"align-items": "baseline",
|
||||
"gap": "5px",
|
||||
"line-height": "1.4",
|
||||
"margin-bottom": "2px"
|
||||
});
|
||||
|
||||
if (nextNode.tagName === "A") {
|
||||
// Gestione <a> (link)
|
||||
let text = $el.text().trim();
|
||||
$icon.css({
|
||||
"margin-right": "4px",
|
||||
"vertical-align": "middle"
|
||||
});
|
||||
|
||||
if (!text) {
|
||||
const href = $el.attr("href") || "";
|
||||
const fallback = href.split("/").pop();
|
||||
text = fallback || "(documento)";
|
||||
$el.text(text);
|
||||
}
|
||||
$row.append($icon);
|
||||
|
||||
$el.css({
|
||||
let content = null;
|
||||
let nextIndex = i + 1;
|
||||
|
||||
while (nextIndex < nodes.length) {
|
||||
const nextNode = nodes[nextIndex];
|
||||
|
||||
if (nextNode.nodeType === 3) {
|
||||
const text = nextNode.nodeValue.trim();
|
||||
if (text) {
|
||||
content = $('<span></span>').text(text);
|
||||
if (text.length > 40) {
|
||||
content.css({
|
||||
"display": "inline-block",
|
||||
"max-width": "200px",
|
||||
"white-space": "nowrap",
|
||||
"overflow": "hidden",
|
||||
"text-overflow": "ellipsis",
|
||||
"vertical-align": "middle",
|
||||
"color": "#a94442"
|
||||
"vertical-align": "middle"
|
||||
}).attr("title", text);
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else if (nextNode.nodeType === 1) {
|
||||
const $el = $(nextNode);
|
||||
|
||||
content = $el;
|
||||
break;
|
||||
if (nextNode.tagName === "A") {
|
||||
let text = $el.text().trim();
|
||||
|
||||
if (!text) {
|
||||
const href = $el.attr("href") || "";
|
||||
const fallback = href.split("/").pop();
|
||||
text = fallback || "(documento)";
|
||||
$el.text(text);
|
||||
}
|
||||
|
||||
// ✅ Gestione <span> (es. .monospace o altro)
|
||||
else if (nextNode.tagName === "SPAN") {
|
||||
const text = $el.text().trim();
|
||||
if (text) {
|
||||
content = $el.clone();
|
||||
$el.css({
|
||||
"display": "inline-block",
|
||||
"max-width": "200px",
|
||||
"white-space": "nowrap",
|
||||
"overflow": "hidden",
|
||||
"text-overflow": "ellipsis",
|
||||
"vertical-align": "middle",
|
||||
"color": "#a94442"
|
||||
}).attr("title", text);
|
||||
|
||||
content.css({
|
||||
"display": "inline-block",
|
||||
"max-width": "200px",
|
||||
"white-space": "nowrap",
|
||||
"overflow": "hidden",
|
||||
"text-overflow": "ellipsis",
|
||||
"vertical-align": "middle"
|
||||
}).attr("title", text);
|
||||
break;
|
||||
}
|
||||
}
|
||||
content = $el;
|
||||
break;
|
||||
}
|
||||
|
||||
nextIndex++;
|
||||
else if (nextNode.tagName === "SPAN") {
|
||||
const text = $el.text().trim();
|
||||
if (text) {
|
||||
content = $el.clone();
|
||||
|
||||
content.css({
|
||||
"display": "inline-block",
|
||||
"max-width": "200px",
|
||||
"white-space": "nowrap",
|
||||
"overflow": "hidden",
|
||||
"text-overflow": "ellipsis",
|
||||
"vertical-align": "middle"
|
||||
}).attr("title", text);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
i = nextIndex - 1; // Salta i nodi già processati
|
||||
nextIndex++;
|
||||
}
|
||||
|
||||
if (content) {
|
||||
$row.append(content);
|
||||
newContent.append($row);
|
||||
console.log(`✅ Riga generata: ${$icon.attr("class")} + contenuto`);
|
||||
} else {
|
||||
console.warn(`⚠️ Riga ignorata: icona "${$icon.attr("class")}" senza contenuto`);
|
||||
}
|
||||
i = nextIndex - 1;
|
||||
|
||||
if (content) {
|
||||
$row.append(content);
|
||||
newContent.append($row);
|
||||
console.log(`✅ Riga generata: ${$icon.attr("class")} + contenuto`);
|
||||
} else {
|
||||
console.warn(`⚠️ Riga ignorata: icona "${$icon.attr("class")}" senza contenuto`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$td.empty().append(newContent);
|
||||
});
|
||||
$td.empty().append(newContent);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// Funzione per applicare le correzioni di stile alle celle del curriculum
|
||||
function applyStyleFixes() {
|
||||
const url = window.location.href;
|
||||
|
||||
// Correzione per le celle del curriculum
|
||||
if (url.match(/\/profilo\/\d+\/curriculum\//)) {
|
||||
console.log("GAIA Swissknife: Ricostruzione celle curriculum in modo ordinato...");
|
||||
rebuildCurriculumDetailCells();
|
||||
}
|
||||
|
||||
// Correzione per menu laterale autorizzazioni
|
||||
if (url.includes("/autorizzazioni")) {
|
||||
console.log("GAIA Swissknife: Correzione menu laterale autorizzazioni...");
|
||||
fixAutorizzazioniSidebarFilters();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Funzione per aggiungere i pulsanti per settare gli esiti degli esami
|
||||
|
|
@ -393,6 +443,14 @@ GM_addStyle(GM_getResourceText("DataTablesCSS"));
|
|||
<button id="gaia-auth-toggle" title="Riduci/Espandi" style="background: transparent; border: none; color: white; font-weight: bold; font-size: 16px; cursor: pointer; padding: 0; margin-left: 10px;">−</button>
|
||||
</div>
|
||||
<div id="gaia-auth-body" style="padding: 15px;">
|
||||
<div id="gaia-auth-summary" style="margin-bottom: 10px; font-size: 13px;">
|
||||
<strong>📋 Richieste trovate:</strong><br>
|
||||
${corsiUnici.map(c => {
|
||||
const count = richieste.filter(r => r.codice === c).length;
|
||||
const plural = count === 1 ? "richiesta" : "richieste";
|
||||
return `• ${c} – ${count} ${plural}`;
|
||||
}).join("<br>")}
|
||||
</div>
|
||||
<label for="gaia-auth-select">Seleziona un corso:</label>
|
||||
<select id="gaia-auth-select" style="width: 100%; padding: 5px; margin-bottom: 10px;">
|
||||
<option value="">-- Seleziona --</option>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue