MediaWiki:Common.js: Difference between revisions

Created page with "Any JavaScript here will be loaded for all users on every page load.: // Run this code only on the Special:AllPages page if ( mw.config.get( 'wgCanonicalSpecialPageName' ) === 'Allpages' ) { $( function() { // Regular expression to test if a title is *only* digits var numericRegex = /^[0-9]+$/; // Iterate over all links in the main content area $( '#mw-content-text a' ).each( function() { var title = $( this ).attr(..."
 
No edit summary
Tags: Manual revert Mobile edit Mobile web edit
 
(16 intermediate revisions by the same user not shown)
Line 1: Line 1:
/* Any JavaScript here will be loaded for all users on every page load. */
/* Any JavaScript here will be loaded for all users on every page load. */
// Run this code only on the Special:AllPages page
if ( mw.config.get( 'wgCanonicalSpecialPageName' ) === 'Allpages' ) {
    $( function() {
        // Regular expression to test if a title is *only* digits
        var numericRegex = /^[0-9]+$/;
        // Iterate over all links in the main content area
        $( '#mw-content-text a' ).each( function() {
            var title = $( this ).attr( 'title' );
            if ( title && numericRegex.test( title ) ) {
                // Find the parent list item and hide it
                $( this ).closest( 'li' ).hide();
            }
        } );
    } );
}