Content deleted Content added
Polygnotus (talk | contribs) ←Created page with 'mw.loader.using(['mediawiki.util'], function () { $(document).ready(function () { if ((mw.config.get('wgNamespaceNumber') !== 0 && mw.config.get('wgPageName') !== 'User:Polygnotus/dupreftest') || mw.config.get('wgAction') !== 'view') { return; } let referencesHeading = document.getElementById("References"); if (!referencesHeading) { return; } const style = document...' |
Polygnotus (talk | contribs) highlight on hover |
||
Line 11:
const style = document.createElement('style');
style.textContent = `
li:target { border: 4px dotted red; padding: 2px;} .duplicate-citation { background-color: #ffe6e6; }
.duplicate-citation-highlight { background-color: #ffcccc; }
document.head.appendChild(style);
Line 40 ⟶ 44:
// Create the edit summary
▲ }
// Make the edit
Line 80 ⟶ 79:
referenceSpans.forEach((span) => {
const links = span.querySelectorAll('a');
const refNumber = span.closest('li')?.id.
let validLink = null;
Line 193 ⟶ 192:
if (linkHref) {
const citeNoteId = linkHref.substring(1); // Remove the leading '#'
const refNumber =
citeNoteMap.set(citeNoteId, refNumber);
}
Line 281 ⟶ 280:
link.textContent = ref.refNumber;
paragraphInfo.appendChild(link);
// Highlight the duplicate citations in the reference list
const citationElement = document.getElementById(ref.citeNote);
if (citationElement) {
citationElement.classList.add('duplicate-citation');
link.addEventListener('mouseover', () => {
citationElement.classList.add('duplicate-citation-highlight');
});
link.addEventListener('mouseout', () => {
citationElement.classList.remove('duplicate-citation-highlight');
});
}
} else {
paragraphInfo.appendChild(document.createTextNode(ref.refNumber));
|