MediaWiki:Gadget-Links-in-logs.js

$( function {   var pageName = mw.config.get( "wgPageName" );    if( pageName.indexOf( "Special:Log" ) === 0 || pageName.indexOf( "Special:UserRights" ) === 0 ) {        mw.loader.using( [ "mw.util" ], function  { mw.util.addCSS( "a.log-link { filter: brightness(0.6); margin-right: 0.4em }" ); } );        var DATE_RGX = /\d\d:\d\d, (\d\d? .+?|.+? \d\d?,) \d{4}/;       var allItems = document.querySelectorAll( "li[class^=mw-logline-]" );        var newLink, timestampMatch;        for( var i = 0, numItems = allItems.length; i < numItems; i++ ) {            for( var j = 0, numChildren = allItems[i].childNodes.length; j < numChildren; j++ ) {                if( allItems[i].childNodes[j].nodeType === 3 && ( ( timestampMatch = DATE_RGX.exec( allItems[i].childNodes[j].textContent ) ) !== null ) ) {                   newLink = document.createElement( "a" );                    newLink.href = mw.config.get( "wgServer" ) + mw.config.get( "wgScriptPath" ) + "/index.php?title=Special:Log&logid=" + allItems[i].dataset.mwLogid;                    newLink.textContent = timestampMatch[0];                    newLink.className = "log-link";                    allItems[i].childNodes[j].textContent = allItems[i].childNodes[j].textContent.replace( timestampMatch[0], "" );                    allItems[i].insertBefore( newLink, allItems[i].childNodes[j] );                    break; // inner loop                }            }        }    } } );