<script> (function () {
console.log("🔍 Tooltip citazioni avviato");
const abstractMapByTitle = {
"the epistemology of mathematical and statistical modeling: a quiet methodological revolution": `
Rodgers JL
The epistemology of mathematical and statistical modeling: a quiet methodological revolution
Am Psychol, 2010
Questo articolo propone un cambiamento radicale nella valutazione statistica, suggerendo un approccio epistemologico alternativo.
`
};
function normalize(text) {
return text.replace(/\s+/g, ' ').trim().toLowerCase();
}
function findMatchingTitle(refContent) {
const refText = normalize(refContent.textContent || );
for (const title in abstractMapByTitle) {
if (refText.includes(normalize(title))) return title;
}
return null;
}
function showTooltip(link, content) {
const popup = document.createElement('div');
popup.className = 'citation-popup-container';
popup.innerHTML = content;
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`;
}
function attachTooltipEvents() {
document.querySelectorAll('sup.reference > a').forEach(link => {
link.addEventListener('click', function (e) {
const href = link.getAttribute('href');
const refId = href && href.slice(1);
const refElement = document.getElementById(refId);
if (!refElement) return;
const matchedTitle = findMatchingTitle(refElement);
if (!matchedTitle) return;
e.preventDefault();
e.stopPropagation();
document.querySelectorAll('.citation-popup-container').forEach(el => el.remove());
showTooltip(link, abstractMapByTitle[matchedTitle]);
});
});
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());
}
});
console.log("✅ Tooltip attivo per citazioni con abstract noti");
}
function waitForRefs() {
if (document.querySelectorAll('sup.reference > a').length === 0) {
return setTimeout(waitForRefs, 200);
}
attachTooltipEvents();
}
waitForRefs();
})(); </script>
<style> .citation-popup-container {
position: absolute; background: white; padding: 12px; max-width: 28em; box-shadow: 0 0 30px rgba(0,0,0,0.3); border-radius: 8px; font-size: 90%; z-index: 999;
} .citation-popup-abstract {
margin-top: 8px; color: #333;
} </style>