User:Enterprisey/strike-archived.js
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;
if( !toc ) return;
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$='" + $.escapeSelector( possHdr.querySelector( ".mw-headline" ).id ) + "']";
toc.querySelector( tocSel ).style.textDecoration = "line-through";
}
}
} );
// </nowiki>