User:Hemantha/minerva.js

Source: Wikipedia, the free encyclopedia.

This is an old revision of this page, as edited by Hemantha (talk | contribs) at 08:43, 12 February 2022. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

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.
mw.loader.using('mediawiki.util').done(function() {
        if(!mw.config.get('wgPageName').match(/Articles_for_deletion|Deletion_sort/)) return;
        document.querySelectorAll('ul > li:first-child > .delsort-notice:first-child').forEach( function (x) {
                var sel = '.delsort-notice > a:first-of-type';
                var ul = x.parentElement.parentElement;
                var firstA = ul.querySelector(sel);
                firstA.style.display = 'none';
                firstA.insertAdjacentHTML('beforebegin',
                    Array.prototype.slice.call(ul.querySelectorAll(sel))
                       .map(function(x) { return '<a href=' + x.href + '>' + x.textContent.match(/list of ([^-]*)/)[1] + '</a>';} )
                       .join(', ')
                    + ' lists');
                Array.prototype.slice.call(ul.querySelectorAll('.delsort-notice'))
                    .slice(1).forEach(function(x) { x.parentElement.style.display='none'; });
        });
});