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
|
// @namespace https://gitlab.luigidacunto.com/consultant/gaia-swissknife
|
||||||
// @updateURL https://luigidacunto.com/scripts/gaia-swissknife/tampermonkey-script/GAIA-Swissknife.user.js
|
// @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
|
// @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
|
// @author Luigi D'Acunto
|
||||||
// @version 1.0.0
|
// @version 1.1.0
|
||||||
// @description Aggiunge funzionalità alle pagine di GAIA
|
// @description Aggiunge funzionalità alle pagine di GAIA
|
||||||
// @match https://gaia.cri.it/*
|
// @match https://gaia.cri.it/*
|
||||||
// @require https://code.jquery.com/jquery-3.6.0.min.js
|
// @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
|
// Funzione per aggiungere il blocco di intestazione
|
||||||
function ensureSwissknifeHeader() {
|
function ensureSwissknifeHeader() {
|
||||||
|
console.log("GAIA Swissknife: Aggiungo intestazione GAIA Swissknife...");
|
||||||
if ($('#sezione').length > 0 && $('#gaia-swissknife-header').length === 0) {
|
if ($('#sezione').length > 0 && $('#gaia-swissknife-header').length === 0) {
|
||||||
const headerHTML = `
|
const headerHTML = `
|
||||||
<hr>
|
<hr>
|
||||||
|
|
@ -41,135 +43,183 @@ GM_addStyle(GM_getResourceText("DataTablesCSS"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Funzione per applicare le correzioni di stile alle celle del curriculum
|
// Funzione per correggere i filtri della sidebar delle autorizzazioni
|
||||||
function applyStyleFixes() {
|
function fixAutorizzazioniSidebarFilters() {
|
||||||
const url = window.location.href;
|
const $ul = $("#sezione-2");
|
||||||
|
if (!$ul.length) return;
|
||||||
|
|
||||||
if (url.match(/\/profilo\/\d+\/curriculum\//)) {
|
const voci = {};
|
||||||
console.log("GAIA Swissknife: Ricostruzione celle curriculum (versione pulita)...");
|
|
||||||
|
|
||||||
$("td.piu-piccolo").each(function (cellIndex) {
|
// Scansiona tutti i link
|
||||||
const $td = $(this);
|
$ul.find("li[role='presentation'] a").each(function () {
|
||||||
const rawNodes = Array.from(this.childNodes);
|
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
|
if (!text || isNaN(badge)) return;
|
||||||
const nodes = rawNodes.filter(n => {
|
|
||||||
if (n.nodeType === 3) return n.nodeValue.trim() !== "";
|
|
||||||
return true; // elementi HTML validi
|
|
||||||
});
|
|
||||||
|
|
||||||
console.log(`\n📦 [Cella ${cellIndex + 1}] Analizzo ${nodes.length} nodi validi...`);
|
if (!voci[text]) {
|
||||||
const newContent = $('<div></div>');
|
voci[text] = {
|
||||||
|
count: 0,
|
||||||
|
href: href
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
for (let i = 0; i < nodes.length; i++) {
|
voci[text].count += badge;
|
||||||
const node = nodes[i];
|
});
|
||||||
|
|
||||||
// Se è un'icona <i>, cerca il contenuto associato
|
$ul.find("li[role='presentation']").remove();
|
||||||
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"
|
|
||||||
});
|
|
||||||
|
|
||||||
$icon.css({
|
Object.entries(voci).forEach(([tipo, info]) => {
|
||||||
"margin-right": "4px",
|
const $li = $(`
|
||||||
"vertical-align": "middle"
|
<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>
|
console.log(`\n📦 [Cella ${cellIndex + 1}] Analizzo ${nodes.length} nodi validi...`);
|
||||||
let content = null;
|
const newContent = $('<div></div>');
|
||||||
let nextIndex = i + 1;
|
|
||||||
|
|
||||||
while (nextIndex < nodes.length) {
|
for (let i = 0; i < nodes.length; i++) {
|
||||||
const nextNode = nodes[nextIndex];
|
const node = nodes[i];
|
||||||
|
|
||||||
if (nextNode.nodeType === 3) {
|
if (node.nodeType === 1 && node.tagName === "I") {
|
||||||
const text = nextNode.nodeValue.trim();
|
const $icon = $(node).clone();
|
||||||
if (text) {
|
const $row = $('<div class="gaia-line"></div>').css({
|
||||||
content = $('<span></span>').text(text);
|
"display": "flex",
|
||||||
if (text.length > 40) {
|
"align-items": "baseline",
|
||||||
content.css({
|
"gap": "5px",
|
||||||
"display": "inline-block",
|
"line-height": "1.4",
|
||||||
"max-width": "200px",
|
"margin-bottom": "2px"
|
||||||
"white-space": "nowrap",
|
});
|
||||||
"overflow": "hidden",
|
|
||||||
"text-overflow": "ellipsis",
|
|
||||||
"vertical-align": "middle"
|
|
||||||
}).attr("title", text);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} else if (nextNode.nodeType === 1) {
|
|
||||||
const $el = $(nextNode);
|
|
||||||
|
|
||||||
if (nextNode.tagName === "A") {
|
$icon.css({
|
||||||
// Gestione <a> (link)
|
"margin-right": "4px",
|
||||||
let text = $el.text().trim();
|
"vertical-align": "middle"
|
||||||
|
});
|
||||||
|
|
||||||
if (!text) {
|
$row.append($icon);
|
||||||
const href = $el.attr("href") || "";
|
|
||||||
const fallback = href.split("/").pop();
|
|
||||||
text = fallback || "(documento)";
|
|
||||||
$el.text(text);
|
|
||||||
}
|
|
||||||
|
|
||||||
$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",
|
"display": "inline-block",
|
||||||
"max-width": "200px",
|
"max-width": "200px",
|
||||||
"white-space": "nowrap",
|
"white-space": "nowrap",
|
||||||
"overflow": "hidden",
|
"overflow": "hidden",
|
||||||
"text-overflow": "ellipsis",
|
"text-overflow": "ellipsis",
|
||||||
"vertical-align": "middle",
|
"vertical-align": "middle"
|
||||||
"color": "#a94442"
|
|
||||||
}).attr("title", text);
|
}).attr("title", text);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else if (nextNode.nodeType === 1) {
|
||||||
|
const $el = $(nextNode);
|
||||||
|
|
||||||
content = $el;
|
if (nextNode.tagName === "A") {
|
||||||
break;
|
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)
|
$el.css({
|
||||||
else if (nextNode.tagName === "SPAN") {
|
"display": "inline-block",
|
||||||
const text = $el.text().trim();
|
"max-width": "200px",
|
||||||
if (text) {
|
"white-space": "nowrap",
|
||||||
content = $el.clone();
|
"overflow": "hidden",
|
||||||
|
"text-overflow": "ellipsis",
|
||||||
|
"vertical-align": "middle",
|
||||||
|
"color": "#a94442"
|
||||||
|
}).attr("title", text);
|
||||||
|
|
||||||
content.css({
|
content = $el;
|
||||||
"display": "inline-block",
|
break;
|
||||||
"max-width": "200px",
|
|
||||||
"white-space": "nowrap",
|
|
||||||
"overflow": "hidden",
|
|
||||||
"text-overflow": "ellipsis",
|
|
||||||
"vertical-align": "middle"
|
|
||||||
}).attr("title", text);
|
|
||||||
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) {
|
i = nextIndex - 1;
|
||||||
$row.append(content);
|
|
||||||
newContent.append($row);
|
if (content) {
|
||||||
console.log(`✅ Riga generata: ${$icon.attr("class")} + contenuto`);
|
$row.append(content);
|
||||||
} else {
|
newContent.append($row);
|
||||||
console.warn(`⚠️ Riga ignorata: icona "${$icon.attr("class")}" senza contenuto`);
|
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
|
// 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>
|
<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>
|
||||||
<div id="gaia-auth-body" style="padding: 15px;">
|
<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>
|
<label for="gaia-auth-select">Seleziona un corso:</label>
|
||||||
<select id="gaia-auth-select" style="width: 100%; padding: 5px; margin-bottom: 10px;">
|
<select id="gaia-auth-select" style="width: 100%; padding: 5px; margin-bottom: 10px;">
|
||||||
<option value="">-- Seleziona --</option>
|
<option value="">-- Seleziona --</option>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue