Page MenuHomeWickedGov Phorge

initOnHook.js
No OneTemporary

Size
1 KB
Referenced Files
None
Subscribers
None

initOnHook.js

const ipReveal = require( './ipReveal.js' );
const ipRevealUtils = require( './ipRevealUtils.js' );
/**
* Checks which users have been revealed recently, and reveals those users on load.
*
* @param {string|JQuery|*} documentRoot A DOM Element, Document, jQuery or selector
* to use as the root for searches.
*/
function checkRecentlyRevealedUsers( documentRoot ) {
const recentUsers = [];
$( '.mw-tempuserlink', documentRoot ).each( function () {
const target = $( this ).text();
// Trigger a lookup for one of each revealed user
if ( ipRevealUtils.getRevealedStatus( target ) && recentUsers.indexOf( target ) < 0 ) {
$( this ).next( '.ext-checkuser-tempaccount-reveal-ip-button' ).trigger( 'revealIp' );
recentUsers.push( target );
}
} );
}
/**
* Code to run when the page loads.
*
* @param {string|JQuery|*} documentRoot A DOM Element, Document, jQuery or selector
* to use as context
*/
module.exports = function ( documentRoot ) {
if ( !documentRoot ) {
documentRoot = document;
}
mw.hook( 'wikipage.content' ).add( ( $content ) => {
ipReveal.addButton( $content );
checkRecentlyRevealedUsers( documentRoot );
} );
ipReveal.enableMultiReveal( $( documentRoot ) );
checkRecentlyRevealedUsers( documentRoot );
};

File Metadata

Mime Type
text/plain
Expires
Aug 19 2026, 22:40 (8 w, 3 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
d6/56/3ff25619b61d3a2675addafc122f
Default Alt Text
initOnHook.js (1 KB)

Event Timeline