User:PleaseStand/userinfo-dev.js: Difference between revisions

Content deleted Content added
Undid revision 615068114 by PleaseStand (talk)
fix message handling and add Contributions link
Line 31:
'ps-userinfo-years-months': '$1 {{PLURAL:$1|year|years}} $2 {{PLURAL:$2|month|months}}',
 
'ps-userinfo-blocked': "<b>'BLOCKED</b>"',
'ps-userinfo-editcount': '$1 {{PLURAL:$1|edit|edits}}',
'ps-userinfo-invalid': 'invalid username',
Line 93:
page: userPrefix + info.name
} )
}, new h.Rawelement( 'strong', {}, mw.messagemsg( 'ps-userinfo-blocked' ).parse() ) ) );
}
 
if ( info.isMissing ) {
items.push( mw.message( 'ps-userinfo-missing' ).parseescaped() );
} else if ( info.isIPv4 ) {
items.push( mw.message( 'ps-userinfo-ipv4' ).parseescaped() );
} else if ( info.isIPv6 ) {
items.push( mw.message( 'ps-userinfo-ipv6' ).parseescaped() );
} else if ( info.isInvalid ) {
items.push( mw.message( 'ps-userinfo-invalid' ).parseescaped() );
} else {
$.each( info.groups, function ( i, v ) {
if ( $.inArray( v, ['*', 'user', 'autoconfirmed'] ) < 0 ) {
groups.push( mw.message( 'group-' + v + '-member', info.gender ).parseescaped() );
}
} );
if ( groups.length ) {
items.push( groups.join( mw.message( 'ps-userinfo-groupseparator' ).parseescaped() ) );
}
 
Line 119:
buildDurationMessage( info.registration, new Date() ).text(),
info.gender
).parseescaped() );
}
 
Line 128:
project: hostParts.slice( 0, -1 ).join( '.' )
} )
}, new h.Raw( mw.message( 'ps-userinfo-editcount', info.editCount ).parsetext() ) ) );
}
}
Line 135:
items.push( mw.message(
'ps-userinfo-lastedited',
h.element( 'a', { href: mw.util.getUrl( 'Special:Contributions/' + info.name ) },
buildDurationMessage( info.lastEdited, new Date() ).text(),
info.name
),
mw.html.escape( info.name )
).parse() );
}
Line 148 ⟶ 150:
fontSize: '75%'
} )
.htmltext( mw.messagemsg( 'ps-userinfo-gendersymbol-' + info.gender ).parse() )
.appendTo( '#firstHeading' );
 
// Replace the subtitle with the rest of the info
$( '#siteSub' ).html( items.join( mw.message( 'ps-userinfo-itemseparator' ).parseescaped() ) );
}