Aggiorna la versione a 1.0.0 e aggiunge nuove funzionalità, inclusa l'integrazione di DataTable e l'evidenziazione delle righe "Respinto"
This commit is contained in:
parent
ee9f9cec33
commit
440941d71a
1 changed files with 48 additions and 37 deletions
|
|
@ -4,7 +4,7 @@
|
||||||
// @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
|
||||||
// @author Luigi D'Acunto
|
// @author Luigi D'Acunto
|
||||||
// @version 0.5.10-beta
|
// @version 1.0.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
|
||||||
|
|
@ -24,6 +24,24 @@ GM_addStyle(GM_getResourceText("DataTablesCSS"));
|
||||||
// Recupera la versione dallo script se disponibile, altrimenti usa un valore di fallback
|
// Recupera la versione dallo script se disponibile, altrimenti usa un valore di fallback
|
||||||
const currentVersion = (typeof GM_info !== 'undefined' && GM_info.script && GM_info.script.version) ? GM_info.script.version : 'x.x';
|
const currentVersion = (typeof GM_info !== 'undefined' && GM_info.script && GM_info.script.version) ? GM_info.script.version : 'x.x';
|
||||||
|
|
||||||
|
console.log(`GAIA Swissknife: Versione ${currentVersion}`);
|
||||||
|
|
||||||
|
// Inizializza le funzionalità
|
||||||
|
|
||||||
|
// Funzione per aggiungere il blocco di intestazione
|
||||||
|
function ensureSwissknifeHeader() {
|
||||||
|
if ($('#sezione').length > 0 && $('#gaia-swissknife-header').length === 0) {
|
||||||
|
const headerHTML = `
|
||||||
|
<hr>
|
||||||
|
<li id="gaia-swissknife-header" class="dropdown-header grassetto piu-grande">
|
||||||
|
GAIA Swissknife v${currentVersion}
|
||||||
|
</li>
|
||||||
|
`;
|
||||||
|
$('#sezione').append(headerHTML);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Funzione per applicare le correzioni di stile alle celle del curriculum
|
||||||
function applyStyleFixes() {
|
function applyStyleFixes() {
|
||||||
const url = window.location.href;
|
const url = window.location.href;
|
||||||
|
|
||||||
|
|
@ -154,19 +172,6 @@ GM_addStyle(GM_getResourceText("DataTablesCSS"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Funzione per aggiungere il blocco di intestazione
|
|
||||||
function ensureSwissknifeHeader() {
|
|
||||||
if ($('#sezione').length > 0 && $('#gaia-swissknife-header').length === 0) {
|
|
||||||
const headerHTML = `
|
|
||||||
<hr>
|
|
||||||
<li id="gaia-swissknife-header" class="dropdown-header grassetto piu-grande">
|
|
||||||
GAIA Swissknife v${currentVersion}
|
|
||||||
</li>
|
|
||||||
`;
|
|
||||||
$('#sezione').append(headerHTML);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Funzione per aggiungere i pulsanti per settare gli esiti degli esami
|
// Funzione per aggiungere i pulsanti per settare gli esiti degli esami
|
||||||
function addExamOutcomeButtons() {
|
function addExamOutcomeButtons() {
|
||||||
console.log("GAIA Swissknife: esecuzione di addExamOutcomeButtons() ...");
|
console.log("GAIA Swissknife: esecuzione di addExamOutcomeButtons() ...");
|
||||||
|
|
@ -229,7 +234,7 @@ GM_addStyle(GM_getResourceText("DataTablesCSS"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Funzione per aggiungere il pulsante "Apri tutti i Curriculum"
|
// Funzione per aggiungere il pulsante "Apri tutti i Curriculum" sezione iscritti
|
||||||
function addOpenAllProfilesButton() {
|
function addOpenAllProfilesButton() {
|
||||||
if (!window.location.href.includes('/iscritti/')) return;
|
if (!window.location.href.includes('/iscritti/')) return;
|
||||||
|
|
||||||
|
|
@ -304,11 +309,11 @@ GM_addStyle(GM_getResourceText("DataTablesCSS"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Funzione per evidenziare le righe con "Respinto" NON STA FUNZIONANDO
|
// Funzione per evidenziare le righe con "Respinto"
|
||||||
function highlightRejectedCourses() {
|
function highlightRejectedCourses() {
|
||||||
if (!window.location.href.match(/\/profilo\/\d+\/curriculum\//)) return;
|
if (!window.location.href.match(/\/profilo\/\d+\/curriculum\//)) return;
|
||||||
|
|
||||||
console.log(`GAIA Swissknife: Qualifiche Rifiutate, rilevazione avviata..`);
|
console.log("GAIA Swissknife: Avvio evidenziazione 'Respinto'…");
|
||||||
|
|
||||||
const $table = $(".table.table-striped");
|
const $table = $(".table.table-striped");
|
||||||
if (!$table.length || !$.fn.DataTable.isDataTable($table)) return;
|
if (!$table.length || !$.fn.DataTable.isDataTable($table)) return;
|
||||||
|
|
@ -316,23 +321,25 @@ GM_addStyle(GM_getResourceText("DataTablesCSS"));
|
||||||
const api = $table.DataTable();
|
const api = $table.DataTable();
|
||||||
|
|
||||||
function applyRejectionStyle() {
|
function applyRejectionStyle() {
|
||||||
api.rows({ search: "applied" }).every(function (rowIdx, tableLoop, rowLoop) {
|
// Prima puliamo tutte le righe (reset)
|
||||||
|
api.rows().every(function () {
|
||||||
const $row = $(this.node());
|
const $row = $(this.node());
|
||||||
const hasRespinto = $row.text().includes("Respinto");
|
$row.css({
|
||||||
|
"box-shadow": "",
|
||||||
if (hasRespinto) {
|
"background-color": ""
|
||||||
const nomeCorso = $row.find("p.grassetto").text().trim() || "Corso non trovato";
|
});
|
||||||
console.log(`🟥 Respinto trovato nella riga ${rowIdx + 1}: ${nomeCorso}`);
|
});
|
||||||
|
|
||||||
|
// Poi coloriamo solo le righe che contengono <span class="text-danger">Respinto</span>
|
||||||
|
$table.find("span.text-danger").each(function () {
|
||||||
|
const text = $(this).text().trim().toLowerCase();
|
||||||
|
if (text === "respinto") {
|
||||||
|
const $row = $(this).closest("tr");
|
||||||
|
console.log("🟥 Evidenzio riga:", $row.index(), $row.find("p.grassetto").text().trim());
|
||||||
$row.css({
|
$row.css({
|
||||||
"box-shadow": "inset 8px 0 0 0 #dc3545",
|
"box-shadow": "inset 8px 0 0 0 #dc3545",
|
||||||
"background-color": "#fbe9ea"
|
"background-color": "#fbe9ea"
|
||||||
});
|
});
|
||||||
} else {
|
|
||||||
$row.css({
|
|
||||||
"box-shadow": "",
|
|
||||||
"background-color": ""
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -555,23 +562,27 @@ GM_addStyle(GM_getResourceText("DataTablesCSS"));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Applica le correzioni le colorazioni dei tipi di qualifica in lista
|
||||||
applyColoring();
|
applyColoring();
|
||||||
|
|
||||||
$table.on('draw.dt', function () {
|
|
||||||
// mantiene le celle pulite
|
|
||||||
applyStyleFixes();
|
|
||||||
// ricolora dopo ogni ricerca/ordinamento
|
|
||||||
applyColoring();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$(document).ready(() => {
|
$(document).ready(() => {
|
||||||
applyStyleFixes();
|
applyStyleFixes();
|
||||||
addExamOutcomeButtons();
|
addExamOutcomeButtons();
|
||||||
addOpenAllProfilesButton();
|
addOpenAllProfilesButton();
|
||||||
highlightRejectedCourses();
|
|
||||||
addAuthorizationProfileTool();
|
addAuthorizationProfileTool();
|
||||||
enhanceCurriculumTable();
|
enhanceCurriculumTable();
|
||||||
|
highlightRejectedCourses();
|
||||||
console.log("GAIA Swissknife: Funzioni caricate con successo!");
|
console.log("GAIA Swissknife: Funzioni caricate con successo!");
|
||||||
});
|
});
|
||||||
|
|
||||||
})(jQuery.noConflict(true));
|
})(jQuery.noConflict(true));
|
||||||
|
|
||||||
|
// ==CHANGELOG==
|
||||||
|
// v1.0.0 - Versione stabile, con:
|
||||||
|
// - DataTable integrata nella tabella curriculum
|
||||||
|
// - Evidenziazione "Respinto"
|
||||||
|
// - Correzioni grafiche file/link
|
||||||
|
// - Gestione richieste iscrizioni con modale mobile
|
||||||
|
// - Funzioni esiti massivi su termina corso
|
||||||
|
// ==/CHANGELOG==
|
||||||
Loading…
Add table
Add a link
Reference in a new issue