Nota: dopo aver pubblicato, potrebbe essere necessario pulire la cache del proprio browser per vedere i cambiamenti.
- Firefox / Safari: tieni premuto il tasto delle maiuscole Shift e fai clic su Ricarica, oppure premi Ctrl-F5 o Ctrl-R (⌘-R su Mac)
- Google Chrome: premi Ctrl-Shift-R (⌘-Shift-R su un Mac)
- Edge: tieni premuto il tasto Ctrl e fai clic su Aggiorna, oppure premi Ctrl-F5.
(function waitForReferencesAndInit() {
const references = document.querySelectorAll('sup.reference > a');
if (references.length === 0) {
return setTimeout(waitForReferencesAndInit, 100);
}
console.log("✅ CommonCita.js attivo");
const abstractData = {
"Rodgers2010": `
<strong>Rodgers JL</strong><br>
<em>The epistemology of mathematical and statistical modeling: a quiet methodological revolution</em><br>
<small><span style="color:#999">Am Psychol, 2010</span></small>
<hr>
<div class="citation-popup-abstract">
Questo articolo propone un cambiamento radicale nella valutazione statistica, suggerendo un approccio epistemologico alternativo.
</div>`
};
references.forEach(link => {
const href = link.getAttribute('href');
const match = href && href.match(/#cite_note-(.+?)(?:-\d+)?$/);
if (!match) return;
const refId = match[1];
if (!abstractData[refId]) return;
link.style.cursor = "pointer";
link.addEventListener('click', function (e) {
e.preventDefault();
e.stopPropagation();
document.querySelectorAll('.citation-popup-container').forEach(p => p.remove());
const popup = document.createElement('div');
popup.className = 'citation-popup-container';
popup.innerHTML = abstractData[refId];
document.body.appendChild(popup);
const rect = link.getBoundingClientRect();
popup.style.top = `${rect.bottom + window.scrollY + 10}px`;
popup.style.left = `${rect.left + window.scrollX}px`;
});
});
document.addEventListener('click', function (e) {
if (!e.target.closest('.citation-popup-container') && !e.target.closest('sup.reference')) {
document.querySelectorAll('.citation-popup-container').forEach(p => p.remove());
}
});
})();