Jump to content

User:Jdlrobson/mobilecontribs.js: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
No edit summary
Tags: Mobile edit Mobile web edit Advanced mobile edit
No edit summary
Tags: Mobile edit Mobile web edit
Line 3: Line 3:
mw.loader.load( '/w/index.php?title=User:Jdlrobson/mobilecontribs.css&action=raw&ctype=text/css', 'text/css' );
mw.loader.load( '/w/index.php?title=User:Jdlrobson/mobilecontribs.css&action=raw&ctype=text/css', 'text/css' );
var lastDate;
var lastDate;
https://gerrit.wikimedia.org/r/c/mediawiki/core/+/730590/ got upstreamed, exit early.
// https://gerrit.wikimedia.org/r/c/mediawiki/core/+/730590/ got upstreamed, exit early.
if ( $( '.mw-index-pager-list-header').length > 0 ) {
if ( $( '.mw-index-pager-list-header').length > 0 ) {
return;
return;

Revision as of 02:24, 15 February 2022

$( function () {
    if ( mw.config.get( 'wgCanonicalSpecialPageName' ) === 'Contributions' ) {
        mw.loader.load( '/w/index.php?title=User:Jdlrobson/mobilecontribs.css&action=raw&ctype=text/css', 'text/css' );
        var lastDate;
        // https://gerrit.wikimedia.org/r/c/mediawiki/core/+/730590/ got upstreamed, exit early.
        if ( $( '.mw-index-pager-list-header').length > 0 ) {
            return;
        }
        $('.mw-contributions-list li').each(function (i, node) {
            if ( $( node ).hasClass( 'list-header-row' ) ) {
                return;
            }
            var date = $(node).find('.mw-changeslist-date')
                .text().split(',')[1].trim();
            if ( date && date !== lastDate ) {
                var $li = $( '<li>' ).addClass( 'list-header-row' ).append(
                    $('<h4>' ).addClass( 'mw-index-pager-list-header').text(date)
                );
                $li.insertBefore( node );
                lastDate = date;
            }
        })
    }
})