minori
This commit is contained in:
parent
ab7315340f
commit
0f59eccc5d
1 changed files with 13 additions and 15 deletions
|
|
@ -54,7 +54,7 @@
|
||||||
// Cerca il menu laterale (ul#sezione) dove inserire il blocco
|
// Cerca il menu laterale (ul#sezione) dove inserire il blocco
|
||||||
if ($('#sezione').length > 0) {
|
if ($('#sezione').length > 0) {
|
||||||
console.log("GAIA Swissknife: Elementi trovati, aggiungo i pulsanti nel menu laterale...");
|
console.log("GAIA Swissknife: Elementi trovati, aggiungo i pulsanti nel menu laterale...");
|
||||||
|
|
||||||
ensureSwissknifeHeader();
|
ensureSwissknifeHeader();
|
||||||
// Aggiungi i pulsanti per settare gli esiti
|
// Aggiungi i pulsanti per settare gli esiti
|
||||||
const buttonsHTML = `
|
const buttonsHTML = `
|
||||||
|
|
@ -108,16 +108,16 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Funzione per aggiungere il pulsante "Apri tutte le schede profilo"
|
// Funzione per aggiungere il pulsante "Apri tutti i Curriculum"
|
||||||
function addOpenAllProfilesButton() {
|
function addOpenAllProfilesButton() {
|
||||||
if (!window.location.href.includes('/iscritti/')) return;
|
if (!window.location.href.includes('/iscritti/')) return;
|
||||||
|
|
||||||
const openButton = $(`
|
const openButton = $(`
|
||||||
<button id="open_all_profiles" style="margin: 5px; padding: 8px; width: 97%; background-color:rgba(234, 0, 255, 0.65); color: #FFF; border: none; border-radius: 4px; cursor: pointer;">
|
<button id="open_all_profiles" style="margin: 5px; padding: 8px; width: 97%; background-color:rgba(234, 0, 255, 0.65); color: #FFF; border: none; border-radius: 4px; cursor: pointer;">
|
||||||
Apri tutte le schede profilo
|
Apri tutti i Curriculum
|
||||||
</button>
|
</button>
|
||||||
`);
|
`);
|
||||||
|
|
||||||
openButton.on('click', () => {
|
openButton.on('click', () => {
|
||||||
const iframe = document.querySelector('iframe.embed-responsive-item');
|
const iframe = document.querySelector('iframe.embed-responsive-item');
|
||||||
if (!iframe) {
|
if (!iframe) {
|
||||||
|
|
@ -125,7 +125,7 @@
|
||||||
console.log("GAIA Swissknife: iframe non trovato.");
|
console.log("GAIA Swissknife: iframe non trovato.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Verifica che il contenuto sia accessibile (same-origin)
|
// Verifica che il contenuto sia accessibile (same-origin)
|
||||||
let iframeDoc;
|
let iframeDoc;
|
||||||
try {
|
try {
|
||||||
|
|
@ -135,14 +135,14 @@
|
||||||
console.error("GAIA Swissknife: accesso iframe negato.", err);
|
console.error("GAIA Swissknife: accesso iframe negato.", err);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const $iframeLinks = $(iframeDoc).find("a[href^='/profilo/'][href*='?fpc']");
|
const $iframeLinks = $(iframeDoc).find("a[href^='/profilo/'][href*='?fpc']");
|
||||||
if ($iframeLinks.length === 0) {
|
if ($iframeLinks.length === 0) {
|
||||||
alert("Nessun profilo trovato all'interno dell'iframe.");
|
alert("Nessun profilo trovato all'interno dell'iframe.");
|
||||||
console.log("GAIA Swissknife: Nessun link profilo nell'iframe.");
|
console.log("GAIA Swissknife: Nessun link profilo nell'iframe.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const profileLinks = $iframeLinks.map(function() {
|
const profileLinks = $iframeLinks.map(function() {
|
||||||
const href = $(this).attr('href');
|
const href = $(this).attr('href');
|
||||||
const match = href.match(/\/profilo\/(\d+)\//);
|
const match = href.match(/\/profilo\/(\d+)\//);
|
||||||
|
|
@ -152,21 +152,20 @@
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}).get().filter(Boolean);
|
}).get().filter(Boolean);
|
||||||
|
|
||||||
|
|
||||||
// Mostra le URL in console sempre
|
// Mostra le URL in console sempre
|
||||||
console.log("GAIA Swissknife: Profili trovati:");
|
console.log("GAIA Swissknife: Profili trovati:");
|
||||||
profileLinks.forEach(link => console.log(link));
|
profileLinks.forEach(link => console.log(link));
|
||||||
|
|
||||||
if (!confirm(`Vuoi aprire ${profileLinks.length} profili in nuove schede?`)) return;
|
if (!confirm(`Vuoi aprire ${profileLinks.length} profili in nuove schede?`)) return;
|
||||||
|
|
||||||
profileLinks.forEach(link => {
|
profileLinks.forEach(link => {
|
||||||
window.open(link, '_blank');
|
window.open(link, '_blank');
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log(`GAIA Swissknife: Aperte ${profileLinks.length} schede da iframe.`);
|
console.log(`GAIA Swissknife: Aperte ${profileLinks.length} schede da iframe.`);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Inserimento del pulsante nel menu laterale o in floating
|
// Inserimento del pulsante nel menu laterale o in floating
|
||||||
if ($('#sezione').length > 0) {
|
if ($('#sezione').length > 0) {
|
||||||
ensureSwissknifeHeader();
|
ensureSwissknifeHeader();
|
||||||
|
|
@ -183,7 +182,6 @@
|
||||||
}).appendTo('body');
|
}).appendTo('body');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$(document).ready(() => {
|
$(document).ready(() => {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue