Jump to content

User:Enterprisey/more-listing-items.js

From Wikipedia, the free encyclopedia
This is the current revision of this page, as edited by Enterprisey (talk | contribs) at 06:49, 12 February 2019 (bugfix for links that already had the text "500" in them). The present address (URL) is a permanent link to this version.
(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.
// <nowiki>
$( function () {
    if( !document.getElementsByClassName( "mw-numlink" ).length ) return;
    function adjustCount( oldUrl, count ) {
        return $( "<a>" ).attr( "href", oldUrl.replace( "&limit=500", "&limit=" + count ) ).text( count );
    }
    $( ".mw-numlink:contains(500)" ).each( function () {
        var oldUrl = $( this ).attr( "href" );
        $( this ).after( " | ",
                adjustCount( oldUrl, 1000 ), " | ",
                adjustCount( oldUrl, 2500 ), " | ",
                adjustCount( oldUrl, 5000 ) );
    } );
} );
// </nowiki>