Jump to content

User:Enterprisey/strike-archived.js

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Enterprisey (talk | contribs) at 07:01, 29 January 2019 (create script). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)
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.
// <nowiki>
$( function () {
    var archivedDivs = document.querySelectorAll( "div.boilerplate.archived" ),
        toc = document.querySelector( "#toc ul" ),
        possHdr,
        tocSel;
    for( var i = 0; i < archivedDivs.length; i++ ) {
        possHdr = archivedDivs[i].previousElementSibling;
        if( possHdr && possHdr.matches( "h1,h2,h3,h4,h5,h6" ) ) {
            tocSel = "a[href$='" + possHdr.querySelector( ".mw-headline" ).id + "']";
            toc.querySelector( tocSel ).style.textDecoration = "line-through";
        }
    }
} );
// </nowiki>