Code that you insert on this page could contain malicious content capable of compromising your account. If you import a script from another page with "importScript", "mw.loader.load", "iusc", or "lusc", take note that this causes you to dynamically load a remote script, which could be changed by others. Editors are responsible for all edits and actions they perform, including by scripts. User scripts are not centrally supported and may malfunction or become inoperable due to software changes. A guide to help you find broken scripts is available. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump. This code will be executed when previewing this page.
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
//perhaps add this to duplicatereferences// Wikipedia Reference Highlighter$(function(){// Function to highlight all references with the same base IDfunctionhighlightReferences(baseId,clickedElement){// Remove previous highlights$('.reference-highlight, .reference-highlight-clicked').removeClass('reference-highlight reference-highlight-clicked');// Highlight all references with the same base ID in the main text$('sup.reference a[href^="#cite_note-'+baseId+'"]').each(function(){$(this).closest('sup').addClass('reference-highlight');});// Highlight the reference in the list at the bottomvarcitationElement=$('#cite_note-'+baseId);citationElement.addClass('reference-highlight');// Highlight all the "Jump up to" links in the current referencecitationElement.find('.mw-cite-backlink a').each(function(){$(this).addClass('reference-highlight');});// Highlight the clicked element differently$(clickedElement).addClass('reference-highlight-clicked');}// Add click event listener to all reference links in the main text$('sup.reference a').on('click',function(e){e.preventDefault();varhref=$(this).attr('href');varbaseId=href.split('-')[1].split('#')[0];highlightReferences(baseId,this);// Scroll to the reference list itemvartarget=$(href);$('html, body').animate({scrollTop:target.offset().top},500);});// Add click event listener to the "Jump up to" links in the references section$('.mw-cite-backlink a').on('click',function(e){e.preventDefault();varhref=$(this).attr('href');varbaseId=$(this).closest('li').attr('id').split('-')[1];highlightReferences(baseId,this);// Scroll to the reference in the main textvartarget=$(href);$('html, body').animate({scrollTop:target.offset().top},500);});// Add necessary CSS$('<style>').prop('type','text/css').html(` .reference-highlight { background-color: purple !important; color: white !important; } .reference-highlight a { color: white !important; } .reference-highlight-clicked { background-color: orange !important; color: black !important; } .reference-highlight-clicked a { color: black !important; } `).appendTo('head');});