User:Polygnotus/DuplicateReferences.js: Difference between revisions

Content deleted Content added
No edit summary
No edit summary
Line 14:
li:target { border: 4px dotted red; padding: 2px;}
.duplicate-citation-highlight { background-color: #ffe6e6; }
.duplicate-citation-hover { background-color: #ffcccc; }
.duplicate-citation-clicked { background-color: #ffeeee; }
`;
document.head.appendChild(style);
Line 285 ⟶ 287:
const citationElement = document.getElementById(duplicate.citeNote);
if (citationElement) {
citationElement.classList.addif ('duplicate-citation-highlight'.citeNote === ref.citeNote); {
citationElement.classList.add('duplicate-citation-hover');
} else {
citationElement.classList.add('duplicate-citation-highlight');
}
}
});
Line 293 ⟶ 299:
const citationElement = document.getElementById(duplicate.citeNote);
if (citationElement) {
citationElement.classList.remove('duplicate-citation-hover');
citationElement.classList.remove('duplicate-citation-highlight');
}
});
});
 
// Highlight duplicates on click
link.addEventListener('click', (e) => {
e.preventDefault();
// Remove previous click highlights
document.querySelectorAll('.duplicate-citation-clicked').forEach(el => {
el.classList.remove('duplicate-citation-clicked');
});
// Add new click highlights
refInfo.forEach(duplicate => {
const citationElement = document.getElementById(duplicate.citeNote);
if (citationElement) {
citationElement.classList.add('duplicate-citation-clicked');
}
});