Jump to content

User:Enterprisey/links-in-logs.js

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Enterprisey (talk | contribs) at 04:34, 16 August 2018 (create new 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.
$( function() {
    if( mw.config.get( "wgPageName" ).indexOf( "Special:Log" ) >= 0 ) {
        var allItems = document.querySelectorAll( "li[class^=mw-logline-]" );
        var newLink;
        for( var i = 0; numItems = allItems.length; i < numItems; i++ ) {
            newLink = document.createElement( "a" );
            newLink.href = "https://en.wikipedia.org/w/index.php?title=Special%3ALog&logid=" + allItems[i].dataset.mw-logid;
            newLink.textContent = allItems[i].childNodes[0].textContent;
            allItems[i].replaceChild( newLink, allItems[i].childNodes[0] );
        }
    }
} );