_ _    _ _____  ___   __                       
 __      _(_) | _(_)___ / ( _ ) / /_   ___ ___  _ __ ___  
 \ \ /\ / / | |/ / | |_ \ / _ \| '_ \ / __/ _ \| '_ ` _ \ 
  \ V  V /| |   <| |___) | (_) | (_) | (_| (_) | | | | | |
   \_/\_/ |_|_|\_\_|____/ \___/ \___(_)___\___/|_| |_| |_|

User:Gadget850/RefErrors.js

The topic of User:Gadget850/RefErrors.js is one that has captured the attention of many people as of late. Whether due to its historical relevance or its impact on current society, User:Gadget850/RefErrors.js has been the subject of discussion and debate in a wide range of contexts. In this article, we will explore the different aspects of User:Gadget850/RefErrors.js and its influence in various areas, from politics to popular culture. Through detailed and insightful analysis, we seek to shed light on this broad and significant topic, with the goal of providing our readers with a deeper and broader understanding of User:Gadget850/RefErrors.js.
// adapted from User:Ucucha/HarvErrors.js
if(window.checkLinksToCitations === undefined)
    window.checkLinksToCitations = true;

jQuery(document).ready(function($) {
    // first check: do links in ref templates citations point to a valid citation?
    links = document.links;
    for (i=0; i < links.length; i++)
    {
        href = links.getAttribute('href');
        if (href.indexOf('#endnote') == 0)
            if (document.getElementById(href.substring(1)) == null)
                links.parentNode.innerHTML +=
                    " <strong class=error>Ref error: link to " +
                    href +
                    " doesn't point to any matching note.</strong>";
    }

    // second check: do endnote IDs have citations pointing to them?
    if(window.checkLinksToCitations) {
        cites = jQuery('.citation');
        for(i=0; i < cites.length; i++) {
            id = cites.getAttribute('id');
            // we only need to check citations with a
            if(!id || id.indexOf('endnote') !== 0)
                continue;
            // don't do cites that are inside a ref
            parentid = cites.parentNode.getAttribute('id');
            if(parentid && parentid.indexOf('cite_note') === 0)
                continue;
            // check for links to this citation
            query = 'a';
            if(jQuery(query).length == 0) {
                cites.innerHTML +=
                    " <strong class=error>Note error: There is no Ref link pointing to this note named " + id + ".</strong>";
            }
        }
    }
});